stepheneb-jnlp 0.0.5 → 0.0.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/History.txt +40 -0
  2. data/lib/jnlp/jnlp.rb +73 -16
  3. data/lib/jnlp/version.rb +1 -1
  4. metadata +1 -1
data/History.txt CHANGED
@@ -1,3 +1,43 @@
1
+ == 0.0.5.1 2009-06-24
2
+
3
+ * add certificate_version attribute to Jnlp::Resource
4
+
5
+ * refactor Resource version_str parsing into method Jnlp::Resource#parse_version_str
6
+
7
+ Examples of parsing:
8
+ returns: [version, revision, date_str, date_time, certificate_version]
9
+
10
+ "1.5R4.1"
11
+ => ["1.5", 4, "", nil, ""]
12
+
13
+ "0.1.0-20090624.174313-1036"
14
+ => ["0.1.0", 1036, "20090624.174313", Wed, 24 Jun 2009 17:43:13 +0000, ""]
15
+
16
+ "0.1.0-20090624.011056-1033-s1"
17
+ => ["0.1.0", 1033, "20090624.011056", Wed, 24 Jun 2009 01:10:56 +0000, "s1"]
18
+
19
+ "2.1.7-r2-s1"
20
+ => ["2.1.7", 2, "", nil, "s1"]
21
+
22
+ * added MavenJnlp class for encapsulating jnlp resources served by a MavenJnlp Java Web Start server.
23
+
24
+ == 0.0.5 2009-05-30
25
+
26
+ * new method Jnlp::MavenJnlpFamily#latest_snapshot_version
27
+
28
+ * initial rspec testing framework
29
+
30
+ * replace import with java_import to make rake work
31
+
32
+ * add MavenJnlp#summarize method
33
+
34
+ Display a summary of the jnlp families and versions available on stdout.
35
+
36
+ * Add main, suffix and filename_pack attributes to JNLP::Resource
37
+
38
+ In a jnlp one jar may contain a attribute named main to indicated that is the jar with the main class.
39
+
40
+
1
41
  == 0.0.4 2009-03-30
2
42
 
3
43
  * added MavenJnlp class for encapsulating jnlp resources served
data/lib/jnlp/jnlp.rb CHANGED
@@ -352,6 +352,16 @@ module Jnlp #:nodoc:
352
352
  # 72
353
353
  #
354
354
  attr_reader :revision
355
+ #
356
+ # Contains the certificate version of the resource
357
+ # if one exists, otherwize it is nil
358
+ #
359
+ # Example:
360
+ #
361
+ # "s1"
362
+ #
363
+ attr_reader :certificate_version
364
+ #
355
365
  def initialize(res, codebase, os)
356
366
  @resource = res
357
367
  @kind = res.name
@@ -373,31 +383,75 @@ module Jnlp #:nodoc:
373
383
  @filename = "#{@name}#{@suffix}"
374
384
  @filename_pack = @filename + ".pack"
375
385
  @filename_pack_gz = @filename_pack + ".gz"
376
- # example: "0.1.0-20070926.155656-107"
377
- # but ...
378
- # some version strings just look like this: "0.1.0"
379
- # or this: "2.1.7-r2"
386
+
380
387
  @url = "#{codebase}/#{@href_path}#{@name}.jar"
381
388
  @url << "?version-id=#{@version_str}" if @version_str
382
389
  # example: data-util__V0.1.0-20070926.155656-107.jar.pack
383
390
  # @url_pack = "#{codebase}/#{@href_path}#{@filename}.pack"
384
391
  # example: data-util__V0.1.0-20070926.155656-107.jar.pack.gz
385
392
  @url_pack_gz = "#{codebase}/#{@href_path}#{@filename}.pack.gz"
