Class: MultiRepo::Performer
- Inherits:
-
Object
- Object
- MultiRepo::Performer
- Defined in:
- lib/multirepo/logic/performer.rb
Class Method Summary collapse
- .build_dependencies(config_entries, lock_entries) ⇒ Object
- .config_entry_for_lock_entry(config_entries, lock_entry) ⇒ Object
- .depth_ordered_dependencies ⇒ Object
- .perform_main_repo_checkout(main_repo, ref_name, force = false, message = nil) ⇒ Object
Class Method Details
.build_dependencies(config_entries, lock_entries) ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/multirepo/logic/performer.rb', line 46 def self.build_dependencies(config_entries, lock_entries) lock_entries.map do |lock_entry| config_entry = config_entry_for_lock_entry(config_entries, lock_entry) dependency = Dependency.new dependency.config_entry = config_entry dependency.lock_entry = lock_entry next dependency end end |
.config_entry_for_lock_entry(config_entries, lock_entry) ⇒ Object
58 59 60 |
# File 'lib/multirepo/logic/performer.rb', line 58 def self.config_entry_for_lock_entry(config_entries, lock_entry) config_entries.find { |config_entry| config_entry.id == lock_entry.id } end |
.depth_ordered_dependencies ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/multirepo/logic/performer.rb', line 28 def self.depth_ordered_dependencies config_entries = ConfigFile.new(".").load_entries lock_entries = LockFile.new(".").load_entries dependencies = build_dependencies(config_entries, lock_entries) dependency_ordered_nodes = Node.new(".").ordered_descendants depth_ordered = dependency_ordered_nodes.map do |node| dependencies.find do |d| configPath = Utils.standard_path(d.config_entry.path) nodePath = Utils.standard_path(node.path) next configPath.casecmp(nodePath) == 0 end end return depth_ordered end |
.perform_main_repo_checkout(main_repo, ref_name, force = false, message = nil) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/multirepo/logic/performer.rb', line 9 def self.perform_main_repo_checkout(main_repo, ref_name, force = false, = nil) # Make sure the main repo is clean before attempting a checkout unless force || main_repo.clean? fail MultiRepoException, "Can't checkout #{ref_name} because the main repo contains uncommitted changes" end # Checkout the specified ref unless main_repo.checkout(ref_name) fail MultiRepoException, "Couldn't perform checkout of main repo #{ref_name}!" end Console.log_substep( || "Checked out main repo #{ref_name}") # After checkout, make sure we're working with a multirepo-enabled ref unless Utils.multirepo_tracked?(".") fail MultiRepoException, "Revision #{ref_name} is not tracked by multirepo!" end end |