Class: Exo::Generator
- Inherits:
-
Object
- Object
- Exo::Generator
- Defined in:
- app/services/exo/generator.rb
Constant Summary collapse
- APP_FOLDER_EXCLUDED =
['assets', 'helpers']
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
-
#slug ⇒ Object
Returns the value of attribute slug.
Instance Method Summary collapse
- #generates_config ⇒ Object
- #generates_folders ⇒ Object
-
#initialize(slug, options = nil) ⇒ Generator
constructor
A new instance of Generator.
Constructor Details
#initialize(slug, options = nil) ⇒ Generator
Returns a new instance of Generator.
8 9 10 11 |
# File 'app/services/exo/generator.rb', line 8 def initialize slug, =nil self.slug = slug self. = || {} end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
6 7 8 |
# File 'app/services/exo/generator.rb', line 6 def end |
#slug ⇒ Object
Returns the value of attribute slug.
6 7 8 |
# File 'app/services/exo/generator.rb', line 6 def slug @slug end |
Instance Method Details
#generates_config ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/services/exo/generator.rb', line 13 def generates_config exo_config_path = File.join root_path, 'config', 'exo', "#{slug}.yml" dir = File.dirname exo_config_path FileUtils.mkdir_p dir unless File.directory? dir unless File.exists?(exo_config_path) puts " + #{exo_config_path}" yaml = { 'theme' => slug, 'main_host' => "#{slug}.com", 'hosts' => nil, 'contributors' => nil, 'resources' => nil, 'routes' => nil }.to_yaml File.open(exo_config_path, 'w') {|f| f.write yaml } end end |
#generates_folders ⇒ Object
32 33 34 35 36 37 |
# File 'app/services/exo/generator.rb', line 32 def generates_folders app_folder = File.join root_path, 'app' generates_slug_subfolder_of app_folder generates_slug_subfolder_of File.join app_folder, 'assets' end |