Class: Foy::Runner::GitFetcher
- Inherits:
-
Object
- Object
- Foy::Runner::GitFetcher
- Defined in:
- lib/foy_runner/git_fetcher.rb
Instance Method Summary collapse
- #clean_up ⇒ Object
- #get(file) ⇒ Object
-
#initialize(url) ⇒ GitFetcher
constructor
A new instance of GitFetcher.
Constructor Details
#initialize(url) ⇒ GitFetcher
Returns a new instance of GitFetcher.
4 5 6 |
# File 'lib/foy_runner/git_fetcher.rb', line 4 def initialize(url) @url = url end |
Instance Method Details
#clean_up ⇒ Object
15 16 17 |
# File 'lib/foy_runner/git_fetcher.rb', line 15 def clean_up FileUtils.remove_entry_secure(@dir, true) if @dir end |
#get(file) ⇒ Object
8 9 10 11 12 13 |
# File 'lib/foy_runner/git_fetcher.rb', line 8 def get(file) @dir = Dir.mktmpdir `git clone -n #{@url} #{@dir} --depth 1` `cd #{@dir}; git checkout HEAD #{file}` File.join(@dir, file) end |