Class: Gemkeeper::ManifestBuilder
- Inherits:
-
Object
- Object
- Gemkeeper::ManifestBuilder
- Defined in:
- lib/gemkeeper/manifest_builder.rb
Overview
Builds or updates a manifest from a Gemfile.lock, tracking what changed.
Defined Under Namespace
Classes: Result
Class Method Summary collapse
Instance Method Summary collapse
- #build!(input: $stdin, output: $stdout) ⇒ Object
-
#initialize(lockfile_path:, manifest:) ⇒ ManifestBuilder
constructor
A new instance of ManifestBuilder.
Constructor Details
#initialize(lockfile_path:, manifest:) ⇒ ManifestBuilder
Returns a new instance of ManifestBuilder.
21 22 23 24 |
# File 'lib/gemkeeper/manifest_builder.rb', line 21 def initialize(lockfile_path:, manifest:) @lockfile_path = lockfile_path @manifest = manifest end |
Class Method Details
.build(lockfile_path:, manifest:, input: $stdin, output: $stdout) ⇒ Object
17 18 19 |
# File 'lib/gemkeeper/manifest_builder.rb', line 17 def self.build(lockfile_path:, manifest:, input: $stdin, output: $stdout) new(lockfile_path:, manifest:).build!(input:, output:) end |
Instance Method Details
#build!(input: $stdin, output: $stdout) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/gemkeeper/manifest_builder.rb', line 26 def build!(input: $stdin, output: $stdout) candidates = LockfileParser.internal_sources(@lockfile_path) already_mapped_count = candidates.count { |c| @manifest.repo_for(c[:name]) } before_size = @manifest.gems.size GemRepoResolver.new(candidates:, manifest: @manifest, input:, output:).resolve! unless candidates.empty? added_count = @manifest.gems.size - before_size skipped_count = candidates.size - already_mapped_count - added_count Result.new(manifest: @manifest, candidates:, added_count:, skipped_count:, already_mapped_count:) end |