Method: TestIds::Git#initialize
- Defined in:
- lib/test_ids/git.rb
#initialize(options) ⇒ Git
Returns a new instance of Git.
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/test_ids/git.rb', line 52 def initialize() unless File.exist?("#{[:local]}/.git") FileUtils.rm_rf([:local]) if File.exist?([:local]) FileUtils.mkdir_p([:local]) Dir.chdir [:local] do `git clone #{[:remote]} .` unless File.exist?('lock.json') # Should really try to use the Git driver for this exec 'touch lock.json' exec 'git add lock.json' exec 'git commit -m "Initial commit"' exec 'git push' end end end @local = [:local] @repo = ::Git.open([:local]) # Get rid of any local edits coming in here, this is only called once at the start # of the program generation run. # No need to pull latest as that will be done when we obtain a lock. @repo.reset_hard end |