Sha256: 348a2ee142af46efadfc6b100ae99060fd3dff2ea4a385683721f5192548b6d9

Contents?: true

Size: 1.01 KB

Versions: 1

Compression:

Stored size: 1.01 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.class.new, 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

1 entries across 1 versions & 1 rubygems

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