jbundler 0.5.3 → 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. data/Gemfile +4 -2
  2. data/Gemfile.lock +10 -18
  3. data/lib/jbundler/aether.rb +8 -4
  4. data/lib/jbundler/classpath_file.rb +1 -1
  5. data/lib/jbundler/cli.rb +25 -4
  6. data/lib/jbundler/config.rb +13 -5
  7. data/lib/jbundler/configurator.rb +23 -0
  8. data/lib/jbundler/executable.rb +13 -14
  9. data/lib/jbundler/executable_pom.rb +94 -133
  10. data/lib/jbundler/gemfile_lock.rb +1 -1
  11. data/lib/jbundler/lazy.rb +2 -2
  12. data/lib/jbundler/pom.rb +1 -1
  13. data/lib/jbundler/tree.rb +14 -32
  14. data/lib/jbundler/tree_pom.rb +19 -0
  15. data/lib/jbundler/vendor.rb +36 -0
  16. data/lib/jbundler.jar +0 -0
  17. data/lib/jbundler.rb +17 -7
  18. data/spec/config_spec.rb +153 -0
  19. data/spec/vendor_spec.rb +60 -0
  20. metadata +13 -31
  21. data/lib/jbundler/maven.rb +0 -27
  22. data/spec/executable_compile/Gemfile +0 -3
  23. data/spec/executable_compile/Gemfile.lock +0 -18
  24. data/spec/executable_compile/Jarfile +0 -1
  25. data/spec/executable_compile/Jarfile.lock +0 -2
  26. data/spec/executable_compile/start.rb +0 -1
  27. data/spec/executable_no_compile/Gemfile +0 -3
  28. data/spec/executable_no_compile/Gemfile.lock +0 -18
  29. data/spec/executable_no_compile/Jarfile +0 -1
  30. data/spec/executable_no_compile/Jarfile.lock +0 -2
  31. data/spec/executable_no_compile/start.rb +0 -1
  32. data/spec/executable_only_java_sources/Gemfile +0 -3
  33. data/spec/executable_only_java_sources/Gemfile.lock +0 -18
  34. data/spec/executable_only_java_sources/Jarfile +0 -3
  35. data/spec/executable_only_java_sources/Jarfile.lock +0 -2
  36. data/spec/executable_only_java_sources/start.rb +0 -6
  37. data/spec/executable_spec.rb +0 -43
  38. data/spec/tree/Gemfile +0 -3
  39. data/spec/tree/Jarfile +0 -5
  40. data/spec/tree/Jarfile.lock +0 -2
  41. data/spec/tree/myfirst.jar +0 -0
  42. data/spec/tree/ref.txt +0 -27
  43. data/spec/tree_spec.rb +0 -33
data/Gemfile CHANGED
@@ -1,5 +1,7 @@
1
+ #-*- mode: ruby -*-
1
2
  source 'https://rubygems.org'
3
+
2
4
  gemspec
3
5
 
4
- # needed for some specs
5
- gem 'rspec', '<3.0', :group => :test
6
+ gem "copyright-header", "1.0.8", :platform => :mri, :group => :copyright
7
+
data/Gemfile.lock CHANGED
@@ -1,32 +1,24 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- jbundler (0.5.2)
4
+ jbundler (0.5.4)
5
5
  bundler (~> 1.2)
6
- ruby-maven (>= 3.1.0.0.1, < 3.1.1)
6
+ ruby-maven (>= 3.1.1.0.1, < 3.1.2)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- backports (3.3.4)
12
- descendants_tracker (0.0.1)
13
- diff-lcs (1.2.4)
14
- maven-tools (0.33.3)
11
+ backports (3.3.5)
12
+ copyright-header (1.0.8)
13
+ descendants_tracker (0.0.3)
14
+ maven-tools (0.34.2)
15
15
  virtus (~> 0.5)
16
16
  minitest (4.7.5)
17
17
  rake (10.1.0)
18
- rspec (2.14.1)
19
- rspec-core (~> 2.14.0)
20
- rspec-expectations (~> 2.14.0)
21
- rspec-mocks (~> 2.14.0)
22
- rspec-core (2.14.5)
23
- rspec-expectations (2.14.2)
24
- diff-lcs (>= 1.1.3, < 2.0)
25
- rspec-mocks (2.14.3)
26
- ruby-maven (3.1.0.0.1)
18
+ ruby-maven (3.1.1.0.1)
27
19
  maven-tools (~> 0.33)
