puck 1.0.0-java → 1.1.0-java

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/puck/jar.rb +39 -29
  3. data/lib/puck/version.rb +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1d3c8ed8c414ffb5241dd8dd7b903686ea9d1bf5
4
- data.tar.gz: 67e2972eaafcac0792998786d3d65b96942dc4f2
3
+ metadata.gz: 1d2fa619bd5d33c67783df7f02b076b8d8fb7d61
4
+ data.tar.gz: a2d9a4ceaf07a7c12c8d0f156633ff65627ee8b2
5
5
  SHA512:
6
- metadata.gz: 32db0d6f29e15a77dc05cb24078c18333c1bf2de228ee1bf8b5fcd113c1eab0c1a4308d972411b6690e1f6da2f2b828376e704d94eba27e63cdcc0c4a20b89cd
7
- data.tar.gz: 9fd222f28c53f4d6f61a4532b14d56cbd077d09efccdd68b05a334f891084e930cf541ac6e97d989bf4d6e0fe6637d8d6b0fe0daa50f8f59e82c52e1b0fa3fe9
6
+ metadata.gz: f1d492499c49e043bbc2f2b9585e79437b76d7ad32539024378ba1fc2b0d49006083e8f376ddc3d83aa46697aeae1ad4adb8a1d72b00c16352bba9c92186b688
7
+ data.tar.gz: 0882d65123098436d26afdbd499afb254f1aa883623e1daae7edf8fa7c114edf67267209d2de814f0bdfacf0f3554f255b2a1b75788846b71f5e85654d8e282a
@@ -48,8 +48,11 @@ module Puck
48
48
  # is the same as the name of the directory containing the "lib" directory.
49
49
  #
50
50
  # @param [Hash] configuration
51
- # @option configuration [String] :extra_files a list of files to include in
52
- # the Jar. The paths must be below the `:app_dir`.
51
+ # @option configuration [Array<String>, Hash<String,String>] :extra_files a
52
+ # list of files to include in the Jar. The option can be either an Array,
53
+ # in which case paths must be below the `:app_dir`, or a Hash, in which
54
+ # case the file specified by the key is included at the path specified by
55
+ # the corresponding value.
53
56
  # @option configuration [String] :gem_groups ([:default]) a list of gem
54
57
  # groups to include in the Jar. Remember to include the default group if
55
58
  # you override this option.
@@ -97,42 +100,49 @@ module Puck
97
100
  create_jar_bootstrap!(tmp_dir, gem_dependencies)
98
101
 
99
102
  ant = Ant.new(output_level: 1)
100
- ant.jar(destfile: output_path) do
101
- manifest do
102
- attribute name: 'Main-Class', value: 'org.jruby.JarBootstrapMain'
103
- attribute name: 'Created-By', value: "Puck v#{Puck::VERSION}"
104
- end
103
+ begin
104
+ ant.jar(destfile: output_path) do
105
+ manifest do
106
+ attribute name: 'Main-Class', value: 'org.jruby.JarBootstrapMain'
107
+ attribute name: 'Created-By', value: "Puck v#{Puck::VERSION}"
108
+ end
105
109
 
106
- zipfileset dir: tmp_dir, includes: 'jar-bootstrap.rb'
110
+ zipfileset dir: tmp_dir, includes: 'jar-bootstrap.rb'
107
111
 
108
- if jruby_complete_path
109
- zipfileset src: jruby_complete_path
110
- else
111
- zipfileset src: JRubyJars.core_jar_path
112
- zipfileset src: JRubyJars.stdlib_jar_path
113
- end
112
+ if jruby_complete_path
113
+ zipfileset src: jruby_complete_path
114
+ else
115
+ zipfileset src: JRubyJars.core_jar_path
116
+ zipfileset src: JRubyJars.stdlib_jar_path
117
+ end
114
118
 
115
- %w[bin lib].each do |sub_dir|
116
- path = project_dir + sub_dir
117
- if File.exists?(path)
118
- zipfileset dir: path, prefix: File.join(JAR_APP_HOME, sub_dir)
119
+ %w[bin lib].each do |sub_dir|
120
+ path = project_dir + sub_dir
121
+ if File.exists?(path)
122
+ zipfileset dir: path, prefix: File.join(JAR_APP_HOME, sub_dir)
123
+ end
119
124
  end
120
- end
121
125
 
122
- extra_files.each do |ef|
123
- path = Pathname.new(ef).expand_path.cleanpath
124
- prefix = File.join(JAR_APP_HOME, path.relative_path_from(project_dir).dirname.to_s)
125
- zipfileset dir: path.dirname, prefix: prefix, includes: path.basename
126
- end
126
+ extra_files.each do |file, target_path|
127
+ path = Pathname.new(file).expand_path.cleanpath
128
+ if target_path
129
+ zipfileset file: path, fullpath: target_path
130
+ else
131
+ prefix = File.join(JAR_APP_HOME, path.relative_path_from(project_dir).dirname.to_s)
132
+ zipfileset dir: path.dirname, prefix: prefix, includes: path.basename
133
+ end
134
+ end
127
135
 
128
- gem_dependencies.each do |spec|
129
- base_path = Pathname.new(spec[:base_path]).expand_path.cleanpath
130
- unless project_dir == base_path
131
- zipfileset dir: spec[:base_path], prefix: File.join(JAR_GEM_HOME, spec[:versioned_name])
136
+ gem_dependencies.each do |spec|
137
+ base_path = Pathname.new(spec[:base_path]).expand_path.cleanpath
138
+ unless project_dir == base_path
139
+ zipfileset dir: spec[:base_path], prefix: File.join(JAR_GEM_HOME, spec[:versioned_name])
140
+ end
132
141
  end
133
142
  end
143
+ rescue Java::OrgApacheToolsAnt::BuildException => e
144
+ raise PuckError, sprintf('Error when building JAR: %s (%s)', e.message, e.class), e.backtrace
134
145
  end
135
-
136
146
  output_path
137
147
  end
138
148
  end
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Puck
4
- VERSION = '1.0.0'.freeze
4
+ VERSION = '1.1.0'.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.0.0
4
+ version: 1.1.0
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-02-12 00:00:00.000000000 Z
11
+ date: 2015-09-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: