Sha256: 3f5bbfd44e004fc7a1ef77bc381fdd3b3cf13539b0a1086c63bd47025e8e60bc

Contents?: true

Size: 1.3 KB

Versions: 69

Compression:

Stored size: 1.3 KB

Contents

# frozen_string_literal: true

require 'eac_git/executables'
require 'eac_ruby_utils/envs'
require 'git'
require 'eac_launcher/paths/real'

module EacLauncher
  module Git
    class Base < ::EacLauncher::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

Version data entries

69 entries across 69 versions & 1 rubygems

Version Path
avm-tools-0.99.0 lib/eac_launcher/git/base/underlying.rb
avm-tools-0.98.0 lib/eac_launcher/git/base/underlying.rb
avm-tools-0.97.0 lib/eac_launcher/git/base/underlying.rb
avm-tools-0.96.0 lib/eac_launcher/git/base/underlying.rb
avm-tools-0.95.0 lib/eac_launcher/git/base/underlying.rb
avm-tools-0.94.3 lib/eac_launcher/git/base/underlying.rb
avm-tools-0.94.2 lib/eac_launcher/git/base/underlying.rb
avm-tools-0.94.1 lib/eac_launcher/git/base/underlying.rb
avm-tools-0.94.0 lib/eac_launcher/git/base/underlying.rb
avm-tools-0.93.0 lib/eac_launcher/git/base/underlying.rb
avm-tools-0.92.0 lib/eac_launcher/git/base/underlying.rb
avm-tools-0.91.0 lib/eac_launcher/git/base/underlying.rb
avm-tools-0.90.0 lib/eac_launcher/git/base/underlying.rb
avm-tools-0.89.0 lib/eac_launcher/git/base/underlying.rb
avm-tools-0.88.0 lib/eac_launcher/git/base/underlying.rb
avm-tools-0.87.1 lib/eac_launcher/git/base/underlying.rb
avm-tools-0.87.0 lib/eac_launcher/git/base/underlying.rb
avm-tools-0.86.0 lib/eac_launcher/git/base/underlying.rb
avm-tools-0.85.1 lib/eac_launcher/git/base/underlying.rb
avm-tools-0.85.0 lib/eac_launcher/git/base/underlying.rb