Class: Kaigara::Operation
- Inherits:
-
Object
- Object
- Kaigara::Operation
- Includes:
- DSL
- Defined in:
- app/models/sysops/operation.rb
Overview
A script that Sysops
executes
Defined Under Namespace
Classes: ThorShell
Instance Attribute Summary collapse
-
#environment ⇒ Object
Returns the value of attribute environment.
-
#name ⇒ Object
Returns the value of attribute name.
-
#work_dir ⇒ Object
Returns the value of attribute work_dir.
Instance Method Summary collapse
-
#apply! ⇒ Object
Executes operation content.
-
#initialize(path) ⇒ Operation
constructor
A new instance of Operation.
Methods included from DSL
#debian_family?, #execute, #file, #file_matches?, #hostname, included, #package, #package_update, #redhat_family?, #repo_extended, #script, #template
Constructor Details
#initialize(path) ⇒ Operation
Returns a new instance of Operation.
25 26 27 28 29 30 |
# File 'app/models/sysops/operation.rb', line 25 def initialize(path) @shell = ThorShell.new @name = File.basename(path) @content = File.read(path) Environment.load_variables(self) # We loads variables to both shell and operation classes. So it's available from your ruby code in +operations/+ and from our DSL. end |
Instance Attribute Details
#environment ⇒ Object
Returns the value of attribute environment.
23 24 25 |
# File 'app/models/sysops/operation.rb', line 23 def environment @environment end |
#name ⇒ Object
Returns the value of attribute name.
22 23 24 |
# File 'app/models/sysops/operation.rb', line 22 def name @name end |
#work_dir ⇒ Object
Returns the value of attribute work_dir.
21 22 23 |
# File 'app/models/sysops/operation.rb', line 21 def work_dir @work_dir end |
Instance Method Details
#apply! ⇒ Object
Executes operation content
33 34 35 36 |
# File 'app/models/sysops/operation.rb', line 33 def apply! @shell.say "Applying #{@name}\n--------------------", :yellow instance_eval @content end |