rails 0.13.1 → 0.14.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rails might be problematic. Click here for more details.

Files changed (86) hide show
  1. data/CHANGELOG +105 -0
  2. data/Rakefile +39 -17
  3. data/bin/breakpointer +2 -2
  4. data/bin/console +2 -22
  5. data/bin/destroy +2 -6
  6. data/bin/generate +2 -6
  7. data/bin/performance/benchmarker +3 -0
  8. data/bin/performance/profiler +3 -0
  9. data/bin/process/reaper +3 -0
  10. data/bin/process/spawner +3 -0
  11. data/bin/process/spinner +3 -0
  12. data/bin/rails +4 -0
  13. data/bin/runner +2 -27
  14. data/bin/server +2 -48
  15. data/configs/apache.conf +8 -0
  16. data/configs/database.yml +8 -8
  17. data/environments/boot.rb +17 -0
  18. data/environments/development.rb +10 -7
  19. data/environments/environment.rb +37 -73
  20. data/environments/production.rb +15 -6
  21. data/environments/test.rb +12 -6
  22. data/fresh_rakefile +6 -198
  23. data/helpers/application.rb +2 -2
  24. data/helpers/application_helper.rb +1 -1
  25. data/helpers/test_helper.rb +6 -19
  26. data/html/javascripts/controls.js +427 -165
  27. data/html/javascripts/dragdrop.js +256 -277
  28. data/html/javascripts/effects.js +766 -277
  29. data/html/javascripts/prototype.js +903 -217
  30. data/html/javascripts/scriptaculous.js +47 -0
  31. data/html/javascripts/slider.js +258 -0
  32. data/html/robots.txt +1 -0
  33. data/lib/binding_of_caller.rb +3 -1
  34. data/lib/breakpoint.rb +5 -5
  35. data/lib/breakpoint_client.rb +1 -1
  36. data/lib/code_statistics.rb +7 -4
  37. data/lib/commands.rb +17 -0
  38. data/lib/commands/breakpointer.rb +1 -0
  39. data/lib/commands/console.rb +22 -0
  40. data/lib/commands/destroy.rb +6 -0
  41. data/lib/commands/generate.rb +6 -0
  42. data/{bin → lib/commands/ncgi}/listener +0 -0
  43. data/{bin → lib/commands/ncgi}/tracker +0 -0
  44. data/lib/commands/performance/benchmarker.rb +26 -0
  45. data/{bin/profiler → lib/commands/performance/profiler.rb} +3 -2
  46. data/lib/commands/process/reaper.rb +130 -0
  47. data/lib/commands/process/spawner.rb +52 -0
  48. data/lib/commands/process/spinner.rb +57 -0
  49. data/lib/commands/runner.rb +27 -0
  50. data/lib/commands/server.rb +59 -0
  51. data/{bin/update → lib/commands/update.rb} +1 -2
  52. data/lib/dispatcher.rb +20 -3
  53. data/lib/fcgi_handler.rb +59 -41
  54. data/lib/initializer.rb +479 -0
  55. data/lib/rails_generator/base.rb +2 -2
  56. data/lib/rails_generator/commands.rb +59 -7
  57. data/lib/rails_generator/generators/applications/app/app_generator.rb +26 -15
  58. data/lib/rails_generator/generators/components/controller/controller_generator.rb +3 -2
  59. data/lib/rails_generator/generators/components/controller/templates/view.rhtml +1 -1
  60. data/lib/rails_generator/generators/components/mailer/USAGE +2 -3
  61. data/lib/rails_generator/generators/components/mailer/templates/unit_test.rb +1 -1
  62. data/lib/rails_generator/generators/components/migration/migration_generator.rb +3 -1
  63. data/lib/rails_generator/generators/components/scaffold/scaffold_generator.rb +32 -31
  64. data/lib/rails_generator/generators/components/scaffold/templates/view_edit.rhtml +1 -1
  65. data/lib/rails_generator/generators/components/scaffold/templates/view_list.rhtml +1 -1
  66. data/lib/rails_generator/generators/components/scaffold/templates/view_new.rhtml +1 -1
  67. data/lib/rails_generator/lookup.rb +3 -3
  68. data/lib/rails_generator/options.rb +1 -0
  69. data/lib/rails_generator/scripts.rb +1 -1
  70. data/lib/rails_version.rb +9 -0
  71. data/lib/railties_path.rb +1 -0
  72. data/lib/rubyprof_ext.rb +1 -1
  73. data/lib/tasks/databases.rake +152 -0
  74. data/lib/tasks/documentation.rake +44 -0
  75. data/lib/tasks/framework.rake +33 -0
  76. data/lib/tasks/javascripts.rake +6 -0
  77. data/lib/tasks/misc.rake +15 -0
  78. data/lib/tasks/rails.rb +7 -0
  79. data/lib/tasks/statistics.rake +16 -0
  80. data/lib/tasks/testing.rake +37 -0
  81. data/lib/test_help.rb +13 -0
  82. data/lib/webrick_server.rb +31 -9
  83. metadata +121 -85
  84. data/bin/benchmarker +0 -19
  85. data/bin/breakpointer_for_gem +0 -4
  86. data/bin/console_sandbox +0 -0