28
- ruby-maven-libs (= 3.1.0)
29
- ruby-maven-libs (3.1.0)
20
+ ruby-maven-libs (= 3.1.1)
21
+ ruby-maven-libs (3.1.1)
30
22
  thor (0.15.4)
31
23
  virtus (0.5.5)
32
24
  backports (~> 3.3)
@@ -37,8 +29,8 @@ PLATFORMS
37
29
  ruby
38
30
 
39
31
  DEPENDENCIES
32
+ copyright-header (= 1.0.8)
40
33
  jbundler!
41
34
  minitest (~> 4.0)
42
35
  rake (~> 10.0)
43
- rspec (< 3.0)
44
36
  thor (> 0.14.0, < 0.16.0)
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright (C) 2013 Kristian Meier
2
+ # Copyright (C) 2013 Christian Meier
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining a copy of
5
5
  # this software and associated documentation files (the "Software"), to deal in
@@ -53,9 +53,13 @@ module JBundler
53
53
  @aether = Aether.new( config.verbose )
54
54
  @aether.add_proxy( config.proxy ) if config.proxy
55
55
  @aether.add_mirror( config.mirror ) if config.mirror
56
- @aether.offline = config.offline
57
- @aether.user_settings = config.settings if config.settings
58
- @aether.local_repository = java.io.File.new(config.local_repository) if config.local_repository
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
59
63
  rescue NativeException => e
60
64
  e.cause.print_stack_trace
61
65
  raise e
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright (C) 2013 Kristian Meier
2
+ # Copyright (C) 2013 Christian Meier
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining a copy of
5
5
  # this software and associated documentation files (the "Software"), to deal in
data/lib/jbundler/cli.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright (C) 2013 Kristian Meier
2
+ # Copyright (C) 2013 Christian Meier
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining a copy of
5
5
  # this software and associated documentation files (the "Software"), to deal in
@@ -32,8 +32,15 @@ module JBundler
32
32
  def do_show
33
33
  require 'java'
34
34
  require 'jbundler/classpath_file'
35
- classpath_file = JBundler::ClasspathFile.new(config.classpath_file)
36
- if classpath_file.exists?
35
+ require 'jbundler/vendor'
36
+ classpath_file = JBundler::ClasspathFile.new( config.classpath_file )
37
+ vendor = JBundler::Vendor.new( config.vendor_dir )
38
+ if vendor.vendored?
39
+ puts "JBundler classpath:"
40
+ vendor.require_jars.each do |path|
41
+ puts " * #{path}"
42
+ end
43
+ elsif classpath_file.exists?
37
44
  classpath_file.require_classpath unless defined? JBUNDLER_CLASSPATH
38
45
  puts "JBundler classpath:"
39
46
  JBUNDLER_CLASSPATH.each do |path|
@@ -52,7 +59,7 @@ module JBundler
52
59
  end
53
60
 
54
61
  desc 'executable', 'create an executable jar with a given bootstrap.rb file\nLIMITATION: only for jruby 1.6.x and newer'
55
- method_option :bootstrap, :type => :string, :aliases => '-b'#, :required => true, :desc => 'file which will be executed when the jar gets executed'
62
+ method_option :bootstrap, :type => :string, :aliases => '-b', :required => true, :desc => 'file which will be executed when the jar gets executed'
56
63
  method_option :compile, :type => :boolean, :aliases => '-c', :default => false, :desc => 'compile the ruby files from the lib directory'
57
64
  method_option :verbose, :type => :boolean, :aliases => '-v', :default => false, :desc => 'more output'
58
65
  method_option :groups, :type => :array, :aliases => '-g', :desc => 'bundler groups to use for determine the gems to include in the jar file'
@@ -67,8 +74,22 @@ module JBundler
67
74
  end
68
75
 
69
76
  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 all options. the install command is also the default when no command is given."
77
+ 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 !"
78
+ method_option :no_deployment, :type => :boolean, :default => false, :desc => 'clears the vendored jars'
70
79
  def install
71
80
  require 'jbundler'
