From 07eb9ffd151b622eccb1dd527455b4f6f10973ff Mon Sep 17 00:00:00 2001 From: Akira Matsuda Date: Tue, 9 Sep 2008 18:58:34 +0900 Subject: Ruby 1.9 compat: remove constants from block parameters [#1002 state:resolved] Signed-off-by: Jeremy Kemper --- railties/lib/commands/process/spawner.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'railties/lib/commands') diff --git a/railties/lib/commands/process/spawner.rb b/railties/lib/commands/process/spawner.rb index dc0008698a..8bf47abb75 100644 --- a/railties/lib/commands/process/spawner.rb +++ b/railties/lib/commands/process/spawner.rb @@ -181,10 +181,10 @@ ARGV.options do |opts| opts.on(" Options:") - opts.on("-p", "--port=number", Integer, "Starting port number (default: #{OPTIONS[:port]})") { |OPTIONS[:port]| } + opts.on("-p", "--port=number", Integer, "Starting port number (default: #{OPTIONS[:port]})") { |v| OPTIONS[:port] = v } if spawner_class.can_bind_to_custom_address? - opts.on("-a", "--address=ip", String, "Bind to IP address (default: #{OPTIONS[:address]})") { |OPTIONS[:address]| } + opts.on("-a", "--address=ip", String, "Bind to IP address (default: #{OPTIONS[:address]})") { |v| OPTIONS[:address] = v } end opts.on("-p", "--port=number", Integer, "Starting port number (default: #{OPTIONS[:port]})") { |v| OPTIONS[:port] = v } -- cgit v1.2.3 From 8e68ec4dcceb606853a50d41076c7d5e118089b7 Mon Sep 17 00:00:00 2001 From: Akira Matsuda Date: Tue, 9 Sep 2008 17:24:23 +0900 Subject: Ruby 1.9 compat: use String#lines instead of to_a in Ruby 1.9 [#1001 state:resolved] Signed-off-by: Jeremy Kemper --- railties/lib/commands/plugin.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'railties/lib/commands') diff --git a/railties/lib/commands/plugin.rb b/railties/lib/commands/plugin.rb index 980244a71b..5c6cb7605c 100644 --- a/railties/lib/commands/plugin.rb +++ b/railties/lib/commands/plugin.rb @@ -901,7 +901,7 @@ class RecursiveHTTPFetcher def initialize(urls_to_fetch, level = 1, cwd = ".") @level = level @cwd = cwd - @urls_to_fetch = urls_to_fetch.to_a + @urls_to_fetch = RUBY_VERSION >= '1.9' ? urls_to_fetch.lines : urls_to_fetch.to_a @quiet = false end -- cgit v1.2.3 From 5f7c42413b099f8811c45a27202cce5dc9e7d285 Mon Sep 17 00:00:00 2001 From: Akira Matsuda Date: Tue, 9 Sep 2008 16:26:22 +0900 Subject: Ruby 1.9 compat: remove instance variables and global variables from block parameters [#1000 state:resolved] Signed-off-by: Jeremy Kemper --- railties/lib/commands/plugin.rb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'railties/lib/commands') diff --git a/railties/lib/commands/plugin.rb b/railties/lib/commands/plugin.rb index 5c6cb7605c..9ff4739562 100644 --- a/railties/lib/commands/plugin.rb +++ b/railties/lib/commands/plugin.rb @@ -461,11 +461,11 @@ module Commands o.on("-r", "--root=DIR", String, "Set an explicit rails app directory.", - "Default: #{@rails_root}") { |@rails_root| self.environment = RailsEnvironment.new(@rails_root) } + "Default: #{@rails_root}") { |rails_root| @rails_root = rails_root; self.environment = RailsEnvironment.new(@rails_root) } o.on("-s", "--source=URL1,URL2", Array, - "Use the specified plugin repositories instead of the defaults.") { |@sources|} + "Use the specified plugin repositories instead of the defaults.") { |sources| @sources = sources} - o.on("-v", "--verbose", "Turn on verbose output.") { |$verbose| } + o.on("-v", "--verbose", "Turn on verbose output.") { |verbose| $verbose = verbose } o.on("-h", "--help", "Show this help message.") { puts o; exit } o.separator "" @@ -552,12 +552,12 @@ module Commands o.separator "Options:" o.separator "" o.on( "-s", "--source=URL1,URL2", Array, - "Use the specified plugin repositories.") {|@sources|} + "Use the specified plugin repositories.") {|sources| @sources = sources} o.on( "--local", - "List locally installed plugins.") {|@local| @remote = false} + "List locally installed plugins.") {|local| @local, @remote = local, false} o.on( "--remote", "List remotely available plugins. This is the default behavior", - "unless --local is provided.") {|@remote|} + "unless --local is provided.") {|remote| @remote = remote} end end @@ -598,7 +598,7 @@ module Commands o.separator "Options:" o.separator "" o.on( "-c", "--check", - "Report status of repository.") { |@sources|} + "Report status of repository.") { |sources| @sources = sources} end end @@ -689,7 +689,7 @@ module Commands o.separator "Options:" o.separator "" o.on( "-l", "--list", - "List but don't prompt or add discovered repositories.") { |@list| @prompt = !@list } + "List but don't prompt or add discovered repositories.") { |list| @list, @prompt = list, !@list } o.on( "-n", "--no-prompt", "Add all new repositories without prompting.") { |v| @prompt = !v } end -- cgit v1.2.3