Module: Plugems::Loader::ClassMethods
- Included in:
- Plugems::Loader
- Defined in:
- lib/plugems/loader.rb
Instance Method Summary collapse
- #gem_rake_tasks ⇒ Object
- #gem_views ⇒ Object
- #load(configuration) ⇒ Object
- #load_as_plugin(gem) ⇒ Object
- #plugin?(name) ⇒ Boolean
- #plugin_views ⇒ Object
Instance Method Details
#gem_rake_tasks ⇒ Object
22 23 24 |
# File 'lib/plugems/loader.rb', line 22 def gem_rake_tasks (@@gem_rake_tasks ||= []).flatten.uniq end |
#gem_views ⇒ Object
26 27 28 |
# File 'lib/plugems/loader.rb', line 26 def gem_views (@@gem_views ||= []).flatten.uniq end |
#load(configuration) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/plugems/loader.rb', line 12 def load(configuration) # TODO find a way to get the plugin_paths defined in the Rails::Initializer block, if any #@@configuration = configuration @@loaded_plugems = {} # hash of all loaded plugems, to prevent loading duplicates manifest = Plugems::Manifest.load("#{RAILS_ROOT}/config/manifest.yml") load_plugems(manifest) set_dependencies_loaded_flag end |
#load_as_plugin(gem) ⇒ Object
40 41 42 43 44 45 46 47 |
# File 'lib/plugems/loader.rb', line 40 def load_as_plugin(gem) debug "Plugin #{gem}" path = plugin_path(gem) plugin_lib = File.join(path, "lib") $: << plugin_lib if File.exist?(plugin_lib) process_plugin_manifest(path) require_gem_file(gem) end |
#plugin?(name) ⇒ Boolean
36 37 38 |
# File 'lib/plugems/loader.rb', line 36 def plugin?(name) (path = plugin_path(name)) && File.directory?(path) end |
#plugin_views ⇒ Object
30 31 32 33 34 |
# File 'lib/plugems/loader.rb', line 30 def plugin_views plugin_lib_paths.collect do |plugin_path| Dir["#{plugin_path}/views/**/*.*"] end.flatten.uniq end |