Skip to content

stepheneb/jnlp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

85 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

# @markup rdoc # @title README # @author Stephen Bannasch

A Ruby gem for encapsulating the content and resources referenced by Java Web Start jnlps and interacting with jnlp repositories managed by the maven-jnlp Eclipse plugin.

Complete rdoc available here: rdoc.info/projects/stepheneb/jnlp

{file:history.html Release History}

For more information about the structure of Java Web Start see Sun’s documentation

j = Jnlp::Jnlp.new("authoring.jnlp")
j = Jnlp::Jnlp.new("http://jnlp.concord.org/dev/org/concord/maven-jnlp/otrunk-sensor/otrunk-sensor.jnlp")

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.

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.

require 'jnlp'
mj = Jnlp::MavenJnlp.new('http://jnlp.concord.org', '/dev/org/concord/maven-jnlp/')

This takes about 90s on a 3Mbps connection processing Concord’s Maven Jnlp Web Start server.

You can now do this:

mj.maven_jnlp_families.length                        # => 26
mj.maven_jnlp_families[0].name                       # => "all-otrunk-snapshot"
mj.maven_jnlp_families[0].versions.length            # => 1568
mj.maven_jnlp_families[0].versions.first.version     # => "0.1.0-20070420.131610"
mj.maven_jnlp_families[0].snapshot_version           # => "0.1.0-20090327.222627"

mj.maven_jnlp_families[0].versions.last.url

# => "/dev/org/concord/maven-jnlp/all-otrunk-snapshot/all-otrunk-snapshot-0.1.0-20090327.222627.jnlp"

mj.maven_jnlp_families[0].snapshot.url

# => "/dev/org/concord/maven-jnlp/all-otrunk-snapshot/all-otrunk-snapshot-0.1.0-20090327.222627.jnlp"

mj.maven_jnlp_families[0].versions.first.url

# => "/dev/org/concord/maven-jnlp/all-otrunk-snapshot/all-otrunk-snapshot-0.1.0-20070420.131610.jnlp"

You can pass in an options hash to limit the number of maven jnlp families parsed:

Example: passing in an optional array of maven jnlp families This will get all versions of each family.

mj = Jnlp::MavenJnlp.new('http://jnlp.concord.org', '/dev/org/concord/maven-jnlp/', 
     { :families => ['all-otrunk-snapshot', 'gui-testing'] })

mj.maven_jnlp_families.length

# => 2

Example: passing in an optional hash of maven jnlp families This will get all versions of each family.

mj = Jnlp::MavenJnlp.new('http://jnlp.concord.org', '/dev/org/concord/maven-jnlp/', 
     { :families => { 'all-otrunk-snapshot' => nil, 'gui-testing' => nil } })

mj.maven_jnlp_families.length

# => 2

Example: passing in an optional hash of maven jnlp families and specifying the versions of the jnlp urls to get for one family.

mj = Jnlp::MavenJnlp.new('http://jnlp.concord.org', '/dev/org/concord/maven-jnlp/',
     { :families => { 
       'all-otrunk-snapshot' => { :versions => ['0.1.0-20100513.161426', '0.1.0-20100513.154925'] },
       'gui-testing' => nil }
     })
mjfs = mj.maven_jnlp_families
[mjfs.length, mjfs[0].versions.length, mjfs[1].versions.length]

# => [2, 2, 50]

The source code for the jnlp gem is on github and the gem dependencies are managed with [bundler](gembundler.com/)

git clone git://github.com/stepheneb/jnlp.git
cd jnlp
gem install nokogiri
bundle install

Bundler should install nokogiri but can’t because of this bug: can’t find gem specified in gemspec with a range

nokogiri    ">= 1.4.4", "<= 1.5"
rake
rspec        '~> 2.5.0'
ci_reporter  '~> 1.6.4'
rdoc         '~> 3.9.4'
yard         '~> 0.7.2'
$ bundle exec rake -T
rake build         # Build jnlp-0.7.3.gem into the pkg directory
rake clobber_rdoc  # Remove RDoc HTML files
rake hudson:spec   # run the spec tests and generate JUnit XML reports (for integrating with a Hudson CIS server)
rake install       # Build and install jnlp-0.7.3.gem into system gems
rake rdoc          # Build RDoc HTML files
rake release       # Create tag v0.7.3 and build and push jnlp-0.7.3.gem to Rubygems
rake rerdoc        # Rebuild RDoc HTML files
rake spec          # Run RSpec
rake yard          # Generate YARD Documentation

JRuby:

jruby -S rake spec

MRI:

bundle exec rake spec

Generating JUnit XML output for integrating with the Hudson CIS server:

bundle exec rake hudson:spec

Run an adhoc test in the file sample.rb in the same top-level directory as this source code by telling ruby to first add ‘lib/’ to the load path.

ruby -Ilib sample.rb
bundle exec rake build
gem install pkg/jnlp-<version>.gem
bundle exec rake release

Add tests for:

  • MavenJnlp features.

  • downloading and caching jars

  • re-generating original and local jnlps

About

A Ruby gem for encapslating the content and resources referenced by Java Web Start jnlps

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages