Class: Jasminewebos::CLI

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

Class Method Summary collapse

Class Method Details

.execute(stdout, arguments = []) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
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
# File 'lib/jasminewebos/cli.rb', line 6

def self.execute(stdout, arguments=[])
  command = ""
  mandatory_options = %w(  )
  
  generate = false
  start_server = false
  
  parser = OptionParser.new do |opts|
    opts.banner = "      Tools for working with jasmine_webos\n\n      Usage: \n      \#{File.basename($0)} -g\n      generates the jasmine files in the current directory\n      \n      \#{File.basename($0)} -s\n      starts the jasmine server from the current directory\n      \n      Options:\n    BANNER\n    opts.separator \"\"\n    opts.on(\"-g\", String,\n            \"Starts the jasmine server from the current directory\") { generate = true }\n    opts.on(\"-s\", String,\n            \"Generate the jasmine files in the current directory\") { start_server = true }\n    opts.on(\"-h\", \"--help\",\n            \"Show this help message.\") { stdout.puts opts; exit }\n    opts.parse!(arguments)\n    \n    if mandatory_options && mandatory_options.find { |option| options[option.to_sym].nil? }\n      stdout.puts opts; exit\n    end\n  end\n  \n  config = Jasminewebos::Configuration.new(FileUtils.pwd)\n  \n  self.generate_stub(config) if generate\n  self.launch_server(config) if start_server\n  \nend\n".gsub(/^          /,'')

.generate_stub(config) ⇒ Object



47
48
49
50
51
# File 'lib/jasminewebos/cli.rb', line 47

def self.generate_stub(config)
  puts("Generating jasmine_webos required files")
  Jasminewebos::Generator.new(config).run
  puts("  Complete.")
end

.launch_server(config) ⇒ Object



53
54
55
# File 'lib/jasminewebos/cli.rb', line 53

def self.launch_server(config)
  Jasminewebos::Server.new(config).start
end