class Rock::Bundles::Bundle
Representation of a bundle we found
The bundle's configuration parameters are stored under the 'bundle' key in either config/app.yml or config/bundle.yml
config/app.yml or config/bundle.yml are used to recognize bundles from normal directories. See Rock::Bundles.is_bundle_path?.
Attributes
config[RW]
The bundle's configuration hash. It gets loaded ony if load_config is called.
Configuration in bundles
name[R]
The bundle name
path[R]
The full path to the bundle
Public Class Methods
new(path)
click to toggle source
# File lib/rock/bundles.rb, line 52 def initialize(path) @name = File.basename(path) @path = path end
Public Instance Methods
==(other)
click to toggle source
# File lib/rock/bundles.rb, line 57 def ==(other) return false if !other.kind_of?(Bundle) other.name == name && other.path == path end
each_dependency(&block)
click to toggle source
Enumerate the names of the bundles on which this bundle depends
# File lib/rock/bundles.rb, line 82 def each_dependency(&block) load_config['dependencies'].each(&block) end
load_config()
click to toggle source
Loads the configuration file, or return an already loaded configuration
# File lib/rock/bundles.rb, line 65 def load_config if @config return config end if File.file?(bundle_yml = File.join(path, "config", "bundle.yml")) base = YAML.load(File.read(bundle_yml)) elsif File.file?(app_yml = File.join(path, "config", "app.yml")) base = YAML.load(File.read(app_yml)) end base ||= Hash.new @config = (base['bundle'] || Hash.new) @config['dependencies'] ||= Array.new config end
registered?()
click to toggle source
Returns true if this bundle can be found through the ROCK_BUNDLE_PATH or if it must be referred to through its full path
# File lib/rock/bundles.rb, line 45 def registered? paths = (ENV['ROCK_BUNDLE_PATH'] || '').split(":") paths.any? do |p| p == path || path =~ /^#{Regexp.quote(p)}/ end end