@@ -0,0 +1,17 @@
1
+ unless defined?(RAILS_ROOT)
2
+ root_path = File.join(File.dirname(__FILE__), '..')
3
+ unless RUBY_PLATFORM =~ /mswin32/
4
+ require 'pathname'
5
+ root_path = Pathname.new(root_path).cleanpath.to_s
6
+ end
7
+ RAILS_ROOT = root_path
8
+ end
9
+
10
+ if File.directory?("#{RAILS_ROOT}/vendor/rails")
11
+ require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
12
+ else
13
+ require 'rubygems'
14
+ require 'initializer'
15
+ end
16
+
17
+ Rails::Initializer.run(:set_load_path)
@@ -1,14 +1,17 @@
1
1
  # In the development environment your application's code is reloaded on
2
2
  # every request. This slows down response time but is perfect for development
3
3
  # since you don't have to restart the webserver when you make code changes.
4
+ config.cache_classes = false
4
5
 
5
6
  # Log error messages when you accidentally call methods on nil.
6
- require 'active_support/whiny_nil'
7
+ config.whiny_nils = true
7
8
 
8
- # Reload code; show full error reports; disable caching.
9
- Dependencies.mechanism = :load
10
- ActionController::Base.consider_all_requests_local = true
11
- ActionController::Base.perform_caching = false
9
+ # Enable the breakpoint server that script/breakpointer connects to
10
+ config.breakpoint_server = true
12
11
 
13
- # The breakpoint server port that script/breakpointer connects to.
14
- BREAKPOINT_SERVER_PORT = 42531
12
+ # Show full error reports and disable caching
13
+ config.action_controller.consider_all_requests_local = true
14
+ config.action_controller.perform_caching = false
15
+
16
+ # Don't care if the mailer can't send
17
+ config.action_mailer.raise_delivery_errors = false
@@ -1,87 +1,51 @@
1
- # Load the Rails framework and configure your application.
2
- # You can include your own configuration at the end of this file.
3
- #
4
1
  # Be sure to restart your webserver when you modify this file.
5
2
 
6
- # The path to the root directory of your application.
7
- RAILS_ROOT = File.join(File.dirname(__FILE__), '..')
3
+ # Uncomment below to force Rails into production mode
4
+ # (Use only when you can't set environment variables through your web/app server)
5
+ # ENV['RAILS_ENV'] = 'production'
8
6
 
9
- # The environment your application is currently running. Don't set
10
- # this here; put it in your webserver's configuration as the RAILS_ENV
11
- # environment variable instead.
12
- #
13
- # See config/environments/*.rb for environment-specific configuration.
14
- RAILS_ENV = ENV['RAILS_ENV'] || 'development'
7
+ # Bootstrap the Rails environment, frameworks, and default configuration
8
+ require File.join(File.dirname(__FILE__), 'boot')
15
9
 
10
+ Rails::Initializer.run do |config|
11
+ # Skip frameworks you're not going to use
12
+ # config.frameworks -= [ :action_web_service, :action_mailer ]
16
13
 
17
- # Load the Rails framework. Mock classes for testing come first.
18
- ADDITIONAL_LOAD_PATHS = ["#{RAILS_ROOT}/test/mocks/#{RAILS_ENV}"]
14
+ # Add additional load paths for your own custom dirs
15
+ # config.load_paths += %W( #{RAILS_ROOT}/app/services )
19
16
 
