Sha256: 7d67e2dec61d6d86b0b7c9a8213ce0f63d2fb9cae49d8e68a6254c765205c73d

Contents?: true

Size: 511 Bytes

Versions: 4

Compression:

Stored size: 511 Bytes

Contents

module Jets::Git
  module GitCli
    def git?
      git_folder? && git_installed?
    end

    def git_folder?
      File.exist?(".git")
    end

    def git_installed?
      system "type git > /dev/null 2>&1"
    end

    def git(args, on_error: :nil)
      out = `git #{args}`.strip
      unless $?.success?
        case on_error
        when :raise
          raise Jets::Git::Error, "ERROR: git #{args} failed".color(:red)
        when :nil
          return
        end
      end
      out
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
jets-6.0.3 lib/jets/git/git_cli.rb
jets-6.0.2 lib/jets/git/git_cli.rb
jets-git-0.2.1 lib/jets/git/git_cli.rb
jets-git-0.2.0 lib/jets/git/git_cli.rb