puck 1.1.2-java → 1.2.1-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9be5db817f2a52208fd00d8eb9cd41ea3fe4c2c0
4
- data.tar.gz: c1df6a00d10c8a6267ecef863e5c5c1657f54203
3
+ metadata.gz: 47bef3c027c28957af4b9cee38362eb563da11fc
4
+ data.tar.gz: feac13fef9a26c7abde2e17dfba0eb8d32d2f1fb
5
5
  SHA512:
6
- metadata.gz: be33f0e5cd5dcc5d827448a09c3c9beecf2ac315ff5eea48b7f55d70ac6d8095243b36a6d0d2970de5e6a8aa6124c3b0055ed6338945d2042c465fd522cf430e
7
- data.tar.gz: a05e6f86f4dad6a3b41f19e4bc031ee7101ea1a5f19591c3b09cca3a3f4436165fc13a1e6b90f7a11c1090f8c2097406b4cdb08e5441bbc6844a6b0ecf056d3b
6
+ metadata.gz: 184478dc20a2ad1439fec9b1f0a1edd3c967c62c139490c6d76dc05484eb2adc23ea29f1946b64372afbf65cb58b3ab7b683a7c1ea6d180599a16ba87a0b64fb
7
+ data.tar.gz: 0eccc25eb4cbb0234abddf4b1e4c476500654ad751a1e13a3f29e887a11043fc611e4c6b1cf162d1fda5762a180d35d9f06f35de8bc53d5b5c28c3448849a0a2
@@ -1,12 +1,16 @@
1
1
  if ARGV.any?
2
2
  file_name = ARGV.shift
3
+ bin_file_found = false
3
4
  PUCK_BIN_PATH.each do |dir|
4
5
  relative_path = File.join(dir, file_name)
5
6
  if File.exists?("classpath:/#{relative_path}")
7
+ bin_file_found = true
6
8
  $0 = relative_path
7
9
  load(relative_path)
8
- exit
10
+ break
9
11
  end
10
12
  end