20
- # Then model subdirectories.
21
- ADDITIONAL_LOAD_PATHS.concat(Dir["#{RAILS_ROOT}/app/models/[_a-z]*"])
22
- ADDITIONAL_LOAD_PATHS.concat(Dir["#{RAILS_ROOT}/components/[_a-z]*"])
17
+ # Force all environments to use the same logger level
18
+ # (by default production uses :info, the others :debug)
19
+ # config.log_level = :debug
23
20
 
24
- # Followed by the standard includes.
25
- ADDITIONAL_LOAD_PATHS.concat %w(
26
- app
27
- app/models
28
- app/controllers
29
- app/helpers
30
- app/apis
31
- components
32
- config
33
- lib
34
- vendor
35
- vendor/rails/railties
36
- vendor/rails/railties/lib
37
- vendor/rails/actionpack/lib
38
- vendor/rails/activesupport/lib
39
- vendor/rails/activerecord/lib
40
- vendor/rails/actionmailer/lib
41
- vendor/rails/actionwebservice/lib
42
- ).map { |dir| "#{RAILS_ROOT}/#{dir}" }.select { |dir| File.directory?(dir) }
21
+ # Use the database for sessions instead of the file system
22
+ # (create the session table with 'rake create_sessions_table')
23
+ # config.action_controller.session_store = :active_record_store
43
24
 
44
- # Prepend to $LOAD_PATH
45
- ADDITIONAL_LOAD_PATHS.reverse.each { |dir| $:.unshift(dir) if File.directory?(dir) }
25
+ # Enable page/fragment caching by setting a file-based store
26
+ # (remember to create the caching directory and make it readable to the application)
27
+ # config.action_controller.fragment_cache_store = :file_store, "#{RAILS_ROOT}/cache"
46
28
 
47
- # Require Rails libraries.
48
- require 'rubygems' unless File.directory?("#{RAILS_ROOT}/vendor/rails")
29
+ # Activate observers that should always be running
30
+ # config.active_record.observers = :cacher, :garbage_collector
49
31
 
50
- require 'active_support'
51
- require 'active_record'
52
- require 'action_controller'
53
- require 'action_mailer'
54
- require 'action_web_service'
32
+ # Make Active Record use UTC-base instead of local time
33
+ # config.active_record.default_timezone = :utc
34
+
35
+ # Use Active Record's schema dumper instead of SQL when creating the test database
36
+ # (enables use of different database adapters for development and test environments)
37
+ # config.active_record.schema_format = :ruby
55
38
 
56
- # Environment-specific configuration.
57
- require_dependency "environments/#{RAILS_ENV}"
58
- ActiveRecord::Base.configurations = File.open("#{RAILS_ROOT}/config/database.yml") { |f| YAML::load(f) }
59
- ActiveRecord::Base.establish_connection
60
-
61
-
62
- # Configure defaults if the included environment did not.
63
- begin
64
- RAILS_DEFAULT_LOGGER = Logger.new("#{RAILS_ROOT}/log/#{RAILS_ENV}.log")
65
- RAILS_DEFAULT_LOGGER.level = (RAILS_ENV == 'production' ? Logger::INFO : Logger::DEBUG)
66
- rescue StandardError
67
- RAILS_DEFAULT_LOGGER = Logger.new(STDERR)
68
- RAILS_DEFAULT_LOGGER.level = Logger::WARN
69
- RAILS_DEFAULT_LOGGER.warn(
70
- "Rails Error: Unable to access log file. Please ensure that log/#{RAILS_ENV}.log exists and is chmod 0666. " +
71
- "The log level has been raised to WARN and the output directed to STDERR until the problem is fixed."
72
- )
39
+ # See Rails::Configuration for more options
73
40
  end
74
41
 
75
- [ActiveRecord, ActionController, ActionMailer].each { |mod| mod::Base.logger ||= RAILS_DEFAULT_LOGGER }
76
- [ActionController, ActionMailer].each { |mod| mod::Base.template_root ||= "#{RAILS_ROOT}/app/views/" }
77
-
78
- # Set up routes.
79
- ActionController::Routing::Routes.reload
80
-
81
- Controllers = Dependencies::LoadingModule.root(
82
- File.join(RAILS_ROOT, 'app', 'controllers'),
83
- File.join(RAILS_ROOT, 'components')
84
- )
85
-
86
- # Include your app's configuration here:
42
+ # Add new inflection rules using the following format
43
+ # (all these examples are active by default):
44
+ # Inflector.inflections do |inflect|
45
+ # inflect.plural /^(ox)$/i, '\1en'
46
+ # inflect.singular /^(ox)en/i, '\1'
47
+ # inflect.irregular 'person', 'people'
48
+ # inflect.uncountable %w( fish sheep )
49
+ # end
87
50
 
