Class: CartBinaryUploader::CartupCommandHelper

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

Constant Summary collapse

COMMAND_RUN =
'run'.freeze
COMMAND_INIT =
'init'.freeze
COMMAND_HELP =
'help'.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCartupCommandHelper

Returns a new instance of CartupCommandHelper.



11
12
13
14
15
16
17
18
# File 'lib/cartup_command_helper.rb', line 11

def initialize
  @help_description = <<-EOF
    These are common Cartup commands used in some situations: 
    - init      Create an empty cart_uploader.yaml 
    - run       uploading the Carthage prebuilts to a cloud storage
    - help      show help instructions and list available subcommands
  EOF
end

Instance Attribute Details

#help_descriptionObject (readonly)

Returns the value of attribute help_description.



9
10
11
# File 'lib/cartup_command_helper.rb', line 9

def help_description
  @help_description
end

Instance Method Details

#handle(command) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/cartup_command_helper.rb', line 20

def handle(command)
  case command
  when COMMAND_RUN
    CartBinaryUploader.run
  when COMMAND_INIT
    CartBinaryUploader.init
  when COMMAND_HELP
    print_helper
  else
    print_helper
  end
end


33
34
35
# File 'lib/cartup_command_helper.rb', line 33

def print_helper
  puts @help_description
end