puck 1.0.0.pre0 → 1.0.0.pre1
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/puck +0 -2
- data/lib/puck/configuration.rb +20 -13
- data/lib/puck/jar.rb +23 -10
- data/lib/puck/version.rb +1 -1
- metadata +7 -21
data/bin/puck
CHANGED
data/lib/puck/configuration.rb
CHANGED
@@ -19,26 +19,33 @@ module Puck
|
|
19
19
|
|
20
20
|
private
|
21
21
|
|
22
|
-
|
23
|
-
|
22
|
+
SCALAR_ARGS = [:app_name, :app_dir, :build_dir, :jruby_complete].freeze
|
23
|
+
LIST_ARGS = [:extra_files].freeze
|
24
|
+
ARG_PREFIX = '--'.freeze
|
24
25
|
|
26
|
+
def command_line_options
|
25
27
|
state = nil
|
26
|
-
|
27
|
-
|
28
|
-
arg
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
28
|
+
option = nil
|
29
|
+
@argv.each_with_object({}) do |arg, options|
|
30
|
+
if arg.start_with?(ARG_PREFIX)
|
31
|
+
option = arg.sub(/^--/, '').gsub('-', '_').to_sym
|
32
|
+
if LIST_ARGS.include?(option)
|
33
|
+
options[option] = []
|
34
|
+
state = :list
|
35
|
+
else
|
36
|
+
state = :scalar
|
37
|
+
end
|
33
38
|
else
|
34
39
|
case state
|
35
|
-
when :
|
36
|
-
options[
|
40
|
+
when :list
|
41
|
+
options[option] << arg
|
42
|
+
when :scalar
|
43
|
+
options[option] = arg
|
44
|
+
option = nil
|
45
|
+
state = nil
|
37
46
|
end
|
38
47
|
end
|
39
48
|
end
|
40
|
-
|
41
|
-
options
|
42
49
|
end
|
43
50
|
end
|
44
51
|
end
|
data/lib/puck/jar.rb
CHANGED
@@ -6,18 +6,21 @@ require 'pathname'
|
|
6
6
|
require 'set'
|
7
7
|
require 'ant'
|
8
8
|
require 'bundler'
|
9
|
-
require 'jruby-jars'
|
10
9
|
require 'puck/version'
|
11
10
|
|
11
|
+
begin
|
12
|
+
require 'jruby-jars'
|
13
|
+
rescue LoadError
|
14
|
+
end
|
12
15
|
|
13
16
|
module Puck
|
14
17
|
class Jar
|
15
18
|
def initialize(configuration={})
|
16
19
|
@configuration = configuration.dup
|
17
|
-
@configuration[:
|
18
|
-
@configuration[:
|
19
|
-
@configuration[:build_dir] ||= File.join(@configuration[:
|
20
|
-
@configuration[:jar_name] ||= @configuration[:
|
20
|
+
@configuration[:app_dir] ||= Dir.pwd
|
21
|
+
@configuration[:app_name] ||= File.basename(@configuration[:app_dir])
|
22
|
+
@configuration[:build_dir] ||= File.join(@configuration[:app_dir], 'build')
|
23
|
+
@configuration[:jar_name] ||= @configuration[:app_name] + '.jar'
|
21
24
|
end
|
22
25
|
|
23
26
|
def create!
|
@@ -25,8 +28,14 @@ module Puck
|
|
25
28
|
|
26
29
|
Dir.mktmpdir do |tmp_dir|
|
27
30
|
output_path = File.join(@configuration[:build_dir], @configuration[:jar_name])
|
28
|
-
project_dir = Pathname.new(@configuration[:
|
31
|
+
project_dir = Pathname.new(@configuration[:app_dir])
|
29
32
|
extra_files = @configuration[:extra_files] || []
|
33
|
+
jruby_complete_path = @configuration[:jruby_complete]
|
34
|
+
|
35
|
+
if !(defined? JRubyJars) && !(jruby_complete_path && File.exists?(jruby_complete_path))
|
36
|
+
raise ArgumentError, 'Cannot build Jar: jruby-jars must be installed, or :jruby_complete must be specified'
|
37
|
+
end
|
38
|
+
|
30
39
|
gem_dependencies = resolve_gem_dependencies
|
31
40
|
create_jar_bootstrap!(tmp_dir, gem_dependencies)
|
32
41
|
|
@@ -38,8 +47,13 @@ module Puck
|
|
38
47
|
end
|
39
48
|
|
40
49
|
zipfileset dir: tmp_dir, includes: 'jar-bootstrap.rb'
|
41
|
-
|
42
|
-
|
50
|
+
|
51
|
+
if jruby_complete_path
|
52
|
+
zipfileset src: jruby_complete_path
|
53
|
+
else
|
54
|
+
zipfileset src: JRubyJars.core_jar_path
|
55
|
+
zipfileset src: JRubyJars.stdlib_jar_path
|
56
|
+
end
|
43
57
|
|
44
58
|
%w[bin lib].each do |sub_dir|
|
45
59
|
zipfileset dir: project_dir + sub_dir, prefix: "META-INF/app.home/#{sub_dir}"
|
@@ -70,8 +84,7 @@ module Puck
|
|
70
84
|
gemspec_path = File.join(ENV['GEM_HOME'], 'bundler', 'gems', "#{bundler_spec.name}-#{revision[0, 12]}", "#{bundler_spec.name}.gemspec")
|
71
85
|
base_path = File.dirname(gemspec_path)
|
72
86
|
else
|
73
|
-
|
74
|
-
gemspec_path = File.join(ENV['GEM_HOME'], 'specifications', "#{bundler_spec.full_name}#{platform_ext}.gemspec")
|
87
|
+
gemspec_path = File.join(ENV['GEM_HOME'], 'specifications', "#{bundler_spec.full_name}.gemspec")
|
75
88
|
base_path = File.join(ENV['GEM_HOME'], 'gems', bundler_spec.full_name)
|
76
89
|
end
|
77
90
|
if File.exists?(gemspec_path)
|
data/lib/puck/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.0.0.pre1
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,28 +9,13 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-07-
|
13
|
-
dependencies:
|
14
|
-
- !ruby/object:Gem::Dependency
|
15
|
-
name: jruby-jars
|
16
|
-
version_requirements: !ruby/object:Gem::Requirement
|
17
|
-
requirements:
|
18
|
-
- - '='
|
19
|
-
- !ruby/object:Gem::Version
|
20
|
-
version: 1.7.3
|
21
|
-
none: false
|
22
|
-
requirement: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - '='
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: 1.7.3
|
27
|
-
none: false
|
28
|
-
prerelease: false
|
29
|
-
type: :runtime
|
12
|
+
date: 2013-07-19 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
30
14
|
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 …`
|
31
15
|
email:
|
32
16
|
- theo@iconara.net
|
33
|
-
executables:
|
17
|
+
executables:
|
18
|
+
- puck
|
34
19
|
extensions: []
|
35
20
|
extra_rdoc_files: []
|
36
21
|
files:
|
@@ -41,7 +26,8 @@ files:
|
|
41
26
|
- lib/puck/version.rb
|
42
27
|
- bin/puck
|
43
28
|
homepage: http://github.com/iconara/puck
|
44
|
-
licenses:
|
29
|
+
licenses:
|
30
|
+
- Apache License 2.0
|
45
31
|
post_install_message:
|
46
32
|
rdoc_options: []
|
47
33
|
require_paths:
|