Class: Decko::Commands::RakeCommand::Parser

Inherits:
OptionParser
  • Object
show all
Defined in:
decko/lib/decko/commands/rake_command/parser.rb

Instance Method Summary collapse

Constructor Details

#initialize(command, opts) ⇒ Parser

Returns a new instance of Parser.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'decko/lib/decko/commands/rake_command/parser.rb', line 9

def initialize command, opts
  super() do |parser|
    parser.banner = "Usage: decko #{command} [options]\n\n" \
                  "Run decko:#{command} task on the production "\
                  " database specified in config/database.yml\n\n"
    parser.on("--production", "-p",
              "#{command} production database (default)") do
      opts[:envs] = ["production"]
    end
    parser.on("--test", "-t",
              "#{command} test database") do
      opts[:envs] = ["test"]
    end
    parser.on("--development", "-d",
              "#{command} development database") do
      opts[:envs] = ["development"]
    end
    parser.on("--all", "-a",
              "#{command} production, test, and development database") do
      opts[:envs] = %w[production development test]
    end
  end
end