jbundler 0.8.0.pre → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +15 -13
- data/Readme.md +103 -15
- data/bin/jbundle +40 -40
- data/lib/jbundler.rb +47 -5
- data/lib/jbundler/aether.rb +139 -0
- data/lib/jbundler/classpath_file.rb +115 -0
- data/lib/jbundler/cli.rb +146 -0
- data/lib/jbundler/config.rb +191 -0
- data/lib/jbundler/configurator.rb +27 -0
- data/lib/jbundler/context.rb +34 -0
- data/lib/jbundler/dependency_pom.rb +30 -0
- data/lib/jbundler/gemfile_lock.rb +69 -0
- data/lib/jbundler/jarfile_lock.rb +67 -0
- data/lib/jbundler/jruby_complete.rb +44 -0
- data/lib/jbundler/jruby_complete_pom.rb +31 -0
- data/lib/jbundler/lock_down.rb +166 -0
- data/lib/jbundler/pom.rb +145 -27
- data/lib/jbundler/pom_runner.rb +71 -0
- data/lib/jbundler/show.rb +53 -0
- data/lib/jbundler/tree.rb +31 -0
- data/lib/jbundler/vendor.rb +52 -0
- data/spec/classpath_file_spec.rb +138 -0
- data/spec/config_spec.rb +180 -0
- data/spec/pom_spec.rb +30 -0
- data/spec/project/Settings.xml +0 -0
- data/spec/project/settings.xml +0 -0
- data/spec/setup.rb +16 -0
- data/spec/vendor_spec.rb +60 -0
- metadata +77 -37
- data/lib/jbundler/executor.rb +0 -107
data/lib/jbundler/executor.rb
DELETED
@@ -1,107 +0,0 @@
|
|
1
|
-
require 'maven/ruby/maven'
|
2
|
-
require 'maven/tools/artifact'
|
3
|
-
require 'maven/tools/gemspec_dependencies'
|
4
|
-
require 'fileutils'
|
5
|
-
require 'jar_dependencies'
|
6
|
-
module JBundler
|
7
|
-
|
8
|
-
class Executor
|
9
|
-
|
10
|
-
attr_reader :debug, :verbose
|
11
|
-
|
12
|
-
def initialize( debug = false, verbose = false )
|
13
|
-
@debug = debug
|
14
|
-
@verbose = verbose
|
15
|
-
end
|
16
|
-
|
17
|
-
def maven_new
|
18
|
-
m = Maven::Ruby::Maven.new
|
19
|
-
m.property( 'jbundler.basedir', File.expand_path( basedir ) )
|
20
|
-
m.property( 'jbundler.jarfile', File.expand_path( JBundler.jarfile ) )
|
21
|
-
m.property( 'verbose', (debug || verbose) == true )
|
22
|
-
if debug
|
23
|
-
m.options[ '-X' ] = nil
|
24
|
-
elsif verbose
|
25
|
-
m.options[ '-e' ] = nil
|
26
|
-
else
|
27
|
-
m.options[ '-q' ] = nil
|
28
|
-
end
|
29
|
-
m.verbose = debug
|
30
|
-
attach_jar_coordinates( m )
|
31
|
-
m
|
32
|
-
end
|
33
|
-
private :maven_new
|
34
|
-
|
35
|
-
def maven
|
36
|
-
@maven ||= maven_new
|
37
|
-
end
|
38
|
-
|
39
|
-
def basedir
|
40
|
-
File.expand_path( '.' )
|
41
|
-
end
|
42
|
-
|
43
|
-
def exec( *args )
|
44
|
-
maven.options[ '-f' ] = File.expand_path( '../pom.rb', __FILE__ )
|
45
|
-
maven.exec( *args )
|
46
|
-
end
|
47
|
-
|
48
|
-
def attach_jar_coordinates( maven )
|
49
|
-
load_path = $LOAD_PATH.dup
|
50
|
-
require 'bundler/setup'
|
51
|
-
done = []
|
52
|
-
index = 0
|
53
|
-
Gem.loaded_specs.each do |name, spec|
|
54
|
-
# TODO get rid of this somehow
|
55
|
-
deps = Maven::Tools::GemspecDependencies.new( spec )
|
56
|
-
deps.java_dependency_artifacts.each do |a|
|
57
|
-
unless done.include? a.key
|
58
|
-
maven.property( "jbundler.jars.#{index}", a.to_s )
|
59
|
-
index += 1
|
60
|
-
done << a.key
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
rescue LoadError
|
65
|
-
warn "no bundler found - ignore Gemfile if exists"
|
66
|
-
ensure
|
67
|
-
$LOAD_PATH.replace( load_path )
|
68
|
-
end
|
69
|
-
|
70
|
-
def lock_down( options = {} )
|
71
|
-
vendor_dir = File.expand_path( options[ :vendor_dir ] ) if options[ :vendor_dir ]
|
72
|
-
out = File.expand_path( '.jbundler.output' )
|
73
|
-
tree = File.expand_path( '.jbundler.tree' )
|
74
|
-
maven.property( 'jars.outputFile', out )
|
75
|
-
maven.property( 'maven.repo.local', Jars.home )
|
76
|
-
maven.property( 'jars.home', vendor_dir ) if vendor_dir
|
77
|
-
# TODO move into jar-dependencies
|
78
|
-
maven.property( 'jars.lock', File.expand_path( Jars.lock ) )
|
79
|
-
maven.property( 'jars.force', options[ :force ] == true )
|
80
|
-
maven.property( 'jars.update', options[ :update ] ) if options[ :update ]
|
81
|
-
|
82
|
-
args = [ 'gem:jars-lock' ]
|
83
|
-
if options[ :tree ]
|
84
|
-
args += [ 'dependency:tree', '-P -gemfile.lock', '-DoutputFile=' + tree ]
|
85
|
-
end
|
86
|
-
|
87
|
-
puts
|
88
|
-
puts '-- jar root dependencies --'
|
89
|
-
puts
|
90
|
-
status = exec( *args )
|
91
|
-
exit 1 unless status
|
92
|
-
if File.exists?( tree )
|
93
|
-
puts
|
94
|
-
puts '-- jar dependency tree --'
|
95
|
-
puts
|
96
|
-
puts File.read( tree )
|
97
|
-
puts
|
98
|
-
end
|
99
|
-
puts
|
100
|
-
puts File.read( out ).gsub( /#{File.dirname(out)}\//, '' )
|
101
|
-
puts
|
102
|
-
ensure
|
103
|
-
FileUtils.rm_f out
|
104
|
-
FileUtils.rm_f tree
|
105
|
-
end
|
106
|
-
end
|
107
|
-
end
|