51
+ # Include your application configuration below
@@ -1,8 +1,17 @@
1
1
  # The production environment is meant for finished, "live" apps.
2
- # Code is not reloaded between requests, full error reports are disabled,
3
- # and caching is turned on.
2
+ # Code is not reloaded between requests
3
+ config.cache_classes = true
4
4
 
5
- # Don't reload code; don't show full error reports; enable caching.
6
- Dependencies.mechanism = :require
7
- ActionController::Base.consider_all_requests_local = false
8
- ActionController::Base.perform_caching = true
5
+ # Use a different logger for distributed setups
6
+ # config.logger = SyslogLogger.new
7
+
8
+
9
+ # Full error reports are disabled and caching is turned on
10
+ config.action_controller.consider_all_requests_local = false
11
+ config.action_controller.perform_caching = true
12
+
13
+ # Enable serving of images, stylesheets, and javascripts from an asset server
14
+ # config.action_controller.asset_host = "http://assets.example.com"
15
+
16
+ # Disable delivery errors if you bad email addresses should just be ignored
17
+ # config.action_mailer.raise_delivery_errors = false
@@ -2,16 +2,22 @@
2
2
  # test suite. You never need to work with it otherwise. Remember that
3
3
  # your test database is "scratch space" for the test suite and is wiped
4
4
  # and recreated between test runs. Don't rely on the data there!
5
+ config.cache_classes = true
5
6
 
6
7
  # Log error messages when you accidentally call methods on nil.
7
- require 'active_support/whiny_nil'
8
+ config.whiny_nils = true
8
9
 
9
- # Don't reload code; show full error reports; disable caching.
10
- Dependencies.mechanism = :require
11
- ActionController::Base.consider_all_requests_local = true
12
- ActionController::Base.perform_caching = false
10
+ # Show full error reports and disable caching
11
+ config.action_controller.consider_all_requests_local = true
12
+ config.action_controller.perform_caching = false
13
13
 
14
14
  # Tell ActionMailer not to deliver emails to the real world.
15
15
  # The :test delivery method accumulates sent emails in the
16
16
  # ActionMailer::Base.deliveries array.
17
- ActionMailer::Base.delivery_method = :test
17
+ config.action_mailer.delivery_method = :test
18
+
19
+ # Overwrite the default settings for fixtures in tests. See Fixtures
20
+ # for more details about these settings.
21
+ # config.transactional_fixtures = true
22
+ # config.instantiated_fixtures = false
23
+ # config.pre_loaded_fixtures = false
@@ -1,202 +1,10 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/switchtower.rake, and they will automatically be available to Rake.
3
+
4
+ require(File.join(File.dirname(__FILE__), 'config', 'boot'))
5
+
1
6
  require 'rake'
2
7
  require 'rake/testtask'
3
8
  require 'rake/rdoctask'
4
9
 
