Sha256: 2773377ef93d723e667ae3904e31aa0e915131bcf32da78fca76366a0eeedbfe

Contents?: true

Size: 987 Bytes

Versions: 2

Compression:

Stored size: 987 Bytes

Contents

module EacLauncher
  module Git
    class Base < ::EacLauncher::Path
      module Underlying
        def execute!(*args)
          args, options = build_args(args)
          ::EacRubyUtils::Envs.local.command(*args).execute!(options)
        end

        def system!(*args)
          args, options = build_args(args)
          ::EacRubyUtils::Envs.local.command(*args).system!(options)
        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)
          [['git', '-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

2 entries across 2 versions & 1 rubygems

Version Path
eac_launcher-0.2.0 lib/eac_launcher/git/base/underlying.rb
eac_launcher-0.1.7 lib/eac_launcher/git/base/underlying.rb