diff --git a/script/about b/script/about deleted file mode 100755 index 1eeb6eb9..00000000 --- a/script/about +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env ruby -require File.expand_path('../../config/boot', __FILE__) -$LOAD_PATH.unshift "#{RAILTIES_PATH}/builtin/rails_info" -require 'commands/about' diff --git a/script/autospec b/script/autospec deleted file mode 100755 index 837bbd7f..00000000 --- a/script/autospec +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env ruby -gem 'test-unit', '1.2.3' if RUBY_VERSION.to_f >= 1.9 -ENV['RSPEC'] = 'true' # allows autotest to discover rspec -ENV['AUTOTEST'] = 'true' # allows autotest to run w/ color on linux -system((RUBY_PLATFORM =~ /mswin|mingw/ ? 'autotest.bat' : 'autotest'), *ARGV) || - $stderr.puts("Unable to find autotest. Please install ZenTest or fix your PATH") diff --git a/script/benchmarker b/script/benchmarker deleted file mode 100755 index 4a0ea231..00000000 --- a/script/benchmarker +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env ruby - -if ARGV.empty? - puts "Usage: benchmarker times 'Person.expensive_way' 'Person.another_expensive_way' ..." - exit -end - -require File.dirname(__FILE__) + '/../config/environment' -require 'benchmark' -include Benchmark - -# Don't include compilation in the benchmark -ARGV[1..-1].each { |expression| eval(expression) } - -bm(6) do |x| - ARGV[1..-1].each_with_index do |expression, idx| - x.report("##{idx + 1}") { ARGV[0].to_i.times { eval(expression) } } - end -end \ No newline at end of file diff --git a/script/breakpointer b/script/breakpointer deleted file mode 100755 index 64af76ed..00000000 --- a/script/breakpointer +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../config/boot' -require 'commands/breakpointer' \ No newline at end of file diff --git a/script/console b/script/console deleted file mode 100755 index 235a1f27..00000000 --- a/script/console +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env ruby -require File.expand_path('../../config/boot', __FILE__) -require 'commands/console' diff --git a/script/console_sandbox b/script/console_sandbox deleted file mode 100755 index b20ff11a..00000000 --- a/script/console_sandbox +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env ruby -ActiveRecord::Base.lock_mutex -ActiveRecord::Base.connection.begin_db_transaction -at_exit do - ActiveRecord::Base.connection.rollback_db_transaction - ActiveRecord::Base.unlock_mutex -end diff --git a/script/console_sandbox.rb b/script/console_sandbox.rb deleted file mode 100755 index b20ff11a..00000000 --- a/script/console_sandbox.rb +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env ruby -ActiveRecord::Base.lock_mutex -ActiveRecord::Base.connection.begin_db_transaction -at_exit do - ActiveRecord::Base.connection.rollback_db_transaction - ActiveRecord::Base.unlock_mutex -end diff --git a/script/dbconsole b/script/dbconsole deleted file mode 100755 index 83c8436a..00000000 --- a/script/dbconsole +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env ruby -require File.expand_path('../../config/boot', __FILE__) -require 'commands/dbconsole' diff --git a/script/destroy b/script/destroy deleted file mode 100755 index 88d295f7..00000000 --- a/script/destroy +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env ruby -require File.expand_path('../../config/boot', __FILE__) -require 'commands/destroy' diff --git a/script/generate b/script/generate deleted file mode 100755 index 62a8a4c0..00000000 --- a/script/generate +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env ruby -require File.expand_path('../../config/boot', __FILE__) -require 'commands/generate' diff --git a/script/performance/benchmarker b/script/performance/benchmarker deleted file mode 100755 index 3bff809f..00000000 --- a/script/performance/benchmarker +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env ruby -require File.expand_path('../../../config/boot', __FILE__) -require 'commands/performance/benchmarker' diff --git a/script/performance/profiler b/script/performance/profiler deleted file mode 100755 index 07640575..00000000 --- a/script/performance/profiler +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env ruby -require File.expand_path('../../../config/boot', __FILE__) -require 'commands/performance/profiler' diff --git a/script/performance/request b/script/performance/request deleted file mode 100755 index ae3f38c7..00000000 --- a/script/performance/request +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../config/boot' -require 'commands/performance/request' diff --git a/script/plugin b/script/plugin deleted file mode 100755 index b82201fa..00000000 --- a/script/plugin +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env ruby -require File.expand_path('../../config/boot', __FILE__) -require 'commands/plugin' diff --git a/script/process/inspector b/script/process/inspector deleted file mode 100755 index bf25ad86..00000000 --- a/script/process/inspector +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../config/boot' -require 'commands/process/inspector' diff --git a/script/process/reaper b/script/process/reaper deleted file mode 100755 index c77f0453..00000000 --- a/script/process/reaper +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../config/boot' -require 'commands/process/reaper' diff --git a/script/process/spawner b/script/process/spawner deleted file mode 100755 index 7118f398..00000000 --- a/script/process/spawner +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../config/boot' -require 'commands/process/spawner' diff --git a/script/profiler b/script/profiler deleted file mode 100755 index 77c9fbef..00000000 --- a/script/profiler +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env ruby -if ARGV.empty? - $stderr.puts "Usage: profiler 'Person.expensive_method(10)' [times]" - exit(1) -end - -# Keep the expensive require out of the profile. -$stderr.puts 'Loading Rails...' -require File.dirname(__FILE__) + '/../config/environment' - -# Define a method to profile. -if ARGV[1] and ARGV[1].to_i > 1 - eval "def profile_me() #{ARGV[1]}.times { #{ARGV[0]} } end" -else - eval "def profile_me() #{ARGV[0]} end" -end - -# Use the ruby-prof extension if available. Fall back to stdlib profiler. -begin - require 'prof' - $stderr.puts 'Using the ruby-prof extension.' - Prof.clock_mode = Prof::GETTIMEOFDAY - Prof.start - profile_me - results = Prof.stop - require 'rubyprof_ext' - Prof.print_profile(results, $stderr) -rescue LoadError - $stderr.puts 'Using the standard Ruby profiler.' - Profiler__.start_profile - profile_me - Profiler__.stop_profile - Profiler__.print_profile($stderr) -end diff --git a/script/runner b/script/runner deleted file mode 100755 index be4c5d45..00000000 --- a/script/runner +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env ruby -require File.expand_path('../../config/boot', __FILE__) -require 'commands/runner' diff --git a/script/server b/script/server deleted file mode 100755 index b9fcb717..00000000 --- a/script/server +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env ruby -require File.expand_path('../../config/boot', __FILE__) -require 'commands/server' diff --git a/script/spec b/script/spec deleted file mode 100755 index 46fdbe6e..00000000 --- a/script/spec +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env ruby -if ARGV.any? {|arg| %w[--drb -X --generate-options -G --help -h --version -v].include?(arg)} - require 'rubygems' unless ENV['NO_RUBYGEMS'] -else - gem 'test-unit', '1.2.3' if RUBY_VERSION.to_f >= 1.9 - ENV["RAILS_ENV"] ||= 'test' - require File.expand_path(File.dirname(__FILE__) + "/../config/environment") unless defined?(RAILS_ROOT) -end -require 'spec/autorun' -exit ::Spec::Runner::CommandLine.run diff --git a/script/spec_server b/script/spec_server deleted file mode 100755 index 17b56f87..00000000 --- a/script/spec_server +++ /dev/null @@ -1,116 +0,0 @@ -#!/usr/bin/env ruby -$LOAD_PATH.unshift File.dirname(__FILE__) + '/../vendor/plugins/rspec/lib' # For rspec installed as plugin -require 'rubygems' -require 'drb/drb' -require 'rbconfig' -require 'spec' -require 'optparse' - -# This is based on Florian Weber's TDDMate -module Spec - module Runner - class RailsSpecServer - def run(argv, stderr, stdout) - $stdout = stdout - $stderr = stderr - - base = ActiveRecord::Base - def base.clear_reloadable_connections! - active_connections.each do |name, conn| - if conn.requires_reloading? - conn.disconnect! - active_connections.delete(name) - end - end - end - - if ActionController.const_defined?(:Dispatcher) - dispatcher = ::ActionController::Dispatcher.new($stdout) - dispatcher.cleanup_application - elsif ::Dispatcher.respond_to?(:reset_application!) - ::Dispatcher.reset_application! - else - raise "Application reloading failed" - end - if Object.const_defined?(:Fixtures) && Fixtures.respond_to?(:reset_cache) - Fixtures.reset_cache - end - - ::Dependencies.mechanism = :load - require_dependency('application.rb') unless Object.const_defined?(:ApplicationController) - load File.dirname(__FILE__) + '/../spec/spec_helper.rb' - - if in_memory_database? - load "#{RAILS_ROOT}/db/schema.rb" # use db agnostic schema by default - ActiveRecord::Migrator.up('db/migrate') # use migrations - end - - ::Spec::Runner::CommandLine.run( - ::Spec::Runner::OptionParser.parse( - argv, - $stderr, - $stdout - ) - ) - end - - def in_memory_database? - ENV["RAILS_ENV"] == "test" and - ::ActiveRecord::Base.connection.class.to_s == "ActiveRecord::ConnectionAdapters::SQLite3Adapter" and - ::Rails::Configuration.new.database_configuration['test']['database'] == ':memory:' - end - end - end -end -puts "Loading Rails environment" - -ENV["RAILS_ENV"] = "test" -require File.expand_path(File.dirname(__FILE__) + "/../config/environment") -require 'dispatcher' - -def restart_test_server - puts "restarting" - config = ::Config::CONFIG - ruby = File::join(config['bindir'], config['ruby_install_name']) + config['EXEEXT'] - command_line = [ruby, $0, ARGV].flatten.join(' ') - exec(command_line) -end - -def daemonize(pid_file = nil) - return yield if $DEBUG - pid = Process.fork{ - Process.setsid - Dir.chdir(RAILS_ROOT) - trap("SIGINT"){ exit! 0 } - trap("SIGTERM"){ exit! 0 } - trap("SIGHUP"){ restart_test_server } - File.open("/dev/null"){|f| - STDERR.reopen f - STDIN.reopen f - STDOUT.reopen f - } - yield - } - puts "spec_server launched. (PID: %d)" % pid - File.open(pid_file,"w"){|f| f.puts pid } if pid_file - exit! 0 -end - -options = Hash.new -opts = OptionParser.new -opts.on("-d", "--daemon"){|v| options[:daemon] = true } -opts.on("-p", "--pid PIDFILE"){|v| options[:pid] = v } -opts.parse!(ARGV) - -puts "Ready" -exec_server = lambda { - trap("USR2") { restart_test_server } if Signal.list.has_key?("USR2") - DRb.start_service("druby://127.0.0.1:8989", Spec::Runner::RailsSpecServer.new) - DRb.thread.join -} - -if options[:daemon] - daemonize(options[:pid], &exec_server) -else - exec_server.call -end diff --git a/script/story b/script/story deleted file mode 100755 index defeee71..00000000 --- a/script/story +++ /dev/null @@ -1,77 +0,0 @@ -#!/usr/bin/env ruby -require 'rubygems' - -class StoryCommand - ROOT_PATH = File.expand_path(File.dirname(__FILE__) + "/..") - - STORIES_PATH = "#{ROOT_PATH}/stories" - STEP_MATCHERS_PATH = "#{ROOT_PATH}/stories/steps" - HELPER_PATH = "#{ROOT_PATH}/stories/helper" - DRIVER_MANAGER_PATH = "#{ROOT_PATH}/lib/selenium_driver_manager" - - require DRIVER_MANAGER_PATH - - def self.run - self.new.run - end - - def run - if ARGV.reject { |a| a =~ /^-/ }.any? - run_story_files(ARGV.dup) - else - run_story_files(all_story_files) - end - ensure - SeleniumDriverManager.instance.stop - end - - def all_story_files - Dir["#{STORIES_PATH}/**/*.story"].uniq - end - - def clean_story_paths(paths) - paths.reject! { |path| path =~ /^-/ } - paths.map! { |path| File.expand_path(path) } - paths.map! { |path| path.gsub(/\.story$/, "") } - paths.map! { |path| path.gsub(/#{STORIES_PATH}\//, "") } - end - - def run_story_files(stories) - clean_story_paths(stories).each do |story| - setup_and_run_story(File.readlines("#{STORIES_PATH}/#{story}.story"), story) - end - end - - def setup_and_run_story(lines, story_name) - require HELPER_PATH - - steps = steps_for_story(lines, story_name) - steps.reject! { |step| !File.exist?("#{STEP_MATCHERS_PATH}/#{step}.rb") } - steps.each { |step| require "#{STEP_MATCHERS_PATH}/#{step}" } - - run_story(lines, steps) - end - - def steps_for_story(lines, story_name) - if lines.first =~ /^# steps: / - lines.first.gsub(/^# steps: /, "").split(",").map(&:strip) - else - story_name.to_s.split("/") - end - end - - def run_story(lines, steps) - tempfile = Tempfile.new("story") - lines.each do |line| - tempfile.puts line - end - tempfile.close - - with_steps_for(*steps.map(&:to_sym)) do - run tempfile.path, :type => SeleniumRailsStory - end - end - -end - -StoryCommand.run \ No newline at end of file