doubleshot 0.1.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. data/Doubleshot +33 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.textile +208 -0
  4. data/bin/doubleshot +7 -0
  5. data/ext/java/Empty.java +0 -0
  6. data/lib/doubleshot.rb +37 -0
  7. data/lib/doubleshot/cli.rb +84 -0
  8. data/lib/doubleshot/cli/options.rb +34 -0
  9. data/lib/doubleshot/commands/build.rb +34 -0
  10. data/lib/doubleshot/commands/gem.rb +39 -0
  11. data/lib/doubleshot/commands/init.rb +129 -0
  12. data/lib/doubleshot/commands/install.rb +35 -0
  13. data/lib/doubleshot/commands/jar.rb +7 -0
  14. data/lib/doubleshot/commands/test.rb +119 -0
  15. data/lib/doubleshot/compiler.rb +47 -0
  16. data/lib/doubleshot/configuration.rb +361 -0
  17. data/lib/doubleshot/configuration/source_locations.rb +59 -0
  18. data/lib/doubleshot/dependencies.rb +31 -0
  19. data/lib/doubleshot/dependencies/dependency.rb +38 -0
  20. data/lib/doubleshot/dependencies/dependency_list.rb +60 -0
  21. data/lib/doubleshot/dependencies/gem_dependency.rb +8 -0
  22. data/lib/doubleshot/dependencies/gem_dependency_list.rb +10 -0
  23. data/lib/doubleshot/dependencies/jar_dependency.rb +8 -0
  24. data/lib/doubleshot/dependencies/jar_dependency_list.rb +10 -0
  25. data/lib/doubleshot/jar.rb +51 -0
  26. data/lib/doubleshot/readonly_collection.rb +32 -0
  27. data/lib/doubleshot/setup.rb +49 -0
  28. data/lib/ruby/blank.rb +132 -0
  29. data/lib/ruby/gem/requirement.rb +5 -0
  30. data/lib/ruby/kernel.rb +8 -0
  31. data/lib/ruby/pathname.rb +11 -0
  32. data/lib/ruby/string.rb +42 -0
  33. data/lib/ruby/time.rb +8 -0
  34. data/test/compiler_spec.rb +44 -0
  35. data/test/configuration/source_locations_spec.rb +98 -0
  36. data/test/configuration_spec.rb +295 -0
  37. data/test/dependencies/dependency_list_spec.rb +73 -0
  38. data/test/dependencies/dependency_spec.rb +49 -0
  39. data/test/dependencies/gem_dependency_list_spec.rb +7 -0
  40. data/test/dependencies/gem_dependency_spec.rb +7 -0
  41. data/test/dependencies/jar_dependency_list_spec.rb +7 -0
  42. data/test/dependencies/jar_dependency_spec.rb +7 -0
  43. data/test/dependencies_spec.rb +42 -0
  44. data/test/doubleshot_spec.rb +51 -0
  45. data/test/helper.rb +18 -0
  46. data/test/readonly_collection_spec.rb +45 -0
  47. metadata +300 -0
