aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib
diff options
context:
space:
mode:
authorNicholas Seckar <nseckar@gmail.com>2006-06-28 20:53:00 +0000
committerNicholas Seckar <nseckar@gmail.com>2006-06-28 20:53:00 +0000
commit81a6a60dc6dff2ad8c2a45bf17fc40e760224e30 (patch)
tree691d04124ae4a872a992eff39b1c2d86891fbe84 /railties/lib
parentc02d1f7d9b73f708d8f656044b096454344ccb78 (diff)
downloadrails-81a6a60dc6dff2ad8c2a45bf17fc40e760224e30.tar.gz
rails-81a6a60dc6dff2ad8c2a45bf17fc40e760224e30.tar.bz2
rails-81a6a60dc6dff2ad8c2a45bf17fc40e760224e30.zip
Remove opts.on { |options[:option_name] } style hash assignment. Closes #4440.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4502 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'railties/lib')
-rw-r--r--railties/lib/breakpoint_client.rb10
-rw-r--r--railties/lib/commands/console.rb4
-rw-r--r--railties/lib/commands/process/inspector.rb6
-rw-r--r--railties/lib/commands/process/reaper.rb6
-rw-r--r--railties/lib/commands/process/spawner.rb12
-rw-r--r--railties/lib/commands/process/spinner.rb6
-rw-r--r--railties/lib/commands/runner.rb2
-rw-r--r--railties/lib/commands/servers/webrick.rb8
-rw-r--r--railties/lib/rails_generator/generators/applications/app/app_generator.rb6
-rw-r--r--railties/lib/rails_generator/generators/components/model/model_generator.rb2
-rw-r--r--railties/lib/rails_generator/options.rb8
11 files changed, 35 insertions, 35 deletions
diff --git a/railties/lib/breakpoint_client.rb b/railties/lib/breakpoint_client.rb
index 36b7469e88..9273321599 100644
--- a/railties/lib/breakpoint_client.rb
+++ b/railties/lib/breakpoint_client.rb
@@ -30,13 +30,13 @@ ARGV.options do |opts|
"connections from the server.",
"Default: Find a good URI automatically.",
"Example: -c druby://localhost:12345"
- ) { |Options[:ClientURI]| }
+ ) { |v| Options[:ClientURI] = v }
opts.on("-s", "--server-uri=uri",
"Connect to the server specified at the",
"specified uri.",
"Default: druby://localhost:42531"
- ) { |Options[:ServerURI]| }
+ ) { |v| Options[:ServerURI] = v }
opts.on("-R", "--retry-delay=delay", Integer,
"Automatically try to reconnect to the",
@@ -45,14 +45,14 @@ ARGV.options do |opts|
"A value of 0 disables automatical",
"reconnecting completely.",
"Default: 10"
- ) { |Options[:RetryDelay]| }
+ ) { |v| Options[:RetryDelay] = v }
opts.on("-P", "--[no-]permanent",
"Run the breakpoint client in permanent mode.",
"This means that the client will keep continue",
"running even after the server has closed the",
"connection. Useful for example in Rails."
- ) { |Options[:Permanent]| }
+ ) { |v| Options[:Permanent] = v }
opts.on("-V", "--[no-]verbose",
"Run the breakpoint client in verbose mode.",
@@ -60,7 +60,7 @@ ARGV.options do |opts|
"individual breakpoints. This might help in seeing",
"that the breakpoint client is still alive, but adds",
"quite a bit of clutter."
- ) { |Options[:Verbose]| }
+ ) { |v| Options[:Verbose] = v }
opts.separator ""
diff --git a/railties/lib/commands/console.rb b/railties/lib/commands/console.rb
index ed0cc10de7..8b35a8d296 100644
--- a/railties/lib/commands/console.rb
+++ b/railties/lib/commands/console.rb
@@ -4,8 +4,8 @@ require 'optparse'
options = { :sandbox => false, :irb => irb }
OptionParser.new do |opt|
opt.banner = "Usage: console [environment] [options]"
- opt.on('-s', '--sandbox', 'Rollback database modifications on exit.') { |options[:sandbox]| }
- opt.on("--irb=[#{irb}]", 'Invoke a different irb.') { |options[:irb]| }
+ opt.on('-s', '--sandbox', 'Rollback database modifications on exit.') { |v| options[:sandbox] = v }
+ opt.on("--irb=[#{irb}]", 'Invoke a different irb.') { |v| options[:irb] = v }
opt.parse!(ARGV)
end
diff --git a/railties/lib/commands/process/inspector.rb b/railties/lib/commands/process/inspector.rb
index 6a23f498e0..15643059fc 100644
--- a/railties/lib/commands/process/inspector.rb
+++ b/railties/lib/commands/process/inspector.rb
@@ -54,9 +54,9 @@ ARGV.options do |opts|
opts.on(" Options:")
- opts.on("-s", "--ps=command", "default: #{OPTIONS[:ps]}", String) { |OPTIONS[:ps]| }
- opts.on("-p", "--pidpath=path", "default: #{OPTIONS[:pid_path]}", String) { |OPTIONS[:pid_path]| }
- opts.on("-r", "--pattern=pattern", "default: #{OPTIONS[:pattern]}", String) { |OPTIONS[:pattern]| }
+ opts.on("-s", "--ps=command", "default: #{OPTIONS[:ps]}", String) { |v| OPTIONS[:ps] = v }
+ opts.on("-p", "--pidpath=path", "default: #{OPTIONS[:pid_path]}", String) { |v| OPTIONS[:pid_path] = v }
+ opts.on("-r", "--pattern=pattern", "default: #{OPTIONS[:pattern]}", String) { |v| OPTIONS[:pattern] = v }
opts.separator ""
diff --git a/railties/lib/commands/process/reaper.rb b/railties/lib/commands/process/reaper.rb
index 6ac2f8e8bd..375a78e21b 100644
--- a/railties/lib/commands/process/reaper.rb
+++ b/railties/lib/commands/process/reaper.rb
@@ -121,9 +121,9 @@ ARGV.options do |opts|
opts.on(" Options:")
- opts.on("-a", "--action=name", "reload|graceful|kill (default: #{OPTIONS[:action]})", String) { |OPTIONS[:action]| }
- opts.on("-p", "--pidpath=path", "default: #{OPTIONS[:pid_path]}", String) { |OPTIONS[:pid_path]| }
- opts.on("-r", "--pattern=pattern", "default: #{OPTIONS[:pattern]}", String) { |OPTIONS[:pattern]| }
+ opts.on("-a", "--action=name", "reload|graceful|kill (default: #{OPTIONS[:action]})", String) { |v| OPTIONS[:action] = v }
+ opts.on("-p", "--pidpath=path", "default: #{OPTIONS[:pid_path]}", String) { |v| OPTIONS[:pid_path] = v }
+ opts.on("-r", "--pattern=pattern", "default: #{OPTIONS[:pattern]}", String) { |v| OPTIONS[:pattern] = v }
opts.separator ""
diff --git a/railties/lib/commands/process/spawner.rb b/railties/lib/commands/process/spawner.rb
index 8b5d56b324..b90e67c758 100644
--- a/railties/lib/commands/process/spawner.rb
+++ b/railties/lib/commands/process/spawner.rb
@@ -91,12 +91,12 @@ ARGV.options do |opts|
opts.on(" Options:")
- opts.on("-p", "--port=number", Integer, "Starting port number (default: #{OPTIONS[:port]})") { |OPTIONS[:port]| }
- opts.on("-i", "--instances=number", Integer, "Number of instances (default: #{OPTIONS[:instances]})") { |OPTIONS[:instances]| }
- opts.on("-r", "--repeat=seconds", Integer, "Repeat spawn attempts every n seconds (default: off)") { |OPTIONS[:repeat]| }
- opts.on("-e", "--environment=name", String, "test|development|production (default: #{OPTIONS[:environment]})") { |OPTIONS[:environment]| }
- opts.on("-n", "--process=name", String, "default: #{OPTIONS[:process]}") { |OPTIONS[:process]| }
- opts.on("-s", "--spawner=path", String, "default: #{OPTIONS[:spawner]}") { |OPTIONS[:spawner]| }
+ opts.on("-p", "--port=number", Integer, "Starting port number (default: #{OPTIONS[:port]})") { |v| OPTIONS[:port] = v }
+ opts.on("-i", "--instances=number", Integer, "Number of instances (default: #{OPTIONS[:instances]})") { |v| OPTIONS[:instances] = v }
+ opts.on("-r", "--repeat=seconds", Integer, "Repeat spawn attempts every n seconds (default: off)") { |v| OPTIONS[:repeat] = v }
+ opts.on("-e", "--environment=name", String, "test|development|production (default: #{OPTIONS[:environment]})") { |v| OPTIONS[:environment] = v }
+ opts.on("-n", "--process=name", String, "default: #{OPTIONS[:process]}") { |v| OPTIONS[:process] = v }
+ opts.on("-s", "--spawner=path", String, "default: #{OPTIONS[:spawner]}") { |v| OPTIONS[:spawner] = v }
opts.on("-d", "--dispatcher=path", String, "default: #{OPTIONS[:dispatcher]}") { |dispatcher| OPTIONS[:dispatcher] = File.expand_path(dispatcher) }
opts.separator ""
diff --git a/railties/lib/commands/process/spinner.rb b/railties/lib/commands/process/spinner.rb
index af073c747f..c0b2f09a94 100644
--- a/railties/lib/commands/process/spinner.rb
+++ b/railties/lib/commands/process/spinner.rb
@@ -36,9 +36,9 @@ ARGV.options do |opts|
opts.on(" Options:")
- opts.on("-c", "--command=path", String) { |OPTIONS[:command]| }
- opts.on("-i", "--interval=seconds", Float) { |OPTIONS[:interval]| }
- opts.on("-d", "--daemon") { |OPTIONS[:daemon]| }
+ opts.on("-c", "--command=path", String) { |v| OPTIONS[:command] = v }
+ opts.on("-i", "--interval=seconds", Float) { |v| OPTIONS[:interval] = v }
+ opts.on("-d", "--daemon") { |v| OPTIONS[:daemon] = v }
opts.separator ""
diff --git a/railties/lib/commands/runner.rb b/railties/lib/commands/runner.rb
index f4d70f1541..47186d52e4 100644
--- a/railties/lib/commands/runner.rb
+++ b/railties/lib/commands/runner.rb
@@ -10,7 +10,7 @@ ARGV.options do |opts|
opts.on("-e", "--environment=name", String,
"Specifies the environment for the runner to operate under (test/development/production).",
- "Default: development") { |options[:environment]| }
+ "Default: development") { |v| options[:environment] = v }
opts.separator ""
diff --git a/railties/lib/commands/servers/webrick.rb b/railties/lib/commands/servers/webrick.rb
index db8e8b3d93..3fddcc5459 100644
--- a/railties/lib/commands/servers/webrick.rb
+++ b/railties/lib/commands/servers/webrick.rb
@@ -19,13 +19,13 @@ ARGV.options do |opts|
opts.on("-p", "--port=port", Integer,
"Runs Rails on the specified port.",
- "Default: 3000") { |OPTIONS[:port]| }
+ "Default: 3000") { |v| OPTIONS[:port] = v }
opts.on("-b", "--binding=ip", String,
"Binds Rails to the specified ip.",
- "Default: 0.0.0.0") { |OPTIONS[:ip]| }
+ "Default: 0.0.0.0") { |v| OPTIONS[:ip] = v }
opts.on("-e", "--environment=name", String,
"Specifies the environment to run this server under (test/development/production).",
- "Default: development") { |OPTIONS[:environment]| }
+ "Default: development") { |v| OPTIONS[:environment] = v }
opts.on("-m", "--mime-types=filename", String,
"Specifies an Apache style mime.types configuration file to be used for mime types",
"Default: none") { |mime_types_file| OPTIONS[:mime_types] = WEBrick::HTTPUtils::load_mime_types(mime_types_file) }
@@ -36,7 +36,7 @@ ARGV.options do |opts|
opts.on("-c", "--charset=charset", String,
"Set default charset for output.",
- "Default: UTF-8") { |OPTIONS[:charset]| }
+ "Default: UTF-8") { |v| OPTIONS[:charset] = v }
opts.separator ""
diff --git a/railties/lib/rails_generator/generators/applications/app/app_generator.rb b/railties/lib/rails_generator/generators/applications/app/app_generator.rb
index 6d58b98fbe..bbdd3cb206 100644
--- a/railties/lib/rails_generator/generators/applications/app/app_generator.rb
+++ b/railties/lib/rails_generator/generators/applications/app/app_generator.rb
@@ -97,15 +97,15 @@ class AppGenerator < Rails::Generator::Base
opt.separator 'Options:'
opt.on("-r", "--ruby=path", String,
"Path to the Ruby binary of your choice (otherwise scripts use env, dispatchers current path).",
- "Default: #{DEFAULT_SHEBANG}") { |options[:shebang]| }
+ "Default: #{DEFAULT_SHEBANG}") { |v| options[:shebang] = v }
opt.on("-d", "--database=name", String,
"Preconfigure for selected database (options: mysql/oracle/postgresql/sqlite2/sqlite3).",
- "Default: mysql") { |options[:db]| }
+ "Default: mysql") { |v| options[:db] = v }
opt.on("-f", "--freeze",
"Freeze Rails in vendor/rails from the gems generating the skeleton",
- "Default: false") { |options[:freeze]| }
+ "Default: false") { |v| options[:freeze] = v }
end
def mysql_socket_location
diff --git a/railties/lib/rails_generator/generators/components/model/model_generator.rb b/railties/lib/rails_generator/generators/components/model/model_generator.rb
index 0940b57f73..e242482632 100644
--- a/railties/lib/rails_generator/generators/components/model/model_generator.rb
+++ b/railties/lib/rails_generator/generators/components/model/model_generator.rb
@@ -29,6 +29,6 @@ class ModelGenerator < Rails::Generator::NamedBase
opt.separator ''
opt.separator 'Options:'
opt.on("--skip-migration",
- "Don't generate a migration file for this model") { |options[:skip_migration]| }
+ "Don't generate a migration file for this model") { |v| options[:skip_migration] = v }
end
end
diff --git a/railties/lib/rails_generator/options.rb b/railties/lib/rails_generator/options.rb
index 4329f930a3..042e05107d 100644
--- a/railties/lib/rails_generator/options.rb
+++ b/railties/lib/rails_generator/options.rb
@@ -120,16 +120,16 @@ module Rails
opt.separator ''
opt.separator 'Rails Info:'
opt.on('-v', '--version', 'Show the Rails version number and quit.')
- opt.on('-h', '--help', 'Show this help message and quit.') { |options[:help]| }
+ opt.on('-h', '--help', 'Show this help message and quit.') { |v| options[:help] = v }
opt.separator ''
opt.separator 'General Options:'
- opt.on('-p', '--pretend', 'Run but do not make any changes.') { |options[:pretend]| }
+ opt.on('-p', '--pretend', 'Run but do not make any changes.') { |v| options[:pretend] = v }
opt.on('-f', '--force', 'Overwrite files that already exist.') { options[:collision] = :force }
opt.on('-s', '--skip', 'Skip files that already exist.') { options[:collision] = :skip }
- opt.on('-q', '--quiet', 'Suppress normal output.') { |options[:quiet]| }
- opt.on('-t', '--backtrace', 'Debugging: show backtrace on errors.') { |options[:backtrace]| }
+ opt.on('-q', '--quiet', 'Suppress normal output.') { |v| options[:quiet] = v }
+ opt.on('-t', '--backtrace', 'Debugging: show backtrace on errors.') { |v| options[:backtrace] = v }
opt.on('-c', '--svn', 'Modify files with subversion. (Note: svn must be in path)') do
options[:svn] = `svn status`.inject({}) do |opt, e|
opt[e.chomp[7..-1]] = true