-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(PDK-673) Moving git commands into a util class
- Loading branch information
Helen Campbell
committed
Nov 9, 2017
1 parent
acc5897
commit 0213b47
Showing
4 changed files
with
41 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
module PDK | ||
module Util | ||
module Git | ||
def self.git_bindir | ||
@git_dir ||= File.join('private', 'git', Gem.win_platform? ? 'cmd' : 'bin') | ||
end | ||
|
||
def self.git_paths | ||
@paths ||= begin | ||
paths = [File.join(PDK::Util.pdk_package_basedir, git_bindir)] | ||
|
||
if Gem.win_platform? | ||
paths << File.join(PDK::Util.pdk_package_basedir, 'private', 'git', 'mingw64', 'bin') | ||
paths << File.join(PDK::Util.pdk_package_basedir, 'private', 'git', 'mingw64', 'libexec', 'git-core') | ||
paths << File.join(PDK::Util.pdk_package_basedir, 'private', 'git', 'usr', 'bin') | ||
end | ||
|
||
paths | ||
end | ||
end | ||
|
||
def self.git_bin | ||
git_bin = Gem.win_platform? ? 'git.exe' : 'git' | ||
vendored_bin_path = File.join(git_bindir, git_bin) | ||
|
||
PDK::CLI::Exec.try_vendored_bin(vendored_bin_path, git_bin) | ||
end | ||
|
||
def self.git(*args) | ||
PDK::CLI::Exec.ensure_bin_present!(git_bin, 'git') | ||
|
||
PDK::CLI::Exec.execute(git_bin, *args) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters