Module: RubyGit::CommandLine
- Defined in:
- lib/ruby_git/command_line.rb,
lib/ruby_git/command_line/result.rb,
lib/ruby_git/command_line/runner.rb,
lib/ruby_git/command_line/options.rb,
lib/ruby_git/command_line/encoding_normalizer.rb
Overview
Runs a git command and returns the result
Defined Under Namespace
Modules: EncodingNormalizer Classes: Options, Result, Runner
Class Method Summary collapse
-
.binary_path ⇒ String
private
The path to the git binary.
-
.env ⇒ Hash<String, String>
private
The environment variables that will be set for all git commands.
-
.global_options(repository_path:, worktree_path:) ⇒ Array<String>
private
The global options that will be set for all git commands.
-
.logger ⇒ Logger
private
The logger to use for logging git commands.
-
.run(*args, repository_path: nil, worktree_path: nil, **options) ⇒ RubyGit::CommandLine::Result
Run a git command.
Class Method Details
.binary_path ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The path to the git binary
68 |
# File 'lib/ruby_git/command_line.rb', line 68 def self.binary_path = RubyGit.binary_path |
.env ⇒ Hash<String, String>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The environment variables that will be set for all git commands
55 56 57 58 59 60 61 62 63 |
# File 'lib/ruby_git/command_line.rb', line 55 def self.env { 'GIT_DIR' => nil, 'GIT_WORK_TREE' => nil, 'GIT_INDEX_FILE' => nil, # 'GIT_SSH' => Git::Base.config.git_ssh, 'LC_ALL' => 'en_US.UTF-8' } end |
.global_options(repository_path:, worktree_path:) ⇒ Array<String>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The global options that will be set for all git commands
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/ruby_git/command_line.rb', line 73 def self.(repository_path:, worktree_path:) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength [].tap do |global_opts| global_opts << "--git-dir=#{repository_path}" unless repository_path.nil? global_opts << "--work-tree=#{worktree_path}" unless worktree_path.nil? global_opts << '-c' << 'core.quotePath=true' global_opts << '-c' << 'color.ui=false' global_opts << '-c' << 'color.advice=false' global_opts << '-c' << 'color.diff=false' global_opts << '-c' << 'color.grep=false' global_opts << '-c' << 'color.push=false' global_opts << '-c' << 'color.remote=false' global_opts << '-c' << 'color.showBranch=false' global_opts << '-c' << 'color.status=false' global_opts << '-c' << 'color.transport=false' end end |
.logger ⇒ Logger
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The logger to use for logging git commands
93 |
# File 'lib/ruby_git/command_line.rb', line 93 def self.logger = RubyGit.logger |
.run(*args, repository_path: nil, worktree_path: nil, **options) ⇒ RubyGit::CommandLine::Result
Run a git command
42 43 44 45 46 47 48 49 50 |
# File 'lib/ruby_git/command_line.rb', line 42 def self.run(*args, repository_path: nil, worktree_path: nil, **) runner = RubyGit::CommandLine::Runner.new( env, binary_path, (repository_path:, worktree_path:), logger ) runner.call(*args, **) end |