doubleshot 0.2.0-java → 0.3.0-java
Sign up to get free protection for your applications and to get access to all the features.
- data/Doubleshot +16 -6
- data/README-OLD.textile +216 -0
- data/README.textile +38 -182
- data/lib/doubleshot.rb +100 -39
- data/lib/doubleshot/commands/gem.rb +15 -12
- data/lib/doubleshot/commands/test.rb +38 -5
- data/lib/doubleshot/configuration.rb +2 -2
- data/lib/doubleshot/dependencies/dependency.rb +1 -1
- data/lib/doubleshot/dependencies/gem_dependency.rb +2 -10
- data/lib/doubleshot/dependencies/jar_dependency.rb +12 -2
- data/lib/doubleshot/lockfile.rb +9 -6
- data/lib/doubleshot/pom.rb +15 -2
- data/lib/doubleshot/resolver.rb +1 -0
- data/lib/doubleshot/resolver/gem_resolver.rb +45 -0
- data/lib/doubleshot/resolver/gem_resolver/artifact.rb +146 -0
- data/lib/doubleshot/resolver/gem_resolver/demand.rb +57 -0
- data/lib/doubleshot/resolver/gem_resolver/dependency.rb +57 -0
- data/lib/doubleshot/resolver/gem_resolver/errors.rb +37 -0
- data/lib/doubleshot/resolver/gem_resolver/gem_source.rb +58 -0
- data/lib/doubleshot/resolver/gem_resolver/graph.rb +200 -0
- data/lib/doubleshot/resolver/gem_resolver/solver.rb +279 -0
- data/lib/doubleshot/resolver/gem_resolver/solver/constraint_row.rb +29 -0
- data/lib/doubleshot/resolver/gem_resolver/solver/constraint_table.rb +35 -0
- data/lib/doubleshot/resolver/gem_resolver/solver/variable_row.rb +47 -0
- data/lib/doubleshot/resolver/gem_resolver/solver/variable_table.rb +59 -0
- data/lib/doubleshot/resolver/gem_resolver/source.rb +36 -0
- data/lib/doubleshot/resolver/jar_resolver.rb +1 -3
- data/lib/ruby/gem/requirement.rb +9 -0
- data/target/doubleshot.jar +0 -0
- data/test/compiler_spec.rb +31 -3
- data/test/configuration_spec.rb +11 -3
- data/test/dependencies/gem_dependency_spec.rb +3 -17
- data/test/dependencies/jar_dependency_spec.rb +20 -0
- data/test/helper.rb +3 -1
- data/test/helpers/stub_source.rb +120 -0
- data/test/lockfile_spec.rb +9 -17
- data/test/pom_spec.rb +31 -1
- data/test/resolver/gem_resolver/artifact_spec.rb +106 -0
- data/test/resolver/gem_resolver/demand_spec.rb +70 -0
- data/test/resolver/gem_resolver/dependency_spec.rb +33 -0
- data/test/resolver/gem_resolver/gem_source_spec.rb +28 -0
- data/test/resolver/gem_resolver/graph_spec.rb +239 -0
- data/test/resolver/gem_resolver/solver_spec.rb +449 -0
- data/test/resolver/gem_resolver/source_spec.rb +18 -0
- data/test/resolver/gem_resolver_spec.rb +102 -0
- metadata +35 -73
- data/lib/doubleshot/jar.rb +0 -62
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/usr/bin/env jruby
|
2
|
+
|
3
|
+
# encoding: utf-8
|
4
|
+
|
5
|
+
require_relative "../../helper"
|
6
|
+
|
7
|
+
describe Doubleshot::Resolver::GemResolver::Source do
|
8
|
+
|
9
|
+
before do
|
10
|
+
@source = Doubleshot::Resolver::GemResolver::Source.new "stub://example.org"
|
11
|
+
end
|
12
|
+
|
13
|
+
describe "initialization" do
|
14
|
+
it "must initialize with a valid URI" do
|
15
|
+
@source.must_be_kind_of Helper::StubSource
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,102 @@
|
|
1
|
+
#!/usr/bin/env jruby
|
2
|
+
|
3
|
+
# encoding: utf-8
|
4
|
+
|
5
|
+
require_relative "../helper"
|
6
|
+
|
7
|
+
describe Doubleshot::Resolver::GemResolver do
|
8
|
+
before do
|
9
|
+
@resolver = Doubleshot::Resolver::GemResolver.new "stub://example.org"
|
10
|
+
end
|
11
|
+
|
12
|
+
describe "fetch" do
|
13
|
+
before do
|
14
|
+
@dependencies = Doubleshot::Dependencies::GemDependencyList.new
|
15
|
+
end
|
16
|
+
|
17
|
+
it "must return the same GemDependencyList" do
|
18
|
+
@dependencies.fetch("rdoc")
|
19
|
+
@resolver.resolve!(@dependencies).must_be_same_as @dependencies
|
20
|
+
end
|
21
|
+
|
22
|
+
it "must take a GemDependencyList and populate nested dependencies" do
|
23
|
+
@dependencies.fetch("rdoc")
|
24
|
+
@resolver.resolve! @dependencies
|
25
|
+
@dependencies.size.must_equal 3
|
26
|
+
end
|
27
|
+
|
28
|
+
it "must raise a NoSolutionError if a dependency can't be resolved" do
|
29
|
+
# IT'S OVER 9000!!! (this version doesn't exist)
|
30
|
+
@dependencies.fetch("rdoc").add_requirement "> 9000"
|
31
|
+
-> { @resolver.resolve! @dependencies }.must_raise(Doubleshot::Resolver::GemResolver::Errors::NoSolutionError)
|
32
|
+
end
|
33
|
+
|
34
|
+
it "must only add dependencies that meet requirements" do
|
35
|
+
@dependencies.fetch("rdoc").add_requirement "~> 3.9.0"
|
36
|
+
@resolver.resolve! @dependencies
|
37
|
+
# This previous version of the rdoc gem doesn't have the json dependency:
|
38
|
+
@dependencies.size.must_equal 1
|
39
|
+
end
|
40
|
+
|
41
|
+
describe "scenarios" do
|
42
|
+
# list of scenarios we expect to be resolvable
|
43
|
+
describe "success" do
|
44
|
+
it "should succeed on independent gems" do
|
45
|
+
@dependencies.fetch "minitest"
|
46
|
+
@dependencies.fetch "rack"
|
47
|
+
@dependencies.fetch("json").add_requirement "=1.7.4"
|
48
|
+
|
49
|
+
@resolver.resolve! @dependencies
|
50
|
+
@dependencies.size.must_equal 3
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should succeed on simple linear dependencies" do
|
54
|
+
@dependencies.fetch("rdoc").add_requirement "=3.8.3"
|
55
|
+
|
56
|
+
@resolver.resolve! @dependencies
|
57
|
+
@dependencies.size.must_equal 3
|
58
|
+
end
|
59
|
+
|
60
|
+
it "should find the latest possible dependencies" do
|
61
|
+
@dependencies.fetch "top-level"
|
62
|
+
|
63
|
+
@resolver.resolve! @dependencies
|
64
|
+
|
65
|
+
@dependencies.size.must_equal 4
|
66
|
+
@dependencies.fetch("top-level").version.must_equal "1.0"
|
67
|
+
@dependencies.fetch("mid-level-1").version.must_equal "2.0"
|
68
|
+
@dependencies.fetch("mid-level-2").version.must_equal "2.0"
|
69
|
+
@dependencies.fetch("bottom-level").version.must_equal "2.3"
|
70
|
+
end
|
71
|
+
|
72
|
+
it "should correctly resolve dependencies when one resolution exists but it is not the latest" do
|
73
|
+
skip "pending: https://github.com/reset/solve/pull/7"
|
74
|
+
@dependencies.fetch "get-the-old-one"
|
75
|
+
|
76
|
+
@resolver.resolve! @dependencies
|
77
|
+
|
78
|
+
@dependencies.size.must_equal 4
|
79
|
+
@dependencies.fetch("get-the-old-one").version.must_equal "1.0"
|
80
|
+
@dependencies.fetch("locked-mid-1").version.must_equal "1.3"
|
81
|
+
@dependencies.fetch("locked-mid-2").version.must_equal "1.4"
|
82
|
+
@dependencies.fetch("old-bottom").version.must_equal "0.5"
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
# list of scenarios we expect to be unresolvable
|
87
|
+
describe "failure" do
|
88
|
+
it "should fail on conflicting dependencies" do
|
89
|
+
@dependencies.fetch("locked-mid-1").add_requirement "2.0"
|
90
|
+
@dependencies.fetch("locked-mid-2").add_requirement "2.0"
|
91
|
+
|
92
|
+
-> { @resolver.resolve! @dependencies }.must_raise(Doubleshot::Resolver::GemResolver::Errors::NoSolutionError)
|
93
|
+
end
|
94
|
+
|
95
|
+
it "should fail when no possible version dependency exists in the source(s)" do
|
96
|
+
@dependencies.fetch "oops"
|
97
|
+
-> { @resolver.resolve! @dependencies }.must_raise(Doubleshot::Resolver::GemResolver::Errors::NoSolutionError)
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
metadata
CHANGED
@@ -2,67 +2,15 @@
|
|
2
2
|
name: doubleshot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.
|
5
|
+
version: 0.3.0
|
6
6
|
platform: java
|
7
7
|
authors:
|
8
8
|
- Sam Smoot
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-11-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
|
-
- !ruby/object:Gem::Dependency
|
15
|
-
name: bundler
|
16
|
-
version_requirements: !ruby/object:Gem::Requirement
|
17
|
-
requirements:
|
18
|
-
- - ! '>='
|
19
|
-
- !ruby/object:Gem::Version
|
20
|
-
version: !binary |-
|
21
|
-
MA==
|
22
|
-
none: false
|
23
|
-
requirement: !ruby/object:Gem::Requirement
|
24
|
-
requirements:
|
25
|
-
- - ! '>='
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
version: !binary |-
|
28
|
-
MA==
|
29
|
-
none: false
|
30
|
-
prerelease: false
|
31
|
-
type: :runtime
|
32
|
-
- !ruby/object:Gem::Dependency
|
33
|
-
name: rdoc
|
34
|
-
version_requirements: !ruby/object:Gem::Requirement
|
35
|
-
requirements:
|
36
|
-
- - ! '>='
|
37
|
-
- !ruby/object:Gem::Version
|
38
|
-
version: 2.4.2
|
39
|
-
none: false
|
40
|
-
requirement: !ruby/object:Gem::Requirement
|
41
|
-
requirements:
|
42
|
-
- - ! '>='
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
version: 2.4.2
|
45
|
-
none: false
|
46
|
-
prerelease: false
|
47
|
-
type: :runtime
|
48
|
-
- !ruby/object:Gem::Dependency
|
49
|
-
name: perfer
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ! '>='
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: !binary |-
|
55
|
-
MA==
|
56
|
-
none: false
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ! '>='
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: !binary |-
|
62
|
-
MA==
|
63
|
-
none: false
|
64
|
-
prerelease: false
|
65
|
-
type: :runtime
|
66
14
|
- !ruby/object:Gem::Dependency
|
67
15
|
name: minitest
|
68
16
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -129,24 +77,6 @@ dependencies:
|
|
129
77
|
none: false
|
130
78
|
prerelease: false
|
131
79
|
type: :runtime
|
132
|
-
- !ruby/object:Gem::Dependency
|
133
|
-
name: simplecov
|
134
|
-
version_requirements: !ruby/object:Gem::Requirement
|
135
|
-
requirements:
|
136
|
-
- - ! '>='
|
137
|
-
- !ruby/object:Gem::Version
|
138
|
-
version: !binary |-
|
139
|
-
MA==
|
140
|
-
none: false
|
141
|
-
requirement: !ruby/object:Gem::Requirement
|
142
|
-
requirements:
|
143
|
-
- - ! '>='
|
144
|
-
- !ruby/object:Gem::Version
|
145
|
-
version: !binary |-
|
146
|
-
MA==
|
147
|
-
none: false
|
148
|
-
prerelease: false
|
149
|
-
type: :runtime
|
150
80
|
- !ruby/object:Gem::Dependency
|
151
81
|
name: doubleshot
|
152
82
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -194,15 +124,26 @@ files:
|
|
194
124
|
- test/dependencies_spec.rb
|
195
125
|
- test/doubleshot_spec.rb
|
196
126
|
- test/helper.rb
|
127
|
+
- test/helpers/stub_source.rb
|
197
128
|
- test/lockfile_spec.rb
|
198
129
|
- test/pom_spec.rb
|
199
130
|
- test/readonly_collection_spec.rb
|
131
|
+
- test/resolver/gem_resolver/artifact_spec.rb
|
132
|
+
- test/resolver/gem_resolver/demand_spec.rb
|
133
|
+
- test/resolver/gem_resolver/dependency_spec.rb
|
134
|
+
- test/resolver/gem_resolver/gem_source_spec.rb
|
135
|
+
- test/resolver/gem_resolver/graph_spec.rb
|
136
|
+
- test/resolver/gem_resolver/solver_spec.rb
|
137
|
+
- test/resolver/gem_resolver/source_spec.rb
|
138
|
+
- test/resolver/gem_resolver_spec.rb
|
200
139
|
- test/resolver/jar_resolver_spec.rb
|
201
140
|
- test/resolver_spec.rb
|
202
141
|
- !binary |-
|
203
142
|
RG91Ymxlc2hvdA==
|
204
143
|
- !binary |-
|
205
144
|
TUlULUxJQ0VOU0U=
|
145
|
+
- !binary |-
|
146
|
+
UkVBRE1FLU9MRC50ZXh0aWxl
|
206
147
|
- !binary |-
|
207
148
|
UkVBRE1FLnRleHRpbGU=
|
208
149
|
- lib/doubleshot/cli/options.rb
|
@@ -225,10 +166,22 @@ files:
|
|
225
166
|
- lib/doubleshot/dependencies/jar_dependency.rb
|
226
167
|
- lib/doubleshot/dependencies/jar_dependency_list.rb
|
227
168
|
- lib/doubleshot/dependencies.rb
|
228
|
-
- lib/doubleshot/jar.rb
|
229
169
|
- lib/doubleshot/lockfile.rb
|
230
170
|
- lib/doubleshot/pom.rb
|
231
171
|
- lib/doubleshot/readonly_collection.rb
|
172
|
+
- lib/doubleshot/resolver/gem_resolver/artifact.rb
|
173
|
+
- lib/doubleshot/resolver/gem_resolver/demand.rb
|
174
|
+
- lib/doubleshot/resolver/gem_resolver/dependency.rb
|
175
|
+
- lib/doubleshot/resolver/gem_resolver/errors.rb
|
176
|
+
- lib/doubleshot/resolver/gem_resolver/gem_source.rb
|
177
|
+
- lib/doubleshot/resolver/gem_resolver/graph.rb
|
178
|
+
- lib/doubleshot/resolver/gem_resolver/solver/constraint_row.rb
|
179
|
+
- lib/doubleshot/resolver/gem_resolver/solver/constraint_table.rb
|
180
|
+
- lib/doubleshot/resolver/gem_resolver/solver/variable_row.rb
|
181
|
+
- lib/doubleshot/resolver/gem_resolver/solver/variable_table.rb
|
182
|
+
- lib/doubleshot/resolver/gem_resolver/solver.rb
|
183
|
+
- lib/doubleshot/resolver/gem_resolver/source.rb
|
184
|
+
- lib/doubleshot/resolver/gem_resolver.rb
|
232
185
|
- lib/doubleshot/resolver/jar_resolver.rb
|
233
186
|
- lib/doubleshot/resolver.rb
|
234
187
|
- lib/doubleshot/setup.rb
|
@@ -293,8 +246,17 @@ test_files:
|
|
293
246
|
- test/dependencies_spec.rb
|
294
247
|
- test/doubleshot_spec.rb
|
295
248
|
- test/helper.rb
|
249
|
+
- test/helpers/stub_source.rb
|
296
250
|
- test/lockfile_spec.rb
|
297
251
|
- test/pom_spec.rb
|
298
252
|
- test/readonly_collection_spec.rb
|
253
|
+
- test/resolver/gem_resolver/artifact_spec.rb
|
254
|
+
- test/resolver/gem_resolver/demand_spec.rb
|
255
|
+
- test/resolver/gem_resolver/dependency_spec.rb
|
256
|
+
- test/resolver/gem_resolver/gem_source_spec.rb
|
257
|
+
- test/resolver/gem_resolver/graph_spec.rb
|
258
|
+
- test/resolver/gem_resolver/solver_spec.rb
|
259
|
+
- test/resolver/gem_resolver/source_spec.rb
|
260
|
+
- test/resolver/gem_resolver_spec.rb
|
299
261
|
- test/resolver/jar_resolver_spec.rb
|
300
262
|
- test/resolver_spec.rb
|
data/lib/doubleshot/jar.rb
DELETED
@@ -1,62 +0,0 @@
|
|
1
|
-
require "pathname"
|
2
|
-
|
3
|
-
gemfile = Pathname "Gemfile"
|
4
|
-
gemfile_lock = Pathname "Gemfile.lock"
|
5
|
-
|
6
|
-
install_gems = -> do
|
7
|
-
require "bundler"
|
8
|
-
require "bundler/cli"
|
9
|
-
Bundler::CLI.new.install
|
10
|
-
end
|
11
|
-
|
12
|
-
if gemfile.exist?
|
13
|
-
begin
|
14
|
-
install_gems.call if !gemfile_lock.exist? || gemfile.mtime > gemfile_lock.mtime
|
15
|
-
require "bundler/setup"
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
install_jars = -> do
|
20
|
-
require "jbundler/cli"
|
21
|
-
JBundler::Cli.new.install
|
22
|
-
end
|
23
|
-
|
24
|
-
jarfile = Pathname "Jarfile"
|
25
|
-
jarfile_lock = Pathname "Jarfile.lock"
|
26
|
-
|
27
|
-
if jarfile.exist?
|
28
|
-
require "bundler" unless Object::const_defined?("Bundler")
|
29
|
-
require "jbundler"
|
30
|
-
install_jars.call if !jarfile_lock.exist? || jarfile.mtime > jarfile_lock.mtime
|
31
|
-
end
|
32
|
-
|
33
|
-
require "ant"
|
34
|
-
|
35
|
-
source = Pathname "ext/java"
|
36
|
-
target = Pathname "target"
|
37
|
-
|
38
|
-
target.mkdir unless target.exist?
|
39
|
-
|
40
|
-
ant.path id: "classpath" do
|
41
|
-
fileset dir: "target"
|
42
|
-
["ext/java"].each do |jar|
|
43
|
-
fileset dir: Pathname(jar).dirname
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
ant.path id: "classpath" do
|
48
|
-
fileset dir: target.to_s
|
49
|
-
JBUNDLER_CLASSPATH.each do |jar|
|
50
|
-
fileset dir: Pathname(jar).dirname
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
ant.javac srcdir: source.to_s, destdir: target.to_s, debug: "yes", includeantruntime: "no", classpathref: "classpath"
|
55
|
-
|
56
|
-
$CLASSPATH << target.to_s
|
57
|
-
|
58
|
-
ant.jar jarfile: "example.jar", basedir: target.to_s do
|
59
|
-
@config.runtime.jars.each do |jar|
|
60
|
-
ant.zipgroupfileset dir: jar.path.dirname, includes: jar.path.to_s
|
61
|
-
end
|
62
|
-
end
|