class CLAide::Command::Plugins::Create

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

Public Class Methods

description() click to toggle source
# File lib/claide/command/plugins/create.rb, line 14
        def self.description
          <<-DESC
                Creates a scaffold for the development of a new plugin
                named `NAME` according to the best practices.

                If a `TEMPLATE_URL`, pointing to a git repo containing a
                compatible template, is specified, it will be used
                in place of the default one.
          DESC
        end
new(argv) click to toggle source
Calls superclass method
# File lib/claide/command/plugins/create.rb, line 30
def initialize(argv)
  @name = argv.shift_argument
  prefix = CLAide::Plugins.config.plugin_prefix + '-'
  unless @name.nil? || @name.empty? || @name.start_with?(prefix)
    @name = prefix + @name.dup
  end
  @template_url = argv.shift_argument
  super
end

Public Instance Methods

run() click to toggle source
# File lib/claide/command/plugins/create.rb, line 49
def run
  runner = TemplateRunner.new @name, @template_url
  runner.clone_template
  runner.configure_template
  show_reminder
end
validate!() click to toggle source
Calls superclass method
# File lib/claide/command/plugins/create.rb, line 40
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

Private Instance Methods

show_reminder() click to toggle source

Shows a reminder to the plugin author to make a Pull Request in order to update plugins.json once the plugin is released

# File lib/claide/command/plugins/create.rb, line 63
def show_reminder
  repo = PluginsHelper.plugins_raw_url
  UI.notice "Don't forget to create a Pull Request on #{repo}\n" \
    ' to add your plugin to the plugins.json file once it is released!'
end