diff options
Diffstat (limited to 'vendor/rails-2.0.2/railties/lib/tasks')
-rw-r--r-- | vendor/rails-2.0.2/railties/lib/tasks/annotations.rake | 23 | ||||
-rw-r--r-- | vendor/rails-2.0.2/railties/lib/tasks/databases.rake | 363 | ||||
-rw-r--r-- | vendor/rails-2.0.2/railties/lib/tasks/documentation.rake | 80 | ||||
-rw-r--r-- | vendor/rails-2.0.2/railties/lib/tasks/framework.rake | 118 | ||||
-rw-r--r-- | vendor/rails-2.0.2/railties/lib/tasks/log.rake | 9 | ||||
-rw-r--r-- | vendor/rails-2.0.2/railties/lib/tasks/misc.rake | 10 | ||||
-rw-r--r-- | vendor/rails-2.0.2/railties/lib/tasks/rails.rb | 8 | ||||
-rw-r--r-- | vendor/rails-2.0.2/railties/lib/tasks/routes.rake | 17 | ||||
-rw-r--r-- | vendor/rails-2.0.2/railties/lib/tasks/statistics.rake | 18 | ||||
-rw-r--r-- | vendor/rails-2.0.2/railties/lib/tasks/testing.rake | 118 | ||||
-rw-r--r-- | vendor/rails-2.0.2/railties/lib/tasks/tmp.rake | 37 |
11 files changed, 0 insertions, 801 deletions
diff --git a/vendor/rails-2.0.2/railties/lib/tasks/annotations.rake b/vendor/rails-2.0.2/railties/lib/tasks/annotations.rake deleted file mode 100644 index ea6046670..000000000 --- a/vendor/rails-2.0.2/railties/lib/tasks/annotations.rake +++ /dev/null @@ -1,23 +0,0 @@ -require 'source_annotation_extractor' - -desc "Enumerate all annotations" -task :notes do - SourceAnnotationExtractor.enumerate "OPTIMIZE|FIXME|TODO", :tag => true -end - -namespace :notes do - desc "Enumerate all OPTIMIZE annotations" - task :optimize do - SourceAnnotationExtractor.enumerate "OPTIMIZE" - end - - desc "Enumerate all FIXME annotations" - task :fixme do - SourceAnnotationExtractor.enumerate "FIXME" - end - - desc "Enumerate all TODO annotations" - task :todo do - SourceAnnotationExtractor.enumerate "TODO" - end -end
\ No newline at end of file diff --git a/vendor/rails-2.0.2/railties/lib/tasks/databases.rake b/vendor/rails-2.0.2/railties/lib/tasks/databases.rake deleted file mode 100644 index 2ecd09af2..000000000 --- a/vendor/rails-2.0.2/railties/lib/tasks/databases.rake +++ /dev/null @@ -1,363 +0,0 @@ -namespace :db do - namespace :create do - desc 'Create all the local databases defined in config/database.yml' - task :all => :environment do - ActiveRecord::Base.configurations.each_value do |config| - # Skip entries that don't have a database key, such as the first entry here: - # - # defaults: &defaults - # adapter: mysql - # username: root - # password: - # host: localhost - # - # development: - # database: blog_development - # <<: *defaults - next unless config['database'] - # Only connect to local databases - if %w( 127.0.0.1 localhost ).include?(config['host']) || config['host'].blank? - create_database(config) - else - p "This task only creates local databases. #{config['database']} is on a remote host." - end - end - end - end - - desc 'Create the database defined in config/database.yml for the current RAILS_ENV' - task :create => :environment do - create_database(ActiveRecord::Base.configurations[RAILS_ENV]) - end - - def create_database(config) - begin - ActiveRecord::Base.establish_connection(config) - ActiveRecord::Base.connection - rescue - case config['adapter'] - when 'mysql' - @charset = ENV['CHARSET'] || 'utf8' - @collation = ENV['COLLATION'] || 'utf8_general_ci' - begin - ActiveRecord::Base.establish_connection(config.merge({'database' => nil})) - ActiveRecord::Base.connection.create_database(config['database'], {:charset => @charset, :collation => @collation}) - ActiveRecord::Base.establish_connection(config) - rescue - $stderr.puts "Couldn't create database for #{config.inspect}" - end - when 'postgresql' - `createdb "#{config['database']}" -E utf8` - when 'sqlite' - `sqlite "#{config['database']}"` - when 'sqlite3' - `sqlite3 "#{config['database']}"` - end - else - p "#{config['database']} already exists" - end - end - - namespace :drop do - desc 'Drops all the local databases defined in config/database.yml' - task :all => :environment do - ActiveRecord::Base.configurations.each_value do |config| - # Skip entries that don't have a database key - next unless config['database'] - # Only connect to local databases - if config['host'] == 'localhost' || config['host'].blank? - drop_database(config) - else - p "This task only drops local databases. #{config['database']} is on a remote host." - end - end - end - end - - desc 'Drops the database for the current RAILS_ENV' - task :drop => :environment do - drop_database(ActiveRecord::Base.configurations[RAILS_ENV || 'development']) - end - - desc "Migrate the database through scripts in db/migrate. Target specific version with VERSION=x. Turn off output with VERBOSE=false." - task :migrate => :environment do - ActiveRecord::Migration.verbose = ENV["VERBOSE"] ? ENV["VERBOSE"] == "true" : true - ActiveRecord::Migrator.migrate("db/migrate/", ENV["VERSION"] ? ENV["VERSION"].to_i : nil) - Rake::Task["db:schema:dump"].invoke if ActiveRecord::Base.schema_format == :ruby - end - - namespace :migrate do - desc 'Rollbacks the database one migration and re migrate up. If you want to rollback more than one step, define STEP=x' - task :redo => [ 'db:rollback', 'db:migrate' ] - - desc 'Resets your database using your migrations for the current environment' - task :reset => ["db:drop", "db:create", "db:migrate"] - end - - desc 'Rolls the schema back to the previous version. Specify the number of steps with STEP=n' - task :rollback => :environment do - step = ENV['STEP'] ? ENV['STEP'].to_i : 1 - version = ActiveRecord::Migrator.current_version - step - ActiveRecord::Migrator.migrate('db/migrate/', version) - end - - desc 'Drops and recreates the database from db/schema.rb for the current environment.' - task :reset => ['db:drop', 'db:create', 'db:schema:load'] - - desc "Retrieves the charset for the current environment's database" - task :charset => :environment do - config = ActiveRecord::Base.configurations[RAILS_ENV || 'development'] - case config['adapter'] - when 'mysql' - ActiveRecord::Base.establish_connection(config) - puts ActiveRecord::Base.connection.charset - else - puts 'sorry, your database adapter is not supported yet, feel free to submit a patch' - end - end - - desc "Retrieves the collation for the current environment's database" - task :collation => :environment do - config = ActiveRecord::Base.configurations[RAILS_ENV || 'development'] - case config['adapter'] - when 'mysql' - ActiveRecord::Base.establish_connection(config) - puts ActiveRecord::Base.connection.collation - else - puts 'sorry, your database adapter is not supported yet, feel free to submit a patch' - end - end - - desc "Retrieves the current schema version number" - task :version => :environment do - puts "Current version: #{ActiveRecord::Migrator.current_version}" - end - - desc "Raises an error if there are pending migrations" - task :abort_if_pending_migrations => :environment do - if defined? ActiveRecord - pending_migrations = ActiveRecord::Migrator.new(:up, 'db/migrate').pending_migrations - - if pending_migrations.any? - puts "You have #{pending_migrations.size} pending migrations:" - pending_migrations.each do |pending_migration| - puts ' %4d %s' % [pending_migration.version, pending_migration.name] - end - abort "Run `rake db:migrate` to update your database then try again." - end - end - end - - namespace :fixtures do - desc "Load fixtures into the current environment's database. Load specific fixtures using FIXTURES=x,y" - task :load => :environment do - require 'active_record/fixtures' - ActiveRecord::Base.establish_connection(RAILS_ENV.to_sym) - (ENV['FIXTURES'] ? ENV['FIXTURES'].split(/,/) : Dir.glob(File.join(RAILS_ROOT, 'test', 'fixtures', '*.{yml,csv}'))).each do |fixture_file| - Fixtures.create_fixtures('test/fixtures', File.basename(fixture_file, '.*')) - end - end - - desc "Search for a fixture given a LABEL or ID." - task :identify => :environment do - require "active_record/fixtures" - - label, id = ENV["LABEL"], ENV["ID"] - raise "LABEL or ID required" if label.blank? && id.blank? - - puts %Q(The fixture ID for "#{label}" is #{Fixtures.identify(label)}.) if label - - Dir["#{RAILS_ROOT}/test/fixtures/**/*.yml"].each do |file| - if data = YAML::load(ERB.new(IO.read(file)).result) - data.keys.each do |key| - key_id = Fixtures.identify(key) - - if key == label || key_id == id.to_i - puts "#{file}: #{key} (#{key_id})" - end - end - end - end - end - end - - namespace :schema do - desc "Create a db/schema.rb file that can be portably used against any DB supported by AR" - task :dump => :environment do - require 'active_record/schema_dumper' - File.open(ENV['SCHEMA'] || "db/schema.rb", "w") do |file| - ActiveRecord::SchemaDumper.dump(ActiveRecord::Base.connection, file) - end - end - - desc "Load a schema.rb file into the database" - task :load => :environment do - file = ENV['SCHEMA'] || "db/schema.rb" - load(file) - end - end - - namespace :structure do - desc "Dump the database structure to a SQL file" - task :dump => :environment do - abcs = ActiveRecord::Base.configurations - case abcs[RAILS_ENV]["adapter"] - when "mysql", "oci", "oracle" - ActiveRecord::Base.establish_connection(abcs[RAILS_ENV]) - File.open("db/#{RAILS_ENV}_structure.sql", "w+") { |f| f << ActiveRecord::Base.connection.structure_dump } - when "postgresql" - ENV['PGHOST'] = abcs[RAILS_ENV]["host"] if abcs[RAILS_ENV]["host"] - ENV['PGPORT'] = abcs[RAILS_ENV]["port"].to_s if abcs[RAILS_ENV]["port"] - ENV['PGPASSWORD'] = abcs[RAILS_ENV]["password"].to_s if abcs[RAILS_ENV]["password"] - search_path = abcs[RAILS_ENV]["schema_search_path"] - search_path = "--schema=#{search_path}" if search_path - `pg_dump -i -U "#{abcs[RAILS_ENV]["username"]}" -s -x -O -f db/#{RAILS_ENV}_structure.sql #{search_path} #{abcs[RAILS_ENV]["database"]}` - raise "Error dumping database" if $?.exitstatus == 1 - when "sqlite", "sqlite3" - dbfile = abcs[RAILS_ENV]["database"] || abcs[RAILS_ENV]["dbfile"] - `#{abcs[RAILS_ENV]["adapter"]} #{dbfile} .schema > db/#{RAILS_ENV}_structure.sql` - when "sqlserver" - `scptxfr /s #{abcs[RAILS_ENV]["host"]} /d #{abcs[RAILS_ENV]["database"]} /I /f db\\#{RAILS_ENV}_structure.sql /q /A /r` - `scptxfr /s #{abcs[RAILS_ENV]["host"]} /d #{abcs[RAILS_ENV]["database"]} /I /F db\ /q /A /r` - when "firebird" - set_firebird_env(abcs[RAILS_ENV]) - db_string = firebird_db_string(abcs[RAILS_ENV]) - sh "isql -a #{db_string} > db/#{RAILS_ENV}_structure.sql" - else - raise "Task not supported by '#{abcs["test"]["adapter"]}'" - end - - if ActiveRecord::Base.connection.supports_migrations? - File.open("db/#{RAILS_ENV}_structure.sql", "a") { |f| f << ActiveRecord::Base.connection.dump_schema_information } - end - end - end - - namespace :test do - desc "Recreate the test database from the current environment's database schema" - task :clone => %w(db:schema:dump db:test:purge) do - ActiveRecord::Base.establish_connection(ActiveRecord::Base.configurations['test']) - ActiveRecord::Schema.verbose = false - Rake::Task["db:schema:load"].invoke - end - - - desc "Recreate the test databases from the development structure" - task :clone_structure => [ "db:structure:dump", "db:test:purge" ] do - abcs = ActiveRecord::Base.configurations - case abcs["test"]["adapter"] - when "mysql" - ActiveRecord::Base.establish_connection(:test) - ActiveRecord::Base.connection.execute('SET foreign_key_checks = 0') - IO.readlines("db/#{RAILS_ENV}_structure.sql").join.split("\n\n").each do |table| - ActiveRecord::Base.connection.execute(table) - end - when "postgresql" - ENV['PGHOST'] = abcs["test"]["host"] if abcs["test"]["host"] - ENV['PGPORT'] = abcs["test"]["port"].to_s if abcs["test"]["port"] - ENV['PGPASSWORD'] = abcs["test"]["password"].to_s if abcs["test"]["password"] - `psql -U "#{abcs["test"]["username"]}" -f db/#{RAILS_ENV}_structure.sql #{abcs["test"]["database"]}` - when "sqlite", "sqlite3" - dbfile = abcs["test"]["database"] || abcs["test"]["dbfile"] - `#{abcs["test"]["adapter"]} #{dbfile} < db/#{RAILS_ENV}_structure.sql` - when "sqlserver" - `osql -E -S #{abcs["test"]["host"]} -d #{abcs["test"]["database"]} -i db\\#{RAILS_ENV}_structure.sql` - when "oci", "oracle" - ActiveRecord::Base.establish_connection(:test) - IO.readlines("db/#{RAILS_ENV}_structure.sql").join.split(";\n\n").each do |ddl| - ActiveRecord::Base.connection.execute(ddl) - end - when "firebird" - set_firebird_env(abcs["test"]) - db_string = firebird_db_string(abcs["test"]) - sh "isql -i db/#{RAILS_ENV}_structure.sql #{db_string}" - else - raise "Task not supported by '#{abcs["test"]["adapter"]}'" - end - end - - desc "Empty the test database" - task :purge => :environment do - abcs = ActiveRecord::Base.configurations - case abcs["test"]["adapter"] - when "mysql" - ActiveRecord::Base.establish_connection(:test) - ActiveRecord::Base.connection.recreate_database(abcs["test"]["database"]) - when "postgresql" - ENV['PGHOST'] = abcs["test"]["host"] if abcs["test"]["host"] - ENV['PGPORT'] = abcs["test"]["port"].to_s if abcs["test"]["port"] - ENV['PGPASSWORD'] = abcs["test"]["password"].to_s if abcs["test"]["password"] - enc_option = "-E #{abcs["test"]["encoding"]}" if abcs["test"]["encoding"] - - ActiveRecord::Base.clear_active_connections! - `dropdb -U "#{abcs["test"]["username"]}" #{abcs["test"]["database"]}` - `createdb #{enc_option} -U "#{abcs["test"]["username"]}" #{abcs["test"]["database"]}` - when "sqlite","sqlite3" - dbfile = abcs["test"]["database"] || abcs["test"]["dbfile"] - File.delete(dbfile) if File.exist?(dbfile) - when "sqlserver" - dropfkscript = "#{abcs["test"]["host"]}.#{abcs["test"]["database"]}.DP1".gsub(/\\/,'-') - `osql -E -S #{abcs["test"]["host"]} -d #{abcs["test"]["database"]} -i db\\#{dropfkscript}` - `osql -E -S #{abcs["test"]["host"]} -d #{abcs["test"]["database"]} -i db\\#{RAILS_ENV}_structure.sql` - when "oci", "oracle" - ActiveRecord::Base.establish_connection(:test) - ActiveRecord::Base.connection.structure_drop.split(";\n\n").each do |ddl| - ActiveRecord::Base.connection.execute(ddl) - end - when "firebird" - ActiveRecord::Base.establish_connection(:test) - ActiveRecord::Base.connection.recreate_database! - else - raise "Task not supported by '#{abcs["test"]["adapter"]}'" - end - end - - desc 'Prepare the test database and load the schema' - task :prepare => %w(environment db:abort_if_pending_migrations) do - if defined?(ActiveRecord) && !ActiveRecord::Base.configurations.blank? - Rake::Task[{ :sql => "db:test:clone_structure", :ruby => "db:test:clone" }[ActiveRecord::Base.schema_format]].invoke - end - end - end - - namespace :sessions do - desc "Creates a sessions migration for use with CGI::Session::ActiveRecordStore" - task :create => :environment do - raise "Task unavailable to this database (no migration support)" unless ActiveRecord::Base.connection.supports_migrations? - require 'rails_generator' - require 'rails_generator/scripts/generate' - Rails::Generator::Scripts::Generate.new.run(["session_migration", ENV["MIGRATION"] || "CreateSessions"]) - end - - desc "Clear the sessions table" - task :clear => :environment do - session_table = 'session' - session_table = Inflector.pluralize(session_table) if ActiveRecord::Base.pluralize_table_names - ActiveRecord::Base.connection.execute "DELETE FROM #{session_table}" - end - end -end - -def drop_database(config) - case config['adapter'] - when 'mysql' - ActiveRecord::Base.connection.drop_database config['database'] - when /^sqlite/ - FileUtils.rm_f(File.join(RAILS_ROOT, config['database'])) - when 'postgresql' - `dropdb "#{config['database']}"` - end -end - -def session_table_name - ActiveRecord::Base.pluralize_table_names ? :sessions : :session -end - -def set_firebird_env(config) - ENV["ISC_USER"] = config["username"].to_s if config["username"] - ENV["ISC_PASSWORD"] = config["password"].to_s if config["password"] -end - -def firebird_db_string(config) - FireRuby::Database.db_string_for(config.symbolize_keys) -end diff --git a/vendor/rails-2.0.2/railties/lib/tasks/documentation.rake b/vendor/rails-2.0.2/railties/lib/tasks/documentation.rake deleted file mode 100644 index 41e52f137..000000000 --- a/vendor/rails-2.0.2/railties/lib/tasks/documentation.rake +++ /dev/null @@ -1,80 +0,0 @@ -namespace :doc do - desc "Generate documentation for the application. Set custom template with TEMPLATE=/path/to/rdoc/template.rb" - Rake::RDocTask.new("app") { |rdoc| - rdoc.rdoc_dir = 'doc/app' - rdoc.template = ENV['template'] if ENV['template'] - rdoc.title = "Rails Application Documentation" - rdoc.options << '--line-numbers' << '--inline-source' - rdoc.options << '--charset' << 'utf-8' - rdoc.rdoc_files.include('doc/README_FOR_APP') - rdoc.rdoc_files.include('app/**/*.rb') - rdoc.rdoc_files.include('lib/**/*.rb') - } - - desc "Generate documentation for the Rails framework" - Rake::RDocTask.new("rails") { |rdoc| - rdoc.rdoc_dir = 'doc/api' - rdoc.template = "#{ENV['template']}.rb" if ENV['template'] - rdoc.title = "Rails Framework Documentation" - rdoc.options << '--line-numbers' << '--inline-source' - rdoc.rdoc_files.include('README') - rdoc.rdoc_files.include('vendor/rails/railties/CHANGELOG') - rdoc.rdoc_files.include('vendor/rails/railties/MIT-LICENSE') - rdoc.rdoc_files.include('vendor/rails/railties/README') - rdoc.rdoc_files.include('vendor/rails/railties/lib/{*.rb,commands/*.rb,rails_generator/*.rb}') - rdoc.rdoc_files.include('vendor/rails/activerecord/README') - rdoc.rdoc_files.include('vendor/rails/activerecord/CHANGELOG') - rdoc.rdoc_files.include('vendor/rails/activerecord/lib/active_record/**/*.rb') - rdoc.rdoc_files.exclude('vendor/rails/activerecord/lib/active_record/vendor/*') - rdoc.rdoc_files.include('vendor/rails/activeresource/README') - rdoc.rdoc_files.include('vendor/rails/activeresource/CHANGELOG') - rdoc.rdoc_files.include('vendor/rails/activeresource/lib/active_resource.rb') - rdoc.rdoc_files.include('vendor/rails/activeresource/lib/active_resource/*') - rdoc.rdoc_files.include('vendor/rails/actionpack/README') - rdoc.rdoc_files.include('vendor/rails/actionpack/CHANGELOG') - rdoc.rdoc_files.include('vendor/rails/actionpack/lib/action_controller/**/*.rb') - rdoc.rdoc_files.include('vendor/rails/actionpack/lib/action_view/**/*.rb') - rdoc.rdoc_files.include('vendor/rails/actionmailer/README') - rdoc.rdoc_files.include('vendor/rails/actionmailer/CHANGELOG') - rdoc.rdoc_files.include('vendor/rails/actionmailer/lib/action_mailer/base.rb') - rdoc.rdoc_files.include('vendor/rails/activesupport/README') - rdoc.rdoc_files.include('vendor/rails/activesupport/CHANGELOG') - rdoc.rdoc_files.include('vendor/rails/activesupport/lib/active_support/**/*.rb') - } - - plugins = FileList['vendor/plugins/**'].collect { |plugin| File.basename(plugin) } - - desc "Generate documentation for all installed plugins" - task :plugins => plugins.collect { |plugin| "doc:plugins:#{plugin}" } - - desc "Remove plugin documentation" - task :clobber_plugins do - rm_rf 'doc/plugins' rescue nil - end - - namespace :plugins do - # Define doc tasks for each plugin - plugins.each do |plugin| - task(plugin => :environment) do - plugin_base = "vendor/plugins/#{plugin}" - options = [] - files = Rake::FileList.new - options << "-o doc/plugins/#{plugin}" - options << "--title '#{plugin.titlecase} Plugin Documentation'" - options << '--line-numbers' << '--inline-source' - options << '-T html' - - files.include("#{plugin_base}/lib/**/*.rb") - if File.exists?("#{plugin_base}/README") - files.include("#{plugin_base}/README") - options << "--main '#{plugin_base}/README'" - end - files.include("#{plugin_base}/CHANGELOG") if File.exists?("#{plugin_base}/CHANGELOG") - - options << files.to_s - - sh %(rdoc #{options * ' '}) - end - end - end -end diff --git a/vendor/rails-2.0.2/railties/lib/tasks/framework.rake b/vendor/rails-2.0.2/railties/lib/tasks/framework.rake deleted file mode 100644 index ebc24f46a..000000000 --- a/vendor/rails-2.0.2/railties/lib/tasks/framework.rake +++ /dev/null @@ -1,118 +0,0 @@ -namespace :rails do - namespace :freeze do - desc "Lock this application to the current gems (by unpacking them into vendor/rails)" - task :gems do - deps = %w(actionpack activerecord actionmailer activesupport activeresource) - require 'rubygems' - require 'rubygems/gem_runner' - Gem.manage_gems - - rails = (version = ENV['VERSION']) ? - Gem.cache.find_name('rails', "= #{version}").first : - Gem.cache.find_name('rails').sort_by { |g| g.version }.last - - version ||= rails.version - - unless rails - puts "No rails gem #{version} is installed. Do 'gem list rails' to see what you have available." - exit - end - - puts "Freezing to the gems for Rails #{rails.version}" - rm_rf "vendor/rails" - mkdir_p "vendor/rails" - - begin - chdir("vendor/rails") do - rails.dependencies.select { |g| deps.include? g.name }.each do |g| - Gem::GemRunner.new.run(["unpack", g.name, "--version", g.version_requirements.to_s]) - mv(Dir.glob("#{g.name}*").first, g.name) - end - - Gem::GemRunner.new.run(["unpack", "rails", "--version", "=#{version}"]) - FileUtils.mv(Dir.glob("rails*").first, "railties") - end - rescue Exception - rm_rf "vendor/rails" - raise - end - end - - desc "Lock to latest Edge Rails or a specific revision with REVISION=X (ex: REVISION=4021) or a tag with TAG=Y (ex: TAG=rel_1-1-0)" - task :edge do - $verbose = false - `svn --version` rescue nil - unless !$?.nil? && $?.success? - $stderr.puts "ERROR: Must have subversion (svn) available in the PATH to lock this application to Edge Rails" - exit 1 - end - - rm_rf "vendor/rails" - mkdir_p "vendor/rails" - - svn_root = "http://dev.rubyonrails.org/svn/rails/" - - if ENV['TAG'] - rails_svn = "#{svn_root}/tags/#{ENV['TAG']}" - touch "vendor/rails/TAG_#{ENV['TAG']}" - else - rails_svn = "#{svn_root}/trunk" - - if ENV['REVISION'].nil? - ENV['REVISION'] = /^r(\d+)/.match(%x{svn -qr HEAD log #{svn_root}})[1] - puts "REVISION not set. Using HEAD, which is revision #{ENV['REVISION']}." - end - - touch "vendor/rails/REVISION_#{ENV['REVISION']}" - end - - for framework in %w(railties actionpack activerecord actionmailer activesupport activeresource) - system "svn export #{rails_svn}/#{framework} vendor/rails/#{framework}" + (ENV['REVISION'] ? " -r #{ENV['REVISION']}" : "") - end - end - end - - desc "Unlock this application from freeze of gems or edge and return to a fluid use of system gems" - task :unfreeze do - rm_rf "vendor/rails" - end - - desc "Update both configs, scripts and public/javascripts from Rails" - task :update => [ "update:scripts", "update:javascripts", "update:configs" ] - - namespace :update do - desc "Add new scripts to the application script/ directory" - task :scripts do - local_base = "script" - edge_base = "#{File.dirname(__FILE__)}/../../bin" - - local = Dir["#{local_base}/**/*"].reject { |path| File.directory?(path) } - edge = Dir["#{edge_base}/**/*"].reject { |path| File.directory?(path) } - - edge.each do |script| - base_name = script[(edge_base.length+1)..-1] - next if base_name == "rails" - next if local.detect { |path| base_name == path[(local_base.length+1)..-1] } - if !File.directory?("#{local_base}/#{File.dirname(base_name)}") - mkdir_p "#{local_base}/#{File.dirname(base_name)}" - end - install script, "#{local_base}/#{base_name}", :mode => 0755 - end - end - - desc "Update your javascripts from your current rails install" - task :javascripts do - require 'railties_path' - project_dir = RAILS_ROOT + '/public/javascripts/' - scripts = Dir[RAILTIES_PATH + '/html/javascripts/*.js'] - scripts.reject!{|s| File.basename(s) == 'application.js'} if File.exists?(project_dir + 'application.js') - FileUtils.cp(scripts, project_dir) - end - - desc "Update config/boot.rb from your current rails install" - task :configs do - require 'railties_path' - FileUtils.cp(RAILTIES_PATH + '/environments/boot.rb', RAILS_ROOT + '/config/boot.rb') - end - end -end diff --git a/vendor/rails-2.0.2/railties/lib/tasks/log.rake b/vendor/rails-2.0.2/railties/lib/tasks/log.rake deleted file mode 100644 index 6e1334692..000000000 --- a/vendor/rails-2.0.2/railties/lib/tasks/log.rake +++ /dev/null @@ -1,9 +0,0 @@ -namespace :log do - desc "Truncates all *.log files in log/ to zero bytes" - task :clear do - FileList["log/*.log"].each do |log_file| - f = File.open(log_file, "w") - f.close - end - end -end diff --git a/vendor/rails-2.0.2/railties/lib/tasks/misc.rake b/vendor/rails-2.0.2/railties/lib/tasks/misc.rake deleted file mode 100644 index e44ab2cf1..000000000 --- a/vendor/rails-2.0.2/railties/lib/tasks/misc.rake +++ /dev/null @@ -1,10 +0,0 @@ -task :default => :test -task :environment do - require(File.join(RAILS_ROOT, 'config', 'environment')) -end - -require 'rails_generator/secret_key_generator' -desc 'Generate a crytographically secure secret key. This is typically used to generate a secret for cookie sessions. Pass a unique identifier to the generator using ID="some unique identifier" for greater security.' -task :secret do - puts Rails::SecretKeyGenerator.new(ENV['ID']).generate_secret -end diff --git a/vendor/rails-2.0.2/railties/lib/tasks/rails.rb b/vendor/rails-2.0.2/railties/lib/tasks/rails.rb deleted file mode 100644 index bfcf5bc49..000000000 --- a/vendor/rails-2.0.2/railties/lib/tasks/rails.rb +++ /dev/null @@ -1,8 +0,0 @@ -$VERBOSE = nil - -# Load Rails rakefile extensions -Dir["#{File.dirname(__FILE__)}/*.rake"].each { |ext| load ext } - -# Load any custom rakefile extensions -Dir["#{RAILS_ROOT}/lib/tasks/**/*.rake"].sort.each { |ext| load ext } -Dir["#{RAILS_ROOT}/vendor/plugins/*/**/tasks/**/*.rake"].sort.each { |ext| load ext } diff --git a/vendor/rails-2.0.2/railties/lib/tasks/routes.rake b/vendor/rails-2.0.2/railties/lib/tasks/routes.rake deleted file mode 100644 index 39b713916..000000000 --- a/vendor/rails-2.0.2/railties/lib/tasks/routes.rake +++ /dev/null @@ -1,17 +0,0 @@ -desc 'Print out all defined routes in match order, with names.' -task :routes => :environment do - routes = ActionController::Routing::Routes.routes.collect do |route| - name = ActionController::Routing::Routes.named_routes.routes.index(route).to_s - verb = route.conditions[:method].to_s.upcase - segs = route.segments.inject("") { |str,s| str << s.to_s } - segs.chop! if segs.length > 1 - reqs = route.requirements.empty? ? "" : route.requirements.inspect - {:name => name, :verb => verb, :segs => segs, :reqs => reqs} - end - name_width = routes.collect {|r| r[:name]}.collect {|n| n.length}.max - verb_width = routes.collect {|r| r[:verb]}.collect {|v| v.length}.max - segs_width = routes.collect {|r| r[:segs]}.collect {|s| s.length}.max - routes.each do |r| - puts "#{r[:name].rjust(name_width)} #{r[:verb].ljust(verb_width)} #{r[:segs].ljust(segs_width)} #{r[:reqs]}" - end -end
\ No newline at end of file diff --git a/vendor/rails-2.0.2/railties/lib/tasks/statistics.rake b/vendor/rails-2.0.2/railties/lib/tasks/statistics.rake deleted file mode 100644 index dbd077319..000000000 --- a/vendor/rails-2.0.2/railties/lib/tasks/statistics.rake +++ /dev/null @@ -1,18 +0,0 @@ -STATS_DIRECTORIES = [ - %w(Controllers app/controllers), - %w(Helpers app/helpers), - %w(Models app/models), - %w(Libraries lib/), - %w(APIs app/apis), - %w(Components components), - %w(Integration\ tests test/integration), - %w(Functional\ tests test/functional), - %w(Unit\ tests test/unit) - -].collect { |name, dir| [ name, "#{RAILS_ROOT}/#{dir}" ] }.select { |name, dir| File.directory?(dir) } - -desc "Report code statistics (KLOCs, etc) from the application" -task :stats do - require 'code_statistics' - CodeStatistics.new(*STATS_DIRECTORIES).to_s -end diff --git a/vendor/rails-2.0.2/railties/lib/tasks/testing.rake b/vendor/rails-2.0.2/railties/lib/tasks/testing.rake deleted file mode 100644 index f495031b7..000000000 --- a/vendor/rails-2.0.2/railties/lib/tasks/testing.rake +++ /dev/null @@ -1,118 +0,0 @@ -TEST_CHANGES_SINCE = Time.now - 600 - -# Look up tests for recently modified sources. -def recent_tests(source_pattern, test_path, touched_since = 10.minutes.ago) - FileList[source_pattern].map do |path| - if File.mtime(path) > touched_since - tests = [] - source_dir = File.dirname(path).split("/") - source_file = File.basename(path, '.rb') - - # Support subdirs in app/models and app/controllers - modified_test_path = source_dir.length > 2 ? "#{test_path}/" << source_dir[1..source_dir.length].join('/') : test_path - - # For modified files in app/ run the tests for it. ex. /test/functional/account_controller.rb - test = "#{modified_test_path}/#{source_file}_test.rb" - tests.push test if File.exists?(test) - - # For modified files in app, run tests in subdirs too. ex. /test/functional/account/*_test.rb - test = "#{modified_test_path}/#{File.basename(path, '.rb').sub("_controller","")}" - FileList["#{test}/*_test.rb"].each { |f| tests.push f } if File.exists?(test) - - return tests - - end - end.flatten.compact -end - - -# Recreated here from ActiveSupport because :uncommitted needs it before Rails is available -module Kernel - def silence_stderr - old_stderr = STDERR.dup - STDERR.reopen(RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'NUL:' : '/dev/null') - STDERR.sync = true - yield - ensure - STDERR.reopen(old_stderr) - end -end - -desc 'Test all units and functionals' -task :test do - errors = %w(test:units test:functionals test:integration).collect do |task| - begin - Rake::Task[task].invoke - nil - rescue => e - task - end - end.compact - abort "Errors running #{errors.to_sentence}!" if errors.any? -end - -namespace :test do - Rake::TestTask.new(:recent => "db:test:prepare") do |t| - since = TEST_CHANGES_SINCE - touched = FileList['test/**/*_test.rb'].select { |path| File.mtime(path) > since } + - recent_tests('app/models/**/*.rb', 'test/unit', since) + - recent_tests('app/controllers/**/*.rb', 'test/functional', since) - - t.libs << 'test' - t.verbose = true - t.test_files = touched.uniq - end - Rake::Task['test:recent'].comment = "Test recent changes" - - Rake::TestTask.new(:uncommitted => "db:test:prepare") do |t| - def t.file_list - changed_since_checkin = silence_stderr { `svn status` }.map { |path| path.chomp[7 .. -1] } - - models = changed_since_checkin.select { |path| path =~ /app[\\\/]models[\\\/].*\.rb/ } - controllers = changed_since_checkin.select { |path| path =~ /app[\\\/]controllers[\\\/].*\.rb/ } - - unit_tests = models.map { |model| "test/unit/#{File.basename(model, '.rb')}_test.rb" } - functional_tests = controllers.map { |controller| "test/functional/#{File.basename(controller, '.rb')}_test.rb" } - - unit_tests.uniq + functional_tests.uniq - end - - t.libs << 'test' - t.verbose = true - end - Rake::Task['test:uncommitted'].comment = "Test changes since last checkin (only Subversion)" - - Rake::TestTask.new(:units => "db:test:prepare") do |t| - t.libs << "test" - t.pattern = 'test/unit/**/*_test.rb' - t.verbose = true - end - Rake::Task['test:units'].comment = "Run the unit tests in test/unit" - - Rake::TestTask.new(:functionals => "db:test:prepare") do |t| - t.libs << "test" - t.pattern = 'test/functional/**/*_test.rb' - t.verbose = true - end - Rake::Task['test:functionals'].comment = "Run the functional tests in test/functional" - - Rake::TestTask.new(:integration => "db:test:prepare") do |t| - t.libs << "test" - t.pattern = 'test/integration/**/*_test.rb' - t.verbose = true - end - Rake::Task['test:integration'].comment = "Run the integration tests in test/integration" - - Rake::TestTask.new(:plugins => :environment) do |t| - t.libs << "test" - - if ENV['PLUGIN'] - t.pattern = "vendor/plugins/#{ENV['PLUGIN']}/test/**/*_test.rb" - else - t.pattern = 'vendor/plugins/*/**/test/**/*_test.rb' - end - - t.verbose = true - end - Rake::Task['test:plugins'].comment = "Run the plugin tests in vendor/plugins/*/**/test (or specify with PLUGIN=name)" -end diff --git a/vendor/rails-2.0.2/railties/lib/tasks/tmp.rake b/vendor/rails-2.0.2/railties/lib/tasks/tmp.rake deleted file mode 100644 index b191039d6..000000000 --- a/vendor/rails-2.0.2/railties/lib/tasks/tmp.rake +++ /dev/null @@ -1,37 +0,0 @@ -namespace :tmp do - desc "Clear session, cache, and socket files from tmp/" - task :clear => [ "tmp:sessions:clear", "tmp:cache:clear", "tmp:sockets:clear"] - - desc "Creates tmp directories for sessions, cache, and sockets" - task :create do - FileUtils.mkdir_p(%w( tmp/sessions tmp/cache tmp/sockets tmp/pids )) - end - - namespace :sessions do - desc "Clears all files in tmp/sessions" - task :clear do - FileUtils.rm(Dir['tmp/sessions/[^.]*']) - end - end - - namespace :cache do - desc "Clears all files and directories in tmp/cache" - task :clear do - FileUtils.rm_rf(Dir['tmp/cache/[^.]*']) - end - end - - namespace :sockets do - desc "Clears all files in tmp/sockets" - task :clear do - FileUtils.rm(Dir['tmp/sockets/[^.]*']) - end - end - - namespace :pids do - desc "Clears all files in tmp/pids" - task :clear do - FileUtils.rm(Dir['tmp/pids/[^.]*']) - end - end -end
\ No newline at end of file |