Class: Pod::Command::Plugins::Create

Inherits:
Pod::Command::Plugins show all
Extended by:
Executable
Defined in:
lib/pod/command/plugins/create.rb

Overview

The create subcommand. Used to create a new plugin using either the default template (CocoaPods/cocoapods-plugin-template) or a custom template

Constant Summary collapse

NAME_PREFIX =
'cocoapods-'

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ Create

Returns a new instance of Create.



28
29
30
31
32
33
34
35
# File 'lib/pod/command/plugins/create.rb', line 28

def initialize(argv)
  @name = argv.shift_argument
  unless @name.nil? || @name.empty? || @name.start_with?(NAME_PREFIX)
    @name = NAME_PREFIX + @name.dup
  end
  @template_url = argv.shift_argument
  super
end

Instance Method Details

#runObject



46
47
48
49
50
# File 'lib/pod/command/plugins/create.rb', line 46

def run
  clone_template
  configure_template
  show_reminder
end

#validate!Object



37
38
39
40
41
42
43
44
# File 'lib/pod/command/plugins/create.rb', line 37

def validate!
  super
  if @name.nil? || @name.empty?
    help! 'A name for the plugin is required.'
  end

  help! 'The plugin name cannot contain spaces.' if @name.match(/\s/)
end