Class: Fare::UpdateCLI

Inherits:
Object
  • Object
show all
Defined in:
lib/fare/update_cli.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ UpdateCLI

Returns a new instance of UpdateCLI.



6
7
8
# File 'lib/fare/update_cli.rb', line 6

def initialize(argv)
  @argv = argv
end

Instance Attribute Details

#argvObject (readonly)

Returns the value of attribute argv.



4
5
6
# File 'lib/fare/update_cli.rb', line 4

def argv
  @argv
end

Instance Method Details

#callObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/fare/update_cli.rb', line 10

def call
  options = {
    filename:     Fare.default_config_file,
    environment:  (Fare.environment || "development"),
    force:        false,
  }
  parser = OptionParser.new do |o|
    o.banner = "      Creates topics in SNS, queues in SNS and makes sure the right subscriptions are made.\n      Also, information is cached.\n\n      Usage: fare update [options]\n    BANNER\n    o.on \"--filename FILENAME\", \"Location of the Fare configuration file (default: \#{options[:filename]})\" do |filename|\n      options[:filename] = filename\n    end\n    o.on_tail \"-h\", \"--help\", \"Shows this help page\" do\n      puts o\n      exit\n    end\n    o.on \"-E\", \"--environment ENVIRONMENT\", \"Name of the environment (default: \#{options[:environment]})\" do |environment|\n      options[:environment] = environment\n    end\n    o.on \"-f\", \"--force\", \"Do it even if the lockfile is up to date\" do\n      options[:force] = true\n    end\n  end\n  parser.parse!\n  Fare.update(options)\nend\n".gsub(/^ +/, '')