81
+ if options[ :no_deployment ]
82
+ vendor = JBundler::Vendor.new( config.vendor_dir )
83
+ vendor.clear
84
+ end
85
+ if options[ :deployment ]
86
+ vendor = JBundler::Vendor.new( config.vendor_dir )
87
+ if vendor.vendored?
88
+ raise "already vendored. please 'jbundle install --no-deployment before."
89
+ else
90
+ vendor.setup( JBundler::ClasspathFile.new( config.classpath_file ) )
91
+ end
92
+ end
72
93
  do_show
73
94
  puts 'Your jbundle is complete! Use `jbundle show` to see where the bundled jars are installed.'
74
95
  end
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright (C) 2013 Kristian Meier
2
+ # Copyright (C) 2013 Christian Meier
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining a copy of
5
5
  # this software and associated documentation files (the "Software"), to deal in
@@ -25,23 +25,27 @@ module JBundler
25
25
  # allow yaml config in $HOME/.jbundlerrc and $PWD/.jbundlerrc
26
26
  class Config
27
27
 
28
- attr_accessor :verbose, :local_repository, :jarfile, :gemfile, :skip, :settings, :offline, :work_dir
28
+ attr_accessor :verbose, :local_repository, :jarfile, :gemfile, :skip, :settings, :offline, :work_dir, :vendor_dir
29
29
 
30
30
  def initialize
31
31
  file = '.jbundlerrc'
32
32
  homefile = File.join(ENV['HOME'], file)
33
33
  home_config = YAML.load_file(homefile) if File.exists?(homefile)
34
34
  pwd_config = YAML.load_file(file) if File.exists?(file)
35
+ File.expand_path( file )
35
36
  @config = (home_config || {}).merge(pwd_config || {})
36
37
  end
37
38
 
38
39
  if defined? JRUBY_VERSION
39
40
  def jbundler_env(key)
40
- @config[key.downcase.sub(/^j?bundle_/, '').sub(/[.]/, '_')] || java.lang.System.getProperty(key.downcase.gsub(/_/, '.')) || ENV[key.upcase.gsub(/[.]/, '_')]
41
+ java.lang.System.getProperty(key.downcase.gsub(/_/, '.')) ||
42
+ ENV[key.upcase.gsub(/[.]/, '_')] ||
43
+ @config[key.downcase.sub(/^j?bundle_/, '').sub(/[.]/, '_')]
41
44
  end
42
45
  else
43
46
  def jbundler_env(key)
44
- @config[key.downcase.sub(/^j?bundler/, '').sub(/[.]/, '_')] || ENV[key.upcase.gsub(/[.]/, '_')]
47
+ ENV[key.upcase.gsub(/[.]/, '_')] ||
48
+ @config[key.downcase.sub(/^j?bundler/, '').sub(/[.]/, '_')]
45
49
  end
46
50
  end
47
51
  private :jbundler_env
@@ -79,7 +83,7 @@ module JBundler
79
83
  end
80
84
 
81
85
  def classpath_file
82
- '.jbundler/classpath.rb'
86
+ jbundler_env('JBUNDLE_CLASSPATH_FILE') || '.jbundler/classpath.rb'
83
87
  end
84
88
 
85
89
  def local_repository
@@ -118,5 +122,9 @@ module JBundler
118
122
  @work_dir ||= jbundler_env('JBUNDLE_WORK_DIR') || 'target'
119
123
  end
120
124
 
125
+ def vendor_dir
126
+ @vendor_dir ||= jbundler_env('JBUNDLE_VENDOR_DIR') || File.join( 'vendor', 'jars' )
127
+ end
128
+
121
129
  end
122
130
  end
@@ -0,0 +1,23 @@
1
+ require 'jbundler/configurator'
2
+ module JBundler
3
+ class Configurator
4
+
5
+ attr_accessor :groups, :bootstrap, :verbose, :compile, :work_dir
6
+
7
+ def initialize( config )
8
+ @config = config
9
+ end
10
+
11
+ def configure( maven )
12
+ maven.property( 'jbundler.jarfile', @config.jarfile )
13
+ maven.property( 'jbundler.gemfile', @config.gemfile )
14
+ maven.property( 'jbundler.workdir', work_dir )
15
+ maven.property( 'jbundler.groups', @groups )
16
+ maven.property( 'jbundler.bootstrap', @bootstrap )
17
+ end
18
+
19
+ def work_dir
20
+ @work_dir ||= File.expand_path( @config.work_dir )
21
+ end
22
+ end
23
+ end
@@ -1,8 +1,5 @@
1
- require 'maven/tools/jarfile'
2
- require 'maven/tools/dsl'
3
1
  require 'maven/ruby/maven'
