Class: Vendorificator::Vendor::Git
- Inherits:
-
Vendorificator::Vendor
- Object
- Vendorificator::Vendor
- Vendorificator::Vendor::Git
- Defined in:
- lib/vendorificator/vendor/git.rb
Instance Attribute Summary collapse
-
#conjured_revision ⇒ Object
readonly
Returns the value of attribute conjured_revision.
-
#git ⇒ Object
readonly
Returns the value of attribute git.
Attributes inherited from Vendorificator::Vendor
#args, #block, #environment, #name
Instance Method Summary collapse
- #conjure! ⇒ Object
- #conjure_commit_message ⇒ Object
-
#initialize(environment, name, args = {}, &block) ⇒ Git
constructor
A new instance of Git.
- #upstream_version ⇒ Object
Methods inherited from Vendorificator::Vendor
#===, [], arg_reader, #branch_name, #category, #compute_dependencies!, compute_dependencies!, each, #head, #in_branch, #inspect, install!, instances, #merged, #merged_tag, #merged_version, #needed?, #path, #run!, #shell, #status, #tag_message, #tag_name, #tag_name_base, #tagged_sha1, #to_s, #updatable?, #version, #work_dir, #work_subdir
Constructor Details
#initialize(environment, name, args = {}, &block) ⇒ Git
Returns a new instance of Git.
8 9 10 11 12 13 14 |
# File 'lib/vendorificator/vendor/git.rb', line 8 def initialize(environment, name, args={}, &block) unless args.include?(:repository) args[:repository] = name name = name.split('/').last.sub(/\.git$/, '') end super(environment, name, args, &block) end |
Instance Attribute Details
#conjured_revision ⇒ Object (readonly)
Returns the value of attribute conjured_revision.
6 7 8 |
# File 'lib/vendorificator/vendor/git.rb', line 6 def conjured_revision @conjured_revision end |
#git ⇒ Object (readonly)
Returns the value of attribute git.
6 7 8 |
# File 'lib/vendorificator/vendor/git.rb', line 6 def git @git end |
Instance Method Details
#conjure! ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/vendorificator/vendor/git.rb', line 16 def conjure! shell.say_status :clone, repository MiniGit.git :clone, repository, '.' @git = MiniGit.new('.') if revision git.checkout({:b => 'vendorified'}, revision) elsif branch git.checkout({:b => 'vendorified'}, "origin/#{branch}") end super @conjured_revision = git.capturing.rev_parse('HEAD').strip FileUtils::rm_rf '.git' end |
#conjure_commit_message ⇒ Object
37 38 39 40 41 42 |
# File 'lib/vendorificator/vendor/git.rb', line 37 def rv = "Conjured git module #{name} " rv << "version #{version} " if version rv << "revision #{conjured_revision}" rv end |
#upstream_version ⇒ Object
33 34 35 |
# File 'lib/vendorificator/vendor/git.rb', line 33 def upstream_version conjured_revision end |