Class: Rubber::Configuration::ConfigDescriptor

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initializeConfigDescriptor

Returns a new instance of ConfigDescriptor.



232
233
234
# File 'lib/rubber/generator.rb', line 232

def initialize
  @backup = true
end

Instance Attribute Details

#additiveObject

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

#backupObject

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_postObject

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

#generatorObject

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

#groupObject

The group the output file should have, e.g. “system”



215
216
217
# File 'lib/rubber/generator.rb', line 215

def group
  @group
end

#optionsObject

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
  @options
end

#ownerObject

The owner the output file should have, e.g. “root”



213
214
215
# File 'lib/rubber/generator.rb', line 213

def owner
  @owner
end

#pathObject

The output path to write the transformed config file to



203
204
205
# File 'lib/rubber/generator.rb', line 203

def path
  @path
end

#permsObject

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

#postObject

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_cmdObject

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

#skipObject

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_cmdObject

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_bindingObject



236
237
238
# File 'lib/rubber/generator.rb', line 236

def get_binding
  binding
end

#rubber_envObject



240
241
242
# File 'lib/rubber/generator.rb', line 240

def rubber_env
  Rubber::Configuration.rubber_env
end

#rubber_instanceObject



248
249
250
# File 'lib/rubber/generator.rb', line 248

def rubber_instance
  rubber_instances[rubber_env.host]
end

#rubber_instancesObject



244
245
246
# File 'lib/rubber/generator.rb', line 244

def rubber_instances
  Rubber.instances
end