Class: Rubber::Configuration::ConfigDescriptor
- Inherits:
-
Object
- Object
- Rubber::Configuration::ConfigDescriptor
- Defined in:
- lib/rubber/generator.rb
Overview
Instances of this object are used accept settings from with a config file for when it is transformed by Generator
Instance Attribute Summary collapse
-
#additive ⇒ Object
Sets transformation to be additive, only replaces between given delimiters, e/g/ additive = [“## start”, “## end”].
-
#backup ⇒ Object
Backup file when transforming, defaults to true, set to false to prevent backup.
-
#delayed_post ⇒ Object
The command to run after generating all config files if this file has changed.
-
#generator ⇒ Object
allow access to calling generator so can determine stuff like fake_root.
-
#group ⇒ Object
The group the output file should have, e.g.
-
#options ⇒ Object
use sudo to write the output file attr_accessor :sudo options passed in through code.
-
#owner ⇒ Object
The owner the output file should have, e.g.
-
#path ⇒ Object
The output path to write the transformed config file to.
-
#perms ⇒ Object
The permissions the output file should have, e.g.
-
#post ⇒ Object
The command to run after generating the config file if it has changed.
-
#read_cmd ⇒ Object
The command to use for reading the original config file from (e.g. “crontab -l”).
-
#skip ⇒ Object
Lets one dynamically determine if a given file gets skipped during transformation.
-
#write_cmd ⇒ Object
The command to use for piping the transformed config file to (e.g. “crontab -”).
Instance Method Summary collapse
- #get_binding ⇒ Object
-
#initialize ⇒ ConfigDescriptor
constructor
A new instance of ConfigDescriptor.
- #rubber_env ⇒ Object
- #rubber_instance ⇒ Object
- #rubber_instances ⇒ Object
Constructor Details
#initialize ⇒ ConfigDescriptor
Returns a new instance of ConfigDescriptor.
232 233 234 |
# File 'lib/rubber/generator.rb', line 232 def initialize @backup = true end |
Instance Attribute Details
#additive ⇒ Object
Sets transformation to be additive, only replaces between given delimiters, e/g/ additive = [“## start”, “## end”]
219 220 221 |
# File 'lib/rubber/generator.rb', line 219 def additive @additive end |
#backup ⇒ Object
Backup file when transforming, defaults to true, set to false to prevent backup
223 224 225 |
# File 'lib/rubber/generator.rb', line 223 def backup @backup end |
#delayed_post ⇒ Object
The command to run after generating all config files if this file has changed. Commands duplicated from multiple files are only run once
211 212 213 |
# File 'lib/rubber/generator.rb', line 211 def delayed_post @delayed_post end |
#generator ⇒ Object
allow access to calling generator so can determine stuff like fake_root
230 231 232 |
# File 'lib/rubber/generator.rb', line 230 def generator @generator end |
#group ⇒ Object
The group the output file should have, e.g. “system”
215 216 217 |
# File 'lib/rubber/generator.rb', line 215 def group @group end |
#options ⇒ Object
use sudo to write the output file attr_accessor :sudo options passed in through code
227 228 229 |
# File 'lib/rubber/generator.rb', line 227 def @options end |
#owner ⇒ Object
The owner the output file should have, e.g. “root”
213 214 215 |
# File 'lib/rubber/generator.rb', line 213 def owner @owner end |
#path ⇒ Object
The output path to write the transformed config file to
203 204 205 |
# File 'lib/rubber/generator.rb', line 203 def path @path end |
#perms ⇒ Object
The permissions the output file should have, e.g. 0644 (octal, leading zero is significant)
217 218 219 |
# File 'lib/rubber/generator.rb', line 217 def perms @perms end |
#post ⇒ Object
The command to run after generating the config file if it has changed
209 210 211 |
# File 'lib/rubber/generator.rb', line 209 def post @post end |
#read_cmd ⇒ Object
The command to use for reading the original config file from (e.g. “crontab -l”)
205 206 207 |
# File 'lib/rubber/generator.rb', line 205 def read_cmd @read_cmd end |
#skip ⇒ Object
Lets one dynamically determine if a given file gets skipped during transformation
221 222 223 |
# File 'lib/rubber/generator.rb', line 221 def skip @skip end |
#write_cmd ⇒ Object
The command to use for piping the transformed config file to (e.g. “crontab -”)
207 208 209 |
# File 'lib/rubber/generator.rb', line 207 def write_cmd @write_cmd end |
Instance Method Details
#get_binding ⇒ Object
236 237 238 |
# File 'lib/rubber/generator.rb', line 236 def get_binding binding end |
#rubber_env ⇒ Object
240 241 242 |
# File 'lib/rubber/generator.rb', line 240 def rubber_env Rubber::Configuration.rubber_env end |
#rubber_instance ⇒ Object
248 249 250 |
# File 'lib/rubber/generator.rb', line 248 def rubber_instance rubber_instances[rubber_env.host] end |