4
2
  require 'fileutils'
5
- require 'jbundler/executable_pom'
6
3
  module JBundler
7
4
  class Executable
8
5
 
@@ -13,30 +10,32 @@ module JBundler
13
10
  end
14
11
  def method_missing(m, *args, &b)
15
12
  args[ 0 ].sub!(/^.* - /, '' )
16
- args[ 0 ] = 'asd'
17
13
  @a.send(m,*args, &b)
18
14
  end
19
15
  end
20
16
 
21
- BOOTSTRAP = 'jar-bootstrap.rb'
22
-
23
- include Maven::Tools::DSL
24
-
25
17
  def initialize( bootstrap, config, compile, verbose, *groups )
26
18
  raise "file not found: #{bootstrap}" unless File.exists?( bootstrap )
27
- @pom = ExecutablePom.new( bootstrap, config, compile, verbose, *groups )
19
+ @config = Configurator.new( config )
20
+ @config.bootstrap = bootstrap
21
+ @config.compile = compile
22
+ @config.verbose = verbose
23
+ @config.groups = groups.join( ',' )
28
24
  end
29
25
 
30
26
  def packit
31
- m = Maven::Ruby::Maven.new( @pom.project, '.executable.pom.xml' )
32
- m.verbose = @verbose
33
- m.package
27
+ m = Maven::Ruby::Maven.new
28
+ m.options[ '-f' ] = File.join( File.dirname( __FILE__ ),
29
+ 'executable_pom.rb' )
30
+ @config.configure( m )
31
+ m.verbose = @config.verbose
32
+ m.package( '-P', @config.compile ? :compile : :no_compile )
34
33
 
35
- FileUtils.rm_f( 'dependency-reduced-pom.xml' )
34
+ #FileUtils.rm_f( 'dependency-reduced-pom.xml' )
36
35
  puts
37
36
  puts 'now you can execute your jar like this'
38
37
  puts
39
- puts "\tjava -jar #{@pom.work_dir}/#{@pom.project.artifact_id}.jar"
38
+ puts "\tjava -jar #{@config.work_dir}/executable/*.jar"
40
39
  puts
41
40
  end
42
41
  end
@@ -1,149 +1,110 @@
1
- require 'maven/tools/jarfile'
2
- require 'maven/tools/dsl'
3
- require 'maven/tools/versions'
4
- require 'maven/tools/model'
5
- require 'maven/ruby/maven'
6
- require 'fileutils'
7
- module JBundler
8
- class ExecutablePom
9
-
10
- BOOTSTRAP = 'jar-bootstrap.rb'
1
+ begin
2
+ groups = java.lang.System.getProperty( "jbundler.groups" ) || ''
3
+ require 'bundler'
4
+ Bundler.setup( *groups.split( /,/ ) )
5
+ rescue LoadError
6
+ # ignore- bundler is optional
7
+ end
11
8
 
12
- include Maven::Tools::DSL
9
+ jfile = ::Maven::Tools::Jarfile.new( java.lang.System.getProperty( "jbundler.jarfile" ) )
13
10
 
14
- def initialize( bootstrap, config, compile, verbose, *groups )
15
- @bootstrap = bootstrap
16
- @config = config
17
- @groups = groups
18
- @compile = compile
19
- @verbose = verbose
20
- end
11
+ workdir = java.lang.System.getProperty( "jbundler.workdir" )
12
+ jworkdir = File.join( workdir, 'executable' )
13
+ FileUtils.rm_rf( jworkdir )
14
+ FileUtils.mkdir_p( jworkdir )
21
15
 
22
- private
16
+ BOOTSTRAP = 'jar-bootstrap.rb' unless defined? BOOTSTRAP
23
17
 
