Class: FPM::Fry::Plugin::Alternatives::DSL
- Inherits:
-
Struct
- Object
- Struct
- FPM::Fry::Plugin::Alternatives::DSL
- Defined in:
- lib/fpm/fry/plugin/alternatives.rb
Instance Attribute Summary collapse
-
#alternatives ⇒ Object
Returns the value of attribute alternatives.
-
#builder ⇒ Object
Returns the value of attribute builder.
Instance Method Summary collapse
- #[]=(name, options = {}, value) ⇒ Object
- #add(name, value, options = {}) ⇒ Object
- #finish! ⇒ Object
-
#initialize(b, a = {}) ⇒ DSL
constructor
A new instance of DSL.
Constructor Details
#initialize(b, a = {}) ⇒ DSL
Returns a new instance of DSL.
10 11 12 |
# File 'lib/fpm/fry/plugin/alternatives.rb', line 10 def initialize( b, a = {}) super end |
Instance Attribute Details
#alternatives ⇒ Object
Returns the value of attribute alternatives
8 9 10 |
# File 'lib/fpm/fry/plugin/alternatives.rb', line 8 def alternatives @alternatives end |
#builder ⇒ Object
Returns the value of attribute builder
8 9 10 |
# File 'lib/fpm/fry/plugin/alternatives.rb', line 8 def builder @builder end |
Instance Method Details
#[]=(name, options = {}, value) ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/fpm/fry/plugin/alternatives.rb', line 14 def []=(name, ={}, value) name = name.to_s if value.kind_of? String = normalize(name, .merge(path: value) ) else = normalize(name, .merge(value) ) end alternatives[name] = end |
#add(name, value, options = {}) ⇒ Object
24 25 26 |
# File 'lib/fpm/fry/plugin/alternatives.rb', line 24 def add(name, value, ={}) self[name, ] = value end |
#finish! ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/fpm/fry/plugin/alternatives.rb', line 28 def finish! install = alternatives.map{|_,v| install_command(v) } uninstall = alternatives.map{|_,v| uninstall_command(v) } builder.plugin('script_helper') do after_install_or_upgrade(*install) before_remove_entirely(*uninstall) end end |