Sha256: 1057853d5a799596e2b1c6eb604398bbc0a710429631dbb11c27712a94811bc9

Contents?: true

Size: 1.4 KB

Versions: 109

Compression:

Stored size: 1.4 KB

Contents

# frozen_string_literal: true

require 'eac_git/executables'
require 'eac_ruby_utils/envs'
require 'git'
require 'avm/launcher/paths/real'

module Avm
  module Launcher
    module Git
      class Base < ::Avm::Launcher::Paths::Real
        module Underlying
          def command(*args)
            args, options = build_args(args)
            r = ::EacGit::Executables.git.command(*args)
            (options[:exit_outputs] || {}).each do |status_code, result|
              r = r.status_result(status_code, result)
            end
            r
          end

          def execute(*args)
            command(*args).execute
          end

          def execute!(*args)
            command(*args).execute!
          end

          def system!(*args)
            command(*args).system!
          end

          def init
            git
            self
          end

          private

          def build_args(args)
            options = {}
            if args.last.is_a?(Hash)
              options = args.last
              args.pop
            end
            args = args.first if args.first.is_a?(Array)
            [['-C', self, '--no-pager'] + args, options]
          end

          def git_uncached
            FileUtils.mkdir_p(self)
            if File.exist?(subpath('.git'))
              ::Git.open(self)
            else
              ::Git.init(self)
            end
          end
        end
      end
    end
  end
end

Version data entries

109 entries across 109 versions & 2 rubygems

Version Path
avm-tools-0.140.0 lib/avm/launcher/git/base/underlying.rb
eac_tools-0.36.0 sub/avm-tools/lib/avm/launcher/git/base/underlying.rb
avm-tools-0.139.0 lib/avm/launcher/git/base/underlying.rb
eac_tools-0.35.0 sub/avm-tools/lib/avm/launcher/git/base/underlying.rb
avm-tools-0.138.0 lib/avm/launcher/git/base/underlying.rb
eac_tools-0.34.0 sub/avm-tools/lib/avm/launcher/git/base/underlying.rb
avm-tools-0.137.0 lib/avm/launcher/git/base/underlying.rb
eac_tools-0.33.0 sub/avm-tools/lib/avm/launcher/git/base/underlying.rb
eac_tools-0.32.0 sub/avm-tools/lib/avm/launcher/git/base/underlying.rb
avm-tools-0.136.2 lib/avm/launcher/git/base/underlying.rb
eac_tools-0.31.1 sub/avm-tools/lib/avm/launcher/git/base/underlying.rb
eac_tools-0.31.0 sub/avm-tools/lib/avm/launcher/git/base/underlying.rb
avm-tools-0.136.1 lib/avm/launcher/git/base/underlying.rb
eac_tools-0.30.0 sub/avm-tools/lib/avm/launcher/git/base/underlying.rb
eac_tools-0.29.0 sub/avm-tools/lib/avm/launcher/git/base/underlying.rb
avm-tools-0.136.0 lib/avm/launcher/git/base/underlying.rb
eac_tools-0.28.0 sub/avm-tools/lib/avm/launcher/git/base/underlying.rb
eac_tools-0.27.2 sub/avm-tools/lib/avm/launcher/git/base/underlying.rb
eac_tools-0.27.1 sub/avm-tools/lib/avm/launcher/git/base/underlying.rb
avm-tools-0.135.0 lib/avm/launcher/git/base/underlying.rb