stepheneb-jnlp 0.0.3 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,15 @@
1
+ == 0.0.4 2009-03-30
2
+
3
+ * added MavenJnlp class for encapsulating jnlp resources served
4
+ by a MavenJnlp Java Web Start server.
5
+
6
+ * specified a dependency on hpricot v 0.6.164, so far v0.7
7
+ doesn't support JRUby
8
+
9
+ == 0.0.3 2009-02
10
+
11
+ * extended OTrunk capability and integration with JRuby
12
+
1
13
  == 0.0.1 2008-04-14
2
14
 
3
15
  * 1 major enhancement:
data/Manifest.txt CHANGED
@@ -9,6 +9,7 @@ lib/jnlp.rb
9
9
  lib/jnlp/version.rb
10
10
  lib/jnlp/jnlp.rb
11
11
  lib/jnlp/otrunk.rb
12
+ lib/jnlp/maven_jnlp.rb
12
13
  log/debug.log
13
14
  script/console
14
15
  script/destroy
data/README.txt CHANGED
@@ -1,48 +1,43 @@
1
- = jnlp
1
+ == jnlp
2
2
 
3
- * FIX (url)
3
+ A gem for encapsulating the content and resources referenced by Java Web Start jnlps
4
4
 
5
- == DESCRIPTION:
5
+ Complete rdoc available here: http://rubywebstart.rubyforge.org/jnlp/Jnlp/Jnlp.html
6
6
 
7
- FIX (describe your package)
7
+ For more information about the structure of Java Web Start see:
8
8
 
9
- == FEATURES/PROBLEMS:
9
+ http://java.sun.com/javase/6/docs/technotes/guides/javaws/developersguide/contents.html
10
10
 
11
- * FIX (list of features or problems)
11
+ To create a new Jnlp call Jnlp#new with a string that contains either a local path or a url.
12
12
 
13
- == SYNOPSIS:
13
+ Examples:
14
14
 
15
- FIX (code sample of usage)
15
+ Creating a new Jnlp object from a local Java Web Start jnlp file.
16
16
 
17
- == REQUIREMENTS:
17
+ j = Jnlp::Jnlp.new("authoring.jnlp")
18
18
 
19
- * FIX (list of requirements)
19
+ Creating a new Jnlp object from a Java Web Start jnlp referenced with a url.
20
20
 
21
- == INSTALL:
21
+ j = Jnlp::Jnlp.new("jnlp.concord.org/dev/org/concord/maven-jnlp/otrunk-sensor/otrunk-sensor.jnlp")
22
22
 
23
- * FIX (sudo gem install, anything else)
23
+ Once the Jnlp object is created you can call Jnlp#cache_resources to create a local cache of all the jar and nativelib resources.
24
24
 
25
- == LICENSE:
25
+ 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:
26
26
 
27
- (The MIT License)
27
+ http://java.sun.com/javase/6/docs/technotes/guides/javaws/developersguide/downloadservletguide.html
28
28
 
29
- Copyright (c) 2008 FIX
29
+ == Building the gem
30
30
 
31
- Permission is hereby granted, free of charge, to any person obtaining
32
- a copy of this software and associated documentation files (the
33
- 'Software'), to deal in the Software without restriction, including
34
- without limitation the rights to use, copy, modify, merge, publish,
35
- distribute, sublicense, and/or sell copies of the Software, and to
36
- permit persons to whom the Software is furnished to do so, subject to
37
- the following conditions:
31
+ === First patch Hoe
38
32
 