386
- if @version_str && @version_str[/-[\d]{8}.[\d]{6}-/] && version_data = /(.*)-(.*)-(.*)/.match(@version_str)
387
- @version = version_data[1]
388
- @revision = version_data[3] && version_data[3].to_i
389
- @date_str = version_data[2] # example: "20070926.155656"
390
- d, t = @date_str.scan(/\d+/) # => ["20070926", "155656"]
391
- d1 = "#{d[0..3]}-#{d[4..5]}-#{d[6..7]}" # => "2007-09-26"
392
- t1 = "#{t[0..1]}:#{t[2..3]}:#{t[4..5]}" # => "15:56:56"
393
- dt = "-#{d1}T#{t1}Z" # => "-2007-09-26T15:56:56Z"
394
- @date_time = DateTime.parse(dt) # => #<DateTime: 10673317777/10800,0,2299161>
395
- else
396
- @version = @version_str # some version strings just look like this: "0.1.0"
397
- end
393
+ @version, @revision, @date_str, @date_time, @certificate_version = parse_version_str(@version_str)
398
394
  @os = os
399
395
  end
400
396
  #
397
+ # parse_version_str
398
+ #
399
+ # input examples:
400
+ #
401
+ # "0.1.0-20070926.155656-107"
402
+ #
403
+ # or a newer example:
404
+ #
405
+ # "0.1.0-20090618.143130-890-s1"
406
+ #
407
+ # but ... some version strings just look like this:
408
+ #
409
+ # "0.1.0"
410
+ #
411
+ # or this:
412
+ #
413
+ # "2.1.7-r2"
414
+ #
415
+ # results:
416
+ #
417
+ # version # => '0.1.0'
418
+ # revision # => 20
419
+ # date_str # => '20070926.155656'
420
+ # date_time # => #<DateTime: 10673317777/10800,0,2299161>
421
+ # certificate_version # => 's1'
422
+ #
423
+ def parse_version_str(version_str)
424
+ version = date_str = certificate_version = ''
425
+ revision = date_time = nil
426
+ if version_str && version_str.length > 0
427
+ if md = version_str.match(/(\d|\.)+/)
428
+ version = md[0]
429
+ # date_str
430
+ if md2 = md.post_match.match(/-([\d]{8}.[\d]{6})(-|$)/)
431
+ date_str = md2[1]
432
+ d, t = date_str.scan(/\d+/) # => ["20070926", "155656"]
433
+ d1 = "#{d[0..3]}-#{d[4..5]}-#{d[6..7]}" # => "2007-09-26"
434
+ t1 = "#{t[0..1]}:#{t[2..3]}:#{t[4..5]}" # => "15:56:56"
435
+ dt = "#{d1}T#{t1}Z" # => "2007-09-26T15:56:56Z"
436
+ date_time = DateTime.parse(dt) # => #<DateTime: 10673317777/10800,0,2299161>
437
+ # revision
438
+ if md3 = md2.post_match.match(/\d+/)
439
+ revision = md3[0].to_i
440
+ end
441
+ else
442
+ if match = md.post_match[/\d+/]
443
+ revision = match.to_i
444
+ end
445
+ end
446
+ # certificate_version
447
+ if match = md.post_match[/-(s\d+)/, 1]
448
+ certificate_version = match
449
+ end
450
+ end
451
+ end
452
+ [version, revision, date_str, date_time, certificate_version]
453
+ end
454
+ #
401
455
  # Set's up the local cache directory references
402
456
  #
403
457
  def local_cache_dir=(dir_path)
@@ -1043,6 +1097,9 @@ module Jnlp #:nodoc:
1043
1097
  def require_resources
1044
1098
  if RUBY_PLATFORM =~ /java/
1045
1099
  resource_paths(:remove_jruby => true).each {|res| require res}
1100
+ true
1101
+ else
1102
+ false
1046
1103
  end
1047
1104
  end
1048
1105
  #
data/lib/jnlp/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Jnlp #:nodoc:
2
- VERSION = '0.0.5'
2
+ VERSION = '0.0.5.1'
3
3
  #
4
4
  # Let's see if this patch:
5
5
  #
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.5
4
+ version: 0.0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen Bannasch