Class: Pod::Command::Mod::Create

Inherits:
Pod::Command::Mod show all
Extended by:
Executable
Defined in:
lib/cocoapods-modularization/command/mod/create.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ Create

Returns a new instance of Create.



22
23
24
25
26
27
28
# File 'lib/cocoapods-modularization/command/mod/create.rb', line 22

def initialize(argv)
  @name = argv.shift_argument
  @path = argv.shift_argument
  @template_url = argv.option('template-url', TEMPLATE_REPO)
  super
  @additional_args = argv.remainder!
end

Class Method Details

.optionsObject



16
17
18
19
20
# File 'lib/cocoapods-modularization/command/mod/create.rb', line 16

def self.options
  [
    ['--template-url=URL', 'The URL of the git repo containing a compatible template'],
  ].concat(super)
end

Instance Method Details

#runObject



39
40
41
42
43
# File 'lib/cocoapods-modularization/command/mod/create.rb', line 39

def run
  clone_template
  configure_template
  print_info
end

#validate!Object



30
31
32
33
34
35
36
37
# File 'lib/cocoapods-modularization/command/mod/create.rb', line 30

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] == '.'
  help! "Path is needed" unless @path
end