jnlp 0.0.5.3 → 0.0.5.4

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.
data/History.txt CHANGED
@@ -1,3 +1,23 @@
1
+ == 0.0.5.4 2010-02-11
2
+
3
+ addition optional parameter: arch for Jnlp::Jnlp instance methods:
4
+ j2se_version(os=nil, arch=nil)
5
+ max_heap_size(os=nil, arch=nil)
6
+ initial_heap_size(os=nil, arch=nil)
7
+
8
+ new method Jnlp::Jnlp#java_vm_args(os=nil, arch=nil)
9
+
10
+ works with additional specific j2se elements such as:
11
+
12
+ <resources os="Mac OS X" arch="ppc i386">
13
+ <j2se version="1.5" max-heap-size="128m" initial-heap-size="32m"/>
14
+ </resources>
15
+ <resources os="Mac OS X" arch="x86_64">
16
+ <j2se version="1.5" max-heap-size="128m" initial-heap-size="32m" java-vm-args="-d32"/>
17
+ </resources>
18
+
19
+ new specs for new behaviors
20
+
1
21
  == 0.0.5.3 2009-12-23
2
22
 
3
23
  remove older files, specs for jnlp with jars without explicit version attributes
data/README.txt CHANGED
@@ -41,3 +41,8 @@ The source code for the jnlp gem is on github[http://github.com/stepheneb/jnlp/t
41
41
 
42
42
  git clone git://github.com/stepheneb/jnlp.git
43
43
 
44
+ === Running the tests
45
+
46
+ In JRuby: jruby -S rake spec
47
+ In MRI: rake spec
48
+
data/lib/jnlp/jnlp.rb CHANGED
@@ -125,25 +125,50 @@ module Jnlp #:nodoc:
125
125
  #
126
126
  attr_reader :initial_heap_size
127
127
  #
128
+ # Contains the value of the optional java-vm-args attribute in
129
+ # in the J2SE element, the value is nil if not present:
130
+ #
131
+ # Example:
132
+ #
133
+ # "-d32"
134
+ #
135
+ attr_reader :java_vm_args
136
+ #
128
137
  # Contains the value of the os attribute in the
129
138
  # parent <resources> element that contains this property
130
- # if the attribute was set in the parent.
139
+ # if the attribute was set in the parent. The attribute is normalized
140
+ # by converting to lowercase and changing ' ' characters to '_'
141
+ #
131
142
  # Example:
132
143
  #
133
- # "Mac OS X"
144
+ # "Mac OS X" => "mac_os_x"
134
145
  #
135
146
  attr_reader :os
136
147
  #
148
+ # Contains the value of the arch attribute in the
149
+ # parent <resources> element that contains this property
150
+ # if the attribute was set in the parent.The attribute is normalized
151
+ # by converting to lowercase and changing ' ' characters to '_'
152
+ #
153
+ # Examples:
154
+ #
155
+ # "ppc i386" => "ppc_i386"
156
+ # "x86_64" => "x86_64"
157
+ #
158
+ attr_reader :arch
159
+ #
137
160
  # Creates a new Jnlp::Property object.
138
161
  # * _prop_: the Hpricot parsing of the specific jnlp/resources/property element
139
162
  # * _os_: optional: include it if the resources parent element that contains the property has this attribute set
140
163
  #
141
- def initialize(j2se, os=nil)
164
+ def initialize(j2se, os=nil, arch=nil)
142
165
  @j2se = j2se
143
166
  @version = j2se['version']
144
167
  @max_heap_size = j2se['max-heap-size']
145
168
  @initial_heap_size = j2se['initial-heap-size']
169
+ @java_vm_args = j2se['java-vm-args']
146
170
  @os = os
171
+ @arch = arch
147
172
  end
148
173
  end
149
174
 
@@ -882,20 +907,25 @@ module Jnlp #:nodoc:
882
907
  import_jnlp(path) unless path.empty?
883
908
  end
884
909
 
885
- def j2se_version(os=nil)
886
- j2se = j2ses.detect {|j2se| j2se.os == os }
910
+ def j2se_version(os=nil, arch=nil)
911
+ j2se = j2ses.detect { |j2se| j2se.os == os && j2se.arch == arch}
887
912
  j2se ? j2se.version : nil
888
913
  end
889
914
 
890
- def max_heap_size(os=nil)
891
- j2se = j2ses.detect {|j2se| j2se.os == os }
915
+ def max_heap_size(os=nil, arch=nil)
916
+ j2se = j2ses.detect { |j2se| j2se.os == os && j2se.arch == arch }
892
917
  j2se ? j2se.max_heap_size : nil
893
918
  end
894
919
 
895
- def initial_heap_size(os=nil)
896
- j2se = j2ses.detect {|j2se| j2se.os == os }
920
+ def initial_heap_size(os=nil, arch=nil)
921
+ j2se = j2ses.detect { |j2se| j2se.os == os && j2se.arch == arch }
897
922
  j2se ? j2se.initial_heap_size : nil
898
923
  end
924
+
925
+ def java_vm_args(os=nil, arch=nil)
926
+ j2se = j2ses.detect { |j2se| j2se.os == os && j2se.arch == arch }
927
+ j2se ? j2se.java_vm_args : nil
928
+ end
899
929
 
900
930
 
901
931
  #
@@ -957,7 +987,10 @@ module Jnlp #:nodoc:
957
987
  if os = resources[:os]
958
988
  os = os.strip.downcase.gsub(/\W+/, '_').gsub(/^_+|_+$/, '')
959
989
  end
960
- (resources/"j2se").each { |j2se| @j2ses << J2se.new(j2se, os) }
990
+ if arch = resources[:arch]
991
+ arch = arch.strip.downcase.gsub(/\W+/, '_').gsub(/^_+|_+$/, '')
992
+ end
993
+ (resources/"j2se").each { |j2se| @j2ses << J2se.new(j2se, os, arch) }
961
994
  (resources/"property").each { |prop| @properties << Property.new(prop, os) }
962
995
  (resources/"jar").each { |res| @jars << Resource.new(res, @codebase, os) }
963
996
  (resources/"nativelib").each { |res| @nativelibs << Resource.new(res, @codebase, os) }
data/lib/jnlp/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Jnlp #:nodoc:
2
- VERSION = '0.0.5.3'
2
+ VERSION = '0.0.5.4'
3
3
  #
4
4
  # Let's see if this patch:
5
5
  #
data/spec/jnlp_spec.rb CHANGED
@@ -56,14 +56,18 @@ describe Jnlp do
56
56
  @first_jnlp.max_heap_size.should == '128m'
57
57
  end
58
58
 
59
- it "should have an j2se_version attribute with the value '1.5+'" do
59
+ it "should have a j2se_version attribute with the value '1.5+'" do
60
60
  @first_jnlp.j2se_version.should == '1.5+'
61
61
  end
62
62
 
63
- it "should have an j2se_version attribute with the value '1.5 if mac_os_x is specified'" do
63
+ it "should have a j2se_version attribute with the value '1.5' if the os: mac_os_x is specified" do
64
64
  @first_jnlp.j2se_version('mac_os_x').should == '1.5'
65
65
  end
66
66
 
67
+ it "should return nil in response to the j2se_version method if the os: mac_os_x and arch: x86_64 are specified" do
68
+ @first_jnlp.j2se_version('mac_os_x', 'x86_64').should == nil
69
+ end
70
+
67
71
  it "should have an vendor attribute with the value 'Concord Consortium'" do
68
72
  @first_jnlp.vendor.should == 'Concord Consortium'
69
73
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jnlp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5.3
4
+ version: 0.0.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen Bannasch
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-12-23 00:00:00 -05:00
12
+ date: 2010-02-11 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency