librarianp 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +1 -1
- data/README.md +2 -0
- data/VERSION +1 -1
- data/lib/librarian/action/resolve.rb +5 -0
- data/lib/librarian/dependency.rb +6 -0
- data/lib/librarian/manifest.rb +25 -1
- data/lib/librarian/resolver/implementation.rb +17 -13
- data/librarian.gemspec +3 -3
- metadata +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 04a1e4db0787f3a2fd35ed107c2b56d4d4ad6a6b
|
4
|
+
data.tar.gz: 2818792e819ffa97695db3845a5cf49d5a523530
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c5819c7a0a6313718d33d812bf635244135e835599822014e6d93c167cc449a43609484c275257e6f150d24fff45a84ec6bd34fdb17c34e3e6b5c450caae7be
|
7
|
+
data.tar.gz: 2ca7a08199372c51f33be95176edfe1adf391858066671f78a31da1db987b15b43ca17f00660b2c55439d6429221aaace6ce9384042365dd956556e52a3e7c33
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## 0.4.0
|
4
|
+
|
5
|
+
* Resolve iteratively instead of recursively
|
6
|
+
* Fail if there are duplicated dependencies in spec file
|
7
|
+
* Merge duplicated dependencies and warn the user
|
8
|
+
|
3
9
|
## 0.3.0
|
4
10
|
|
5
11
|
* Allow customizing default specfile and receiver downstream
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
Librarian [![Build Status](https://secure.travis-ci.org/carlossg/librarian.png)](http://travis-ci.org/carlossg/librarian) [![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/carlossg/librarian)
|
2
2
|
=========
|
3
3
|
|
4
|
+
This is a forked version published as `librarianp` with improvements in order to support `librarian-puppet`.
|
5
|
+
|
4
6
|
Librarian is a framework for writing bundlers, which are tools that resolve,
|
5
7
|
fetch, install, and isolate a project's dependencies, in Ruby.
|
6
8
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.4.0
|
@@ -23,6 +23,11 @@ module Librarian
|
|
23
23
|
manifests = changes.analyze
|
24
24
|
end
|
25
25
|
|
26
|
+
dupes = spec.dependencies.group_by{ |e| e.name }.select { |k, v| v.size > 1 }
|
27
|
+
unless dupes.empty?
|
28
|
+
raise Error, "Duplicated dependencies: #{dupes.values.flatten.map {|d| {d.name => d.source.to_s} }}"
|
29
|
+
end
|
30
|
+
|
26
31
|
resolution = resolver.resolve(spec, manifests)
|
27
32
|
persist_resolution(resolution)
|
28
33
|
end
|
data/lib/librarian/dependency.rb
CHANGED
data/lib/librarian/manifest.rb
CHANGED
@@ -219,7 +219,31 @@ module Librarian
|
|
219
219
|
end
|
220
220
|
|
221
221
|
def fetch_dependencies!
|
222
|
-
source.fetch_dependencies(name, version, extra)
|
222
|
+
remove_duplicate_dependencies(name, source.fetch_dependencies(name, version, extra))
|
223
|
+
end
|
224
|
+
|
225
|
+
# merge dependencies with the same name into one
|
226
|
+
# with the source of the first one and merged requirements
|
227
|
+
def merge_dependencies(dependencies)
|
228
|
+
requirement = Dependency::Requirement.new(*dependencies.map{|d| d.requirement})
|
229
|
+
Dependency.new(dependencies.first.name, requirement, dependencies.first.source)
|
230
|
+
end
|
231
|
+
|
232
|
+
# Avoid duplicated dependencies with different sources or requirements
|
233
|
+
def remove_duplicate_dependencies(module_name, dependencies)
|
234
|
+
uniq = []
|
235
|
+
dependencies_by_name = dependencies.group_by{|d| d.name}
|
236
|
+
dependencies_by_name.map do |name, dependencies_same_name|
|
237
|
+
if dependencies_same_name.size > 1
|
238
|
+
environment.logger.warn { "Dependency '#{name}' duplicated for module #{module_name}, trying to merge: #{dependencies_same_name.map{|d| d.to_s}}" }
|
239
|
+
merged = merge_dependencies(dependencies_same_name)
|
240
|
+
environment.logger.warn { "Dependency '#{name}' merged as #{merged}" }
|
241
|
+
uniq << merged
|
242
|
+
else
|
243
|
+
uniq << dependencies_same_name.first
|
244
|
+
end
|
245
|
+
end
|
246
|
+
uniq
|
223
247
|
end
|
224
248
|
|
225
249
|
def _normalize_version(version)
|
@@ -47,27 +47,31 @@ module Librarian
|
|
47
47
|
manifests = index_by(manifests, &:name) if manifests.kind_of?(Array)
|
48
48
|
queue = spec.dependencies + sourced_dependencies_for_manifests(manifests)
|
49
49
|
state = State.new(manifests.dup, [], queue)
|
50
|
-
|
50
|
+
do_resolve(state)
|
51
51
|
end
|
52
52
|
|
53
53
|
private
|
54
54
|
|
55
|
-
def
|
56
|
-
|
57
|
-
|
55
|
+
def do_resolve(state)
|
56
|
+
stack = [state]
|
57
|
+
while !stack.empty? do
|
58
|
+
state = stack.pop
|
59
|
+
shift_resolved_enqueued_dependencies(state) or return
|
60
|
+
state.queue.empty? and return state.manifests
|
58
61
|
|
59
|
-
|
60
|
-
|
62
|
+
state.dependencies << state.queue.shift
|
63
|
+
dependency = state.dependencies.last
|
61
64
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
+
resolving_dependency_map_find_manifests(dependency) do |manifest|
|
66
|
+
check_manifest(state, manifest) or next
|
67
|
+
check_manifest_for_cycles(state, manifest) or next unless cyclic
|
65
68
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
+
m = state.manifests.merge(dependency.name => manifest)
|
70
|
+
a = sourced_dependencies_for_manifest(manifest)
|
71
|
+
s = State.new(m, state.dependencies.dup, state.queue + a)
|
69
72
|
|
70
|
-
|
73
|
+
stack.push(s)
|
74
|
+
end
|
71
75
|
end
|
72
76
|
end
|
73
77
|
|
data/librarian.gemspec
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: librarianp 0.
|
2
|
+
# stub: librarianp 0.4.0 ruby lib
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "librarianp"
|
6
|
-
s.version = "0.
|
6
|
+
s.version = "0.4.0"
|
7
7
|
|
8
8
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
9
9
|
s.require_paths = ["lib"]
|
10
10
|
s.authors = ["Jay Feldblum", "Carlos Sanchez"]
|
11
|
-
s.date = "2015-02-
|
11
|
+
s.date = "2015-02-26"
|
12
12
|
s.description = "A Framework for Bundlers, used by librarian-puppet."
|
13
13
|
s.email = ["y_feldblum@yahoo.com", "carlos@apache.org"]
|
14
14
|
s.files = [".gitignore", ".rspec", ".travis.yml", "CHANGELOG.md", "Gemfile", "Gemfile.lock", "LICENSE.txt", "README.md", "Rakefile", "VERSION", "lib/librarian.rb", "lib/librarian/action.rb", "lib/librarian/action/base.rb", "lib/librarian/action/clean.rb", "lib/librarian/action/ensure.rb", "lib/librarian/action/install.rb", "lib/librarian/action/persist_resolution_mixin.rb", "lib/librarian/action/resolve.rb", "lib/librarian/action/update.rb", "lib/librarian/algorithms.rb", "lib/librarian/cli.rb", "lib/librarian/cli/manifest_presenter.rb", "lib/librarian/config.rb", "lib/librarian/config/database.rb", "lib/librarian/config/file_source.rb", "lib/librarian/config/hash_source.rb", "lib/librarian/config/source.rb", "lib/librarian/dependency.rb", "lib/librarian/dsl.rb", "lib/librarian/dsl/receiver.rb", "lib/librarian/dsl/target.rb", "lib/librarian/environment.rb", "lib/librarian/environment/runtime_cache.rb", "lib/librarian/error.rb", "lib/librarian/helpers.rb", "lib/librarian/linter/source_linter.rb", "lib/librarian/lockfile.rb", "lib/librarian/lockfile/compiler.rb", "lib/librarian/lockfile/parser.rb", "lib/librarian/logger.rb", "lib/librarian/manifest.rb", "lib/librarian/manifest_set.rb", "lib/librarian/mock.rb", "lib/librarian/mock/cli.rb", "lib/librarian/mock/dsl.rb", "lib/librarian/mock/environment.rb", "lib/librarian/mock/extension.rb", "lib/librarian/mock/source.rb", "lib/librarian/mock/source/mock.rb", "lib/librarian/mock/source/mock/registry.rb", "lib/librarian/mock/version.rb", "lib/librarian/posix.rb", "lib/librarian/resolution.rb", "lib/librarian/resolver.rb", "lib/librarian/resolver/implementation.rb", "lib/librarian/rspec/support/cli_macro.rb", "lib/librarian/source.rb", "lib/librarian/source/basic_api.rb", "lib/librarian/source/git.rb", "lib/librarian/source/git/repository.rb", "lib/librarian/source/local.rb", "lib/librarian/source/path.rb", "lib/librarian/spec.rb", "lib/librarian/spec_change_set.rb", "lib/librarian/specfile.rb", "lib/librarian/support/abstract_method.rb", "lib/librarian/ui.rb", "lib/librarian/version.rb", "librarian.gemspec", "spec/functional/cli_spec.rb", "spec/functional/posix_spec.rb", "spec/functional/source/git/repository_spec.rb", "spec/functional/source/git_spec.rb", "spec/support/fakefs.rb", "spec/support/method_patch_macro.rb", "spec/support/project_path_macro.rb", "spec/support/with_env_macro.rb", "spec/unit/action/base_spec.rb", "spec/unit/action/clean_spec.rb", "spec/unit/action/ensure_spec.rb", "spec/unit/action/install_spec.rb", "spec/unit/algorithms_spec.rb", "spec/unit/config/database_spec.rb", "spec/unit/dependency/requirement_spec.rb", "spec/unit/dependency_spec.rb", "spec/unit/dsl_spec.rb", "spec/unit/environment/runtime_cache_spec.rb", "spec/unit/environment_spec.rb", "spec/unit/lockfile/parser_spec.rb", "spec/unit/lockfile_spec.rb", "spec/unit/manifest/version_spec.rb", "spec/unit/manifest_set_spec.rb", "spec/unit/manifest_spec.rb", "spec/unit/mock/environment_spec.rb", "spec/unit/mock/source/mock_spec.rb", "spec/unit/resolver_spec.rb", "spec/unit/source/git_spec.rb", "spec/unit/spec_change_set_spec.rb"]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: librarianp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jay Feldblum
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-02-
|
12
|
+
date: 2015-02-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
@@ -241,4 +241,3 @@ test_files:
|
|
241
241
|
- spec/unit/resolver_spec.rb
|
242
242
|
- spec/unit/source/git_spec.rb
|
243
243
|
- spec/unit/spec_change_set_spec.rb
|
244
|
-
has_rdoc:
|