@@ -0,0 +1,73 @@
1
+ #!/usr/bin/env jruby
2
+
3
+ require_relative "../helper"
4
+
5
+ describe Doubleshot::Dependencies::DependencyList do
6
+
7
+ before do
8
+ @list = Doubleshot::Dependencies::DependencyList.new
9
+ @dependency = Doubleshot::Dependencies::Dependency.new "listen"
10
+ end
11
+
12
+ it "must be Enumerable" do
13
+ @list.must_be_kind_of Enumerable
14
+ end
15
+
16
+ describe "add" do
17
+ it "must only accept Dependency instances" do
18
+ assert_raises(ArgumentError) do
19
+ @list.add(Object.new)
20
+ end
21
+ end
22
+
23
+ it "must include an added dependency" do
24
+ @list.add @dependency
25
+ @list.must_include @dependency
26
+ end
27
+
28
+ it "must not add duplicate dependencies" do
29
+ @list.add @dependency
30
+ @list.add @dependency
31
+ @list.size.must_equal 1
32
+ end
33
+
34
+ it "must always return self for chainability" do
35
+ @list.add(@dependency).must_equal @list
36
+ end
37
+ end
38
+
39
+ describe "fetch" do
40
+ it "must find matching dependencies by name" do
41
+ @list.add @dependency
42
+ @list.fetch("listen").must_equal @dependency
43
+ end
44
+
45
+ it "must always return a dependency" do
46
+ @list.fetch("example").must_be_kind_of Doubleshot::Dependencies::Dependency
47
+ end
48
+ end
49
+
50
+ describe "equality" do
51
+ before do
52
+ @other = Doubleshot::Dependencies::DependencyList.new
53
+ @other_dependency = Doubleshot::Dependencies::Dependency.new "listen"
54
+ end
55
+
56
+ it "must be equal if both are empty" do
57
+ @list.must_be :==, @other
58
+ end
59
+
60
+ it "must be equal if other list have equal dependencies" do
61
+ @list.add @dependency
62
+ @other.add @other_dependency
63
+
64
+ @list.must_be :==, @other
65
+ end
66
+
67
+ it "wont be equal" do
68
+ @list.add @dependency
69
+ @list.wont_be :==, @other
70
+ end
71
+ end
72
+
73
+ end
@@ -0,0 +1,49 @@
1
+ #!/usr/bin/env jruby
2
+
3
+ require_relative "../helper"
4
+
5
+ describe Doubleshot::Dependencies::Dependency do
6
+
7
+ before do
8
+ @dependency = Doubleshot::Dependencies::Dependency.new "listen"
9
+ @other = Doubleshot::Dependencies::Dependency.new "listen"
10
+ end
11
+
12
+ describe "add_requirement" do
13
+ it "must return a Gem::Requirement object" do
14
+ @dependency.add_requirement("1.0").must_be_kind_of Gem::Requirement
15
+ end
16
+
17
+ it "must not duplicate requirements" do
18
+ @dependency.add_requirement("2.0")
19
+ @dependency.add_requirement("2.0")
20
+ @dependency.requirements.size.must_equal 1
21
+ end
22
+ end
23
+
24
+ describe "Hash contract" do
25
+
26
+ # Dependency#name must be immutable since
27
+ # we're using it in Set.
28
+ it "won't respond_to name=" do
29
+ @dependency.wont_respond_to :name=
30
+ end
31
+
32
+ it "must have equal hash codes for the same name" do
33
+ @dependency.hash.must_equal @other.hash
34
+ end
35
+
36
+ it "must be equal if names are equal" do
37
+ @dependency.must_be :eql?, @other
38
+ end
39
+ end
40
+
41
+ describe "equality" do
42
+
43
+ it "must override the equality operator to consider requirements" do
44
+ @dependency.must_be :==, @other
45
+ @other.add_requirement ">= 0.1.0"
46
+ @dependency.wont_be :==, @other
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env jruby
2
+
3
+ require_relative "../helper"
4
+
5
+ describe Doubleshot::Dependencies::GemDependencyList do
6
+
7
+ end
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative "../helper"
4
+
5
+ describe Doubleshot::Dependencies::GemDependency do
6
+
7
+ end
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env jruby
2
+
3
+ require_relative "../helper"
4
+
5
+ describe Doubleshot::Dependencies::JarDependencyList do
6
+
7
+ end
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative "../helper"
4
+
5
+ describe Doubleshot::Dependencies::JarDependency do
6
+
7
+ end
@@ -0,0 +1,42 @@
1
+ #!/usr/bin/env jruby
2
+
3
+ require_relative "helper"
4
+
5
+ describe Doubleshot::Dependencies do
6
+
7
+ before do
8
+ @dependencies = Doubleshot::Dependencies.new
9
+ end
10
+
11
+ describe "gems" do
12
+ it "must be a DependencyList" do
13
+ @dependencies.gems.must_be_kind_of Doubleshot::Dependencies::DependencyList
14
+ end
15
+ end
16
+
17
+ describe "jars" do
18
+ it "must be a DependencyList" do
19
+ @dependencies.jars.must_be_kind_of Doubleshot::Dependencies::DependencyList
20
+ end
21
+ end
22
+
23
+ describe "equality" do
24
+ before do
25
+ @other = Doubleshot::Dependencies.new
26
+
27
+ # NOTE: #fetch will add the dependency if it does
28
+ # not yet exist in the List.
29
+ @dependencies.gems.fetch "listen"
30
+ @dependencies.jars.fetch "jetty"
31
+ end
32
+
33
+ it "must equal if their DependencyLists are equal" do
34
+ @dependencies.wont_equal @other
35
+
36
+ @other.gems.fetch "listen"
37
+ @other.jars.fetch "jetty"
38
+
39
+ @dependencies.must_equal @other
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,51 @@
1
+ #!/usr/bin/env jruby
2
+
3
+ require_relative "helper.rb"
4
+
5
+ describe Doubleshot do
6
+
7
+ describe "configuration" do
8
+ it "must pass a Configuration object to the block" do
9
+ called = false
10
+ Doubleshot.new do |config|
11
+ called = true
12
+ config.must_be_kind_of Doubleshot::Configuration
13
+ end
14
+ assert called, "block not called"
15
+ end
16
+ end
17
+
18
+ it "must generate a valid gemspec" do
19
+ gemspec = Doubleshot.new do |config|
20
+ config.gemspec do |spec|
21
+ spec.name = "doubleshot"
22
+ spec.summary = "Build, Dependencies and Testing all in one!"
23
+ spec.description = "Description"
24
+ spec.author = "Sam Smoot"
25
+ spec.homepage = "https://github.com/sam/doubleshot"
26
+ spec.email = "ssmoot@gmail.com"
27
+ spec.version = "1.0"
28
+ spec.license = "MIT-LICENSE"
29
+ spec.executables = [ "doubleshot" ]
30
+ end
31
+ end.build_gemspec
32
+
33
+ eval(gemspec).validate
34
+ end
35
+
36
+ describe "current" do
37
+ it "must be a kind of Doubleshot" do
38
+ Doubleshot::current.must_be_kind_of Doubleshot
39
+ end
40
+
41
+ it "must read a sampling of values correctly" do
42
+ config = Doubleshot::current.config
43
+ config.gemspec.name.must_equal "doubleshot"
44
+ config.source.ruby.to_s.must_equal "lib"
45
+ config.target.to_s.must_equal "target"
46
+ end
47
+ end
48
+
49
+
50
+
51
+ end
data/test/helper.rb ADDED
@@ -0,0 +1,18 @@
1
+ require_relative "../lib/doubleshot"
2
+
3
+ require "minitest/autorun"
4
+ require "minitest/pride"
5
+ require "minitest/wscolor"
6
+
7
+ module Helper
8
+ def self.tmp(path = "tmp")
9
+ dir = Pathname(path.to_s)
10
+ dir.rmtree if dir.exist?
11
+ dir.mkpath
12
+
13
+ yield dir
14
+
15
+ ensure
16
+ dir.rmtree if dir.exist?
17
+ end
18
+ end
@@ -0,0 +1,45 @@
1
+ #!/usr/bin/env jruby
2
+
3
+ require_relative "helper"
4
+
5
+ describe Doubleshot::ReadonlyCollection do
6
+
7
+ before do
8
+ @test_set = Set.new
9
+ @test_set << "test string"
10
+ @readonly_collection = Doubleshot::ReadonlyCollection.new(@test_set)
11
+ end
12
+
13
+ it "should accept only Enumerables during initialization" do
14
+ assert_raises(ArgumentError) do
15
+ Doubleshot::ReadonlyCollection.new(Object.new)
16
+ end
17
+ end
18
+
19
+ describe "empty?" do
20
+ it "must be empty" do
21
+ Doubleshot::ReadonlyCollection.new([]).must_be :empty?
22
+ end
23
+
24
+ it "wont be empty" do
25
+ @readonly_collection.wont_be :empty?
26
+ end
27
+ end
28
+
29
+ describe "equality" do
30
+
31
+ before do
32
+ @other_test_set = Set.new
33
+ @other_test_set << "test string"
34
+ @other_readonly_collection = Doubleshot::ReadonlyCollection.new(@other_test_set)
35
+ end
36
+
37
+ it "must have semantic equality" do
38
+ @readonly_collection.must_be :eql?, @other_readonly_collection
39
+ end
40
+
41
+ it "must override the equality operator to consider requirements" do
42
+ @readonly_collection.must_be :==, @other_readonly_collection
43
+ end
44
+ end
45
+ end
metadata ADDED
@@ -0,0 +1,300 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: doubleshot
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.1.0
6
+ platform: java
7
+ authors:
8
+ - Sam Smoot
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-10-02 00:00:00.000000000 Z
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: jbundler
34
+ version_requirements: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - ! '>='
37
+ - !ruby/object:Gem::Version
38
+ version: !binary |-
39
+ MA==
40
+ none: false
41
+ requirement: !ruby/object:Gem::Requirement
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: !binary |-
46
+ MA==
47
+ none: false
48
+ prerelease: false
49
+ type: :runtime
50
+ - !ruby/object:Gem::Dependency
51
+ name: rdoc
52
+ version_requirements: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ! '>='
55
+ - !ruby/object:Gem::Version
56
+ version: 2.4.2
57
+ none: false
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ! '>='
61
+ - !ruby/object:Gem::Version
62
+ version: 2.4.2
63
+ none: false
64
+ prerelease: false
65
+ type: :runtime
66
+ - !ruby/object:Gem::Dependency
67
+ name: perfer
68
+ version_requirements: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - ! '>='
71
+ - !ruby/object:Gem::Version
72
+ version: !binary |-
73
+ MA==
74
+ none: false
75
+ requirement: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ! '>='
78
+ - !ruby/object:Gem::Version
79
+ version: !binary |-
80
+ MA==
81
+ none: false
82
+ prerelease: false
83
+ type: :runtime
84
+ - !ruby/object:Gem::Dependency
85
+ name: minitest
86
+ version_requirements: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ! '>='
89
+ - !ruby/object:Gem::Version
90
+ version: 3.0.1
91
+ none: false
92
+ requirement: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ! '>='
95
+ - !ruby/object:Gem::Version
96
+ version: 3.0.1
97
+ none: false
98
+ prerelease: false
99
+ type: :runtime
100
+ - !ruby/object:Gem::Dependency
101
+ name: minitest-wscolor
102
+ version_requirements: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - ! '>='
105
+ - !ruby/object:Gem::Version
106
+ version: !binary |-
107
+ MA==
108
+ none: false
109
+ requirement: !ruby/object:Gem::Requirement
110
+ requirements:
111
+ - - ! '>='
112
+ - !ruby/object:Gem::Version
113
+ version: !binary |-
114
+ MA==
115
+ none: false
116
+ prerelease: false
117
+ type: :runtime
118
+ - !ruby/object:Gem::Dependency
119
+ name: listen
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ! '>='
123
+ - !ruby/object:Gem::Version
124
+ version: !binary |-
125
+ MA==
126
+ none: false
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ! '>='
130
+ - !ruby/object:Gem::Version
131
+ version: !binary |-
132
+ MA==
133
+ none: false
134
+ prerelease: false
135
+ type: :runtime
136
+ - !ruby/object:Gem::Dependency
137
+ name: rb-fsevent
138
+ version_requirements: !ruby/object:Gem::Requirement
139
+ requirements:
140
+ - - ~>
141
+ - !ruby/object:Gem::Version
142
+ version: 0.9.1
143
+ none: false
144
+ requirement: !ruby/object:Gem::Requirement
145
+ requirements:
146
+ - - ~>
147
+ - !ruby/object:Gem::Version
148
+ version: 0.9.1
149
+ none: false
150
+ prerelease: false
151
+ type: :runtime
152
+ - !ruby/object:Gem::Dependency
153
+ name: simplecov
154
+ version_requirements: !ruby/object:Gem::Requirement
155
+ requirements:
156
+ - - ! '>='
157
+ - !ruby/object:Gem::Version
158
+ version: !binary |-
159
+ MA==
160
+ none: false
161
+ requirement: !ruby/object:Gem::Requirement
162
+ requirements:
163
+ - - ! '>='
164
+ - !ruby/object:Gem::Version
165
+ version: !binary |-
166
+ MA==
167
+ none: false
168
+ prerelease: false
169
+ type: :runtime
170
+ - !ruby/object:Gem::Dependency
171
+ name: doubleshot
172
+ version_requirements: !ruby/object:Gem::Requirement
173
+ requirements:
174
+ - - ! '>='
175
+ - !ruby/object:Gem::Version
176
+ version: !binary |-
177
+ MA==
178
+ none: false
179
+ requirement: !ruby/object:Gem::Requirement
180
+ requirements:
181
+ - - ! '>='
182
+ - !ruby/object:Gem::Version
183
+ version: !binary |-
184
+ MA==
185
+ none: false
186
+ prerelease: false
187
+ type: :development
188
+ description: ! 'Doubleshot will download dependencies on demand, compile your Java
189
+ sources and
190
+
191
+ let you spend most of your time in Ruby without having to juggle two different
192
+
193
+ dependency management tools, different build tools and being forced to execute
194
+
195
+ your code through Rake or Maven based tools.
196
+
197
+ '
198
+ email: ssmoot@gmail.com
199
+ executables:
200
+ - doubleshot
201
+ extensions: []
202
+ extra_rdoc_files: []
203
+ files:
204
+ - test/compiler_spec.rb
205
+ - test/configuration/source_locations_spec.rb
206
+ - test/configuration_spec.rb
207
+ - test/dependencies/dependency_list_spec.rb
208
+ - test/dependencies/dependency_spec.rb
209
+ - test/dependencies/gem_dependency_list_spec.rb
210
+ - test/dependencies/gem_dependency_spec.rb
211
+ - test/dependencies/jar_dependency_list_spec.rb
212
+ - test/dependencies/jar_dependency_spec.rb
213
+ - test/dependencies_spec.rb
214
+ - test/doubleshot_spec.rb
215
+ - test/helper.rb
216
+ - test/readonly_collection_spec.rb
217
+ - bin/doubleshot
218
+ - !binary |-
219
+ RG91Ymxlc2hvdA==
220
+ - !binary |-
221
+ TUlULUxJQ0VOU0U=
222
+ - !binary |-
223
+ UkVBRE1FLnRleHRpbGU=
224
+ - lib/doubleshot/cli/options.rb
225
+ - lib/doubleshot/cli.rb
226
+ - lib/doubleshot/commands/build.rb
227
+ - lib/doubleshot/commands/gem.rb
228
+ - lib/doubleshot/commands/init.rb
229
+ - lib/doubleshot/commands/install.rb
230
+ - lib/doubleshot/commands/jar.rb
231
+ - lib/doubleshot/commands/test.rb
232
+ - lib/doubleshot/compiler.rb
233
+ - lib/doubleshot/configuration/source_locations.rb
234
+ - lib/doubleshot/configuration.rb
235
+ - lib/doubleshot/dependencies/dependency.rb
236
+ - lib/doubleshot/dependencies/dependency_list.rb
237
+ - lib/doubleshot/dependencies/gem_dependency.rb
238
+ - lib/doubleshot/dependencies/gem_dependency_list.rb
239
+ - lib/doubleshot/dependencies/jar_dependency.rb
240
+ - lib/doubleshot/dependencies/jar_dependency_list.rb
241
+ - lib/doubleshot/dependencies.rb
242
+ - lib/doubleshot/jar.rb
243
+ - lib/doubleshot/readonly_collection.rb
244
+ - lib/doubleshot/setup.rb
245
+ - lib/doubleshot.rb
246
+ - lib/ruby/blank.rb
247
+ - lib/ruby/gem/requirement.rb
248
+ - lib/ruby/kernel.rb
249
+ - lib/ruby/pathname.rb
250
+ - lib/ruby/string.rb
251
+ - lib/ruby/time.rb
252
+ - ext/java/Empty.java
253
+ homepage: https://github.com/sam/doubleshot
254
+ licenses:
255
+ - MIT-LICENSE
256
+ post_install_message:
257
+ rdoc_options:
258
+ - --line-numbers
259
+ - --main
260
+ - README.textile
261
+ - --title
262
+ - doubleshot Documentation
263
+ - lib
264
+ - README.textile
265
+ require_paths:
266
+ - lib
267
+ required_ruby_version: !ruby/object:Gem::Requirement
268
+ requirements:
269
+ - - ! '>='
270
+ - !ruby/object:Gem::Version
271
+ version: !binary |-
272
+ MA==
273
+ none: false
274
+ required_rubygems_version: !ruby/object:Gem::Requirement
275
+ requirements:
276
+ - - ! '>='
277
+ - !ruby/object:Gem::Version
278
+ version: !binary |-
279
+ MA==
280
+ none: false
281
+ requirements: []
282
+ rubyforge_project:
283
+ rubygems_version: 1.8.24
284
+ signing_key:
285
+ specification_version: 3
286
+ summary: Doubleshot is a build and dependency tool for mixed Java and Ruby projects
287
+ test_files:
288
+ - test/compiler_spec.rb
289
+ - test/configuration/source_locations_spec.rb
290
+ - test/configuration_spec.rb
291
+ - test/dependencies/dependency_list_spec.rb
292
+ - test/dependencies/dependency_spec.rb
293
+ - test/dependencies/gem_dependency_list_spec.rb
294
+ - test/dependencies/gem_dependency_spec.rb
295
+ - test/dependencies/jar_dependency_list_spec.rb
296
+ - test/dependencies/jar_dependency_spec.rb
297
+ - test/dependencies_spec.rb
298
+ - test/doubleshot_spec.rb
299
+ - test/helper.rb
300
+ - test/readonly_collection_spec.rb