Class: Jmpod::Command::Create::Oc

Inherits:
Jmpod::Command::Create show all
Defined in:
lib/jmpod/command/create/oc.rb

Instance Method Summary collapse

Methods inherited from Jmpod::Command

options, run

Constructor Details

#initialize(argv) ⇒ Oc

Returns a new instance of Oc.



15
16
17
18
19
# File 'lib/jmpod/command/create/oc.rb', line 15

def initialize(argv)
  @name = argv.shift_argument
  super
  @additional_args = argv.remainder!
end

Instance Method Details

#runObject



29
30
31
32
33
# File 'lib/jmpod/command/create/oc.rb', line 29

def run
  system "pod lib create #{@name} objc --template-url=https://gi-dev.ccrgt.com/ios-thirdpart/pod-template.git"
  # TODO 将podspec上传到私有specs上
  puts "一个新的oc pod创建成功!".green
end

#validate!Object



21
22
23
24
25
26
27
# File 'lib/jmpod/command/create/oc.rb', line 21

def validate!
  super
  help! 'A name for the Pod is required.' unless @name
  help! 'The Pod name cannot contain spaces.' if @name =~ /\s/
  help! 'The Pod name cannot contain plusses.' if @name =~ /\+/
  help! "The Pod name cannot begin with a '.'" if @name[0, 1] == '.'
end