Class: Apperol::CLI
- Inherits:
-
Object
- Object
- Apperol::CLI
- Defined in:
- lib/apperol/cli.rb
Constant Summary collapse
- EX_USAGE =
64
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(args = []) ⇒ CLI
constructor
A new instance of CLI.
Constructor Details
#initialize(args = []) ⇒ CLI
Returns a new instance of CLI.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/apperol/cli.rb', line 18 def initialize(args = []) = {} parser = OptionParser.new do|opts| opts. = "Usage: apperol [options] [app_extension]" app_json.env.each do |env_value| option_key_name = env_value.key.downcase.gsub("_", "-") opts.on("--#{option_key_name} value", "#{env_value.description} (Default: '#{env_value.value}' #{env_value.required?}) ") do |value| [env_value.key] = value end end opts.on("-o", "--org ORG", "Push app to organization on heroku") do |org| [:org] = org end opts.on("-r", "--repo REPO", "GitHub repository used for the deploy (Default: user/dir_name)") do |repo| [:repo] = repo end opts.on("-u", "--user USER", "GitHub user where current repo is located (Default: Your GitHub username)") do |user| [:user] = user end opts.on("-s", "--stack STACK", "Stack for app on heroku (Default: cedar-14)") do |stack| [:stack] = stack end opts.on("--no-ext", "Name app without extension") do [:no_ext] = true end opts.on("-b", "--branch BRANCH", "Branch to setup app from (Default: master)") do |branch| [:branch] = branch end opts.on('-h', '--help', 'Displays Help') do puts opts exit EX_USAGE end end parser.parse!(args) @app_extension = args.shift if ![:no_ext] && !@app_extension $stderr.puts(parser.help) exit EX_USAGE end end |
Instance Method Details
#call ⇒ Object
62 63 64 65 66 67 68 69 |
# File 'lib/apperol/cli.rb', line 62 def call launch_app_setup do |response| build_id = response["id"] output_stream_url = get_output_stream_url(build_id) stream_build(output_stream_url) finalizing_setup(build_id) end end |