Class: TechnoGate::Contao::Generators::Config

Inherits:
Base
  • Object
show all
Defined in:
lib/contao/generators/config.rb

Defined Under Namespace

Classes: AlreadyExists

Instance Attribute Summary

Attributes inherited from Base

#options

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from TechnoGate::Contao::Generators::Base

Instance Method Details

#default_global_config(options = {}) ⇒ Object



31
32
33
# File 'lib/contao/generators/config.rb', line 31

def default_global_config(options = {})
  Contao::Application.send(:default_global_config, options)
end

#generateObject

Raises:



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/contao/generators/config.rb', line 12

def generate
  raise AlreadyExists if File.exists?(global_config_path)

  FileUtils.mkdir_p File.dirname(global_config_path)
  File.open global_config_path, 'w' do |config|
    config.write YAML.dump(default_global_config)
  end

  message = <<-EOS.gsub(/ [ ]+/, '').gsub("\n", ' ').chop
  The configuration file has been created at ~/.contao/config.yml,
  you need to edit this file before working with contao
  EOS
  Notifier.notify message, title: 'Config Generator'
end

#global_config_pathObject



27
28
29
# File 'lib/contao/generators/config.rb', line 27

def global_config_path
  Contao::Application.global_config_path
end