Class: GitCompound::Builder
- Inherits:
-
Object
- Object
- GitCompound::Builder
- Defined in:
- lib/git_compound/builder.rb
Overview
Builder class, responsible for building project from manifest or lockfile
Instance Method Summary collapse
- #components_show ⇒ Object
- #dependencies_check ⇒ Object
-
#initialize(manifest, lock, opts) ⇒ Builder
constructor
A new instance of Builder.
- #locked_components_build ⇒ Object
- #locked_components_guard ⇒ Object
- #locked_dormant_components_remove ⇒ Object
- #locked_manifest_verify ⇒ Object
- #manifest_build ⇒ Object
- #manifest_lock ⇒ Object
- #manifest_update ⇒ Object
- #tasks_execute ⇒ Object
Constructor Details
#initialize(manifest, lock, opts) ⇒ Builder
6 7 8 9 10 |
# File 'lib/git_compound/builder.rb', line 6 def initialize(manifest, lock, opts) @manifest = manifest @lock = lock @opts = opts end |
Instance Method Details
#components_show ⇒ Object
42 43 44 45 46 47 48 |
# File 'lib/git_compound/builder.rb', line 42 def components_show Logger.info 'Processing components list ...' @manifest.process( Worker::CircularDependencyChecker.new, Worker::PrettyPrint.new) self end |
#dependencies_check ⇒ Object
32 33 34 35 36 37 38 39 40 |
# File 'lib/git_compound/builder.rb', line 32 def dependencies_check Logger.info 'Checking dependencies ...' @manifest.process( Worker::CircularDependencyChecker.new, Worker::NameConstraintChecker.new, Worker::ConflictingDependencyChecker.new) self end |
#locked_components_build ⇒ Object
69 70 71 72 73 |
# File 'lib/git_compound/builder.rb', line 69 def locked_components_build Logger.info 'Building components from lockfile ...' @lock.process(Worker::ComponentDispatcher.new(@lock)) self end |
#locked_components_guard ⇒ Object
75 76 77 78 |
# File 'lib/git_compound/builder.rb', line 75 def locked_components_guard @lock.process(Worker::LocalChangesGuard.new(@lock)) self end |
#locked_dormant_components_remove ⇒ Object
80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/git_compound/builder.rb', line 80 def locked_dormant_components_remove raise GitCompoundError, 'No new lockfile !' unless @lock_new dormant_components = @lock.components.reject do |component| @lock_new.find(component) ? true : false end dormant_components.each do |component| Logger.warn "Removing dormant component `#{component.name}` " \ "from `#{component.path}` !" component.remove! end end |
#locked_manifest_verify ⇒ Object
63 64 65 66 67 |
# File 'lib/git_compound/builder.rb', line 63 def locked_manifest_verify return self if @manifest.md5sum == @lock.manifest raise GitCompoundError, 'Manifest md5sum has changed ! Use `update` command.' end |
#manifest_build ⇒ Object
12 13 14 15 16 |
# File 'lib/git_compound/builder.rb', line 12 def manifest_build Logger.info 'Building components ...' @manifest.process(Worker::ComponentBuilder.new(@lock)) self end |
#manifest_lock ⇒ Object
25 26 27 28 29 30 |
# File 'lib/git_compound/builder.rb', line 25 def manifest_lock lock = @lock_new ? @lock_new : @lock lock.lock_manifest(@manifest) lock.write self end |
#manifest_update ⇒ Object
18 19 20 21 22 23 |
# File 'lib/git_compound/builder.rb', line 18 def manifest_update Logger.info 'Updating components ...' @lock_new = Lock.new.clean @manifest.process(Worker::ComponentDispatcher.new(@lock_new)) self end |
#tasks_execute ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/git_compound/builder.rb', line 50 def tasks_execute Logger.info 'Running tasks ...' if @opts.include?(:allow_nested_subtasks) @manifest.process(Worker::TaskRunner.new) else @manifest.tasks.each_value do |task| Worker::TaskRunner.new.visit_task(task) end end self end |