Class: Cubic::Generator::Config
- Inherits:
-
Object
- Object
- Cubic::Generator::Config
- Defined in:
- lib/cubic/generators/config.rb
Overview
Config stores data needed throughout the generation process.
Class Method Summary collapse
- .[](key) ⇒ Object
- .all ⇒ Object
- .css_type(type) ⇒ Object
- .db(db) ⇒ Object
-
.defaults(name) ⇒ Object
Default options.
-
.gems(gems) ⇒ Object
Gems to be added to Gemfile.
-
.html_type(type) ⇒ Object
Consider renaming to ‘template engine’.
-
.name(name) ⇒ Object
Name of the application.
- .orm(orm) ⇒ Object
- .root_path(path) ⇒ Object
-
.test_type(type) ⇒ Object
Prefered testing framework.
Class Method Details
.[](key) ⇒ Object
14 15 16 |
# File 'lib/cubic/generators/config.rb', line 14 def [](key) all[key] || defaults(key) end |
.all ⇒ Object
10 11 12 |
# File 'lib/cubic/generators/config.rb', line 10 def all @settings end |
.css_type(type) ⇒ Object
45 46 47 |
# File 'lib/cubic/generators/config.rb', line 45 def css_type(type) @settings[:css_type] = type || 'css' end |
.db(db) ⇒ Object
36 37 38 |
# File 'lib/cubic/generators/config.rb', line 36 def db(db) @settings[:db] = db || 'sqlite3' end |
.defaults(name) ⇒ Object
Default options.
55 56 57 58 59 60 61 62 63 |
# File 'lib/cubic/generators/config.rb', line 55 def defaults(name) { root_path: Dir.getwd, name: 'No Name', test_type: 'rspec', orm: 'Sequel', db: 'sqlite3', html_type: 'haml', css_type: 'css' }[name] end |
.gems(gems) ⇒ Object
Gems to be added to Gemfile
50 51 52 |
# File 'lib/cubic/generators/config.rb', line 50 def gems(gems) @settings[:gems] = gems end |
.html_type(type) ⇒ Object
Consider renaming to ‘template engine’
41 42 43 |
# File 'lib/cubic/generators/config.rb', line 41 def html_type(type) @settings[:html_type] = type || 'haml' end |
.name(name) ⇒ Object
Name of the application
23 24 25 |
# File 'lib/cubic/generators/config.rb', line 23 def name(name) @settings[:name] = name end |
.orm(orm) ⇒ Object
32 33 34 |
# File 'lib/cubic/generators/config.rb', line 32 def orm(orm) @settings[:orm] = orm || 'Sequel' end |
.root_path(path) ⇒ Object
18 19 20 |
# File 'lib/cubic/generators/config.rb', line 18 def root_path(path) @settings[:root_path] = path end |
.test_type(type) ⇒ Object
Prefered testing framework.
28 29 30 |
# File 'lib/cubic/generators/config.rb', line 28 def test_type(type) @settings[:test_type] = type || 'Rspec' end |