Class: Coppy::Steps::Git
- Inherits:
-
Object
- Object
- Coppy::Steps::Git
- Extended by:
- DSL::Module
- Defined in:
- lib/coppy/steps/git.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(&block) ⇒ Git
constructor
A new instance of Git.
Methods included from DSL::Module
Constructor Details
Instance Method Details
#call(env) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/coppy/steps/git.rb', line 19 def call(env) source_hash = Dir.chdir(env.source) { `git rev-parse HEAD` } source_origin = Dir.chdir(env.source) do `git remote -v`.each_line .map {|line| line.split("\t") } .find {|remote, src, fetch_or_push| remote == "origin" && fetch_or_push == "fetch" } end Dir.chdir(env.target) do system "git init", out: File::NULL git_env = Environment.new( source: Environment.new( hash: source_hash, remote: source_origin ) ) @manifesto.execute!(git_env) end end |