11
- abort(%(No "#{file_name}" in #{PUCK_BIN_PATH.join(File::PATH_SEPARATOR)}))
13
+ unless bin_file_found
14
+ abort(%(No "#{file_name}" in #{PUCK_BIN_PATH.join(File::PATH_SEPARATOR)}))
15
+ end
12
16
  end
@@ -21,7 +21,7 @@ module Puck
21
21
  private
22
22
 
23
23
  SCALAR_ARGS = [:app_name, :app_dir, :build_dir, :jruby_complete].freeze
24
- LIST_ARGS = [:extra_files].freeze
24
+ LIST_ARGS = [:extra_files, :merge_archives].freeze
25
25
  ARG_PREFIX = '--'.freeze
26
26
 
27
27
  def command_line_options
@@ -33,7 +33,8 @@ module Puck
33
33
  # task :jar do
34
34
  # jar = Puck::Jar.new(
35
35
  # extra_files: Dir['config/*.yml'],
36
- # jruby_complete: 'build/custom-jruby-complete.jar'
36
+ # jruby_complete: 'build/custom-jruby-complete.jar',
37
+ # merge_archives: Dir['external.jar']
37
38
  # )
38
39
  # jar.create
39
40
  # end
@@ -53,6 +54,13 @@ module Puck
53
54
  # in which case paths must be below the `:app_dir`, or a Hash, in which
54
55
  # case the file specified by the key is included at the path specified by
55
56
  # the corresponding value.
57
+ # @option configuration [Array<String>, Hash<String,String>] :merge_archives
58
+ # a list of Jars to be merged into the Jar. The option can be either an Array,
59
+ # in which case the source Jar or zip file will be merged at the root,
60
+ # or a Hash, in which case the Jar specified by the key is merged at the path
61
+ # specified by its value. Signature files ('META-INF/*.SF', 'META-INF/*.RSA',
62
+ # 'META-INF/*.DSA' and 'META-INF/SIG-*') are discarded in the merge,
63
+ # since they describe the source Jar and will not match the Jar produced by Puck.
56
64
  # @option configuration [String] :gem_groups ([:default]) a list of gem
57
65
  # groups to include in the Jar. Remember to include the default group if
58
66
  # you override this option.
@@ -91,12 +99,18 @@ module Puck
91
99
  temporary_output_path = File.join(Dir.mktmpdir, @configuration[:jar_name])
92
100
  project_dir = Pathname.new(@configuration[:app_dir]).expand_path.cleanpath
93
101
  extra_files = @configuration[:extra_files] || []
94
- jruby_complete_path = @configuration[:jruby_complete]
95
102
 
96
103
  if !(defined? JRubyJars) && !(jruby_complete_path && File.exists?(jruby_complete_path))
97
104
  raise PuckError, 'Cannot build Jar: jruby-jars must be installed, or :jruby_complete must be specified'
98
105
  end
99
106
 
107
+ merge_archives = (@configuration[:merge_archives] || []).to_a
108
+ if (jruby_complete = @configuration[:jruby_complete])
109
+ merge_archives << jruby_complete
110
+ else
111
+ merge_archives.push(JRubyJars.core_jar_path, JRubyJars.stdlib_jar_path)
112
+ end
113
+
100
114
  gem_dependencies = @dependency_resolver.resolve_gem_dependencies(@configuration)
101
115
  create_jar_bootstrap!(tmp_dir, gem_dependencies)
102
116
 
@@ -110,13 +124,6 @@ module Puck
110
124
 
111
125
  zipfileset dir: tmp_dir, includes: 'jar-bootstrap.rb'
112
126
 
113
- if jruby_complete_path
114
- zipfileset src: jruby_complete_path
115
- else
116
- zipfileset src: JRubyJars.core_jar_path
117
- zipfileset src: JRubyJars.stdlib_jar_path
118
- end
119
-
120
127
  %w[bin lib].each do |sub_dir|
121
128
  path = project_dir + sub_dir
122
129
  if File.exists?(path)
@@ -140,6 +147,14 @@ module Puck
140
147
  zipfileset dir: spec[:base_path], prefix: File.join(JAR_GEM_HOME, spec[:versioned_name])
141
148
  end
142
149
  end
150
+
151
+ merge_archives.each do |archive, target_path|
152
+ if target_path
153
+ zipfileset src: archive, prefix: target_path, excludes: SIGNATURE_FILES
154
+ else
155
+ zipfileset src: archive, excludes: SIGNATURE_FILES
156
+ end
157
+ end
143
158
  end
144
159
 
145
160
  FileUtils.mv(temporary_output_path, output_path)
@@ -162,6 +177,7 @@ module Puck
162
177
  JAR_APP_HOME = 'META-INF/app.home'.freeze
163
178
  JAR_GEM_HOME = 'META-INF/gem.home'.freeze
164
179
  JAR_JRUBY_HOME = 'META-INF/jruby.home'.freeze
180
+ SIGNATURE_FILES = ['META-INF/*.SF', 'META-INF/*.RSA', 'META-INF/*.DSA', 'META-INF/SIG-*'].join(',').freeze
165
181
 
166
182
  def create_jar_bootstrap!(tmp_dir, gem_dependencies)
167
183
  File.open(File.join(tmp_dir, 'jar-bootstrap.rb'), 'w') do |io|
@@ -172,7 +188,7 @@ module Puck
172
188
  io.puts
173
189
  gem_dependencies.each do |spec|
174
190
  spec[:load_paths].each do |load_path|
175
- io.puts(%($LOAD_PATH << 'classpath:#{JAR_GEM_HOME}/#{spec[:versioned_name]}/#{load_path}'))
191
+ io.puts(%($LOAD_PATH << 'classpath:/#{JAR_GEM_HOME}/#{spec[:versioned_name]}/#{load_path}'))
176
192
  end
177
193
  end
178
194
  io.puts
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Puck
4
- VERSION = '1.1.2'.freeze
4
+ VERSION = '1.2.1'.freeze
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puck
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.2.1
5
5
  platform: java
6
6
  authors:
7
7
  - Theo Hultberg
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-07 00:00:00.000000000 Z
11
+ date: 2015-12-14 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Puck takes your app and packs it along with all your gems and a complete JRuby runtime in a standalone Jar file that can be run with just `java -jar …`
14
14
  email: