lib/pod/command/plugins/create.rb in cocoapods-plugins-0.2.0 vs lib/pod/command/plugins/create.rb in cocoapods-plugins-0.3.0

- old
+ new

@@ -1,5 +1,7 @@ +require 'pod/command/plugins_helper' + module Pod class Command class Plugins # The create subcommand. Used to create a new plugin using either the # default template (CocoaPods/cocoapods-plugin-template) or a custom @@ -9,44 +11,44 @@ NAME_PREFIX = 'cocoapods-' self.summary = 'Creates a new plugin' self.description = <<-DESC Creates a scaffold for the development of a new plugin - according to the CocoaPods best practices. + named `NAME` according to the CocoaPods 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 self.arguments = [ - ['NAME', :required], - ['TEMPLATE_URL', :optional] + CLAide::Argument.new('NAME', true), + CLAide::Argument.new('TEMPLATE_URL', false), ] def initialize(argv) @name = argv.shift_argument unless @name.nil? || @name.empty? || @name.index(NAME_PREFIX) == 0 - @name = @name.dup.prepend(NAME_PREFIX) + @name = NAME_PREFIX + @name.dup end @template_url = argv.shift_argument super end def validate! super if @name.nil? || @name.empty? help! 'A name for the plugin is required.' end - if @name.match(/\s/) - help! 'The plugin name cannot contain spaces.' - end + + help! 'The plugin name cannot contain spaces.' if @name.match(/\s/) end def run clone_template configure_template + show_reminder end #----------------------------------------# private @@ -93,9 +95,18 @@ # # @return String # def template_repo_url @template_url || TEMPLATE_REPO + end + + # Shows a reminder to the plugin author to make a Pull Request + # in order to update plugins.json once the plugin is released + # + def show_reminder + repo = PluginsHelper::PLUGINS_JSON_REPO + 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 end end end end