Sha256: a3f59b0e36cff78b03eb86a49b7c4e40ff2c18d77229bb889c4548d521b4cbfd

Contents?: true

Size: 744 Bytes

Versions: 5

Compression:

Stored size: 744 Bytes

Contents

# frozen_string_literal: true

require 'eac_ruby_utils/core_ext'

module EacGit
  class Local
    class Remote
      class Push
        acts_as_immutable
        immutable_accessor :force, type: :boolean
        immutable_accessor :refspec, type: :array

        common_constructor :remote
        delegate :local, to: :remote

        # @return [Array<Object>]
        def immutable_constructor_args
          [remote]
        end

        # @return [void]
        def perform
          local.command(*git_command_args).system!
        end

        # @return [Enumerable<String>]
        def git_command_args
          r = ['push', remote.name]
          r << '--force' if force?
          r + refspecs
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
eac_tools-0.86.5 sub/eac_git/lib/eac_git/local/remote/push.rb
eac_tools-0.86.4 sub/eac_git/lib/eac_git/local/remote/push.rb
eac_tools-0.86.3 sub/eac_git/lib/eac_git/local/remote/push.rb
eac_git-0.16.0 lib/eac_git/local/remote/push.rb
eac_tools-0.86.2 sub/eac_git/lib/eac_git/local/remote/push.rb