Sha256: 82511759dd7a740be0e1f81afffae02ebdc31fa404393da6f8c035b313173e72

Contents?: true

Size: 1 KB

Versions: 2

Compression:

Stored size: 1 KB

Contents

require 'gem/release/context'

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

        private

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

          def const
            Base[name]
          end

          def opts
            except(super, :args, :build_args)
          end

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

          def success
            context.announce "All is good, thanks my friend." unless quiet?
          end

          def quiet?
            opts[:quiet] || opts[:silent]
          end

          def opts
            @opts ||= config.merge(super)
          end

          def config
            context.config.for(name.to_sym)
          end

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gem-release-2.0.0.dev.3 lib/gem/release/cmds/runner.rb
gem-release-2.0.0.dev.2 lib/gem/release/cmds/runner.rb