Class: Jail::Config
- Inherits:
-
Object
- Object
- Jail::Config
- Defined in:
- lib/containerize_me.rb
Instance Attribute Summary collapse
-
#cfg ⇒ Object
readonly
Returns the value of attribute cfg.
-
#dep_order ⇒ Object
readonly
Returns the value of attribute dep_order.
-
#jail ⇒ Object
readonly
Returns the value of attribute jail.
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ Config
constructor
A new instance of Config.
- #order(file) ⇒ Object
Constructor Details
#initialize(params = {}) ⇒ Config
Returns a new instance of Config.
24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/containerize_me.rb', line 24 def initialize(params={}) @cfg = params[:cfg] @cfg[:system_binaries] ||= [] @cfg[:other_binaries] ||= [] @cfg[:copy_items] ||= [] @jail = params[:jail] @templates = params[:templates] @system_binaries = @cfg[:system_binaries] @other_files = @cfg[:other_files] @dep_order = [] order(@cfg) end |
Instance Attribute Details
#cfg ⇒ Object (readonly)
Returns the value of attribute cfg.
23 24 25 |
# File 'lib/containerize_me.rb', line 23 def cfg @cfg end |
#dep_order ⇒ Object (readonly)
Returns the value of attribute dep_order.
23 24 25 |
# File 'lib/containerize_me.rb', line 23 def dep_order @dep_order end |
#jail ⇒ Object (readonly)
Returns the value of attribute jail.
23 24 25 |
# File 'lib/containerize_me.rb', line 23 def jail @jail end |
Instance Method Details
#order(file) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/containerize_me.rb', line 38 def order(file) if File.exists?("#{@templates}/#{file}") cfg = YAML::load_file("#{@templates}/#{file}") else cfg = file end @dep_order << cfg unless @dep_order.include?(cfg) if cfg.has_key?(:depends_on) if cfg[:depends_on].kind_of?(Array) cfg[:depends_on].each { |f| order(f) } end end end |