Sha256: 665f2d705fa7eb30aeebe7cc7f710784f3491a0ef2d2c59696b22126bcdcc950

Contents?: true

Size: 1017 Bytes

Versions: 2

Compression:

Stored size: 1017 Bytes

Contents

# frozen_string_literal: true

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'"

        example [
          'foo                # Creates a new gem called foo',
          'bar github_actions # Creates a new gem called bar, with GitHub Actions as the '\
          'CI provider'
        ]

        def call(**options)
          RSGem::Gem.new(gem_name: options[:gem_name], ci_provider: options[:ci_provider]).create
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rsgem-0.1.1 lib/rsgem/cli/commands/new.rb
rsgem-0.1.0 lib/rsgem/cli/commands/new.rb