Sha256: c7a6b2ded00036209713a56264706ba9aac2c64ad2436d501bdf1d328e499c18

Contents?: true

Size: 998 Bytes

Versions: 12

Compression:

Stored size: 998 Bytes

Contents

require 'gem/release/context'

module Gem
  module Release
    module Cmds
      class Runner < Struct.new(:name, :args, :opts, :context)
        def run
          run_cmd
          success
        end

        private

          def success
            context.ui.success "All is good, thanks my friend."
          end

          def run_cmd
            const.new(context, args, opts).run
          end

          def const
            Base[name]
          end

          def args
            super.select { |arg| arg.is_a?(String) && arg[0] != '-' }
          end

          def opts
            @opts ||= except(Base::DEFAULTS.merge(config.merge(super)), :args, :build_args)
          end

          def config
            Context.new.config.for(name.to_sym)
          end

          def context
            @context ||= super || Context.new(opts)
          end

          def except(hash, *keys)
            hash.reject { |key, _| keys.include?(key) }
          end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
gem-release-2.2.2 lib/gem/release/cmds/runner.rb
gem-release-2.2.1 lib/gem/release/cmds/runner.rb
gem-release-2.2.0 lib/gem/release/cmds/runner.rb
gem-release-2.1.1 lib/gem/release/cmds/runner.rb
gem-release-2.1.0 lib/gem/release/cmds/runner.rb
gem-release-2.0.4 lib/gem/release/cmds/runner.rb
gem-release-2.0.3 lib/gem/release/cmds/runner.rb
gem-release-2.0.2 lib/gem/release/cmds/runner.rb
gem-release-2.0.1 lib/gem/release/cmds/runner.rb
gem-release-2.0.0.rc.3 lib/gem/release/cmds/runner.rb
gem-release-2.0.0.rc.2 lib/gem/release/cmds/runner.rb
gem-release-2.0.0.rc.1 lib/gem/release/cmds/runner.rb