Class: App

Inherits:
Object
  • Object
show all
Defined in:
bin/js-get

Constant Summary collapse

VERSION =
'0.1.7'
JSDIR =
ENV['JSDIR'] || "public/javascripts"
HOST =
ENV['JSGET_HOST'] || "http://js-get.jackhq.com"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(arguments, stdin) ⇒ App

Returns a new instance of App.



50
51
52
53
54
55
56
57
58
59
# File 'bin/js-get', line 50

def initialize(arguments, stdin)
  @arguments = arguments
  @stdin = stdin
  
  # Set defaults
  @options = OpenStruct.new
  @options.verbose = false
  @options.quiet = false
  # TO DO - add additional defaults
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



48
49
50
# File 'bin/js-get', line 48

def options
  @options
end

Instance Method Details

#runObject

Parse options, check arguments, then process the command



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'bin/js-get', line 62

def run
      
  if parsed_options? && arguments_valid? 
    
    puts "Start at #{DateTime.now}\n\n" if @options.verbose
    
    output_options if @options.verbose # [Optional]
          
    process_arguments            
    process_command
    
    puts "\nFinished at #{DateTime.now}" if @options.verbose
    
  else
    output_usage
  end
    
end