Class: Gloss::Initializer
- Inherits:
-
Object
- Object
- Gloss::Initializer
- Defined in:
- lib/gloss/initializer.rb
Instance Method Summary collapse
-
#initialize(force) ⇒ Initializer
constructor
A new instance of Initializer.
- #run ⇒ Object
Constructor Details
#initialize(force) ⇒ Initializer
Returns a new instance of Initializer.
8 9 10 |
# File 'lib/gloss/initializer.rb', line 8 def initialize(force) @force = force end |
Instance Method Details
#run ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/gloss/initializer.rb', line 11 def run() (if File.exist?(CONFIG_PATH) && !@force throw(:"error", "#{CONFIG_PATH} file already exists - aborting. Use --force to override.") end) File.open(CONFIG_PATH, "wb") { |file| file.puts(Config.default_config .transform_keys(&:"to_s") .to_yaml) } Gloss.logger .info("Created #{CONFIG_PATH} with default preferences") end |