39
- The above copyright notice and this permission notice shall be
40
- included in all copies or substantial portions of the Software.
33
+ Hoe versions 1.11.0 and 1.11.1 do not work with JRuby.
34
+
35
+ To build the gem you will need to apply this patch to Hoe:
36
+ 0001-install_gem-nows-works-with-jruby-also.patch[http://gist.github.com/raw/87670/7bd12ecff3e27dd0a1a1d750b61d4efece372374/0001-install_gem-nows-works-with-jruby-also.patch]
37
+
38
+ === The source code
39
+
40
+ The source code for the jnlp gem is on github[http://github.com/stepheneb/jnlp/tree/master].
41
+
42
+ git clone git://github.com/stepheneb/jnlp.git
41
43
 
42
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
43
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
44
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
45
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
46
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
47
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
48
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile CHANGED
@@ -1,4 +1,19 @@
1
- require 'config/requirements'
2
- require 'config/hoe' # setup Hoe + all gem configuration
3
-
4
- Dir['tasks/**/*.rake'].each { |rake| load rake }
1
+ require 'rubygems'
2
+ require 'hoe'
3
+
4
+ require './lib/jnlp.rb'
5
+
6
+ Hoe.new('jnlp', Jnlp::VERSION) do |p|
7
+ p.rubyforge_name = 'rubywebstart' # if different than lowercase project name
8
+ p.author = 'Stephen Bannasch'
9
+ p.email = 'stephen.bannasch@gmail.com'
10
+ p.url = 'http://rubywebstart.rubyforge.org/jnlp/rdoc/'
11
+ p.summary = "Ruby tools for working with Java Web Start JNLPs."
12
+ p.description = "For manipulation of Java Web Start Jnlps and the resources they reference."
13
+ p.extra_deps << ['hpricot','=0.6.164']
14
+ end
15
+
16
+ task :default => :spec
17
+ Spec::Rake::SpecTask.new do |t|
18
+ t.spec_files = FileList["spec/**/*_spec.rb"]
19
+ end
data/config/hoe.rb CHANGED
@@ -4,7 +4,7 @@ AUTHOR = 'Stephen Bannasch' # can also be an array of Authors
4
4
  EMAIL = "stephen.bannasch@gmail.com"
5
5
  DESCRIPTION = "For manipulation of Java Web Start Jnlps and the resources they reference."
6
6
  GEM_NAME = 'jnlp' # what ppl will type to install your gem
7
- RUBYFORGE_PROJECT = 'jnlp' # The unix name for your project
7
+ RUBYFORGE_PROJECT = 'rubywebstart' # The unix name for your project
8
8
  HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
9
9
  DOWNLOAD_PATH = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
10
10
 
@@ -53,8 +53,8 @@ $hoe = Hoe.new(GEM_NAME, VERS) do |p|
53
53
  p.description = DESCRIPTION
54
54
  p.summary = DESCRIPTION
55
55
  p.url = HOMEPATH
56
+ p.remote_rdoc_dir = 'jnlp' # Release to root
56
57
  p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
57
- p.test_globs = ["test/**/test_*.rb"]
58
58
  p.clean_globs |= ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store'] #An array of file patterns to delete on clean.
59
59
 
60
60
  # == Optional
data/lib/jnlp/jnlp.rb CHANGED
@@ -2,7 +2,7 @@
2
2
  # :title: Jnlp::Jnlp RDoc
3
3
  #
4
4
  # to regenerate and display this rdoc:
5
- # rdoc -U -SN jnlp.rb otrunk.rb ; open doc/index.html
5
+ # rdoc -U -SN jnlp.rb otrunk.rb maven_jnlp.rb; open doc/index.html
6
6
  #
7
7
  require 'rubygems'
8
8
  require 'open-uri'
@@ -13,9 +13,9 @@ require 'date'
13
13
 
14
14
  if RUBY_PLATFORM =~ /java/
15
15
  include Java
16
- import java.util.jar.JarInputStream unless defined? JarInputStream
17
- import java.io.FileInputStream unless defined? FileInputStream
18
- import java.net.URL unless defined? URL
16
+ java_import java.util.jar.JarInputStream unless defined? JarInputStream
17
+ java_import java.io.FileInputStream unless defined? FileInputStream
18
+ java_import java.net.URL unless defined? URL
19
19
  end
20
20
 
21
21
  unless Net::HTTP::Get.new('/')['User-Agent'] # unless a 'User-Agent' is already defined add one
@@ -189,6 +189,13 @@ module Jnlp #:nodoc:
189
189
  #
190
190
  # "net/sf/sail/webstart-proxy/jetty-proxy/jetty-proxy.jar"
191
191
  #
192
+ attr_reader :main
193
+ #
194
+ # Contains a boolean that repesents whether the main_class for this
195
+ # jnlp is contained within this jar.
196
+ # This attribute is optional in a jnlp and if present should
197
+ # only be present and set to true on one jar resource in a jnlp.
198
+ #
192
199
  attr_reader :href
193
200
  #
194
201
  # Contains the url reference to the resource
@@ -213,6 +220,14 @@ module Jnlp #:nodoc:
213
220
  #
214
221
  # "httpclient__V0.1.0-20071212.220020-17.jar"
215
222
  #
223
+ attr_reader :suffix
224
+ #
225
+ # Contains the suffix of the resource
226
+ #
227
+ # Example:
228
+ #
229
+ # "__V0.1.0.jar"
230
+ #
216
231
  attr_reader :filename
217
232
  #
218
233
  # Contains the filename of the gzipped pack200 version of the resource
@@ -221,6 +236,14 @@ module Jnlp #:nodoc:
221
236
  #
222
237
  # "httpclient__V0.1.0-20071212.220020-17.jar.pack.gz"
223
238
  #
239
+ attr_reader :filename_pack
240
+ #
241
+ # Contains the filename of the pack200 version of the resource
242
+ #
243
+ # Example:
244
+ #
245
+ # "httpclient__V0.1.0-20071212.220020-17.jar.pack"
246
+ #
224
247
  attr_reader :filename_pack_gz
225
248
  #
226
249
  # Contains the size of the resource
@@ -332,6 +355,7 @@ module Jnlp #:nodoc:
332
355
  def initialize(res, codebase, os)
333
356
  @resource = res
334
357
  @kind = res.name
358
+ @main = res['main'] && res['main'] == 'true'
335
359
  @href = res['href']
336
360
  @href_path = File.dirname(@href)
337
361
  if @href_path == '.'
@@ -471,7 +495,7 @@ module Jnlp #:nodoc:
471
495
  #
472
496
  # == Jnlp
473
497
  #
474
- # A library for encapslating the content and resources referenced by Java Web Start jnlps
498
+ # A gem for encapsulating the content and resources referenced by Java Web Start jnlps
475
499
  #
476
500
  # For more information about the structure of Java Web Start see:
477
501
  # * http://java.sun.com/javase/6/docs/technotes/guides/javaws/developersguide/contents.html
@@ -562,37 +586,8 @@ module Jnlp #:nodoc:
562
586
  #
563
587
  # Note:
564
588
  #
565
- # The current Hpricot v6.0 Gem does not work with JRuby 1.1 release candidates
566
- #
567
- # You can get a version that does work here:
568
- #
569
- # http://www.telscenter.org/confluence/download/attachments/20236/hpricot-0.6.159-java.gem
570
- #
571
- # After you download it -- install it like this:
572
- #
573
- # jruby -S gem install pkg/hpricot-0.6.159-jruby.gem
574
- #
575
- # FYI: If you need to build it yourself (Nick Sieger's patch still applies
576
- # cleanly to the current trunk revision: 161 of Hpricot):
577
- #
578
- # svn co https://code.whytheluckystiff.net/svn/hpricot/trunk hpricot
579
- # cd hpricot
580
- # curl http://caldersphere.net/hpricot-0.6.157-jruby-trunk.patch > hpricot-0.6.157-jruby-trunk.patch
581
- # patch -p0 -i hpricot-0.6.157-jruby-trunk.patch
582
- # jruby -S rake package_jruby
583
- #
584
- # You'll find the gem here:
585
- #
586
- # pkg/hpricot-0.6.159-jruby.gem
587
- #
588
- # If you want to run the tests (there is only one failing test in JRuby Hpricot, C Hpricot has two different failures):
589
- #
590
- # jruby -S rake hpricot_java
591
- # jruby -S rake test
592
- #
593
- # I reported all this on why's tracker for hpricot:
594
- #
595
- # https://code.whytheluckystiff.net/hpricot/ticket/131#comment:1
589
+ # The jnlp gem has a dependency on hpricot version 0.6.164.
590
+ # The most recent version of hpricot, version 0.7.0 does not yet work with JRuby.
596
591
  #
597
592
  class Jnlp
598
593
  #
@@ -846,6 +841,7 @@ module Jnlp #:nodoc:
846
841
  @title = (info/"title").inner_html
847
842
  @vendor = (info/"vendor").inner_html
848
843
  @homepage = (info/"homepage").empty? ? '' : (info/"homepage").attr('href')
844
+ @description = (info/"description").empty? ? '' : (info/"description").inner_html
849
845
  icon = (info/"icon")
850
846
  @icon = Icon.new(icon) unless icon.empty?
851
847
  @offline_allowed = (info/"offline-allowed") ? true : false
@@ -956,6 +952,9 @@ module Jnlp #:nodoc:
956
952
  cp_jars = @jars.collect {|j| j.local_path}
957
953
  cp_nativelibs = @nativelibs.collect {|n| n.local_path}
958
954
  resources = cp_jars + cp_nativelibs
955
+ #
956
+ # FIXME: this should probably be more discriminatory
957
+ #
959
958
  if options[:remove_jruby]
960
959
  resources = resources.reject {|r| r =~ /\/jruby\//}
961
960
  end
@@ -1037,6 +1036,9 @@ module Jnlp #:nodoc:
1037
1036
  #
1038
1037
  # This will add all the jars for this jnlp to the effective
1039
1038
  # classpath for this Java process.
1039
+ #
1040
+ # *If* you are already running in JRuby *AND* the jnlp references a
1041
+ # JRuby resource the JRuby resource will not be required.
1040
1042
  #
1041
1043
  def require_resources
1042
1044
  if RUBY_PLATFORM =~ /java/
data/lib/jnlp/otrunk.rb CHANGED
@@ -11,12 +11,12 @@ require 'net/http'
11
11
  require 'date'
12
12
 
13
13
  if RUBY_PLATFORM =~ /java/
14
- import java.util.jar.JarInputStream unless defined? JarInputStream
15
- import java.io.FileInputStream unless defined? FileInputStream
16
- import java.net.URL unless defined? URL
17
- import java.util.Collection unless defined? Collection
18
- import java.util.List unless defined? List
19
- import java.util.ArrayList unless defined? ArrayList
14
+ java_import java.util.jar.JarInputStream unless defined? JarInputStream
15
+ java_import java.io.FileInputStream unless defined? FileInputStream
16
+ java_import java.net.URL unless defined? URL
17
+ java_import java.util.Collection unless defined? Collection
18
+ java_import java.util.List unless defined? List
19
+ java_import java.util.ArrayList unless defined? ArrayList
20
20
  #
21
21
  # Used to refer to Java classes in the java.io package.
22
22
  # Some of the class names in the java.io package have the
@@ -87,9 +87,9 @@ module Jnlp #:nodoc:
87
87
  #
88
88
  require "#{File.expand_path(File.dirname(__FILE__))}/jnlp.rb"
89
89
  #
90
- # Jnlp::Otrunk is a subclass of Jnlp::Jnlp that adds SAIL
91
- # SAIL-Otrunk specific methods for execution.of the jnlp
92
- # locally without using Java Web Start.
90
+ # Jnlp::Otrunk is a subclass of Jnlp::Jnlp that adds SAIL-Otrunk[https://confluence.concord.org/display/CSP/OTrunk]
91
+ # specific methods for execution.of the jnlp locally without
92
+ # using Java Web Start.
93
93
  #
94
94
  # It assumes a default main-class of:
95
95
  #
data/lib/jnlp/version.rb CHANGED
@@ -1,9 +1,30 @@
1
1
  module Jnlp #:nodoc:
2
- module VERSION #:nodoc:
3
- MAJOR = 0
4
- MINOR = 0
5
- TINY = 2
6
-
7
- STRING = [MAJOR, MINOR, TINY].join('.')
8
- end
2
+ VERSION = '0.0.5'
3
+ #
4
+ # Let's see if this patch:
5
+ #
6
+ # http://rubyforge.org/tracker/index.php?func=detail&aid=24392&group_id=126&atid=577
7
+ #
8
+ # makes it into RubyGems -- it has been applied.
9
+ # Will probably be part of 1.3.2.
10
+ #
11
+ # then I can start using this form again:
12
+ #
13
+ # module VERSION
14
+ # MAJOR = 0
15
+ # MINOR = 0
16
+ # TINY = 4
17
+ #
18
+ # STRING = [MAJOR, MINOR, TINY].join('.')
19
+ #
20
+ # class << self
21
+ # def to_s
22
+ # STRING
23
+ # end
24
+ #
25
+ # def ==(arg)
26
+ # STRING == arg
27
+ # end
28
+ # end
29
+ # end
9
30
  end
data/lib/jnlp.rb CHANGED
@@ -1,8 +1,13 @@
1
1
  $:.unshift(File.dirname(__FILE__)) unless
2
2
  $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
3
3
 
4
+ require 'rubygems'
5
+
6
+ gem 'hpricot', '=0.6.164'
7
+
4
8
  module Jnlp
5
9
  require 'jnlp/jnlp.rb'
6
10
  require 'jnlp/otrunk.rb'
11
+ require 'jnlp/maven_jnlp.rb'
7
12
  require 'jnlp/version.rb'
8
13
  end
data/website/index.html CHANGED
@@ -1,11 +1,63 @@
1
- <html>
2
- <head>
3
- <meta http-equiv="Content-type" content="text/html; charset=utf-8">
4
- <title>jnlp</title>
5
-
6
- </head>
7
- <body id="body">
8
- <p>This page has not yet been created for RubyGem <code>jnlp</code></p>
9
- <p>To the developer: To generate it, update website/index.txt and run the rake task <code>website</code> to generate this <code>index.html</code> file.</p>
10
- </body>
11
- </html>
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <link rel="stylesheet" href="stylesheets/screen.css" type="text/css" media="screen" />
6
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
7
+ <title>
8
+ jnlp
9
+ </title>
10
+ <script src="javascripts/rounded_corners_lite.inc.js" type="text/javascript"></script>
11
+ <style>
12
+
13
+ </style>
14
+ <script type="text/javascript">
15
+ window.onload = function() {
16
+ settings = {
17
+ tl: { radius: 10 },
18
+ tr: { radius: 10 },
19
+ bl: { radius: 10 },
20
+ br: { radius: 10 },
21
+ antiAlias: true,
22
+ autoPad: true,
23
+ validTags: ["div"]
24
+ }
25
+ var versionBox = new curvyCorners(settings, document.getElementById("version"));
26
+ versionBox.applyCornersToAll();
27
+ }
28
+ </script>
29
+ </head>
30
+ <body>
31
+ <div id="main">
32
+
33
+ <h1>jnlp</h1>
34
+ <div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/jnlp"; return false'>
35
+ <p>Get Version</p>
36
+ <a href="http://rubyforge.org/projects/jnlp" class="numbers">0.0.3</a>
37
+ </div>
38
+ <h1>&amp;#x2192; &#8216;jnlp&#8217;</h1>
39
+ <h2>What</h2>
40
+ <h2>Installing</h2>
41
+ <p><pre class='syntax'><span class="ident">sudo</span> <span class="ident">gem</span> <span class="ident">install</span> <span class="ident">jnlp</span></pre></p>
42
+ <h2>The basics</h2>
43
+ <h2>Demonstration of usage</h2>
44
+ <h2>Forum</h2>
45
+ <p><a href="http://groups.google.com/group/jnlp">http://groups.google.com/group/jnlp</a></p>
46
+ <p><span class="caps">TODO</span> &#8211; create Google Group &#8211; jnlp</p>
47
+ <h2>How to submit patches</h2>
48
+ <p>Read the <a href="http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/">8 steps for fixing other people&#8217;s code</a> and for section <a href="http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/#8b-google-groups">8b: Submit patch to Google Groups</a>, use the Google Group above.</p>
49
+ <p>The trunk repository is <code>svn://rubyforge.org/var/svn/jnlp/trunk</code> for anonymous access.</p>
50
+ <h2>License</h2>
51
+ <p>This code is free to use under the terms of the <span class="caps">MIT</span> license.</p>
52
+ <h2>Contact</h2>
53
+ <p>Comments are welcome. Send an email to <a href="mailto:FIXME"><span class="caps">FIXME</span> full name</a> email via the <a href="http://groups.google.com/group/jnlp">forum</a></p>
54
+ <p class="coda">
55
+ <a href="FIXME email">FIXME full name</a>, 12th May 2008<br>
56
+ Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
57
+ </p>
58
+ </div>
59
+
60
+ <!-- insert site tracking codes here, like Google Urchin -->
61
+
62
+ </body>
63
+ </html>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stepheneb-jnlp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen Bannasch