lib/rsgem/cli/commands/new.rb in rsgem-0.1.1 vs lib/rsgem/cli/commands/new.rb in rsgem-0.1.2

- old
+ new

@@ -2,29 +2,32 @@ module RSGem module CLI module Commands class New < Dry::CLI::Command - def self.ci_provider_options - RSGem::Constants::CI_PROVIDERS.map { |ci| "'#{ci.name}'" }.join(', ') - end - desc 'Create a new gem' argument :gem_name, type: :string, required: true, desc: 'Name of your new gem' - argument :ci_provider, type: :string, required: false, - desc: 'CI provider to use. '\ - "Available options are: #{ci_provider_options}. "\ - "Default option is 'travis'" + option :bundler, type: :string, + default: nil, + desc: 'Bundler options to use' + option :ci, type: :string, + default: RSGem::Constants::DEFAULT_CI_PROVIDER.name, + values: RSGem::Constants::CI_PROVIDERS.map(&:name), + desc: 'CI provider to use' example [ - 'foo # Creates a new gem called foo', - 'bar github_actions # Creates a new gem called bar, with GitHub Actions as the '\ - 'CI provider' + 'foo # Creates a new gem called foo', + 'bar --ci=github_actions # Creates a new gem called bar, with GitHub Actions as the '\ + 'CI provider', + 'foo_bar --bundler=--ext # Creates a new gem called foo_bar passing the --ext flag to '\ + 'bundler' ] def call(**options) - RSGem::Gem.new(gem_name: options[:gem_name], ci_provider: options[:ci_provider]).create + RSGem::Gem.new(gem_name: options[:gem_name], + ci_provider: options[:ci], + bundler_options: options[:bundler]).create end end end end end