OSDN Git Service

fix: fetch fail
[pettanr/pettanr.git] / lib / local_manifest / local_manifest.rb
1 module LocalManifest
2   class LocalManifest
3     cattr_accessor :manifest
4     attr :list_groups, :profilers, :filers, :forms, :buckets, :module_names
5     # call me before load routes.rb
6     # routes.rb needs engine_resources manifest in system_resources
7     # ex. it's adding license_groups routes
8     def initialize local_json
9       @module_names = []
10       @local_json = local_json || {}
11     end
12     
13     def init
14       # managers can't initialize before load  application.rb
15       return unless defined? ::Pettanr
16       @list_groups = ListGroup.load(self, @local_json, 'list_groups')
17       @filers = Filer.load(self, @local_json, 'filers')
18       @profilers = Profiler.load(self, @local_json, 'profilers')
19       @forms = Form.load(self, @local_json, 'forms')
20       @buckets = Bucket.load(self, @local_json, 'buckets')
21     end
22     
23   end
24   
25   module ModuleMethods
26     def manifest
27       LocalManifest.manifest
28     end
29     
30     def load local_json
31       LocalManifest.manifest = LocalManifest.new local_json
32     end
33     
34   end
35
36   extend ModuleMethods
37 end
38