jnlp 0.6.1 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +18 -0
- data/README.rdoc +20 -12
- data/jnlp.gemspec +9 -0
- data/lib/jnlp/jnlp.rb +150 -49
- data/lib/jnlp/rack_server.rb +21 -0
- data/lib/jnlp/version.rb +1 -1
- data/spec/jnlp_spec.rb +2 -2
- metadata +89 -82
data/History.txt
CHANGED
@@ -1,3 +1,21 @@
|
|
1
|
+
== 0.6.2 2010-05-24
|
2
|
+
|
3
|
+
Much better support for replicating a maven_jnlp-style directory structure
|
4
|
+
with jars, jnlps, and snapshot information.
|
5
|
+
|
6
|
+
Example:
|
7
|
+
|
8
|
+
server = 'http://localhost:4321'
|
9
|
+
jnlp_cache = 'jnlp'
|
10
|
+
new_href = "#{server}#{jnlp.path}"
|
11
|
+
jnlp.write_jnlp( { :dir => jnlp_cache, :jnlp => { :codebase => server, :href => new_href }, :snapshot => true } )
|
12
|
+
|
13
|
+
Writes a duplicate of the remote jnlp to a local path rooted at 'jnlp/'.
|
14
|
+
With the codebase and href re-written referencing: 'http://localhost:4321'
|
15
|
+
|
16
|
+
In addition a duplicate of the versioned jnlp is written without the version string as a snapshot
|
17
|
+
jnlp and the file: <jnlp-name>-CURRENT_VERSION.txt containing the version string is written.
|
18
|
+
|
1
19
|
== 0.6.1 2010-05-17
|
2
20
|
|
3
21
|
Clear up new version numbering.
|
data/README.rdoc
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
A gem for encapsulating the content and resources referenced by Java Web Start jnlps
|
4
4
|
and interacting with jnlp repositories managed by the maven-jnlp Eclipse plugin.
|
5
5
|
|
6
|
-
Complete rdoc available here:
|
6
|
+
Complete rdoc available here: http://rdoc.info/projects/stepheneb/jnlp
|
7
7
|
|
8
8
|
For more information about the structure of Java Web Start see Sun's documentation[http://java.sun.com/javase/6/docs/technotes/guides/javaws/developersguide/contents.html]
|
9
9
|
|
@@ -17,11 +17,11 @@ To create a new Jnlp::Jnlp call Jnlp::Jnlp#new with a string that contains eithe
|
|
17
17
|
|
18
18
|
=== Creating a new Jnlp::Jnlp object from a Java Web Start jnlp referenced with a url.
|
19
19
|
|
20
|
-
j = Jnlp::Jnlp.new("jnlp.concord.org/dev/org/concord/maven-jnlp/otrunk-sensor/otrunk-sensor.jnlp")
|
20
|
+
j = Jnlp::Jnlp.new("http://jnlp.concord.org/dev/org/concord/maven-jnlp/otrunk-sensor/otrunk-sensor.jnlp")
|
21
21
|
|
22
22
|
Once the Jnlp::Jnlp object is created you can call Jnlp::Jnlp#cache_resources to create a local cache of all the jar and nativelib resources.
|
23
23
|
|
24
|
-
The structure of the cache directory and the naming using for the jar and nativelib files is the same as that used by the Java Web Start Download Servlet, see Sun's
|
24
|
+
The structure of the cache directory and the naming using for the jar and nativelib files is the same as that used by the Java Web Start Download Servlet, see Sun's servlet guide[http://java.sun.com/javase/6/docs/technotes/guides/javaws/developersguide/downloadservletguide.html].
|
25
25
|
|
26
26
|
== Creating MavenJnlp objects that represent the resources deployed by a maven jnlp servlet.
|
27
27
|
|
@@ -107,11 +107,13 @@ The source code for the jnlp gem is on github[http://github.com/stepheneb/jnlp/t
|
|
107
107
|
=== rake tasks
|
108
108
|
|
109
109
|
$ rake -T
|
110
|
-
rake
|
111
|
-
rake
|
112
|
-
rake
|
113
|
-
rake
|
114
|
-
rake
|
110
|
+
rake clobber_rdoc # Remove RDoc HTML files
|
111
|
+
rake hudson:spec # run the spec tests and generate JUnit XML reports (for...
|
112
|
+
rake package # generate the gem package: jnlp-0.6.1.gem
|
113
|
+
rake rdoc # Build RDoc HTML files
|
114
|
+
rake release # push the packaged gem: jnlp-0.6.1.gem to rubygems.org
|
115
|
+
rake rerdoc # Rebuild RDoc HTML files
|
116
|
+
rake spec # run spec tests (the default task)
|
115
117
|
|
116
118
|
=== Running the tests
|
117
119
|
|
@@ -123,12 +125,18 @@ MRI:
|
|
123
125
|
|
124
126
|
rake spec
|
125
127
|
|
126
|
-
Generating JUnit XML for integrating with the Hudson CIS server:
|
128
|
+
Generating JUnit XML output for integrating with the Hudson CIS server:
|
127
129
|
|
128
130
|
rake hudson:spec
|
129
131
|
|
130
|
-
===
|
132
|
+
=== Building and installing the gem locally
|
133
|
+
|
134
|
+
rake package
|
135
|
+
gem install jnlp-<version>.gem
|
131
136
|
|
132
|
-
|
137
|
+
=== TODO
|
133
138
|
|
134
|
-
|
139
|
+
Add tests for:
|
140
|
+
* MavenJnlp features.
|
141
|
+
* downloading and caching jars
|
142
|
+
* re-generating original and local jnlps
|
data/jnlp.gemspec
CHANGED
@@ -24,4 +24,13 @@ Gem::Specification.new do |s|
|
|
24
24
|
s.add_runtime_dependency('hpricot', "= 0.6.164")
|
25
25
|
s.add_development_dependency("rspec", '>= 1.3.0')
|
26
26
|
s.add_development_dependency("ci_reporter", '>= 1.6.0')
|
27
|
+
|
28
|
+
s.post_install_message = <<-POST_INSTALL_MESSAGE
|
29
|
+
|
30
|
+
Thanks for installing: jnlp-#{Jnlp::VERSION}
|
31
|
+
|
32
|
+
Documentation: http://rdoc.info/projects/stepheneb/jnlp
|
33
|
+
Repository: http://github.com/stepheneb/jnlp
|
34
|
+
|
35
|
+
POST_INSTALL_MESSAGE
|
27
36
|
end
|
data/lib/jnlp/jnlp.rb
CHANGED
@@ -370,7 +370,7 @@ module Jnlp #:nodoc:
|
|
370
370
|
#
|
371
371
|
attr_reader :local_path
|
372
372
|
#
|
373
|
-
# Contains the relative local path of the resource
|
373
|
+
# Contains the relative local path of the packed, gzipped resource
|
374
374
|
#
|
375
375
|
# Example:
|
376
376
|
#
|
@@ -543,7 +543,7 @@ module Jnlp #:nodoc:
|
|
543
543
|
#
|
544
544
|
# Returns file size if cached succesfully, false otherwise.
|
545
545
|
#
|
546
|
-
def update_cache(source=@url, destination=@local_path)
|
546
|
+
def update_cache(source=@url, destination=@local_path, options={})
|
547
547
|
unless destination
|
548
548
|
raise ArgumentError, "Must specify destination directory when updatng resource", caller
|
549
549
|
end
|
@@ -553,14 +553,27 @@ module Jnlp #:nodoc:
|
|
553
553
|
end
|
554
554
|
unless file_exists && @signature_verified
|
555
555
|
FileUtils.mkdir_p(File.dirname(destination))
|
556
|
-
|
556
|
+
puts "reading: #{source}" if options[:verbose]
|
557
|
+
tried_to_read = 0
|
558
|
+
begin
|
559
|
+
jarfile = open(source)
|
560
|
+
rescue OpenURI::HTTPError => e
|
561
|
+
puts e
|
562
|
+
if tried_to_read < 1
|
563
|
+
tried_to_read += 1
|
564
|
+
retry
|
565
|
+
end
|
566
|
+
end
|
557
567
|
if jarfile.class == Tempfile
|
558
568
|
FileUtils.cp(jarfile.path, destination)
|
569
|
+
puts "copying to: #{destination}" if options[:verbose]
|
559
570
|
else
|
560
571
|
File.open(destination, 'w') {|f| f.write jarfile.read }
|
572
|
+
puts "writing to: #{destination}" if options[:verbose]
|
561
573
|
end
|
574
|
+
puts "#{jarfile.size} bytes written" if options[:verbose]
|
562
575
|
verify_signature ? jarfile.size : false
|
563
|
-
else
|
576
|
+
else
|
564
577
|
File.size(destination)
|
565
578
|
end
|
566
579
|
end
|
@@ -604,16 +617,16 @@ module Jnlp #:nodoc:
|
|
604
617
|
#
|
605
618
|
# If the signature is not verified then false is returned.
|
606
619
|
#
|
607
|
-
def cache_resource(dest_dir=@local_cache_dir,
|
620
|
+
def cache_resource(dest_dir=@local_cache_dir, options={})
|
608
621
|
unless dest_dir
|
609
622
|
raise ArgumentError, "Must specify destination directory when creating resource", caller
|
610
623
|
end
|
611
624
|
self.local_cache_dir=dest_dir
|
612
|
-
@size = update_cache(@url, @local_path)
|
613
|
-
if include_pack_gz
|
614
|
-
@
|
625
|
+
@size = update_cache(@url, @local_path, options)
|
626
|
+
if options[:include_pack_gz]
|
627
|
+
@relative_local_path_pack_gz = "#{@relative_local_path}.pack.gz"
|
615
628
|
@local_path_pack_gz = "#{dest_dir}/#{@relative_local_path_pack_gz}"
|
616
|
-
@size_pack_gz = update_cache(@url_pack_gz, @local_path_pack_gz)
|
629
|
+
@size_pack_gz = update_cache(@url_pack_gz, @local_path_pack_gz, options)
|
617
630
|
end
|
618
631
|
@signature_verified ? @size : @signature_verified
|
619
632
|
end
|
@@ -709,7 +722,7 @@ module Jnlp #:nodoc:
|
|
709
722
|
#
|
710
723
|
# j = Jnlp::Jnlp.new("http://jnlp.concord.org/dev/org/concord/maven-jnlp/otrunk-sensor/otrunk-sensor.jnlp", 'web_start_cache', :include_pack_gz => true)
|
711
724
|
#
|
712
|
-
# Adding the option
|
725
|
+
# Adding the option :verbose => true will display a log of actions
|
713
726
|
#
|
714
727
|
# Note:
|
715
728
|
#
|
@@ -730,14 +743,34 @@ module Jnlp #:nodoc:
|
|
730
743
|
#
|
731
744
|
attr_reader :local_jnlp
|
732
745
|
#
|
733
|
-
# Contains the full
|
746
|
+
# Contains the full url of the original jnlp
|
734
747
|
#
|
735
748
|
# Example:
|
736
749
|
#
|
737
750
|
# "http://jnlp.concord.org/dev/org/concord/maven-jnlp/otrunk-sensor/otrunk-sensor.jnlp"
|
738
751
|
#
|
752
|
+
attr_reader :url
|
753
|
+
#
|
754
|
+
# Contains the path to the original jnlp.
|
755
|
+
# This is generated by removing the codebase form the url.
|
756
|
+
#
|
757
|
+
# Example:
|
758
|
+
#
|
759
|
+
# "/org/concord/maven-jnlp/otrunk-sensor/otrunk-sensor.jnlp"
|
760
|
+
#
|
739
761
|
attr_reader :path
|
740
762
|
#
|
763
|
+
# Contains the name of the directory the original jnlp is located in.
|
764
|
+
# If the jnlp was originally served from a maven-jnlp server this will
|
765
|
+
# be the maven_jnlp_family name which duplicates the first part of the
|
766
|
+
# name of a versioned jnlp.
|
767
|
+
#
|
768
|
+
# Example:
|
769
|
+
#
|
770
|
+
# "otrunk-sensor"
|
771
|
+
#
|
772
|
+
attr_reader :family
|
773
|
+
#
|
741
774
|
# Contains the name of the jnlp
|
742
775
|
#
|
743
776
|
# Example:
|
@@ -746,6 +779,14 @@ module Jnlp #:nodoc:
|
|
746
779
|
#
|
747
780
|
attr_reader :name
|
748
781
|
#
|
782
|
+
# Contains version string of the jnlp if it has one, otherwize nil
|
783
|
+
#
|
784
|
+
# Example:
|
785
|
+
#
|
786
|
+
# "0.1.0-20100521.210440"
|
787
|
+
#
|
788
|
+
attr_reader :version_str
|
789
|
+
#
|
749
790
|
# Contains the local file-based href attribute of the
|
750
791
|
# local jnlp if it has been created.
|
751
792
|
#
|
@@ -795,7 +836,7 @@ module Jnlp #:nodoc:
|
|
795
836
|
# gzipped pack200 resources should be copied to the
|
796
837
|
# local cache when the cache is updated
|
797
838
|
#
|
798
|
-
attr_accessor :
|
839
|
+
attr_accessor :include_pack_gz
|
799
840
|
#
|
800
841
|
# Contains the spec attribute in the jnlp element
|
801
842
|
# Example:
|
@@ -888,17 +929,17 @@ module Jnlp #:nodoc:
|
|
888
929
|
attr_reader :argument
|
889
930
|
#
|
890
931
|
# Create a new Jnlp by loading and parsing the Java Web Start
|
891
|
-
# Jnlp located at
|
932
|
+
# Jnlp located at url -- url can be a local path or a url.
|
892
933
|
# * if you include _cache_dir_ then the jnlp resources will be cached locally when the object is created
|
893
934
|
# * If you also include a boolean true the pack_gzip versions of the resources will be cached also.
|
894
935
|
#
|
895
|
-
def initialize(
|
896
|
-
|
897
|
-
|
898
|
-
|
899
|
-
@
|
936
|
+
def initialize(url=nil, cache_dir=nil, options={})
|
937
|
+
@url = url
|
938
|
+
self.local_cache_dir = cache_dir
|
939
|
+
@options = options
|
940
|
+
@include_pack_gz = options[:include_pack_gz]
|
900
941
|
@verbose = options[:verbose]
|
901
|
-
import_jnlp(
|
942
|
+
import_jnlp(@url) unless @url.empty?
|
902
943
|
end
|
903
944
|
|
904
945
|
def j2se_version(os=nil, arch=nil)
|
@@ -935,9 +976,13 @@ module Jnlp #:nodoc:
|
|
935
976
|
#
|
936
977
|
# set
|
937
978
|
#
|
938
|
-
def local_cache_dir=(
|
939
|
-
@
|
940
|
-
@relative_local_cache_dir
|
979
|
+
def local_cache_dir=(cache_dir)
|
980
|
+
@relative_local_cache_dir = cache_dir
|
981
|
+
if @relative_local_cache_dir
|
982
|
+
@local_cache_dir = File.expand_path(cache_dir)
|
983
|
+
else
|
984
|
+
@local_cache_dir = nil
|
985
|
+
end
|
941
986
|
end
|
942
987
|
#
|
943
988
|
# Rebuild the Jnlp by loading and parsing the Java Web Start
|
@@ -945,12 +990,11 @@ module Jnlp #:nodoc:
|
|
945
990
|
#
|
946
991
|
# If @local_cache_dir is set then the cache directory wll be updated also.
|
947
992
|
#
|
948
|
-
# If @
|
993
|
+
# If @include_pack_gz is set then the gzipped pack200 versions of the resources
|
949
994
|
# will be cached also.
|
950
995
|
#
|
951
|
-
def import_jnlp(
|
952
|
-
@
|
953
|
-
@name = File.basename(@path)
|
996
|
+
def import_jnlp(url=@url)
|
997
|
+
@name = File.basename(url)
|
954
998
|
#
|
955
999
|
# @local_jnlp_href and @local_jnlp_name are only placeholders
|
956
1000
|
# values so far-- they will become valid when a local jnlp file
|
@@ -960,9 +1004,11 @@ module Jnlp #:nodoc:
|
|
960
1004
|
#
|
961
1005
|
@local_jnlp_name = "local-#{@name}"
|
962
1006
|
@local_jnlp_href = File.expand_path("#{Dir.pwd}/#{@local_jnlp_name}")
|
963
|
-
@jnlp = Hpricot.XML(open(
|
1007
|
+
@jnlp = Hpricot.XML(open(url))
|
964
1008
|
@spec = (@jnlp/"jnlp").attr('spec')
|
965
1009
|
@codebase = (@jnlp/"jnlp").attr('codebase')
|
1010
|
+
@path = @url.gsub(@codebase, '')
|
1011
|
+
@family = File.basename(File.dirname(@path))
|
966
1012
|
@href = (@jnlp/"jnlp").attr('href')
|
967
1013
|
@title, @vendor, @homepage, @description, @icon = nil, nil, nil, nil, nil
|
968
1014
|
unless (info = (@jnlp/"information")).empty?
|
@@ -989,8 +1035,12 @@ module Jnlp #:nodoc:
|
|
989
1035
|
(resources/"jar").each { |res| @jars << Resource.new(res, @codebase, os) }
|
990
1036
|
(resources/"nativelib").each { |res| @nativelibs << Resource.new(res, @codebase, os) }
|
991
1037
|
end
|
1038
|
+
maven_jnlp_version = properties.find {|p| p.name == "maven.jnlp.version"}
|
1039
|
+
if maven_jnlp_version
|
1040
|
+
@version_str = maven_jnlp_version.value[/#{@family}-(.*)/, 1]
|
1041
|
+
end
|
992
1042
|
if @local_cache_dir
|
993
|
-
cache_resources(@local_cache_dir
|
1043
|
+
cache_resources(@local_cache_dir)
|
994
1044
|
generate_local_jnlp
|
995
1045
|
end
|
996
1046
|
end
|
@@ -1001,17 +1051,17 @@ module Jnlp #:nodoc:
|
|
1001
1051
|
# by the Java Web Start Download Servlet, see:
|
1002
1052
|
# * http://java.sun.com/javase/6/docs/technotes/guides/javaws/developersguide/downloadservletguide.html
|
1003
1053
|
#
|
1004
|
-
def cache_resources(dest_dir=@local_cache_dir,
|
1054
|
+
def cache_resources(dest_dir=@local_cache_dir, options=@options)
|
1005
1055
|
unless dest_dir
|
1006
1056
|
raise ArgumentError, "Must specify destination directory when caching resources", caller
|
1007
1057
|
end
|
1008
1058
|
self.local_cache_dir=dest_dir
|
1009
1059
|
@local_resource_signatures_verified = true
|
1010
|
-
@jars.each do |
|
1011
|
-
@local_resource_signatures_verified &&=
|
1060
|
+
@jars.each do |jar|
|
1061
|
+
@local_resource_signatures_verified &&= jar.cache_resource(dest_dir, options)
|
1012
1062
|
end
|
1013
|
-
@nativelibs.each do |
|
1014
|
-
@local_resource_signatures_verified &&=
|
1063
|
+
@nativelibs.each do |nativelib|
|
1064
|
+
@local_resource_signatures_verified &&= nativelib.cache_resource(dest_dir, options)
|
1015
1065
|
end
|
1016
1066
|
if @local_resource_signatures_verified
|
1017
1067
|
generate_local_jnlp
|
@@ -1019,10 +1069,10 @@ module Jnlp #:nodoc:
|
|
1019
1069
|
@local_resource_signatures_verified = @local_resource_signatures_verified ? true : false
|
1020
1070
|
end
|
1021
1071
|
#
|
1022
|
-
# Copies the original Hpricot jnlp into @local_jnlp
|
1023
|
-
#
|
1072
|
+
# Copies the original Hpricot jnlp into @local_jnlp and
|
1073
|
+
# modifies it to reference resources in the local cache.
|
1024
1074
|
#
|
1025
|
-
def generate_local_jnlp
|
1075
|
+
def generate_local_jnlp(options={})
|
1026
1076
|
#
|
1027
1077
|
# get a copy of the existing jnlp
|
1028
1078
|
# (it should be easier than this)
|
@@ -1042,23 +1092,31 @@ module Jnlp #:nodoc:
|
|
1042
1092
|
jnlp_elem[:href] = @local_jnlp_href
|
1043
1093
|
#
|
1044
1094
|
# for each jar and nativelib remove the version
|
1045
|
-
# attribute and point the href to
|
1095
|
+
# attribute and point the href to the local cache
|
1046
1096
|
#
|
1047
1097
|
@jars.each do |jar|
|
1048
1098
|
j = @local_jnlp.at("//jar[@href=#{jar.href}]")
|
1049
1099
|
j.remove_attribute(:version)
|
1050
|
-
|
1100
|
+
if options[:include_pack_gz]
|
1101
|
+
j[:href] = jar.relative_local_path_pack_gz
|
1102
|
+
else
|
1103
|
+
j[:href] = jar.relative_local_path
|
1104
|
+
end
|
1051
1105
|
end
|
1052
1106
|
@nativelibs.each do |nativelib|
|
1053
1107
|
nl = @local_jnlp.at("//nativelib[@href=#{nativelib.href}]")
|
1054
1108
|
nl.remove_attribute(:version)
|
1055
|
-
|
1109
|
+
if options[:include_pack_gz]
|
1110
|
+
nl[:href] = nativelib.relative_local_path_pack_gz
|
1111
|
+
else
|
1112
|
+
nl[:href] = nativelib.relative_local_path
|
1113
|
+
end
|
1056
1114
|
end
|
1057
1115
|
end
|
1058
1116
|
#
|
1059
1117
|
# Returns an array containing all the local paths for this jnlp's resources.
|
1060
1118
|
#
|
1061
|
-
# Pass in the
|
1119
|
+
# Pass in the options hash: (:remove_jruby => true) and
|
1062
1120
|
# the first resource that contains the string /jruby/ will
|
1063
1121
|
# be removed from the returned array.
|
1064
1122
|
#
|
@@ -1074,10 +1132,19 @@ module Jnlp #:nodoc:
|
|
1074
1132
|
#
|
1075
1133
|
# "org/jruby/jruby/jruby__V1.0RC2.jar"
|
1076
1134
|
#
|
1135
|
+
# Pass in the options hash: (:include_pack_gz => true) and the
|
1136
|
+
# resources returned with be pack.gz jars instead of regular jars
|
1137
|
+
#
|
1077
1138
|
def resource_paths(options={})
|
1078
|
-
|
1079
|
-
|
1080
|
-
|
1139
|
+
if options[:include_pack_gs]
|
1140
|
+
cp_jars = @jars.empty? ? [] : @jars.collect {|j| j.local_path_pack_gz}
|
1141
|
+
cp_nativelibs = @nativelibs.empty? ? [] : @nativelibs.collect {|n| n.local_path_pack_gz}
|
1142
|
+
resources = cp_jars + cp_nativelibs
|
1143
|
+
else
|
1144
|
+
cp_jars = @jars.empty? ? [] : @jars.collect {|j| j.local_path}
|
1145
|
+
cp_nativelibs = @nativelibs.empty? ? [] : @nativelibs.collect {|n| n.local_path}
|
1146
|
+
resources = cp_jars + cp_nativelibs
|
1147
|
+
end
|
1081
1148
|
#
|
1082
1149
|
# FIXME: this should probably be more discriminatory
|
1083
1150
|
#
|
@@ -1126,8 +1193,17 @@ module Jnlp #:nodoc:
|
|
1126
1193
|
#
|
1127
1194
|
# returns the jnlp as a string
|
1128
1195
|
#
|
1129
|
-
|
1130
|
-
|
1196
|
+
# <jnlp spec="1.0+" codebase="http://localhost:4321" href="http://localhost:4321/org/concord/maven-jnlp/sensor-applets/sensor-applets-0.1.0-20100521.210440.jnlp">
|
1197
|
+
#
|
1198
|
+
#
|
1199
|
+
def to_jnlp(options={})
|
1200
|
+
jnlp = @jnlp.to_s
|
1201
|
+
unless options.empty?
|
1202
|
+
options.each do |k,v|
|
1203
|
+
jnlp.gsub!(/(<jnlp.*?)(#{k.to_s}=)(['"])(.*?)\3(.*?)>/, "\\1\\2\\3#{v}\\3\\5>")
|
1204
|
+
end
|
1205
|
+
end
|
1206
|
+
jnlp
|
1131
1207
|
end
|
1132
1208
|
#
|
1133
1209
|
# returns the local file-based jnlp as a string
|
@@ -1138,11 +1214,36 @@ module Jnlp #:nodoc:
|
|
1138
1214
|
#
|
1139
1215
|
# Writes a local copy of the original jnlp .
|
1140
1216
|
#
|
1141
|
-
# Writes jnlp to current working directory
|
1142
|
-
#
|
1217
|
+
# Writes jnlp to path of original jnlp into current working directory.
|
1218
|
+
# A number of options can be passed modify the result.
|
1219
|
+
#
|
1220
|
+
# Example:
|
1221
|
+
#
|
1222
|
+
# server = 'http://localhost:4321'
|
1223
|
+
# jnlp_cache = 'jnlp'
|
1224
|
+
# new_href = "#{server}#{jnlp.path}"
|
1225
|
+
# jnlp.write_jnlp( { :dir => jnlp_cache, :jnlp => { :codebase => server, :href => new_href }, :snapshot => true } )
|
1226
|
+
#
|
1227
|
+
# Writes a duplicate of the remote jnlp to a local path rooted at 'jnlp/'.
|
1228
|
+
# With the codebase and href re-written referencing: 'http://localhost:4321'
|
1229
|
+
#
|
1230
|
+
# In addition a duplicate of the versioned jnlp is written without the version string as a snapshot
|
1231
|
+
# jnlp and the file: <jnlp-name>-CURRENT_VERSION.txt containing the version string is written.
|
1232
|
+
#
|
1143
1233
|
#
|
1144
|
-
def write_jnlp(
|
1145
|
-
|
1234
|
+
def write_jnlp(options={})
|
1235
|
+
dir = options[:dir] || '.'
|
1236
|
+
path = options[:path] || @path.gsub(/^\//, '')
|
1237
|
+
Dir.chdir(dir) do
|
1238
|
+
FileUtils.mkdir_p(File.dirname(path))
|
1239
|
+
File.open(path, 'w') {|f| f.write to_jnlp(options[:jnlp]) }
|
1240
|
+
if options[:snapshot]
|
1241
|
+
snapshot_path = "#{File.dirname(path)}/#{@family}.jnlp"
|
1242
|
+
File.open(snapshot_path, 'w') {|f| f.write to_jnlp(options[:jnlp]) }
|
1243
|
+
current_version_path = "#{File.dirname(path)}/#{@family}-CURRENT_VERSION.txt"
|
1244
|
+
File.open(current_version_path, 'w') {|f| f.write @version_str }
|
1245
|
+
end
|
1246
|
+
end
|
1146
1247
|
end
|
1147
1248
|
#
|
1148
1249
|
# Writes a local file-based jnlp.
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'rack'
|
2
|
+
|
3
|
+
class HelloWorld
|
4
|
+
def initialize(name)
|
5
|
+
@name = name
|
6
|
+
end
|
7
|
+
|
8
|
+
def call(env)
|
9
|
+
r = [ "<html><head><title>#{@name}</title></head>" +
|
10
|
+
"<body><h2>#{@name}</h2><ul>" ]
|
11
|
+
env.each_pair do |n, v|
|
12
|
+
r << "<li><p>"
|
13
|
+
r << "#{n} => #{v}"
|
14
|
+
r << "</p></li>"
|
15
|
+
end
|
16
|
+
r << "</ul></body></html>"
|
17
|
+
[200, { 'Content-Type' => 'text/html' }, r ]
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
Rack::Handler::WEBrick.run(HelloWorld.new("Tim"), :Port => 4321)
|
data/lib/jnlp/version.rb
CHANGED
data/spec/jnlp_spec.rb
CHANGED
@@ -48,8 +48,8 @@ describe Jnlp do
|
|
48
48
|
@first_jnlp.href.should == 'http://jnlp.concord.org/dev/org/concord/maven-jnlp/all-otrunk-snapshot/all-otrunk-snapshot-0.1.0-20091221.214313.jnlp'
|
49
49
|
end
|
50
50
|
|
51
|
-
it "should have
|
52
|
-
@first_jnlp.
|
51
|
+
it "should have a url attribute with the value #{@first_jnlp_path}" do
|
52
|
+
@first_jnlp.url.should == @first_jnlp_path
|
53
53
|
end
|
54
54
|
|
55
55
|
it "should have an max_heap_size attribute with the value '128m'" do
|
metadata
CHANGED
@@ -3,13 +3,13 @@ name: jnlp
|
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
version: 0.6.
|
6
|
+
- 0
|
7
|
+
- 6
|
8
|
+
- 2
|
9
|
+
version: 0.6.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
|
-
- Stephen Bannasch
|
12
|
+
- Stephen Bannasch
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
@@ -17,48 +17,48 @@ cert_chain: []
|
|
17
17
|
date: 2010-02-11 00:00:00 -05:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
|
-
- !ruby/object:Gem::Dependency
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
- !ruby/object:Gem::Dependency
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
- !ruby/object:Gem::Dependency
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: hpricot
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 0
|
29
|
+
- 6
|
30
|
+
- 164
|
31
|
+
version: 0.6.164
|
32
|
+
type: :runtime
|
33
|
+
version_requirements: *id001
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
name: rspec
|
36
|
+
prerelease: false
|
37
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
segments:
|
42
|
+
- 1
|
43
|
+
- 3
|
44
|
+
- 0
|
45
|
+
version: 1.3.0
|
46
|
+
type: :development
|
47
|
+
version_requirements: *id002
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: ci_reporter
|
50
|
+
prerelease: false
|
51
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
segments:
|
56
|
+
- 1
|
57
|
+
- 6
|
58
|
+
- 0
|
59
|
+
version: 1.6.0
|
60
|
+
type: :development
|
61
|
+
version_requirements: *id003
|
62
62
|
description: For manipulation of Java Web Start Jnlps and the resources they reference.
|
63
63
|
email: stephen.bannasch@gmail.com
|
64
64
|
executables: []
|
@@ -66,52 +66,59 @@ executables: []
|
|
66
66
|
extensions: []
|
67
67
|
|
68
68
|
extra_rdoc_files:
|
69
|
-
- History.txt
|
70
|
-
- License.txt
|
71
|
-
- README.rdoc
|
69
|
+
- History.txt
|
70
|
+
- License.txt
|
71
|
+
- README.rdoc
|
72
72
|
files:
|
73
|
-
- lib/jnlp
|
74
|
-
- lib/jnlp/
|
75
|
-
- lib/jnlp/
|
76
|
-
- lib/jnlp/
|
77
|
-
- lib/jnlp/
|
78
|
-
- lib/jnlp.rb
|
79
|
-
-
|
80
|
-
- spec/
|
81
|
-
- spec/
|
82
|
-
- spec/
|
83
|
-
- spec/
|
84
|
-
-
|
85
|
-
-
|
86
|
-
-
|
87
|
-
-
|
88
|
-
-
|
73
|
+
- lib/jnlp.rb
|
74
|
+
- lib/jnlp/jnlp.rb
|
75
|
+
- lib/jnlp/maven_jnlp.rb
|
76
|
+
- lib/jnlp/maven_jnlp_server.rb
|
77
|
+
- lib/jnlp/otrunk.rb
|
78
|
+
- lib/jnlp/rack_server.rb
|
79
|
+
- lib/jnlp/version.rb
|
80
|
+
- spec/jnlp_spec.rb
|
81
|
+
- spec/jnlp_with_certficate_versions_spec.rb
|
82
|
+
- spec/jnlp_with_specific_os_arch_j2ses_spec.rb
|
83
|
+
- spec/jnlp_without_versioned_jars_spec.rb
|
84
|
+
- spec/spec_helper.rb
|
85
|
+
- History.txt
|
86
|
+
- License.txt
|
87
|
+
- README.rdoc
|
88
|
+
- Rakefile
|
89
|
+
- jnlp.gemspec
|
89
90
|
has_rdoc: true
|
90
91
|
homepage: http://rubywebstart.rubyforge.org/jnlp/rdoc
|
91
92
|
licenses: []
|
92
93
|
|
93
|
-
post_install_message:
|
94
|
+
post_install_message: |+
|
95
|
+
|
96
|
+
Thanks for installing: jnlp-0.6.2
|
97
|
+
|
98
|
+
Documentation: http://rdoc.info/projects/stepheneb/jnlp
|
99
|
+
Repository: http://github.com/stepheneb/jnlp
|
100
|
+
|
94
101
|
rdoc_options:
|
95
|
-
- --main
|
96
|
-
- README.rdoc
|
102
|
+
- --main
|
103
|
+
- README.rdoc
|
97
104
|
require_paths:
|
98
|
-
- lib
|
105
|
+
- lib
|
99
106
|
required_ruby_version: !ruby/object:Gem::Requirement
|
100
107
|
requirements:
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
segments:
|
111
|
+
- 0
|
112
|
+
version: "0"
|
106
113
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
107
114
|
requirements:
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
segments:
|
118
|
+
- 1
|
119
|
+
- 3
|
120
|
+
- 2
|
121
|
+
version: 1.3.2
|
115
122
|
requirements: []
|
116
123
|
|
117
124
|
rubyforge_project: rubywebstart
|