lock_jar 0.13.0 → 0.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.codeclimate.yml +16 -0
- data/.rubocop.yml +28 -0
- data/.travis.yml +12 -1
- data/Gemfile +6 -3
- data/Guardfile +2 -3
- data/README.md +17 -16
- data/Rakefile +11 -7
- data/lib/lock_jar/buildr.rb +95 -89
- data/lib/lock_jar/bundler.rb +85 -84
- data/lib/lock_jar/class_loader.rb +19 -21
- data/lib/lock_jar/cli.rb +32 -25
- data/lib/lock_jar/domain/artifact.rb +39 -45
- data/lib/lock_jar/domain/dsl.rb +50 -79
- data/lib/lock_jar/domain/dsl_merger.rb +76 -0
- data/lib/lock_jar/domain/gem_dsl.rb +10 -12
- data/lib/lock_jar/domain/jarfile_dsl.rb +6 -18
- data/lib/lock_jar/domain/lockfile.rb +17 -24
- data/lib/lock_jar/logging.rb +4 -3
- data/lib/lock_jar/maven.rb +29 -29
- data/lib/lock_jar/registry.rb +52 -60
- data/lib/lock_jar/resolver.rb +17 -20
- data/lib/lock_jar/runtime/install.rb +28 -0
- data/lib/lock_jar/runtime/list.rb +55 -0
- data/lib/lock_jar/runtime/load.rb +54 -0
- data/lib/lock_jar/runtime/lock.rb +152 -0
- data/lib/lock_jar/runtime.rb +30 -302
- data/lib/lock_jar/version.rb +2 -1
- data/lib/lock_jar.rb +137 -105
- data/lock_jar.gemspec +7 -4
- data/spec/fixtures/jarfile_gem/Gemfile +4 -0
- data/spec/fixtures/jarfile_gem/Jarfile +1 -0
- data/spec/fixtures/jarfile_gem/jarfile_gem.gemspec +23 -0
- data/spec/fixtures/jarfile_gem/lib/jarfile_gem/version.rb +3 -0
- data/spec/fixtures/jarfile_gem/lib/jarfile_gem.rb +5 -0
- data/spec/lock_jar/bundler_spec.rb +27 -0
- data/spec/lock_jar/class_loader_spec.rb +34 -36
- data/spec/lock_jar/cli_spec.rb +39 -46
- data/spec/lock_jar/domain/dsl_merger_spec.rb +49 -0
- data/spec/lock_jar/domain/dsl_spec.rb +35 -37
- data/spec/lock_jar/domain/gem_dsl_spec.rb +18 -0
- data/spec/lock_jar/maven_spec.rb +9 -11
- data/spec/lock_jar/resolver_spec.rb +16 -17
- data/spec/lock_jar/runtime_spec.rb +17 -13
- data/spec/lock_jar_spec.rb +255 -195
- data/spec/spec_helper.rb +13 -8
- data/spec/support/helper.rb +13 -5
- data/spec/support/shared_examples/lockfile.rb +4 -6
- metadata +43 -19
- data/bundler/Gemfile +0 -21
- data/bundler/LICENSE.txt +0 -22
- data/bundler/README.md +0 -29
- data/bundler/Rakefile +0 -2
- data/bundler/lib/lock_jar_bundler/bundler.rb +0 -35
- data/bundler/lib/lock_jar_bundler/piggy_back.rb +0 -98
- data/bundler/lib/lock_jar_bundler/version.rb +0 -5
- data/bundler/lib/lock_jar_bundler.rb +0 -5
- data/bundler/lock_jar_bundler.gemspec +0 -24
- data/bundler/spec/Jarfile +0 -3
- data/bundler/spec/dummy_gem/Jarfile +0 -1
- data/bundler/spec/dummy_gem/dummy_gem.gemspec +0 -19
- data/bundler/spec/lock_jar_bundler_spec.rb +0 -49
- data/bundler/spec/spec_helper.rb +0 -88
- data/lib/lock_jar/domain/dsl_helper.rb +0 -84
- data/spec/lock_jar/domain/dsl_helper_spec.rb +0 -52
data/spec/spec_helper.rb
CHANGED
@@ -1,8 +1,7 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
$LOAD_PATH.unshift File.expand_path('.')
|
2
|
+
$LOAD_PATH.unshift File.expand_path(File.join('..', File.dirname(__FILE__)))
|
3
|
+
$LOAD_PATH.unshift File.expand_path(File.join('..', File.dirname(__FILE__), 'lib'))
|
4
4
|
|
5
|
-
require 'rubygems'
|
6
5
|
require 'rspec'
|
7
6
|
require 'lock_jar'
|
8
7
|
require 'lock_jar/cli'
|
@@ -10,6 +9,10 @@ require 'stringio'
|
|
10
9
|
require 'fileutils'
|
11
10
|
require 'lock_jar/logging'
|
12
11
|
require 'pry'
|
12
|
+
require 'codeclimate-test-reporter'
|
13
|
+
|
14
|
+
# coverage
|
15
|
+
CodeClimate::TestReporter.start
|
13
16
|
|
14
17
|
# Requires supporting ruby files with custom matchers and macros, etc,
|
15
18
|
# in spec/support/ and its subdirectories.
|
@@ -17,16 +20,18 @@ Dir[File.expand_path('.') + '/spec/support/**/*.rb'].each { |f| require f }
|
|
17
20
|
|
18
21
|
LockJar::Logging.verbose!
|
19
22
|
|
23
|
+
# rubocop:disable Style/GlobalVars
|
20
24
|
def mock_terminal
|
21
25
|
@input = StringIO.new
|
22
26
|
@output = StringIO.new
|
23
27
|
$terminal = HighLine.new @input, @output
|
24
28
|
end
|
29
|
+
# rubocop:enable Style/GlobalVars
|
25
30
|
|
26
|
-
TEMP_DIR = File.expand_path(File.join(File.dirname(__FILE__),
|
27
|
-
TEST_REPO = File.expand_path(File.join(TEMP_DIR,
|
28
|
-
PARAM_CONFIG = File.expand_path(File.join(TEMP_DIR,
|
29
|
-
DSL_CONFIG = File.expand_path(File.join(TEMP_DIR,
|
31
|
+
TEMP_DIR = File.expand_path(File.join(File.dirname(__FILE__), '..', 'tmp'))
|
32
|
+
TEST_REPO = File.expand_path(File.join(TEMP_DIR, 'test-repo-install'))
|
33
|
+
PARAM_CONFIG = File.expand_path(File.join(TEMP_DIR, 'param_config'))
|
34
|
+
DSL_CONFIG = File.expand_path(File.join(TEMP_DIR, 'dsl_config'))
|
30
35
|
|
31
36
|
RSpec.configure do |config|
|
32
37
|
config.order = 'default'
|
data/spec/support/helper.rb
CHANGED
@@ -3,7 +3,11 @@ require 'pathname'
|
|
3
3
|
|
4
4
|
module Spec
|
5
5
|
module Helpers
|
6
|
-
def
|
6
|
+
def remove_file(path)
|
7
|
+
FileUtils.rm(path) if File.exist? path
|
8
|
+
end
|
9
|
+
|
10
|
+
def lockjar(cmd, _options = {})
|
7
11
|
lockjar_bin = File.expand_path('../../../bin/lockjar', __FILE__)
|
8
12
|
cmd = "ruby -I#{lib} #{lockjar_bin} #{cmd}"
|
9
13
|
|
@@ -14,9 +18,12 @@ module Spec
|
|
14
18
|
File.expand_path('../../../lib', __FILE__)
|
15
19
|
end
|
16
20
|
|
21
|
+
# rubocop:disable Style/GlobalVars
|
17
22
|
def sys_exec(cmd, expect_err = false)
|
18
23
|
Open3.popen3(cmd.to_s) do |stdin, stdout, stderr|
|
19
|
-
@in_p
|
24
|
+
@in_p = stdin
|
25
|
+
@out_p = stdout
|
26
|
+
@err_p = stderr
|
20
27
|
|
21
28
|
yield @in_p if block_given?
|
22
29
|
@in_p.close
|
@@ -28,17 +35,18 @@ module Spec
|
|
28
35
|
puts @err unless expect_err || @err.empty? || !$show_err
|
29
36
|
@out
|
30
37
|
end
|
38
|
+
# rubocop:enable Style/GlobalVars
|
31
39
|
|
32
40
|
def install_jarfile(*args)
|
33
|
-
root_path ||= Pathname.new(File.expand_path(
|
34
|
-
jarfile_path = root_path.join(
|
41
|
+
root_path ||= Pathname.new(File.expand_path('../../..', __FILE__))
|
42
|
+
jarfile_path = root_path.join('Jarfile')
|
35
43
|
File.open(jarfile_path.to_s, 'w') do |f|
|
36
44
|
f.puts args.last
|
37
45
|
end
|
38
46
|
end
|
39
47
|
|
40
48
|
def is_jruby?
|
41
|
-
defined?(RUBY_ENGINE) && (RUBY_ENGINE ==
|
49
|
+
defined?(RUBY_ENGINE) && (RUBY_ENGINE == 'jruby')
|
42
50
|
end
|
43
51
|
end
|
44
52
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
shared_examples
|
3
|
+
shared_examples 'a lockfile' do
|
4
4
|
let(:lockfile_hash) { lockfile.to_h }
|
5
5
|
|
6
6
|
it 'should have a version' do
|
@@ -15,18 +15,16 @@ shared_examples "a lockfile" do
|
|
15
15
|
|
16
16
|
it 'should have a local repository' do
|
17
17
|
if respond_to? :expected_local_repository
|
18
|
-
lockfile_hash['local_repository'].
|
18
|
+
expect(lockfile_hash['local_repository']).to(eql(expected_local_repository))
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
22
|
it 'should have a maps' do
|
23
|
-
if respond_to? :expected_map
|
24
|
-
lockfile_hash['maps'].should eql expected_map
|
25
|
-
end
|
23
|
+
expect(lockfile_hash['maps']).to(eql(expected_map)) if respond_to? :expected_map
|
26
24
|
end
|
27
25
|
|
28
26
|
it 'should have remote repositories' do
|
29
|
-
lockfile_hash[
|
27
|
+
lockfile_hash['remote_repositories'].should eql expected_remote_repositories
|
30
28
|
end
|
31
29
|
|
32
30
|
context 'for groups' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lock_jar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.14.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Guymon
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 0.18.1
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ~>
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 2.14.1
|
47
|
+
name: rspec
|
48
|
+
prerelease: false
|
49
|
+
type: :development
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 2.14.1
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
requirement: !ruby/object:Gem::Requirement
|
43
57
|
requirements:
|
@@ -52,7 +66,11 @@ dependencies:
|
|
52
66
|
- - '>='
|
53
67
|
- !ruby/object:Gem::Version
|
54
68
|
version: '0'
|
55
|
-
description:
|
69
|
+
description: |-
|
70
|
+
Manage Jar files for Ruby. In the spirit of Bundler, a Jarfile
|
71
|
+
is used to generate a Jarfile.lock that contains all the resolved jar dependencies
|
72
|
+
for scopes runtime, compile, and test. The Jarfile.lock can be used to populate the
|
73
|
+
classpath
|
56
74
|
email: michael@tobedevoured.com
|
57
75
|
executables:
|
58
76
|
- lockjar
|
@@ -61,7 +79,9 @@ extra_rdoc_files:
|
|
61
79
|
- LICENSE
|
62
80
|
- README.md
|
63
81
|
files:
|
82
|
+
- .codeclimate.yml
|
64
83
|
- .gitignore
|
84
|
+
- .rubocop.yml
|
65
85
|
- .travis.yml
|
66
86
|
- CHANGELOG.md
|
67
87
|
- Gemfile
|
@@ -70,20 +90,6 @@ files:
|
|
70
90
|
- README.md
|
71
91
|
- Rakefile
|
72
92
|
- bin/lockjar
|
73
|
-
- bundler/Gemfile
|
74
|
-
- bundler/LICENSE.txt
|
75
|
-
- bundler/README.md
|
76
|
-
- bundler/Rakefile
|
77
|
-
- bundler/lib/lock_jar_bundler.rb
|
78
|
-
- bundler/lib/lock_jar_bundler/bundler.rb
|
79
|
-
- bundler/lib/lock_jar_bundler/piggy_back.rb
|
80
|
-
- bundler/lib/lock_jar_bundler/version.rb
|
81
|
-
- bundler/lock_jar_bundler.gemspec
|
82
|
-
- bundler/spec/Jarfile
|
83
|
-
- bundler/spec/dummy_gem/Jarfile
|
84
|
-
- bundler/spec/dummy_gem/dummy_gem.gemspec
|
85
|
-
- bundler/spec/lock_jar_bundler_spec.rb
|
86
|
-
- bundler/spec/spec_helper.rb
|
87
93
|
- lib/lock_jar.rb
|
88
94
|
- lib/lock_jar/buildr.rb
|
89
95
|
- lib/lock_jar/bundler.rb
|
@@ -91,7 +97,7 @@ files:
|
|
91
97
|
- lib/lock_jar/cli.rb
|
92
98
|
- lib/lock_jar/domain/artifact.rb
|
93
99
|
- lib/lock_jar/domain/dsl.rb
|
94
|
-
- lib/lock_jar/domain/
|
100
|
+
- lib/lock_jar/domain/dsl_merger.rb
|
95
101
|
- lib/lock_jar/domain/gem_dsl.rb
|
96
102
|
- lib/lock_jar/domain/jarfile_dsl.rb
|
97
103
|
- lib/lock_jar/domain/lockfile.rb
|
@@ -100,15 +106,26 @@ files:
|
|
100
106
|
- lib/lock_jar/registry.rb
|
101
107
|
- lib/lock_jar/resolver.rb
|
102
108
|
- lib/lock_jar/runtime.rb
|
109
|
+
- lib/lock_jar/runtime/install.rb
|
110
|
+
- lib/lock_jar/runtime/list.rb
|
111
|
+
- lib/lock_jar/runtime/load.rb
|
112
|
+
- lib/lock_jar/runtime/lock.rb
|
103
113
|
- lib/lock_jar/version.rb
|
104
114
|
- lock_jar.gemspec
|
105
115
|
- spec/fixtures/Jarfile
|
106
116
|
- spec/fixtures/Jarfile2
|
117
|
+
- spec/fixtures/jarfile_gem/Gemfile
|
118
|
+
- spec/fixtures/jarfile_gem/Jarfile
|
119
|
+
- spec/fixtures/jarfile_gem/jarfile_gem.gemspec
|
120
|
+
- spec/fixtures/jarfile_gem/lib/jarfile_gem.rb
|
121
|
+
- spec/fixtures/jarfile_gem/lib/jarfile_gem/version.rb
|
107
122
|
- spec/fixtures/naether-0.13.0.jar
|
123
|
+
- spec/lock_jar/bundler_spec.rb
|
108
124
|
- spec/lock_jar/class_loader_spec.rb
|
109
125
|
- spec/lock_jar/cli_spec.rb
|
110
|
-
- spec/lock_jar/domain/
|
126
|
+
- spec/lock_jar/domain/dsl_merger_spec.rb
|
111
127
|
- spec/lock_jar/domain/dsl_spec.rb
|
128
|
+
- spec/lock_jar/domain/gem_dsl_spec.rb
|
112
129
|
- spec/lock_jar/maven_spec.rb
|
113
130
|
- spec/lock_jar/resolver_spec.rb
|
114
131
|
- spec/lock_jar/runtime_spec.rb
|
@@ -145,11 +162,18 @@ summary: Manage Jar files for Ruby
|
|
145
162
|
test_files:
|
146
163
|
- spec/fixtures/Jarfile
|
147
164
|
- spec/fixtures/Jarfile2
|
165
|
+
- spec/fixtures/jarfile_gem/Gemfile
|
166
|
+
- spec/fixtures/jarfile_gem/Jarfile
|
167
|
+
- spec/fixtures/jarfile_gem/jarfile_gem.gemspec
|
168
|
+
- spec/fixtures/jarfile_gem/lib/jarfile_gem.rb
|
169
|
+
- spec/fixtures/jarfile_gem/lib/jarfile_gem/version.rb
|
148
170
|
- spec/fixtures/naether-0.13.0.jar
|
171
|
+
- spec/lock_jar/bundler_spec.rb
|
149
172
|
- spec/lock_jar/class_loader_spec.rb
|
150
173
|
- spec/lock_jar/cli_spec.rb
|
151
|
-
- spec/lock_jar/domain/
|
174
|
+
- spec/lock_jar/domain/dsl_merger_spec.rb
|
152
175
|
- spec/lock_jar/domain/dsl_spec.rb
|
176
|
+
- spec/lock_jar/domain/gem_dsl_spec.rb
|
153
177
|
- spec/lock_jar/maven_spec.rb
|
154
178
|
- spec/lock_jar/resolver_spec.rb
|
155
179
|
- spec/lock_jar/runtime_spec.rb
|
data/bundler/Gemfile
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
source 'https://rubygems.org'
|
2
|
-
|
3
|
-
# Specify your gem's dependencies in lock_jar_bundler.gemspec
|
4
|
-
gemspec
|
5
|
-
|
6
|
-
group :development do
|
7
|
-
gem 'guard-rspec', :require => false
|
8
|
-
gem 'pry'
|
9
|
-
gem 'yard'
|
10
|
-
gem 'jruby-openssl', :platforms => :jruby
|
11
|
-
gem 'rspec', '~>3.0.0'
|
12
|
-
gem 'lock_jar', path: '../core'
|
13
|
-
end
|
14
|
-
|
15
|
-
# Test gems used in the specs when scanning for bundled jarfiles
|
16
|
-
group :test do
|
17
|
-
gem 'dummy_gem', path: 'spec/dummy_gem'
|
18
|
-
end
|
19
|
-
|
20
|
-
|
21
|
-
|
data/bundler/LICENSE.txt
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
Copyright (c) 2014 Michael Guymon
|
2
|
-
|
3
|
-
MIT License
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
-
a copy of this software and associated documentation files (the
|
7
|
-
"Software"), to deal in the Software without restriction, including
|
8
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
-
permit persons to whom the Software is furnished to do so, subject to
|
11
|
-
the following conditions:
|
12
|
-
|
13
|
-
The above copyright notice and this permission notice shall be
|
14
|
-
included in all copies or substantial portions of the Software.
|
15
|
-
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/bundler/README.md
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
# LockJarBundler
|
2
|
-
|
3
|
-
TODO: Write a gem description
|
4
|
-
|
5
|
-
## Installation
|
6
|
-
|
7
|
-
Add this line to your application's Gemfile:
|
8
|
-
|
9
|
-
gem 'lock_jar_bundler'
|
10
|
-
|
11
|
-
And then execute:
|
12
|
-
|
13
|
-
$ bundle
|
14
|
-
|
15
|
-
Or install it yourself as:
|
16
|
-
|
17
|
-
$ gem install lock_jar_bundler
|
18
|
-
|
19
|
-
## Usage
|
20
|
-
|
21
|
-
TODO: Write usage instructions here
|
22
|
-
|
23
|
-
## Contributing
|
24
|
-
|
25
|
-
1. Fork it ( https://github.com/[my-github-username]/lock_jar_bundler/fork )
|
26
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
-
5. Create a new Pull Request
|
data/bundler/Rakefile
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
require 'lock_jar/registry'
|
2
|
-
require 'lock_jar_bundler/version'
|
3
|
-
|
4
|
-
module LockJar
|
5
|
-
|
6
|
-
class Bundler
|
7
|
-
|
8
|
-
def self.bundled_jarfiles(groups=[:default])
|
9
|
-
jarfiles = []
|
10
|
-
|
11
|
-
::Bundler.with_clean_env do
|
12
|
-
::Bundler.setup(groups)
|
13
|
-
definition = ::Bundler.definition
|
14
|
-
|
15
|
-
definition.specs_for(groups).each do |spec|
|
16
|
-
gem_dir = spec.gem_dir
|
17
|
-
|
18
|
-
jarfile = File.join( gem_dir, "Jarfile" )
|
19
|
-
|
20
|
-
# XXX: assert that is a LockJar file
|
21
|
-
|
22
|
-
if File.exists?( jarfile )
|
23
|
-
puts "#{spec.name} has Jarfile for locking"
|
24
|
-
jarfiles << jarfile
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
jarfiles
|
30
|
-
end
|
31
|
-
|
32
|
-
end
|
33
|
-
|
34
|
-
end
|
35
|
-
|
@@ -1,98 +0,0 @@
|
|
1
|
-
module Bundler
|
2
|
-
class << self
|
3
|
-
alias :_lockjar_extended_require :require
|
4
|
-
def require(*groups)
|
5
|
-
LockJar::Bundler.load(*groups)
|
6
|
-
|
7
|
-
LockJar::Bundler.skip_lock = true
|
8
|
-
|
9
|
-
_lockjar_extended_require
|
10
|
-
end
|
11
|
-
|
12
|
-
alias :_lockjar_extended_setup :setup
|
13
|
-
def setup(*groups)
|
14
|
-
LockJar::Bundler.load(*groups)
|
15
|
-
|
16
|
-
LockJar::Bundler.skip_lock = true
|
17
|
-
|
18
|
-
_lockjar_extended_setup
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
class Runtime
|
23
|
-
|
24
|
-
alias :_lockjar_extended_require :require
|
25
|
-
def require(*groups)
|
26
|
-
LockJar::Bundler.load(*groups)
|
27
|
-
|
28
|
-
LockJar::Bundler.skip_lock = true
|
29
|
-
|
30
|
-
_lockjar_extended_require
|
31
|
-
end
|
32
|
-
|
33
|
-
alias :_lockjar_extended_setup :setup
|
34
|
-
def setup(*groups)
|
35
|
-
LockJar::Bundler.load(*groups)
|
36
|
-
|
37
|
-
LockJar::Bundler.skip_lock = true
|
38
|
-
|
39
|
-
_lockjar_extended_setup
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
class Definition
|
44
|
-
alias :_lockjar_extended_to_lock :to_lock
|
45
|
-
def to_lock
|
46
|
-
to_lock = _lockjar_extended_to_lock
|
47
|
-
|
48
|
-
if LockJar::Bundler.skip_lock != true
|
49
|
-
definition = Bundler.definition
|
50
|
-
#if !definition.send( :nothing_changed? )
|
51
|
-
gems_with_jars = []
|
52
|
-
|
53
|
-
# load local Jarfile
|
54
|
-
if File.exists?( 'Jarfile' )
|
55
|
-
dsl = LockJar::Domain::JarfileDsl.create( File.expand_path( 'Jarfile' ) )
|
56
|
-
gems_with_jars << 'jarfile:Jarfile'
|
57
|
-
# Create new Dsl
|
58
|
-
else
|
59
|
-
dsl = LockJar::Domain::Dsl.new
|
60
|
-
end
|
61
|
-
|
62
|
-
definition.groups.each do |group|
|
63
|
-
if ENV["DEBUG"]
|
64
|
-
puts "[LockJar] Group #{group}:"
|
65
|
-
end
|
66
|
-
|
67
|
-
definition.specs_for( [group] ).each do |spec|
|
68
|
-
gem_dir = spec.gem_dir
|
69
|
-
|
70
|
-
jarfile = File.join( gem_dir, "Jarfile" )
|
71
|
-
|
72
|
-
if File.exists?( jarfile )
|
73
|
-
gems_with_jars << "gem:#{spec.name}"
|
74
|
-
|
75
|
-
if ENV["DEBUG"]
|
76
|
-
puts "[LockJar] #{spec.name} has Jarfile"
|
77
|
-
end
|
78
|
-
|
79
|
-
spec_dsl = LockJar::Domain::GemDsl.create( spec, "Jarfile" )
|
80
|
-
|
81
|
-
dsl = LockJar::Domain::DslHelper.merge( dsl, spec_dsl, group.to_s )
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
end
|
86
|
-
|
87
|
-
puts "[LockJar] Locking Jars for: #{gems_with_jars.inspect}"
|
88
|
-
LockJar.lock( dsl )
|
89
|
-
#elsif ENV["DEBUG"]
|
90
|
-
# puts "[LockJar] Locking skiped, Gemfile has not changed"
|
91
|
-
#end
|
92
|
-
end
|
93
|
-
|
94
|
-
to_lock
|
95
|
-
end
|
96
|
-
|
97
|
-
end
|
98
|
-
end
|
@@ -1,24 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'lock_jar_bundler/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = 'lock_jar_bundler'
|
8
|
-
spec.version = LockJar::Bundler::VERSION
|
9
|
-
spec.authors = ['Michael Guymon']
|
10
|
-
spec.email = %w(michael@tobedevoured)
|
11
|
-
spec.summary = 'Manage Jar files for Ruby'
|
12
|
-
spec.description = 'Manage Jar files for Ruby. In the spirit of Bundler, a Jarfile is used to generate a Jarfile.lock that contains all the resolved jar dependencies for scopes runtime, compile, and test. The Jarfile.lock can be used to populate the classpath'
|
13
|
-
spec.homepage = 'http://github.com/mguymon/lock_jar'
|
14
|
-
spec.license = 'Apache'
|
15
|
-
|
16
|
-
spec.files = `git ls-files -z`.split("\x0")
|
17
|
-
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
-
spec.require_paths = ["lib"]
|
20
|
-
|
21
|
-
spec.add_dependency 'lock_jar', '>= 0.8.0'
|
22
|
-
spec.add_dependency 'bundler', '~> 1.6'
|
23
|
-
spec.add_development_dependency 'rake'
|
24
|
-
end
|
data/bundler/spec/Jarfile
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
jar "com.google.guava:guava:14.0.1"
|
@@ -1,19 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
|
3
|
-
Gem::Specification.new do |spec|
|
4
|
-
spec.name = 'dummy_gem'
|
5
|
-
spec.version = 0.1
|
6
|
-
spec.authors = ['Michael Guymon']
|
7
|
-
spec.email = %w(michael@tobedevoured)
|
8
|
-
spec.summary = 'For testing LockJar Bundler support'
|
9
|
-
spec.description = 'For testing LockJar Bundler support'
|
10
|
-
spec.homepage = 'http://github.com/mguymon/lock_jar'
|
11
|
-
spec.license = 'Apache'
|
12
|
-
|
13
|
-
spec.files = []
|
14
|
-
spec.executables = []
|
15
|
-
spec.test_files = []
|
16
|
-
spec.require_paths = ["lib"]
|
17
|
-
|
18
|
-
spec.add_dependency 'json'
|
19
|
-
end
|
@@ -1,49 +0,0 @@
|
|
1
|
-
require File.expand_path(File.join(File.dirname(__FILE__),'spec_helper'))
|
2
|
-
|
3
|
-
require 'lock_jar'
|
4
|
-
require 'lock_jar_bundler'
|
5
|
-
|
6
|
-
describe LockJar::Bundler, "#bundled_jarfiles" do
|
7
|
-
it "should give a list of jarfile paths" do
|
8
|
-
jar_files = LockJar::Bundler.bundled_jarfiles([:test])
|
9
|
-
expect(jar_files).to eql [File.expand_path('spec/dummy_gem/Jarfile')]
|
10
|
-
end
|
11
|
-
|
12
|
-
it "should create a Jarfile.lock including bundler Jarfiles" do
|
13
|
-
LockJar.lock( "spec/Jarfile", :local_repo => TEST_REPO, :lockfile => "#{TEMP_DIR}/BundledJarfile.lock" )
|
14
|
-
lockfile = LockJar.read("#{TEMP_DIR}/BundledJarfile.lock")
|
15
|
-
expect(lockfile.to_hash).to eql({
|
16
|
-
"version"=>"0.10.0",
|
17
|
-
"merged" => [File.expand_path('spec/dummy_gem/Jarfile')],
|
18
|
-
"groups"=>{
|
19
|
-
"default"=>{
|
20
|
-
"dependencies"=> %w(
|
21
|
-
com.google.guava:guava:jar:14.0.1
|
22
|
-
com.metapossum:metapossum-scanner:jar:1.0.1
|
23
|
-
com.tobedevoured.command:core:jar:0.3.2
|
24
|
-
com.typesafe:config:jar:0.5.0
|
25
|
-
commons-beanutils:commons-beanutils:jar:1.8.3
|
26
|
-
commons-io:commons-io:jar:2.3
|
27
|
-
commons-lang:commons-lang:jar:2.6
|
28
|
-
commons-logging:commons-logging:jar:1.1.1
|
29
|
-
org.modeshape:modeshape-common:jar:2.8.2.Final
|
30
|
-
org.slf4j:slf4j-api:jar:1.6.6),
|
31
|
-
"artifacts"=>[
|
32
|
-
{"jar:com.tobedevoured.command:core:jar:0.3.2"=>{
|
33
|
-
"transitive"=>{
|
34
|
-
"commons-beanutils:commons-beanutils:jar:1.8.3"=>{
|
35
|
-
"commons-logging:commons-logging:jar:1.1.1"=>{}},
|
36
|
-
"com.typesafe:config:jar:0.5.0"=>{},
|
37
|
-
"com.metapossum:metapossum-scanner:jar:1.0.1"=>{
|
38
|
-
"commons-io:commons-io:jar:2.3"=>{}, "commons-lang:commons-lang:jar:2.6"=>{}},
|
39
|
-
"org.slf4j:slf4j-api:jar:1.6.6"=>{},
|
40
|
-
"org.modeshape:modeshape-common:jar:2.8.2.Final"=>{}
|
41
|
-
}
|
42
|
-
}},
|
43
|
-
{"jar:com.google.guava:guava:jar:14.0.1"=>{"transitive"=>{}}}
|
44
|
-
]
|
45
|
-
}
|
46
|
-
}
|
47
|
-
})
|
48
|
-
end
|
49
|
-
end
|
data/bundler/spec/spec_helper.rb
DELETED
@@ -1,88 +0,0 @@
|
|
1
|
-
# This file was generated by the `rspec --init` command. Conventionally, all
|
2
|
-
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
3
|
-
# The generated `.rspec` file contains `--require spec_helper` which will cause this
|
4
|
-
# file to always be loaded, without a need to explicitly require it in any files.
|
5
|
-
#
|
6
|
-
# Given that it is always loaded, you are encouraged to keep this file as
|
7
|
-
# light-weight as possible. Requiring heavyweight dependencies from this file
|
8
|
-
# will add to the boot time of your test suite on EVERY test run, even for an
|
9
|
-
# individual file that may not need all of that loaded. Instead, make a
|
10
|
-
# separate helper file that requires this one and then use it only in the specs
|
11
|
-
# that actually need it.
|
12
|
-
#
|
13
|
-
# The `.rspec` file also contains a few flags that are not defaults but that
|
14
|
-
# users commonly want.
|
15
|
-
#
|
16
|
-
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
17
|
-
|
18
|
-
require 'pry'
|
19
|
-
|
20
|
-
TEMP_DIR = File.expand_path(File.join(File.dirname(__FILE__), "..", ".spec-tmp"))
|
21
|
-
TEST_REPO = File.expand_path(File.join(TEMP_DIR, "test-repo"))
|
22
|
-
|
23
|
-
RSpec.configure do |config|
|
24
|
-
# The settings below are suggested to provide a good initial experience
|
25
|
-
# with RSpec, but feel free to customize to your heart's content.
|
26
|
-
=begin
|
27
|
-
# These two settings work together to allow you to limit a spec run
|
28
|
-
# to individual examples or groups you care about by tagging them with
|
29
|
-
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
30
|
-
# get run.
|
31
|
-
config.filter_run :focus
|
32
|
-
config.run_all_when_everything_filtered = true
|
33
|
-
|
34
|
-
# Many RSpec users commonly either run the entire suite or an individual
|
35
|
-
# file, and it's useful to allow more verbose output when running an
|
36
|
-
# individual spec file.
|
37
|
-
if config.files_to_run.one?
|
38
|
-
# Use the documentation formatter for detailed output,
|
39
|
-
# unless a formatter has already been configured
|
40
|
-
# (e.g. via a command-line flag).
|
41
|
-
config.default_formatter = 'doc'
|
42
|
-
end
|
43
|
-
|
44
|
-
# Print the 10 slowest examples and example groups at the
|
45
|
-
# end of the spec run, to help surface which specs are running
|
46
|
-
# particularly slow.
|
47
|
-
config.profile_examples = 10
|
48
|
-
|
49
|
-
# Run specs in random order to surface order dependencies. If you find an
|
50
|
-
# order dependency and want to debug it, you can fix the order by providing
|
51
|
-
# the seed, which is printed after each run.
|
52
|
-
# --seed 1234
|
53
|
-
config.order = :random
|
54
|
-
|
55
|
-
# Seed global randomization in this process using the `--seed` CLI option.
|
56
|
-
# Setting this allows you to use `--seed` to deterministically reproduce
|
57
|
-
# test failures related to randomization by passing the same `--seed` value
|
58
|
-
# as the one that triggered the failure.
|
59
|
-
Kernel.srand config.seed
|
60
|
-
|
61
|
-
# rspec-expectations config goes here. You can use an alternate
|
62
|
-
# assertion/expectation library such as wrong or the stdlib/minitest
|
63
|
-
# assertions if you prefer.
|
64
|
-
config.expect_with :rspec do |expectations|
|
65
|
-
# Enable only the newer, non-monkey-patching expect syntax.
|
66
|
-
# For more details, see:
|
67
|
-
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
68
|
-
expectations.syntax = :expect
|
69
|
-
end
|
70
|
-
|
71
|
-
# rspec-mocks config goes here. You can use an alternate test double
|
72
|
-
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
73
|
-
config.mock_with :rspec do |mocks|
|
74
|
-
# Enable only the newer, non-monkey-patching expect syntax.
|
75
|
-
# For more details, see:
|
76
|
-
# - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
77
|
-
mocks.syntax = :expect
|
78
|
-
|
79
|
-
# Prevents you from mocking or stubbing a method that does not exist on
|
80
|
-
# a real object. This is generally recommended.
|
81
|
-
mocks.verify_partial_doubles = true
|
82
|
-
end
|
83
|
-
=end
|
84
|
-
|
85
|
-
config.before(:suite) do
|
86
|
-
FileUtils.mkdir_p(TEST_REPO)
|
87
|
-
end
|
88
|
-
end
|