5
- $VERBOSE = nil
6
- TEST_CHANGES_SINCE = Time.now - 600
7
-
8
- desc "Run all the tests on a fresh test database"
9
- task :default => [ :test_units, :test_functional ]
10
-
11
-
12
- desc 'Require application environment.'
13
- task :environment do
14
- unless defined? RAILS_ROOT
15
- require File.dirname(__FILE__) + '/config/environment'
16
- end
17
- end
18
-
19
- desc "Generate API documentation, show coding stats"
20
- task :doc => [ :appdoc, :stats ]
21
-
22
-
23
- # Look up tests for recently modified sources.
24
- def recent_tests(source_pattern, test_path, touched_since = 10.minutes.ago)
25
- FileList[source_pattern].map do |path|
26
- if File.mtime(path) > touched_since
27
- test = "#{test_path}/#{File.basename(path, '.rb')}_test.rb"
28
- test if File.exists?(test)
29
- end
30
- end.compact
31
- end
32
-
33
- desc 'Test recent changes.'
34
- Rake::TestTask.new(:recent => [ :clone_structure_to_test ]) do |t|
35
- since = TEST_CHANGES_SINCE
36
- touched = FileList['test/**/*_test.rb'].select { |path| File.mtime(path) > since } +
37
- recent_tests('app/models/*.rb', 'test/unit', since) +
38
- recent_tests('app/controllers/*.rb', 'test/functional', since)
39
-
40
- t.libs << 'test'
41
- t.verbose = true
42
- t.test_files = touched.uniq
43
- end
44
- task :test_recent => [ :clone_structure_to_test ]
45
-
46
- desc "Run the unit tests in test/unit"
47
- Rake::TestTask.new("test_units") { |t|
48
- t.libs << "test"
49
- t.pattern = 'test/unit/**/*_test.rb'
50
- t.verbose = true
51
- }
52
- task :test_units => [ :clone_structure_to_test ]
53
-
54
- desc "Run the functional tests in test/functional"
55
- Rake::TestTask.new("test_functional") { |t|
56
- t.libs << "test"
57
- t.pattern = 'test/functional/**/*_test.rb'
58
- t.verbose = true
59
- }
60
- task :test_functional => [ :clone_structure_to_test ]
61
-
62
- desc "Generate documentation for the application"
63
- Rake::RDocTask.new("appdoc") { |rdoc|
64
- rdoc.rdoc_dir = 'doc/app'
65
- rdoc.title = "Rails Application Documentation"
66
- rdoc.options << '--line-numbers --inline-source'
67
- rdoc.rdoc_files.include('doc/README_FOR_APP')
68
- rdoc.rdoc_files.include('app/**/*.rb')
69
- }
70
-
71
- desc "Generate documentation for the Rails framework"
72
- Rake::RDocTask.new("apidoc") { |rdoc|
73
- rdoc.rdoc_dir = 'doc/api'
74
- rdoc.template = "#{ENV['template']}.rb" if ENV['template']
75
- rdoc.title = "Rails Framework Documentation"
76
- rdoc.options << '--line-numbers --inline-source'
77
- rdoc.rdoc_files.include('README')
78
- rdoc.rdoc_files.include('CHANGELOG')
79
- rdoc.rdoc_files.include('vendor/rails/railties/CHANGELOG')
80
- rdoc.rdoc_files.include('vendor/rails/railties/MIT-LICENSE')
81
- rdoc.rdoc_files.include('vendor/rails/activerecord/README')
82
- rdoc.rdoc_files.include('vendor/rails/activerecord/CHANGELOG')
83
- rdoc.rdoc_files.include('vendor/rails/activerecord/lib/active_record/**/*.rb')
84
- rdoc.rdoc_files.exclude('vendor/rails/activerecord/lib/active_record/vendor/*')
85
- rdoc.rdoc_files.include('vendor/rails/actionpack/README')
86
- rdoc.rdoc_files.include('vendor/rails/actionpack/CHANGELOG')
87
- rdoc.rdoc_files.include('vendor/rails/actionpack/lib/action_controller/**/*.rb')
88
- rdoc.rdoc_files.include('vendor/rails/actionpack/lib/action_view/**/*.rb')
89
- rdoc.rdoc_files.include('vendor/rails/actionmailer/README')
90
- rdoc.rdoc_files.include('vendor/rails/actionmailer/CHANGELOG')
91
- rdoc.rdoc_files.include('vendor/rails/actionmailer/lib/action_mailer/base.rb')
92
- rdoc.rdoc_files.include('vendor/rails/actionwebservice/README')
93
- rdoc.rdoc_files.include('vendor/rails/actionwebservice/CHANGELOG')
94
- rdoc.rdoc_files.include('vendor/rails/actionwebservice/lib/action_web_service.rb')
95
- rdoc.rdoc_files.include('vendor/rails/actionwebservice/lib/action_web_service/*.rb')
96
- rdoc.rdoc_files.include('vendor/rails/actionwebservice/lib/action_web_service/api/*.rb')
97
- rdoc.rdoc_files.include('vendor/rails/actionwebservice/lib/action_web_service/client/*.rb')
98
- rdoc.rdoc_files.include('vendor/rails/actionwebservice/lib/action_web_service/container/*.rb')
99
- rdoc.rdoc_files.include('vendor/rails/actionwebservice/lib/action_web_service/dispatcher/*.rb')
100
- rdoc.rdoc_files.include('vendor/rails/actionwebservice/lib/action_web_service/protocol/*.rb')
101
- rdoc.rdoc_files.include('vendor/rails/actionwebservice/lib/action_web_service/support/*.rb')
102
- rdoc.rdoc_files.include('vendor/rails/activesupport/README')
103
- rdoc.rdoc_files.include('vendor/rails/activesupport/CHANGELOG')
104
- rdoc.rdoc_files.include('vendor/rails/activesupport/lib/active_support/**/*.rb')
105
- }
106
-
107
- desc "Report code statistics (KLOCs, etc) from the application"
108
- task :stats => [ :environment ] do
109
- require 'code_statistics'
110
- CodeStatistics.new(
111
- ["Helpers", "app/helpers"],
112
- ["Controllers", "app/controllers"],
113
- ["APIs", "app/apis"],
114
- ["Components", "components"],
115
- ["Functionals", "test/functional"],
116
- ["Models", "app/models"],
117
- ["Units", "test/unit"]
118
- ).to_s
119
- end
120
-
121
- desc "Recreate the test databases from the development structure"
122
- task :clone_structure_to_test => [ :db_structure_dump, :purge_test_database ] do
123
- abcs = ActiveRecord::Base.configurations
124
- case abcs["test"]["adapter"]
125
- when "mysql"
126
- ActiveRecord::Base.establish_connection(:test)
127
- ActiveRecord::Base.connection.execute('SET foreign_key_checks = 0')
128
- IO.readlines("db/#{RAILS_ENV}_structure.sql").join.split("\n\n").each do |table|
129
- ActiveRecord::Base.connection.execute(table)
130
- end
131
- when "postgresql"
132
- ENV['PGHOST'] = abcs["test"]["host"] if abcs["test"]["host"]
133
- ENV['PGPORT'] = abcs["test"]["port"].to_s if abcs["test"]["port"]
134
- ENV['PGPASSWORD'] = abcs["test"]["password"].to_s if abcs["test"]["password"]
135
- `psql -U "#{abcs["test"]["username"]}" -f db/#{RAILS_ENV}_structure.sql #{abcs["test"]["database"]}`
136
- when "sqlite", "sqlite3"
137
- `#{abcs[RAILS_ENV]["adapter"]} #{abcs["test"]["dbfile"]} < db/#{RAILS_ENV}_structure.sql`
138
- when "sqlserver"
139
- `osql -E -S #{abcs["test"]["host"]} -d #{abcs["test"]["database"]} -i db\\#{RAILS_ENV}_structure.sql`
140
- else
141
- raise "Unknown database adapter '#{abcs["test"]["adapter"]}'"
142
- end
143
- end
144
-
145
- desc "Dump the database structure to a SQL file"
146
- task :db_structure_dump => :environment do
147
- abcs = ActiveRecord::Base.configurations
148
- case abcs[RAILS_ENV]["adapter"]
149
- when "mysql"
150
- ActiveRecord::Base.establish_connection(abcs[RAILS_ENV])
151
- File.open("db/#{RAILS_ENV}_structure.sql", "w+") { |f| f << ActiveRecord::Base.connection.structure_dump }
152
- when "postgresql"
153
- ENV['PGHOST'] = abcs[RAILS_ENV]["host"] if abcs[RAILS_ENV]["host"]
154
- ENV['PGPORT'] = abcs[RAILS_ENV]["port"].to_s if abcs[RAILS_ENV]["port"]
155
- ENV['PGPASSWORD'] = abcs[RAILS_ENV]["password"].to_s if abcs[RAILS_ENV]["password"]
156
- `pg_dump -U "#{abcs[RAILS_ENV]["username"]}" -s -x -O -f db/#{RAILS_ENV}_structure.sql #{abcs[RAILS_ENV]["database"]}`
157
- when "sqlite", "sqlite3"
158
- `#{abcs[RAILS_ENV]["adapter"]} #{abcs[RAILS_ENV]["dbfile"]} .schema > db/#{RAILS_ENV}_structure.sql`
159
- when "sqlserver"
160
- `scptxfr /s #{abcs[RAILS_ENV]["host"]} /d #{abcs[RAILS_ENV]["database"]} /I /f db\\#{RAILS_ENV}_structure.sql /q /A /r`
161
- `scptxfr /s #{abcs[RAILS_ENV]["host"]} /d #{abcs[RAILS_ENV]["database"]} /I /F db\ /q /A /r`
162
- else
163
- raise "Unknown database adapter '#{abcs["test"]["adapter"]}'"
164
- end
165
- end
166
-
167
- desc "Empty the test database"
168
- task :purge_test_database => :environment do
169
- abcs = ActiveRecord::Base.configurations
170
- case abcs["test"]["adapter"]
171
- when "mysql"
172
- ActiveRecord::Base.establish_connection(:test)
173
- ActiveRecord::Base.connection.recreate_database(abcs["test"]["database"])
174
- when "postgresql"
175
- ENV['PGHOST'] = abcs["test"]["host"] if abcs["test"]["host"]
176
- ENV['PGPORT'] = abcs["test"]["port"].to_s if abcs["test"]["port"]
177
- ENV['PGPASSWORD'] = abcs["test"]["password"].to_s if abcs["test"]["password"]
178
- `dropdb -U "#{abcs["test"]["username"]}" #{abcs["test"]["database"]}`
179
- `createdb -T template0 -U "#{abcs["test"]["username"]}" #{abcs["test"]["database"]}`
180
- when "sqlite","sqlite3"
181
- File.delete(abcs["test"]["dbfile"]) if File.exist?(abcs["test"]["dbfile"])
182
- when "sqlserver"
183
- dropfkscript = "#{abcs["test"]["host"]}.#{abcs["test"]["database"]}.DP1".gsub(/\\/,'-')
184
- `osql -E -S #{abcs["test"]["host"]} -d #{abcs["test"]["database"]} -i db\\#{dropfkscript}`
185
- `osql -E -S #{abcs["test"]["host"]} -d #{abcs["test"]["database"]} -i db\\#{RAILS_ENV}_structure.sql`
186
- else
187
- raise "Unknown database adapter '#{abcs["test"]["adapter"]}'"
188
- end
189
- end
190
-
191
- desc "Clears all *.log files in log/"
192
- task :clear_logs => :environment do
193
- FileList["log/*.log"].each do |log_file|
194
- f = File.open(log_file, "w")
195
- f.close
196
- end
197
- end
198
-
199
- desc "Migrate the database according to the migrate scripts in db/migrate (only supported on PG/MySQL). A specific version can be targetted with VERSION=x"
200
- task :migrate => :environment do
201
- ActiveRecord::Migrator.migrate(File.dirname(__FILE__) + '/db/migrate/', ENV["VERSION"] ? ENV["VERSION"].to_i : nil)
202
- end
10
+ require 'tasks/rails'
@@ -1,4 +1,4 @@
1
- # The filters added to this controller will be run for all controllers in the application.
2
- # Likewise will all the methods added be available for all controllers.
1
+ # Filters added to this controller will be run for all controllers in the application.
2
+ # Likewise, all the methods added will be available for all controllers.
3
3
  class ApplicationController < ActionController::Base
