jbundler 0.7.4 → 0.8.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -3
- data/Gemfile.lock~ +46 -0
- data/Readme.md +15 -103
- data/bin/jbundle +41 -60
- data/lib/jbundler/executor.rb +107 -0
- data/lib/jbundler/pom.rb +27 -145
- data/lib/jbundler.rb +5 -47
- metadata +29 -74
- data/lib/jbundler/aether.rb +0 -139
- data/lib/jbundler/classpath_file.rb +0 -115
- data/lib/jbundler/cli.rb +0 -171
- data/lib/jbundler/config.rb +0 -191
- data/lib/jbundler/configurator.rb +0 -27
- data/lib/jbundler/context.rb +0 -34
- data/lib/jbundler/dependency_pom.rb +0 -29
- data/lib/jbundler/executable.rb +0 -41
- data/lib/jbundler/executable_pom.rb +0 -105
- data/lib/jbundler/gemfile_lock.rb +0 -69
- data/lib/jbundler/jarfile_lock.rb +0 -67
- data/lib/jbundler/jruby_complete.rb +0 -44
- data/lib/jbundler/jruby_complete_pom.rb +0 -31
- data/lib/jbundler/lazy.rb +0 -102
- data/lib/jbundler/lock_down.rb +0 -166
- data/lib/jbundler/pom_runner.rb +0 -71
- data/lib/jbundler/show.rb +0 -53
- data/lib/jbundler/tree.rb +0 -31
- data/lib/jbundler/vendor.rb +0 -52
- data/lib/jbundler.jar +0 -0
- data/spec/aether_spec.rb +0 -98
- data/spec/classpath_file_spec.rb +0 -138
- data/spec/config_spec.rb +0 -180
- data/spec/pom_spec.rb +0 -30
- data/spec/project/Settings.xml +0 -0
- data/spec/project/settings.xml +0 -0
- data/spec/setup.rb +0 -16
- data/spec/vendor_spec.rb +0 -60
data/lib/jbundler.rb
CHANGED
@@ -18,56 +18,14 @@
|
|
18
18
|
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
19
19
|
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
20
20
|
#
|
21
|
-
|
22
|
-
require 'jbundler/context'
|
23
|
-
require 'jbundler/lock_down'
|
24
|
-
|
21
|
+
require 'jbundler/executor'
|
25
22
|
module JBundler
|
26
23
|
|
27
|
-
def self.
|
28
|
-
|
29
|
-
end
|
30
|
-
|
31
|
-
def self.setup_test
|
32
|
-
context.classpath.require_test_classpath
|
33
|
-
context.config
|
24
|
+
def self.install( debug = false, verbose = false, options = {} )
|
25
|
+
JBundler::Executor.new( debug, verbose ).lock_down( options )
|
34
26
|
end
|
35
27
|
|
36
|
-
def self.
|
37
|
-
|
38
|
-
jars = context.vendor.require_jars
|
39
|
-
if context.config.verbose
|
40
|
-
warn "jbundler classpath:"
|
41
|
-
jars.each do |path|
|
42
|
-
warn "\t#{path}"
|
43
|
-
end
|
44
|
-
end
|
45
|
-
elsif context.classpath.exists? && context.jarfile.exists_lock?
|
46
|
-
require 'java'
|
47
|
-
context.classpath.require_classpath
|
48
|
-
if context.config.verbose
|
49
|
-
warn "jbundler classpath:"
|
50
|
-
JBUNDLER_CLASSPATH.each do |path|
|
51
|
-
warn "\t#{path}"
|
52
|
-
end
|
53
|
-
end
|
54
|
-
Jars.freeze_loading
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
def self.install( debug = false, verbose = false )
|
59
|
-
jbundler = JBundler::LockDown.new( context.config )
|
60
|
-
msg = jbundler.lock_down( false, debug, verbose )
|
61
|
-
puts msg if msg
|
62
|
-
end
|
63
|
-
|
64
|
-
def self.setup
|
65
|
-
if context.config.skip
|
66
|
-
warn "skip jbundler setup" if context.config.verbose
|
67
|
-
else
|
68
|
-
require_jars
|
69
|
-
end
|
28
|
+
def self.jarfile
|
29
|
+
ENV[ 'JBUNDLER_JARFILE' ] || ENV_JAVA[ 'jbundler.jarfile' ] || 'Jarfile'
|
70
30
|
end
|
71
31
|
end
|
72
|
-
|
73
|
-
JBundler.setup
|
metadata
CHANGED
@@ -1,39 +1,30 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jbundler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0.pre
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christian Meier
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04-
|
11
|
+
date: 2015-04-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name: maven-tools
|
15
|
-
version_requirements: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ~>
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: 1.0.6
|
20
14
|
requirement: !ruby/object:Gem::Requirement
|
21
15
|
requirements:
|
22
16
|
- - ~>
|
23
17
|
- !ruby/object:Gem::Version
|
24
|
-
version: 1.0.
|
18
|
+
version: 1.0.8
|
19
|
+
name: maven-tools
|
25
20
|
prerelease: false
|
26
21
|
type: :runtime
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: ruby-maven
|
29
22
|
version_requirements: !ruby/object:Gem::Requirement
|
30
23
|
requirements:
|
31
|
-
- -
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: 3.1.1.0.6
|
34
|
-
- - <
|
24
|
+
- - ~>
|
35
25
|
- !ruby/object:Gem::Version
|
36
|
-
version:
|
26
|
+
version: 1.0.8
|
27
|
+
- !ruby/object:Gem::Dependency
|
37
28
|
requirement: !ruby/object:Gem::Requirement
|
38
29
|
requirements:
|
39
30
|
- - '>='
|
@@ -42,64 +33,59 @@ dependencies:
|
|
42
33
|
- - <
|
43
34
|
- !ruby/object:Gem::Version
|
44
35
|
version: 3.1.2
|
36
|
+
name: ruby-maven
|
45
37
|
prerelease: false
|
46
38
|
type: :runtime
|
47
|
-
- !ruby/object:Gem::Dependency
|
48
|
-
name: bundler
|
49
39
|
version_requirements: !ruby/object:Gem::Requirement
|
50
40
|
requirements:
|
51
|
-
- -
|
41
|
+
- - '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 3.1.1.0.6
|
44
|
+
- - <
|
52
45
|
- !ruby/object:Gem::Version
|
53
|
-
version:
|
46
|
+
version: 3.1.2
|
47
|
+
- !ruby/object:Gem::Dependency
|
54
48
|
requirement: !ruby/object:Gem::Requirement
|
55
49
|
requirements:
|
56
50
|
- - ~>
|
57
51
|
- !ruby/object:Gem::Version
|
58
|
-
version:
|
52
|
+
version: 0.1.11
|
53
|
+
name: jar-dependencies
|
59
54
|
prerelease: false
|
60
55
|
type: :runtime
|
61
|
-
- !ruby/object:Gem::Dependency
|
62
|
-
name: jar-dependencies
|
63
56
|
version_requirements: !ruby/object:Gem::Requirement
|
64
57
|
requirements:
|
65
58
|
- - ~>
|
66
59
|
- !ruby/object:Gem::Version
|
67
|
-
version: 0.1.
|
60
|
+
version: 0.1.11
|
61
|
+
- !ruby/object:Gem::Dependency
|
68
62
|
requirement: !ruby/object:Gem::Requirement
|
69
63
|
requirements:
|
70
64
|
- - ~>
|
71
65
|
- !ruby/object:Gem::Version
|
72
|
-
version:
|
66
|
+
version: '1.7'
|
67
|
+
name: bundler
|
73
68
|
prerelease: false
|
74
69
|
type: :runtime
|
75
|
-
- !ruby/object:Gem::Dependency
|
76
|
-
name: rake
|
77
70
|
version_requirements: !ruby/object:Gem::Requirement
|
78
71
|
requirements:
|
79
72
|
- - ~>
|
80
73
|
- !ruby/object:Gem::Version
|
81
|
-
version: '
|
74
|
+
version: '1.7'
|
75
|
+
- !ruby/object:Gem::Dependency
|
82
76
|
requirement: !ruby/object:Gem::Requirement
|
83
77
|
requirements:
|
84
78
|
- - ~>
|
85
79
|
- !ruby/object:Gem::Version
|
86
80
|
version: '10.0'
|
81
|
+
name: rake
|
87
82
|
prerelease: false
|
88
83
|
type: :development
|
89
|
-
- !ruby/object:Gem::Dependency
|
90
|
-
name: minitest
|
91
84
|
version_requirements: !ruby/object:Gem::Requirement
|
92
85
|
requirements:
|
93
86
|
- - ~>
|
94
87
|
- !ruby/object:Gem::Version
|
95
|
-
version: '
|
96
|
-
requirement: !ruby/object:Gem::Requirement
|
97
|
-
requirements:
|
98
|
-
- - ~>
|
99
|
-
- !ruby/object:Gem::Version
|
100
|
-
version: '5.3'
|
101
|
-
prerelease: false
|
102
|
-
type: :development
|
88
|
+
version: '10.0'
|
103
89
|
description: |
|
104
90
|
managing jar dependencies with or without bundler. adding bundler like handling of version ranges for jar dependencies.
|
105
91
|
email:
|
@@ -111,37 +97,11 @@ extra_rdoc_files: []
|
|
111
97
|
files:
|
112
98
|
- bin/jbundle
|
113
99
|
- lib/jbundler.rb
|
114
|
-
- lib/jbundler/
|
115
|
-
- lib/jbundler/dependency_pom.rb
|
116
|
-
- lib/jbundler/aether.rb
|
117
|
-
- lib/jbundler/executable_pom.rb
|
118
|
-
- lib/jbundler/classpath_file.rb
|
119
|
-
- lib/jbundler/jarfile_lock.rb
|
120
|
-
- lib/jbundler/jruby_complete_pom.rb
|
121
|
-
- lib/jbundler/tree.rb
|
122
|
-
- lib/jbundler/lock_down.rb
|
123
|
-
- lib/jbundler/executable.rb
|
100
|
+
- lib/jbundler/executor.rb
|
124
101
|
- lib/jbundler/pom.rb
|
125
|
-
- lib/jbundler/jruby_complete.rb
|
126
|
-
- lib/jbundler/configurator.rb
|
127
|
-
- lib/jbundler/cli.rb
|
128
|
-
- lib/jbundler/lazy.rb
|
129
|
-
- lib/jbundler/config.rb
|
130
|
-
- lib/jbundler/context.rb
|
131
|
-
- lib/jbundler/gemfile_lock.rb
|
132
|
-
- lib/jbundler/vendor.rb
|
133
|
-
- lib/jbundler/show.rb
|
134
|
-
- lib/jbundler.jar
|
135
|
-
- spec/classpath_file_spec.rb
|
136
|
-
- spec/vendor_spec.rb
|
137
|
-
- spec/config_spec.rb
|
138
|
-
- spec/setup.rb
|
139
|
-
- spec/pom_spec.rb
|
140
|
-
- spec/aether_spec.rb
|
141
|
-
- spec/project/Settings.xml
|
142
|
-
- spec/project/settings.xml
|
143
102
|
- MIT-LICENSE
|
144
103
|
- Readme.md
|
104
|
+
- Gemfile.lock~
|
145
105
|
- Gemfile.lock
|
146
106
|
- Gemfile
|
147
107
|
homepage: https://github.com/mkristian/jbundler
|
@@ -159,18 +119,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
159
119
|
version: '0'
|
160
120
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
161
121
|
requirements:
|
162
|
-
- - '
|
122
|
+
- - '>'
|
163
123
|
- !ruby/object:Gem::Version
|
164
|
-
version:
|
124
|
+
version: 1.3.1
|
165
125
|
requirements: []
|
166
126
|
rubyforge_project:
|
167
127
|
rubygems_version: 2.1.9
|
168
128
|
signing_key:
|
169
129
|
specification_version: 4
|
170
130
|
summary: managing jar dependencies
|
171
|
-
test_files:
|
172
|
-
- spec/classpath_file_spec.rb
|
173
|
-
- spec/vendor_spec.rb
|
174
|
-
- spec/config_spec.rb
|
175
|
-
- spec/pom_spec.rb
|
176
|
-
- spec/aether_spec.rb
|
131
|
+
test_files: []
|
data/lib/jbundler/aether.rb
DELETED
@@ -1,139 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright (C) 2013 Christian Meier
|
3
|
-
#
|
4
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
5
|
-
# this software and associated documentation files (the "Software"), to deal in
|
6
|
-
# the Software without restriction, including without limitation the rights to
|
7
|
-
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
8
|
-
# the Software, and to permit persons to whom the Software is furnished to do so,
|
9
|
-
# subject to the following conditions:
|
10
|
-
#
|
11
|
-
# The above copyright notice and this permission notice shall be included in all
|
12
|
-
# copies or substantial portions of the Software.
|
13
|
-
#
|
14
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
16
|
-
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
17
|
-
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
18
|
-
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
19
|
-
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
20
|
-
#
|
21
|
-
require 'yaml'
|
22
|
-
require 'jbundler/config'
|
23
|
-
require 'maven/ruby'
|
24
|
-
|
25
|
-
module JBundler
|
26
|
-
|
27
|
-
class AetherRuby
|
28
|
-
|
29
|
-
def self.setup_classloader
|
30
|
-
require 'java'
|
31
|
-
|
32
|
-
Dir.glob( File.join( Maven.lib, '*.jar' ) ).each do |path|
|
33
|
-
require path
|
34
|
-
end
|
35
|
-
begin
|
36
|
-
require 'jbundler.jar'
|
37
|
-
rescue LoadError
|
38
|
-
# allow the classes already be added to the classloader
|
39
|
-
begin
|
40
|
-
java_import 'jbundler.Aether'
|
41
|
-
rescue NameError
|
42
|
-
# assume this happens only when working on the git clone
|
43
|
-
raise "jbundler.jar is missing - maybe you need to build it first ? use\n$ rmvn prepare-package -Dmaven.test.skip\n"
|
44
|
-
end
|
45
|
-
end
|
46
|
-
java_import 'jbundler.Aether'
|
47
|
-
end
|
48
|
-
|
49
|
-
def initialize( config = Config.new )
|
50
|
-
unless defined? Aether
|
51
|
-
self.class.setup_classloader
|
52
|
-
end
|
53
|
-
@aether = Aether.new( config.verbose )
|
54
|
-
@aether.add_proxy( config.proxy ) if config.proxy
|
55
|
-
@aether.add_mirror( config.mirror ) if config.mirror
|
56
|
-
@aether.offline = config.offline
|
57
|
-
if config.settings
|
58
|
-
@aether.user_settings = java.io.File.new( config.settings )
|
59
|
-
end
|
60
|
-
if config.local_repository
|
61
|
-
@aether.local_repository = java.io.File.new(config.local_repository)
|
62
|
-
end
|
63
|
-
rescue NativeException => e
|
64
|
-
e.cause.print_stack_trace
|
65
|
-
raise e
|
66
|
-
end
|
67
|
-
|
68
|
-
def local_jars
|
69
|
-
@local_jars ||= []
|
70
|
-
end
|
71
|
-
|
72
|
-
def add_local_jar( path )
|
73
|
-
local_jars << File.expand_path( path )
|
74
|
-
end
|
75
|
-
|
76
|
-
def add_artifact(coordinate, extension = nil)
|
77
|
-
if extension
|
78
|
-
coord = coordinate.split(/:/)
|
79
|
-
coord.insert(2, extension)
|
80
|
-
@aether.add_artifact(coord.join(":"))
|
81
|
-
else
|
82
|
-
@aether.add_artifact(coordinate)
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
def add_repository(name, url)
|
87
|
-
@aether.add_repository(name, url)
|
88
|
-
end
|
89
|
-
|
90
|
-
def add_snapshot_repository(name, url)
|
91
|
-
@aether.add_snapshot_repository(name, url)
|
92
|
-
end
|
93
|
-
|
94
|
-
def resolve
|
95
|
-
@aether.resolve unless artifacts.empty?
|
96
|
-
rescue NativeException => e
|
97
|
-
e.cause.print_stack_trace
|
98
|
-
raise e
|
99
|
-
end
|
100
|
-
|
101
|
-
def classpath
|
102
|
-
if artifacts.empty? and local_jars.empty?
|
103
|
-
''
|
104
|
-
else
|
105
|
-
path = [ @aether.classpath ]
|
106
|
-
path = path + @local_jars if @local_jars
|
107
|
-
path.join( File::PATH_SEPARATOR )
|
108
|
-
end
|
109
|
-
end
|
110
|
-
|
111
|
-
def classpath_array
|
112
|
-
classpath.split(/#{File::PATH_SEPARATOR}/)
|
113
|
-
end
|
114
|
-
|
115
|
-
def repositories
|
116
|
-
@aether.repositories
|
117
|
-
end
|
118
|
-
|
119
|
-
def artifacts
|
120
|
-
@aether.artifacts
|
121
|
-
end
|
122
|
-
|
123
|
-
def resolved_coordinates
|
124
|
-
if @aether.artifacts.empty?
|
125
|
-
[]
|
126
|
-
else
|
127
|
-
@aether.resolved_coordinates
|
128
|
-
end
|
129
|
-
end
|
130
|
-
|
131
|
-
def install(coordinate, file)
|
132
|
-
@aether.install(coordinate, file)
|
133
|
-
rescue NativeException => e
|
134
|
-
e.cause.print_stack_trace
|
135
|
-
raise e
|
136
|
-
end
|
137
|
-
|
138
|
-
end
|
139
|
-
end
|
@@ -1,115 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright (C) 2013 Christian Meier
|
3
|
-
#
|
4
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
5
|
-
# this software and associated documentation files (the "Software"), to deal in
|
6
|
-
# the Software without restriction, including without limitation the rights to
|
7
|
-
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
8
|
-
# the Software, and to permit persons to whom the Software is furnished to do so,
|
9
|
-
# subject to the following conditions:
|
10
|
-
#
|
11
|
-
# The above copyright notice and this permission notice shall be included in all
|
12
|
-
# copies or substantial portions of the Software.
|
13
|
-
#
|
14
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
16
|
-
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
17
|
-
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
18
|
-
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
19
|
-
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
20
|
-
#
|
21
|
-
module JBundler
|
22
|
-
|
23
|
-
class ClasspathFile
|
24
|
-
|
25
|
-
def initialize(classpathfile = '.jbundler/classpath.rb')
|
26
|
-
@classpathfile = classpathfile
|
27
|
-
end
|
28
|
-
|
29
|
-
def file
|
30
|
-
@classpathfile
|
31
|
-
end
|
32
|
-
|
33
|
-
def load_classpath
|
34
|
-
load File.expand_path @classpathfile
|
35
|
-
end
|
36
|
-
|
37
|
-
def require_classpath
|
38
|
-
load_classpath
|
39
|
-
JBUNDLER_CLASSPATH.each { |c| require c }
|
40
|
-
end
|
41
|
-
|
42
|
-
def require_test_classpath
|
43
|
-
load_classpath
|
44
|
-
JBUNDLER_TEST_CLASSPATH.each { |c| require c }
|
45
|
-
end
|
46
|
-
|
47
|
-
def mtime
|
48
|
-
File.mtime(@classpathfile)
|
49
|
-
end
|
50
|
-
|
51
|
-
def exists?
|
52
|
-
File.exists?(@classpathfile)
|
53
|
-
end
|
54
|
-
|
55
|
-
def missing?( jarfile )
|
56
|
-
!exists? || !jarfile.exists_lock?
|
57
|
-
end
|
58
|
-
|
59
|
-
def jarfile_newer?( jarfile )
|
60
|
-
jarfile.exists? && (jarfile.mtime > mtime)
|
61
|
-
end
|
62
|
-
|
63
|
-
def jarlock_newer?( jarfile )
|
64
|
-
jarfile.exists_lock? && (jarfile.mtime_lock > mtime)
|
65
|
-
end
|
66
|
-
|
67
|
-
def needs_update?(jarfile, gemfile_lock)
|
68
|
-
if ( jarfile.exists? || gemfile_lock.exists? || jarfile.exists_lock? )
|
69
|
-
missing?( jarfile ) || jarfile_newer?( jarfile ) || jarlock_newer?( jarfile ) || gemfile_lock.newer?( mtime )
|
70
|
-
else
|
71
|
-
false
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
def generate( classpath_array, test_array = [], jruby_array = [], local_repo = nil )
|
76
|
-
FileUtils.mkdir_p(File.dirname(@classpathfile))
|
77
|
-
File.open(@classpathfile, 'w') do |f|
|
78
|
-
if local_repo
|
79
|
-
local_repo = File.expand_path( local_repo )
|
80
|
-
f.puts "require 'jar_dependencies'"
|
81
|
-
f.puts "JBUNDLER_LOCAL_REPO = Jars.home"
|
82
|
-
end
|
83
|
-
dump_array( f, jruby_array || [], 'JRUBY_', local_repo )
|
84
|
-
dump_array( f, test_array || [], 'TEST_', local_repo )
|
85
|
-
dump_array( f, classpath_array || [], '', local_repo )
|
86
|
-
f.close
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
private
|
91
|
-
def dump_array( file, array, prefix, local_repo )
|
92
|
-
file.puts "JBUNDLER_#{prefix}CLASSPATH = []"
|
93
|
-
array.each do |path|
|
94
|
-
dump_jar( file, path, prefix, local_repo )
|
95
|
-
end
|
96
|
-
file.puts "JBUNDLER_#{prefix}CLASSPATH.freeze"
|
97
|
-
end
|
98
|
-
|
99
|
-
def dump_jar( file, path, prefix, local_repo )
|
100
|
-
return if path =~ /pom$/
|
101
|
-
if local_repo
|
102
|
-
path.sub!( /#{local_repo}/, '' )
|
103
|
-
unless File.exists?( path )
|
104
|
-
file.puts "JBUNDLER_#{prefix}CLASSPATH << (JBUNDLER_LOCAL_REPO + '#{path}')"
|
105
|
-
path = nil
|
106
|
-
end
|
107
|
-
end
|
108
|
-
if path
|
109
|
-
# either we do not have a local_repo or the path is a absolute
|
110
|
-
# path from system artifact
|
111
|
-
file.puts "JBUNDLER_#{prefix}CLASSPATH << '#{path}'"
|
112
|
-
end
|
113
|
-
end
|
114
|
-
end
|
115
|
-
end
|
data/lib/jbundler/cli.rb
DELETED
@@ -1,171 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright (C) 2013 Christian Meier
|
3
|
-
#
|
4
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
5
|
-
# this software and associated documentation files (the "Software"), to deal in
|
6
|
-
# the Software without restriction, including without limitation the rights to
|
7
|
-
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
8
|
-
# the Software, and to permit persons to whom the Software is furnished to do so,
|
9
|
-
# subject to the following conditions:
|
10
|
-
#
|
11
|
-
# The above copyright notice and this permission notice shall be included in all
|
12
|
-
# copies or substantial portions of the Software.
|
13
|
-
#
|
14
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
16
|
-
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
17
|
-
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
18
|
-
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
19
|
-
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
20
|
-
#
|
21
|
-
require 'bundler/vendored_thor'
|
22
|
-
require 'jbundler/config'
|
23
|
-
require 'jbundler/executable'
|
24
|
-
require 'jbundler/tree'
|
25
|
-
require 'jbundler/lock_down'
|
26
|
-
require 'jbundler/jruby_complete'
|
27
|
-
module JBundler
|
28
|
-
# As of v1.9.0, bundler's vendored version of thor is namespaced
|
29
|
-
Thor = Bundler::Thor if Gem.loaded_specs['bundler'].version >= Gem::Version.new('1.9.0')
|
30
|
-
|
31
|
-
class Cli < Thor
|
32
|
-
no_tasks do
|
33
|
-
def config
|
34
|
-
@config ||= JBundler::Config.new
|
35
|
-
end
|
36
|
-
|
37
|
-
def unvendor
|
38
|
-
vendor = JBundler::Vendor.new( config.vendor_dir )
|
39
|
-
vendor.clear
|
40
|
-
end
|
41
|
-
|
42
|
-
def vendor
|
43
|
-
vendor = JBundler::Vendor.new( config.vendor_dir )
|
44
|
-
if vendor.vendored?
|
45
|
-
raise "already vendored. please 'jbundle install --no-deployment before."
|
46
|
-
else
|
47
|
-
vendor.setup( JBundler::ClasspathFile.new( config.classpath_file ) )
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
def say_bundle_complete
|
52
|
-
puts ''
|
53
|
-
puts 'Your jbundle is complete! Use `jbundle show` to see where the bundled jars are installed.'
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
desc 'jruby_complete', 'pack a jruby-complete jar with custom dependencies and maybe adjust jruby dependencies like newer versions of joda-time or snakeyaml', :hide => true
|
58
|
-
method_option :clean, :type => :boolean, :default => false
|
59
|
-
method_option :verbose, :type => :boolean, :default => false
|
60
|
-
method_option :debug, :type => :boolean, :default => false
|
61
|
-
method_option :show, :type => :boolean, :default => false, :desc => 'show versions of all libraries from jruby'
|
62
|
-
def jruby_complete
|
63
|
-
jc = JBundler::JRubyComplete.new( config, options )
|
64
|
-
if options[ :show ]
|
65
|
-
jc.show_versions
|
66
|
-
else
|
67
|
-
jc.packit
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
desc 'tree', 'display a graphical representation of the dependency tree'
|
72
|
-
#method_option :details, :type => :boolean, :default => false
|
73
|
-
def tree
|
74
|
-
JBundler::Tree.new( config ).show_it
|
75
|
-
end
|
76
|
-
|
77
|
-
desc 'install', "first `bundle install` is called and then the jar dependencies will be installed. for more details see `bundle help install`, jbundler will ignore most options. the install command is also the default when no command is given."
|
78
|
-
method_option :vendor, :type => :boolean, :default => false, :desc => 'vendor jars into vendor directory (jbundler only).'
|
79
|
-
method_option :debug, :type => :boolean, :default => false, :desc => 'enable maven debug output (jbundler only).'
|
80
|
-
method_option :verbose, :type => :boolean, :default => false, :desc => 'enable maven output (jbundler only).'
|
81
|
-
method_option :deployment, :type => :boolean, :default => false, :desc => "copy the jars into the vendor/jars directory (or as configured). these vendored jars have preference before the classpath jars !"
|
82
|
-
method_option :no_deployment, :type => :boolean, :default => false, :desc => 'clears the vendored jars'
|
83
|
-
method_option :path, :type => :string
|
84
|
-
method_option :without, :type => :array
|
85
|
-
method_option :system, :type => :boolean
|
86
|
-
method_option :local, :type => :boolean
|
87
|
-
method_option :binstubs, :type => :string
|
88
|
-
method_option :trust_policy, :type => :string
|
89
|
-
method_option :gemfile, :type => :string
|
90
|
-
method_option :jobs, :type => :string
|
91
|
-
method_option :retry, :type => :string
|
92
|
-
method_option :no_cache, :type => :boolean
|
93
|
-
method_option :quiet, :type => :boolean
|
94
|
-
def install
|
95
|
-
msg = JBundler::LockDown.new( config ).lock_down( options[ :vendor ],
|
96
|
-
options[ :debug ] ,
|
97
|
-
options[ :verbose ] )
|
98
|
-
config.verbose = ! options[ :quiet ]
|
99
|
-
Show.new( config ).show_classpath
|
100
|
-
unless options[ :quiet ]
|
101
|
-
puts 'jbundle complete !'
|
102
|
-
puts
|
103
|
-
end
|
104
|
-
puts msg if msg
|
105
|
-
end
|
106
|
-
|
107
|
-
desc 'executable', 'create an executable jar with a given bootstrap.rb file\nLIMITATION: only for jruby 1.6.x and newer'
|
108
|
-
method_option :bootstrap, :type => :string, :aliases => '-b', :required => true, :desc => 'file which will be executed when the jar gets executed'
|
109
|
-
method_option :compile, :type => :boolean, :aliases => '-c', :default => false, :desc => 'compile the ruby files from the lib directory'
|
110
|
-
method_option :verbose, :type => :boolean, :aliases => '-v', :default => false, :desc => 'more output'
|
111
|
-
method_option :groups, :type => :array, :aliases => '-g', :desc => 'bundler groups to use for determine the gems to include in the jar file'
|
112
|
-
def executable
|
113
|
-
ex = JBundler::Executable.new( options[ 'bootstrap' ], config, options[ 'compile' ], options[ :verbose ], *( options[ 'groups' ] || [:default] ) )
|
114
|
-
ex.packit
|
115
|
-
end
|
116
|
-
|
117
|
-
desc 'console', 'irb session with gems and/or jars and with lazy jar loading.'
|
118
|
-
def console
|
119
|
-
# dummy - never executed !!!
|
120
|
-
end
|
121
|
-
|
122
|
-
desc 'lock_down', "first `bundle install` is called and then the jar dependencies will be installed. for more details see `bundle help install`, jbundler will ignore all options. the install command is also the default when no command is given. that is kept as fall back in cases where the new install does not work as before."
|
123
|
-
method_option :deployment, :type => :boolean, :default => false, :desc => "copy the jars into the vendor/jars directory (or as configured). these vendored jars have preference before the classpath jars !"
|
124
|
-
method_option :no_deployment, :type => :boolean, :default => false, :desc => 'clears the vendored jars'
|
125
|
-
method_option :path, :type => :string
|
126
|
-
method_option :without, :type => :array
|
127
|
-
method_option :system, :type => :boolean
|
128
|
-
method_option :local, :type => :boolean
|
129
|
-
method_option :binstubs, :type => :string
|
130
|
-
method_option :trust_policy, :type => :string
|
131
|
-
method_option :gemfile, :type => :string
|
132
|
-
method_option :jobs, :type => :string
|
133
|
-
method_option :retry, :type => :string
|
134
|
-
method_option :no_cache, :type => :boolean
|
135
|
-
method_option :quiet, :type => :boolean
|
136
|
-
def lock_down
|
137
|
-
require 'jbundler'
|
138
|
-
|
139
|
-
unvendor if options[ :no_deployment ]
|
140
|
-
|
141
|
-
vendor if options[ :deployment ]
|
142
|
-
|
143
|
-
config.verbose = ! options[ :quiet ]
|
144
|
-
|
145
|
-
Show.new( config ).show_classpath
|
146
|
-
|
147
|
-
say_bundle_complete unless options[ :quiet ]
|
148
|
-
end
|
149
|
-
|
150
|
-
desc 'update', "first `bundle update` is called and if there are no options then the jar dependencies will be updated. for more details see `bundle help update`."
|
151
|
-
method_option :debug, :type => :boolean, :default => false, :desc => 'enable maven debug output (jbundler only).'
|
152
|
-
method_option :verbose, :type => :boolean, :default => false, :desc => 'enable maven output (jbundler only).'
|
153
|
-
def update
|
154
|
-
return unless ARGV.size == 1
|
155
|
-
|
156
|
-
JBundler::LockDown.new( config ).update( options[ :debug ] ,
|
157
|
-
options[ :verbose ] )
|
158
|
-
|
159
|
-
config.verbose = ! options[ :quiet ]
|
160
|
-
Show.new( config ).show_classpath
|
161
|
-
puts ''
|
162
|
-
puts 'Your jbundle is updated! Use `jbundle show` to see where the bundled jars are installed.'
|
163
|
-
end
|
164
|
-
|
165
|
-
desc 'show', "first `bundle show` is called and if there are no options then the jar dependencies will be displayed. for more details see `bundle help show`."
|
166
|
-
def show
|
167
|
-
config.verbose = true
|
168
|
-
Show.new( config ).show_classpath
|
169
|
-
end
|
170
|
-
end
|
171
|
-
end
|