module SupermarketSync::CLI
> SupermarketSync
Launcher¶ ↑
Public Instance Methods
run(argv = ARGV)
click to toggle source
> Launch the Application¶ ↑
# File lib/supermarket_sync/cli.rb, line 41 def run(argv = ARGV) # rubocop: disable AbcSize, MethodLength # # => Parse CLI Configuration # cli = Options.new cli.parse_options(argv) # => Grab the Default Values default = Config.options # => Parse JSON Config File (If Specified and Exists) json_config = Util.parse_json(cli.config[:config_file] || Config.config_file) # => Merge Configuration (CLI Wins) config = [default, json_config, cli.config].compact.reduce(:merge) # => Apply Configuration Config.setup do |cfg| cfg.cookbooks_file = config[:cookbooks_file] cfg.notification = config[:notification] cfg.supermarkets = config[:supermarkets] cfg.source = config[:source] cfg.read_only = config[:read_only] end # => Start the Sync Sync.run! end