Sha256: 133ba3e99d654fee7d18651e259ad08de6a3d8024fb7d269bcec23b6815ed84e
Contents?: true
Size: 1.26 KB
Versions: 7
Compression:
Stored size: 1.26 KB
Contents
require 'optparse' require 'logger' module Heroku module Scalr class CLI def self.run!(argv = ARGV) new(argv).run! end def initialize(argv) super() @config_path = "./config.rb" @options = { log_level: ::Logger::INFO } parser.parse!(argv) unless File.file?(@config_path) puts parser exit end end def run! require 'heroku/scalr' Heroku::Scalr.configure(@options) Heroku::Scalr.run!(@config_path) end def parser @parser ||= OptionParser.new do |o| o.banner = "Usage: heroku-scalr [options]" o.separator "" o.on("-C", "--config PATH", "Configuration file path. Default: ./config.rb") do |path| @config_path = path end o.on("-l", "--log PATH", "Custom log file path. Default: STDOUT") do |path| @options.update log_file: path end o.on("-v", "--verbose", "Enable verbose logging.") do @options.update log_level: ::Logger::DEBUG end o.separator "" o.on_tail("-h", "--help", "Show this message") do puts o exit end end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems