Class: PuppetFixtures::Repository::Git
- Inherits:
-
Base
- Object
- Base
- PuppetFixtures::Repository::Git
show all
- Defined in:
- lib/puppet_fixtures.rb
Instance Method Summary
collapse
Methods inherited from Base
#download, #initialize
Instance Method Details
#clone(flags = nil) ⇒ Object
513
514
515
516
517
518
519
520
521
|
# File 'lib/puppet_fixtures.rb', line 513
def clone(flags = nil)
command = %w[git clone]
command.push('--depth', '1') unless @ref
command.push('-b', @branch) if @branch
command.push(flags) if flags
command.push(@remote, @target)
run_command(command)
end
|
#remote_url_changed?(remote = 'origin') ⇒ Boolean
541
542
543
|
# File 'lib/puppet_fixtures.rb', line 541
def remote_url_changed?(remote = 'origin')
remote_url(remote) != @remote
end
|
#revision ⇒ Object
531
532
533
534
535
536
537
538
539
|
# File 'lib/puppet_fixtures.rb', line 531
def revision
return true unless @ref
command = ['git', 'reset', '--hard', @ref]
result = run_command(command, chdir: @target)
raise "Invalid ref #{@ref} for #{@target}" unless result
result
end
|
#update ⇒ Object
523
524
525
526
527
528
529
|
# File 'lib/puppet_fixtures.rb', line 523
def update
command = %w[git fetch]
command.push('--unshallow') if shallow_git_repo?
run_command(command, chdir: @target)
end
|