This repository was archived by the owner on Apr 28, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77#------------------------------------------------------------------------------
88
99require "bundler/setup"
10+ require "json"
1011require "ucf"
1112
1213require "ro-bundle/version"
Original file line number Diff line number Diff line change @@ -23,7 +23,8 @@ def initialize(filename)
2323 super ( filename )
2424
2525 # Initialize the managed entries and register the .ro directory.
26- initialize_managed_entries ( RODir . new )
26+ @manifest = Manifest . new
27+ initialize_managed_entries ( RODir . new ( @manifest ) )
2728 end
2829 # :startdoc:
2930
@@ -44,5 +45,11 @@ def initialize(filename)
4445 def File . create ( filename , mimetype = MIMETYPE , &block )
4546 super ( filename , mimetype , &block )
4647 end
48+
49+ protected
50+
51+ def manifest
52+ @manifest . structure
53+ end
4754 end
4855end
Original file line number Diff line number Diff line change 88
99module ROBundle
1010 class RODir < ZipContainer ::ManagedDirectory
11- def initialize
12- super ( ".ro" , false , [ Manifest . new ] )
11+
12+ DIR_NAME = ".ro"
13+
14+ def initialize ( manifest )
15+ super ( DIR_NAME , false , [ manifest ] )
1316 end
1417 end
1518
1619 class Manifest < ZipContainer ::ManagedFile
20+
21+ FILE_NAME = "manifest.json"
22+
1723 def initialize
18- super ( "manifest.json" , false )
24+ super ( FILE_NAME , false )
25+ end
26+
27+ # Need this because we can't access file contents in the constructor.
28+ def structure
29+ begin
30+ @structure ||= JSON . parse ( contents )
31+ rescue
32+ @structure = { }
33+ end
1934 end
35+
2036 end
2137end
Original file line number Diff line number Diff line change @@ -37,4 +37,5 @@ Gem::Specification.new do |spec|
3737 spec . add_development_dependency ( "rdoc" , "~> 4.1" )
3838 spec . add_development_dependency "coveralls"
3939 spec . add_runtime_dependency "ucf" , "~> 0.7"
40+ spec . add_runtime_dependency "json" , "~> 1.8"
4041end
You can’t perform that action at this time.
0 commit comments