From 81a6a60dc6dff2ad8c2a45bf17fc40e760224e30 Mon Sep 17 00:00:00 2001 From: Nicholas Seckar Date: Wed, 28 Jun 2006 20:53:00 +0000 Subject: 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 --- railties/lib/commands/console.rb | 4 ++-- railties/lib/commands/process/inspector.rb | 6 +++--- railties/lib/commands/process/reaper.rb | 6 +++--- railties/lib/commands/process/spawner.rb | 12 ++++++------ railties/lib/commands/process/spinner.rb | 6 +++--- railties/lib/commands/runner.rb | 2 +- railties/lib/commands/servers/webrick.rb | 8 ++++---- 7 files changed, 22 insertions(+), 22 deletions(-) (limited to 'railties/lib/commands') 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 "" -- cgit v1.2.3