Class: Resource::Git
Instance Method Summary collapse
-
#initialize(repository, &block) ⇒ Git
constructor
A new instance of Git.
- #run ⇒ Object
Methods inherited from Base
inherited, #not_if, #set_base_defaults, #should_skip?, #unix_mode
Methods included from ClassAttr
Methods included from BlockAttr
Constructor Details
#initialize(repository, &block) ⇒ Git
Returns a new instance of Git.
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/resource/git.rb', line 9 def initialize repository, &block set_base_defaults @repository = repository @sandbox_path = '/tmp' @sandbox_name = 'repository_sandbox' @always_run = true @timestamped = true @swaping_branch = 'master' self.instance_eval(&block) end |
Instance Method Details
#run ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/resource/git.rb', line 20 def run clone unless cloned? fetch_and_pull revision = revision(@branch) checkout revision key = @timestamped ? Time.now.strftime('%Y%m%d%H%M%S') : revision my_release_path = @release_path + key relocate my_release_path encapsulate_object revision, my_release_path, key end |