24
- def setup_jruby( jruby )
25
- if ( jruby < '1.6' )
26
- raise 'jruby before 1.6 are not supported'
27
- elsif ( jruby < '1.7' )
28
- warn 'jruby version below 1.7 uses jruby-complete'
29
- jar 'org.jruby:jruby-complete', jruby
30
- elsif ( jruby < '1.7.5' )
31
- jar 'org.jruby:jruby-core', jruby
32
- else
33
- jar 'org.jruby:jruby', jruby
34
- end
35
- end
18
+ FileUtils.cp( java.lang.System.getProperty( 'jbundler.bootstrap'),
19
+ File.join( jworkdir, BOOTSTRAP ) )
36
20
 
37
- def jruby_home( path )
38
- File.join( 'META-INF/jruby.home/lib/ruby/gems/shared', path )
39
- end
21
+ def jruby_home( path )
22
+ File.join( 'META-INF/jruby.home/lib/ruby/gems/shared', path )
23
+ end
40
24
 
41
- def bundler_setup
42
- require 'bundler'
43
- Bundler.setup( *@groups )
44
- rescue LoadError
45
- # ignore- bundler is optional
46
- end
47
-
48
- def jarfile
49
- unless @jarfile
50
- bundler_setup
51
-
52
- require 'jbundler'
53
- @jarfile = ::Maven::Tools::Jarfile.new( @config.jarfile )
54
- end
55
- @jarfile
25
+
26
+ jfile.locked.each do |dep|
27
+ artifact( dep )
28
+ end
29
+ build.final_name = model.artifact_id
30
+ build.directory = jworkdir
31
+ resource do
32
+ directory jworkdir
33
+ includes [ BOOTSTRAP ]
34
+ end
35
+ Gem.loaded_specs.values.each do |s|
36
+ resource do
37
+ directory s.full_gem_path
38
+ target_path File.join( jruby_home( 'gems' ),
39
+ File.basename( s.full_gem_path ) )
40
+ if s.full_gem_path == File.expand_path( '.' )
41
+ excludes [ "**/#{workdir}/**" ]
56
42
  end
43
+ end
44
+ resource do
45
+ directory File.dirname( s.loaded_from )
46
+ includes [ File.basename( s.loaded_from ) ]
47
+ target_path jruby_home( 'specifications' )
48
+ end
49
+ end
57
50
 
58
- def create_project
59
- maven do
60
- jarfile.locked.each do |dep|
61
- artifact( dep )
62
- end
63
- build.final_name = model.artifact_id
64
- build.directory = work_dir
65
- resource do
66
- directory work_dir
67
- includes [ BOOTSTRAP ]
68
- end
69
- Gem.loaded_specs.values.each do |s|
70
- resource do
71
- directory s.full_gem_path
72
- target_path File.join( jruby_home( 'gems' ),
73
- File.basename( s.full_gem_path ) )
74
- if s.full_gem_path == File.expand_path( '.' )
75
- excludes [ "**/#{File.basename( @config.work_dir )}/**" ]
76
- end
77
- end
78
- resource do
79
- directory File.dirname( s.loaded_from )
80
- includes [ File.basename( s.loaded_from ) ]
81
- target_path jruby_home( 'specifications' )
82
- end
83
- end
84
-
85
- properties( 'maven.test.skip' => true,
86
- 'project.build.sourceEncoding' => 'utf-8' )
51
+ properties( 'maven.test.skip' => true,
52
+ 'project.build.sourceEncoding' => 'utf-8' )
87
53
 
