Class: Vendorificator::Segment::Vendor
- Inherits:
-
Vendorificator::Segment
- Object
- Vendorificator::Segment
- Vendorificator::Segment::Vendor
- Defined in:
- lib/vendorificator/segment/vendor.rb
Instance Attribute Summary collapse
-
#overlay ⇒ Object
readonly
Returns the value of attribute overlay.
-
#vendor ⇒ Object
readonly
Returns the value of attribute vendor.
Instance Method Summary collapse
- #branch_name ⇒ Object
- #compute_dependencies! ⇒ Object
-
#conjure(options = {}) ⇒ Object
Public: Conjures the vendor module without merging back.
- #group ⇒ Object
-
#initialize(options) ⇒ Vendor
constructor
A new instance of Vendor.
-
#merge_back(commit = branch_name) ⇒ Object
Public: Merges back to the original branch (usually master).
- #name ⇒ Object
- #version ⇒ Object
Methods inherited from Vendorificator::Segment
#fast_forward, #head, #included_in_list?, #merged_notes, #merged_version, #pushable_refs, #run!, #status, #to_s, #updatable?, #work_dir
Constructor Details
#initialize(options) ⇒ Vendor
Returns a new instance of Vendor.
7 8 9 10 11 |
# File 'lib/vendorificator/segment/vendor.rb', line 7 def initialize() @vendor = .delete(:vendor) @overlay = .delete(:overlay) super end |
Instance Attribute Details
#overlay ⇒ Object (readonly)
Returns the value of attribute overlay.
5 6 7 |
# File 'lib/vendorificator/segment/vendor.rb', line 5 def @overlay end |
#vendor ⇒ Object (readonly)
Returns the value of attribute vendor.
5 6 7 |
# File 'lib/vendorificator/segment/vendor.rb', line 5 def vendor @vendor end |
Instance Method Details
#branch_name ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/vendorificator/segment/vendor.rb', line 25 def branch_name if _join .branch_name, group, name else super end end |
#compute_dependencies! ⇒ Object
33 34 35 |
# File 'lib/vendorificator/segment/vendor.rb', line 33 def compute_dependencies! @vendor.compute_dependencies! end |
#conjure(options = {}) ⇒ Object
Public: Conjures the vendor module without merging back.
options - available options: :metadata - Hash with metadata information
Returns nothing.
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/vendorificator/segment/vendor.rb', line 42 def conjure( = {}) shell.padding += 1 @vendor.before_conjure! Dir.mktmpdir "vendorificator-#{name}" do |tmpdir| in_branch(branch_name, clean: true) do |tmpgit| begin @git = tmpgit @vendor.git = tmpgit Dir.chdir tmpdir do @vendor.conjure! subdir = @vendor.args[:subdirectory] make_subdir_root subdir if subdir && !subdir.empty? end FileUtils.mkdir_p work_dir tmpdir_entries = (Dir.entries(tmpdir) - %w'. ..'). map { |e| File.join(tmpdir, e) } FileUtils.mv tmpdir_entries, work_dir @vendor.after_conjure! commit_and_annotate([:metadata] || {}) ensure @git = nil @vendor.git = nil end end end ensure shell.padding -= 1 end |
#group ⇒ Object
17 18 19 |
# File 'lib/vendorificator/segment/vendor.rb', line 17 def group @vendor.group end |
#merge_back(commit = branch_name) ⇒ Object
Public: Merges back to the original branch (usually master).
commit - git ref/branch to merge, defaults to segment branch
Returns nothing.
80 81 82 83 84 |
# File 'lib/vendorificator/segment/vendor.rb', line 80 def merge_back(commit = branch_name) git.capturing.merge({no_edit: true, no_ff: true}, commit) unless config.fake_mode? @vendor.postprocess! if @vendor.respond_to? :postprocess! @vendor.compute_dependencies! end |
#name ⇒ Object
13 14 15 |
# File 'lib/vendorificator/segment/vendor.rb', line 13 def name @vendor.name end |
#version ⇒ Object
21 22 23 |
# File 'lib/vendorificator/segment/vendor.rb', line 21 def version @vendor.version end |