4
4
  end
@@ -1,3 +1,3 @@
1
- # The methods added to this helper will be available to all templates in the application.
1
+ # Methods added to this helper will be available to all templates in the application.
2
2
  module ApplicationHelper
3
3
  end
@@ -1,26 +1,13 @@
1
1
  ENV["RAILS_ENV"] = "test"
2
-
3
- # Expand the path to environment so that Ruby does not load it multiple times
4
- # File.expand_path can be removed if Ruby 1.9 is in use.
5
2
  require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
6
- require 'application'
7
-
8
- require 'test/unit'
9
- require 'active_record/fixtures'
10
- require 'action_controller/test_process'
11
- require 'action_web_service/test_invoke'
12
- require 'breakpoint'
13
-
14
- Test::Unit::TestCase.fixture_path = File.dirname(__FILE__) + "/fixtures/"
3
+ require 'test_help'
15
4
 
16
5
  class Test::Unit::TestCase
17
- # Turn these on to use transactional fixtures with table_name(:fixture_name) instantiation of fixtures
18
- # self.use_transactional_fixtures = true
19
- # self.use_instantiated_fixtures = false
20
-
21
- def create_fixtures(*table_names)
22
- Fixtures.create_fixtures(File.dirname(__FILE__) + "/fixtures", table_names)
23
- end
6
+ # Turn off transactional fixtures if you're working with MyISAM tables in MySQL
7
+ self.use_transactional_fixtures = true
8
+
9
+ # Instantiated fixtures are slow, but give you @david where you otherwise would need people(:david)
10
+ self.use_instantiated_fixtures = false
24
11
 
25
12
  # Add more helper methods to be used by all tests here...
26
13
  end