88
- jarfile.populate_unlocked do |dsl|
89
- setup_jruby( dsl.jruby || JRUBY_VERSION )
90
- local = dsl.artifacts.select do |a|
91
- a[ :system_path ]
92
- end
93
- if local
94
- localrepo = File.join( work_dir, 'localrepo' )
95
- repository( "file:#{localrepo}", :id => 'localrepo' )
96
- local.each do |a|
97
- file = "#{localrepo}/#{a[ :group_id ].gsub( /\./, File::SEPARATOR)}/#{a[ :artifact_id ]}/#{a[ :version ]}/#{a[ :artifact_id ]}-#{a[ :version ]}.#{a[ :type ]}"
98
- FileUtils.mkdir_p( File.dirname( file ) )
99
- FileUtils.cp( a.delete( :system_path ), file )
100
- a.delete( :scope )
101
- jar a
102
- end
103
- end
104
- end
105
-
106
- if @compile
107
-
108
- properties 'jruby.plugins.version' => Maven::Tools::VERSIONS[ :jruby_plugins ]
109
- plugin( 'de.saumya.mojo:jruby-maven-plugin', '${jruby.plugins.version}' ) do
110
- execute_goal( :compile,
111
- :rubySourceDirectory => 'lib',
112
- :jrubycVerbose => @verbose)
113
- end
114
-
115
- else
54
+ jfile.populate_unlocked do |dsl|
55
+
56
+ # setup jruby version
57
+ jruby_version = dsl.jruby || JRUBY_VERSION
58
+ if ( jruby_version < '1.6' )
59
+ raise 'jruby before 1.6 are not supported'
60
+ elsif ( jruby_version < '1.7' )
61
+ warn 'jruby version below 1.7 uses jruby-complete'
62
+ jar 'org.jruby:jruby-complete', jruby_version
63
+ elsif ( jruby_version < '1.7.5' )
64
+ jar 'org.jruby:jruby-core', jruby_version
65
+ else
66
+ jar 'org.jruby:jruby', jruby_version
67
+ end
116
68
 
117
- resource do
118
- directory '${basedir}/lib'
119
- includes [ '**/*.rb' ]
120
- end
69
+ local = dsl.artifacts.select do |a|
70
+ a[ :system_path ]
71
+ end
121
72
 
122
- end
123
-
124
- plugin( :shade, '2.1',
125
- :transformers => [ { '@implementation' => 'org.apache.maven.plugins.shade.resource.ManifestResourceTransformer',
126
- :mainClass => 'org.jruby.JarBootstrapMain' } ] ) do
127
- execute_goals( 'shade', :phase => 'package' )
128
- end
129
- end
73
+ # setup a localrepo for the local jars if needed
74
+ if local
75
+ localrepo = File.join( jworkdir, 'localrepo' )
76
+ repository( "file:#{localrepo}", :id => 'localrepo' )
77
+ local.each do |a|
78
+ file = "#{localrepo}/#{a[ :group_id ].gsub( /\./, File::SEPARATOR)}/#{a[ :artifact_id ]}/#{a[ :version ]}/#{a[ :artifact_id ]}-#{a[ :version ]}.#{a[ :type ]}"
79
+ FileUtils.mkdir_p( File.dirname( file ) )
80
+ FileUtils.cp( a.delete( :system_path ), file )
81
+ a.delete( :scope )
82
+ jar a
130
83
  end
84
+ end
85
+ end
131
86
 
132
- public
133
-
134
- def work_dir
135
- unless @work_dir
136
- @work_dir = File.join( @config.work_dir, 'executable' )
137
- FileUtils.rm_rf( @work_dir )
138
- FileUtils.mkdir_p( @work_dir )
139
- FileUtils.cp( @bootstrap, File.join( @work_dir,
140
- BOOTSTRAP ) )
141
- end
142
- @work_dir
143
- end
87
+ profile :compile do
88
+
89
+ properties 'jruby.plugins.version' => Maven::Tools::VERSIONS[ :jruby_plugins ]
90
+ plugin( 'de.saumya.mojo:jruby-maven-plugin', '${jruby.plugins.version}' ) do
91
+ execute_goal( :compile,
92
+ :rubySourceDirectory => 'lib',
93
+ :jrubycVerbose => @verbose)
94
+ end
95
+ end
144
96
 
145
- def project
146
- @project ||= create_project
147
- end
97
+ profile :no_compile do
98
+ build do
99
+ resource do
100
+ directory '${basedir}/lib'
101
+ includes [ '**/*.rb' ]
102
+ end
148
103
  end
149
104
  end
105
+
106
+ plugin( :shade, '2.1',
107
+ :transformers => [ { '@implementation' => 'org.apache.maven.plugins.shade.resource.ManifestResourceTransformer',
108
+ :mainClass => 'org.jruby.JarBootstrapMain' } ] ) do
109
+ execute_goals( 'shade', :phase => 'package' )
110
+ end
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright (C) 2013 Kristian Meier
2
+ # Copyright (C) 2013 Christian Meier
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining a copy of
5
5
  # this software and associated documentation files (the "Software"), to deal in
