Class: PuppetFixtures::Repository::Base
- Inherits:
-
Object
- Object
- PuppetFixtures::Repository::Base
- Defined in:
- lib/puppet_fixtures.rb
Instance Method Summary collapse
- #download(flags = nil, subdir = nil) ⇒ Object
-
#initialize(remote:, target:, branch:, ref:) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(remote:, target:, branch:, ref:) ⇒ Base
444 445 446 447 448 449 |
# File 'lib/puppet_fixtures.rb', line 444 def initialize(remote:, target:, branch:, ref:) @remote = remote @target = target @ref = ref @branch = branch end |
Instance Method Details
#download(flags = nil, subdir = nil) ⇒ Object
451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 |
# File 'lib/puppet_fixtures.rb', line 451 def download(flags = nil, subdir = nil) can_update = false if File.directory?(@target) if remote_url_changed? warn "Remote for #{@target} has changed, recloning repository" FileUtils.rm_rf(@target) else can_update = true end end if can_update update else clone(flags) unless File.exist?(@target) raise "Failed to clone repository #{@remote} into #{@target}" end end revision remove_subdirectory(subdir) if subdir end |