Class: WeexBuilder::Runner

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

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Runner

Returns a new instance of Runner.



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

def initialize(args)
  @args = args
end

Instance Method Details

#execObject

create platform add ios/android



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/runner.rb', line 15

def exec 
  return usage if @args.length == 0
  
  case @args.first
  when 'create'
    return action_usage(@args.first) unless @args.length == 2
    WeexBuilder::Project.create(@args[1])
  when 'platform'
    return action_usage(@args.first) unless @args.length == 3
    return action_usage(@args.first) unless @args[1] == 'add' && /^(iOS|android)$/i =~ @args[2] 

    WeexBuilder::Project.add_platform(@args[2])
  else 
    usage
  end
end