data/lib/jbundler/lazy.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright (C) 2013 Kristian Meier
2
+ # Copyright (C) 2013 Christian Meier
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining a copy of
5
5
  # this software and associated documentation files (the "Software"), to deal in
@@ -99,4 +99,4 @@ module JBundler
99
99
  end
100
100
  end
101
101
  end
102
- end
102
+ end
data/lib/jbundler/pom.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright (C) 2013 Kristian Meier
2
+ # Copyright (C) 2013 Christian Meier
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining a copy of
5
5
  # this software and associated documentation files (the "Software"), to deal in
data/lib/jbundler/tree.rb CHANGED
@@ -1,3 +1,4 @@
1
+ require 'jbundler/configurator'
1
2
  require 'maven/tools/jarfile'
2
3
  require 'maven/tools/dsl'
3
4
  require 'maven/tools/model'
@@ -9,46 +10,27 @@ module JBundler
9
10
  include Maven::Tools::DSL
10
11
 
11
12
  def initialize( config )
12
- @config = config
13
+ @config = Configurator.new( config )
13
14
  end
14
15
 
15
16
  def show_it( debug = false )
16
- require 'jbundler'
17
- jfile = ::Maven::Tools::Jarfile.new( @config.jarfile )
18
- project = maven do
19
- basedir( File.dirname( @config.jarfile ) )
17
+ m = Maven::Ruby::Maven.new
18
+ m.options[ '-f' ] = File.join( File.dirname( __FILE__ ), 'tree_pom.rb' )
19
+ @config.configure( m )
20
20
 
21
- gemfile( @config.gemfile ) if File.exists? @config.gemfile
22
-
23
- jarfile :skip_locked => true
24
-
25
- build.directory = @config.work_dir if @config.work_dir != 'target'
26
-
27
- properties( 'project.build.sourceEncoding' => 'utf-8' )
21
+ unless debug
22
+ # silence the output
23
+ old = java.lang.System.err
24
+ java.lang.System.err = java.io.PrintStream.new( java.io.ByteArrayOutputStream.new )
28
25
  end
29
26
 
30
- output = java.io.ByteArrayOutputStream.new
31
- out = java.io.PrintStream.new( output )
32
- old = java.lang.System.err
33
- java.lang.System.err = out
34
-
35
- m = Maven::Ruby::Maven.new( project, '.tree.pom.xml' )
36
27
  m.exec( 'org.apache.maven.plugins:maven-dependency-plugin:2.8:tree' )
37
- result = output.to_string( 'utf-8' ).split( "\n" )
38
- result = result.each do |line|
39
- line.gsub!( /\[[^ ]+\] /, '' )
40
- end
41
- unless debug
42
- result = result.select do |line|
43
- line =~ /^[INFO].*/
44
- end
45
- end
46
- result = result.each do |line|
47
- line.gsub!( /^.* - /, '' )
48
- end
49
- $stdout.puts result.join( "\n" )#.gsub( /^.* - /, '' )#.gsub( /\n\n\n/, "\n" )
28
+
29
+ puts File.read( File.join( File.expand_path( @config.work_dir ),
30
+ 'tree.txt' ) )
31
+
50
32
  ensure
51
- java.lang.System.err = old
33
+ java.lang.System.err = old if old
52
34
  end
53
35
  end
54
36
  end
@@ -0,0 +1,19 @@
1
+ jfile = java.lang.System.getProperty( "jbundler.jarfile" )
2
+ gfile = java.lang.System.getProperty( "jbundler.gemfile" )
3
+ jworkdir = java.lang.System.getProperty( "jbundler.workdir" )
4
+
5
+ basedir( File.dirname( jfile ) )
6
+
7
+ gemfile( gfile ) if File.exists? gfile
8
+
9
+ jarfile( jfile, :skip_locked => true )
10
+
11
+ build do
12
+ directory = jworkdir
13
+ default_goal 'dependency:tree'
14
+ end
15
+
16
+ properties( 'project.build.sourceEncoding' => 'utf-8',
17
+ 'tesla.dump.readOnly' => true,
18
+ 'tesla.dump.pom' => 'tree.pom.xml',
19
+ 'outputFile' => '${project.build.directory}/tree.txt' )