Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 4502

Show
Ignore:
Timestamp:
06/28/06 20:53:00 (2 years ago)
Author:
ulysses
Message:

Remove opts.on { |options[:option_name] } style hash assignment. Closes #4440.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/railties/CHANGELOG

    r4486 r4502  
    11*SVN* 
     2 
     3* Remove opts.on { |options[:option_name] } style hash assignment. Closes #4440. [nicksieger@gmail.com] 
    24 
    35* Mongrel support for script/server.  #5475 [jeremydurham@gmail.com] 
  • trunk/railties/lib/breakpoint_client.rb

    r2637 r4502  
    3131    "Default: Find a good URI automatically.", 
    3232    "Example: -c druby://localhost:12345" 
    33   ) { |Options[:ClientURI]|
     33  ) { |v| Options[:ClientURI] = v
    3434 
    3535  opts.on("-s", "--server-uri=uri", 
     
    3737    "specified uri.", 
    3838    "Default: druby://localhost:42531" 
    39   ) { |Options[:ServerURI]|
     39  ) { |v| Options[:ServerURI] = v
    4040 
    4141  opts.on("-R", "--retry-delay=delay", Integer, 
     
    4646    "reconnecting completely.", 
    4747    "Default: 10" 
    48   ) { |Options[:RetryDelay]|
     48  ) { |v| Options[:RetryDelay] = v
    4949 
    5050  opts.on("-P", "--[no-]permanent", 
     
    5353    "running even after the server has closed the", 
    5454    "connection. Useful for example in Rails." 
    55   ) { |Options[:Permanent]|
     55  ) { |v| Options[:Permanent] = v
    5656 
    5757  opts.on("-V", "--[no-]verbose", 
     
    6161    "that the breakpoint client is still alive, but adds", 
    6262    "quite a bit of clutter." 
    63   ) { |Options[:Verbose]|
     63  ) { |v| Options[:Verbose] = v
    6464 
    6565  opts.separator "" 
  • trunk/railties/lib/commands/console.rb

    r4118 r4502  
    55OptionParser.new do |opt| 
    66  opt.banner = "Usage: console [environment] [options]" 
    7   opt.on('-s', '--sandbox', 'Rollback database modifications on exit.') { |options[:sandbox]|
    8   opt.on("--irb=[#{irb}]", 'Invoke a different irb.') { |options[:irb]|
     7  opt.on('-s', '--sandbox', 'Rollback database modifications on exit.') { |v| options[:sandbox] = v
     8  opt.on("--irb=[#{irb}]", 'Invoke a different irb.') { |v| options[:irb] = v
    99  opt.parse!(ARGV) 
    1010end 
  • trunk/railties/lib/commands/process/inspector.rb

    r4320 r4502  
    5555  opts.on("  Options:") 
    5656 
    57   opts.on("-s", "--ps=command", "default: #{OPTIONS[:ps]}", String)           { |OPTIONS[:ps]|
    58   opts.on("-p", "--pidpath=path", "default: #{OPTIONS[:pid_path]}", String)   { |OPTIONS[:pid_path]|
    59   opts.on("-r", "--pattern=pattern", "default: #{OPTIONS[:pattern]}", String) { |OPTIONS[:pattern]|
     57  opts.on("-s", "--ps=command", "default: #{OPTIONS[:ps]}", String)           { |v| OPTIONS[:ps] = v
     58  opts.on("-p", "--pidpath=path", "default: #{OPTIONS[:pid_path]}", String)   { |v| OPTIONS[:pid_path] = v
     59  opts.on("-r", "--pattern=pattern", "default: #{OPTIONS[:pattern]}", String) { |v| OPTIONS[:pattern] = v
    6060 
    6161  opts.separator "" 
  • trunk/railties/lib/commands/process/reaper.rb

    r4294 r4502  
    122122  opts.on("  Options:") 
    123123 
    124   opts.on("-a", "--action=name", "reload|graceful|kill (default: #{OPTIONS[:action]})", String)  { |OPTIONS[:action]|
    125   opts.on("-p", "--pidpath=path", "default: #{OPTIONS[:pid_path]}", String)                      { |OPTIONS[:pid_path]|
    126   opts.on("-r", "--pattern=pattern", "default: #{OPTIONS[:pattern]}", String)                    { |OPTIONS[:pattern]|
     124  opts.on("-a", "--action=name", "reload|graceful|kill (default: #{OPTIONS[:action]})", String)  { |v| OPTIONS[:action] = v
     125  opts.on("-p", "--pidpath=path", "default: #{OPTIONS[:pid_path]}", String)                      { |v| OPTIONS[:pid_path] = v
     126  opts.on("-r", "--pattern=pattern", "default: #{OPTIONS[:pattern]}", String)                    { |v| OPTIONS[:pattern] = v
    127127 
    128128  opts.separator "" 
  • trunk/railties/lib/commands/process/spawner.rb

    r4324 r4502  
    9292  opts.on("  Options:") 
    9393 
    94   opts.on("-p", "--port=number",      Integer, "Starting port number (default: #{OPTIONS[:port]})")                { |OPTIONS[:port]|
    95   opts.on("-i", "--instances=number", Integer, "Number of instances (default: #{OPTIONS[:instances]})")            { |OPTIONS[:instances]|
    96   opts.on("-r", "--repeat=seconds",   Integer, "Repeat spawn attempts every n seconds (default: off)")             { |OPTIONS[:repeat]|
    97   opts.on("-e", "--environment=name", String,  "test|development|production (default: #{OPTIONS[:environment]})")  { |OPTIONS[:environment]|
    98   opts.on("-n", "--process=name",     String,  "default: #{OPTIONS[:process]}")                                    { |OPTIONS[:process]|
    99   opts.on("-s", "--spawner=path",     String,  "default: #{OPTIONS[:spawner]}")                                    { |OPTIONS[:spawner]|
     94  opts.on("-p", "--port=number",      Integer, "Starting port number (default: #{OPTIONS[:port]})")                { |v| OPTIONS[:port] = v
     95  opts.on("-i", "--instances=number", Integer, "Number of instances (default: #{OPTIONS[:instances]})")            { |v| OPTIONS[:instances] = v
     96  opts.on("-r", "--repeat=seconds",   Integer, "Repeat spawn attempts every n seconds (default: off)")             { |v| OPTIONS[:repeat] = v
     97  opts.on("-e", "--environment=name", String,  "test|development|production (default: #{OPTIONS[:environment]})")  { |v| OPTIONS[:environment] = v
     98  opts.on("-n", "--process=name",     String,  "default: #{OPTIONS[:process]}")                                    { |v| OPTIONS[:process] = v
     99  opts.on("-s", "--spawner=path",     String,  "default: #{OPTIONS[:spawner]}")                                    { |v| OPTIONS[:spawner] = v
    100100  opts.on("-d", "--dispatcher=path",  String,  "default: #{OPTIONS[:dispatcher]}") { |dispatcher| OPTIONS[:dispatcher] = File.expand_path(dispatcher) } 
    101101 
  • trunk/railties/lib/commands/process/spinner.rb

    r2637 r4502  
    3737  opts.on("  Options:") 
    3838 
    39   opts.on("-c", "--command=path",    String) { |OPTIONS[:command]|
    40   opts.on("-i", "--interval=seconds", Float) { |OPTIONS[:interval]|
    41   opts.on("-d", "--daemon")                  { |OPTIONS[:daemon]|
     39  opts.on("-c", "--command=path",    String) { |v| OPTIONS[:command] = v
     40  opts.on("-i", "--interval=seconds", Float) { |v| OPTIONS[:interval] = v
     41  opts.on("-d", "--daemon")                  { |v| OPTIONS[:daemon] = v
    4242 
    4343  opts.separator "" 
  • trunk/railties/lib/commands/runner.rb

    r4075 r4502  
    1111  opts.on("-e", "--environment=name", String, 
    1212          "Specifies the environment for the runner to operate under (test/development/production).", 
    13           "Default: development") { |options[:environment]|
     13          "Default: development") { |v| options[:environment] = v
    1414 
    1515  opts.separator "" 
  • trunk/railties/lib/commands/servers/webrick.rb

    r2987 r4502  
    2020  opts.on("-p", "--port=port", Integer, 
    2121          "Runs Rails on the specified port.", 
    22           "Default: 3000") { |OPTIONS[:port]|
     22          "Default: 3000") { |v| OPTIONS[:port] = v
    2323  opts.on("-b", "--binding=ip", String, 
    2424          "Binds Rails to the specified ip.", 
    25           "Default: 0.0.0.0") { |OPTIONS[:ip]|
     25          "Default: 0.0.0.0") { |v| OPTIONS[:ip] = v
    2626  opts.on("-e", "--environment=name", String, 
    2727          "Specifies the environment to run this server under (test/development/production).", 
    28           "Default: development") { |OPTIONS[:environment]|
     28          "Default: development") { |v| OPTIONS[:environment] = v
    2929  opts.on("-m", "--mime-types=filename", String, 
    3030                  "Specifies an Apache style mime.types configuration file to be used for mime types", 
     
    3737  opts.on("-c", "--charset=charset", String, 
    3838          "Set default charset for output.", 
    39           "Default: UTF-8") { |OPTIONS[:charset]|
     39          "Default: UTF-8") { |v| OPTIONS[:charset] = v
    4040 
    4141  opts.separator "" 
  • trunk/railties/lib/rails_generator/generators/applications/app/app_generator.rb

    r4336 r4502  
    9898      opt.on("-r", "--ruby=path", String, 
    9999             "Path to the Ruby binary of your choice (otherwise scripts use env, dispatchers current path).", 
    100              "Default: #{DEFAULT_SHEBANG}") { |options[:shebang]|
     100             "Default: #{DEFAULT_SHEBANG}") { |v| options[:shebang] = v
    101101 
    102102      opt.on("-d", "--database=name", String, 
    103103            "Preconfigure for selected database (options: mysql/oracle/postgresql/sqlite2/sqlite3).", 
    104             "Default: mysql") { |options[:db]|
     104            "Default: mysql") { |v| options[:db] = v
    105105 
    106106      opt.on("-f", "--freeze",  
    107107            "Freeze Rails in vendor/rails from the gems generating the skeleton", 
    108             "Default: false") { |options[:freeze]|
     108            "Default: false") { |v| options[:freeze] = v
    109109    end 
    110110     
  • trunk/railties/lib/rails_generator/generators/components/model/model_generator.rb

    r3947 r4502  
    3030      opt.separator 'Options:' 
    3131      opt.on("--skip-migration",  
    32              "Don't generate a migration file for this model") { |options[:skip_migration]|
     32             "Don't generate a migration file for this model") { |v| options[:skip_migration] = v
    3333    end 
    3434end 
  • trunk/railties/lib/rails_generator/options.rb

    r4471 r4502  
    121121          opt.separator 'Rails Info:' 
    122122          opt.on('-v', '--version', 'Show the Rails version number and quit.') 
    123           opt.on('-h', '--help', 'Show this help message and quit.') { |options[:help]|
     123          opt.on('-h', '--help', 'Show this help message and quit.') { |v| options[:help] = v
    124124 
    125125          opt.separator '' 
    126126          opt.separator 'General Options:' 
    127127 
    128           opt.on('-p', '--pretend', 'Run but do not make any changes.') { |options[:pretend]|
     128          opt.on('-p', '--pretend', 'Run but do not make any changes.') { |v| options[:pretend] = v
    129129          opt.on('-f', '--force', 'Overwrite files that already exist.') { options[:collision] = :force } 
    130130          opt.on('-s', '--skip', 'Skip files that already exist.') { options[:collision] = :skip } 
    131           opt.on('-q', '--quiet', 'Suppress normal output.') { |options[:quiet]|
    132           opt.on('-t', '--backtrace', 'Debugging: show backtrace on errors.') { |options[:backtrace]|
     131          opt.on('-q', '--quiet', 'Suppress normal output.') { |v| options[:quiet] = v
     132          opt.on('-t', '--backtrace', 'Debugging: show backtrace on errors.') { |v| options[:backtrace] = v
    133133          opt.on('-c', '--svn', 'Modify files with subversion. (Note: svn must be in path)') do 
    134134            options[:svn] = `svn status`.inject({}) do |opt, e|