Class: Squareone::Generator
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- Squareone::Generator
- Includes:
- Thor::Actions
- Defined in:
- lib/squareone/generator.rb
Class Method Summary collapse
-
.source_root ⇒ Object
Declare source files directory.
Instance Method Summary collapse
-
#copy_files ⇒ Object
Copy files in the root directory.
-
#copy_folders ⇒ Object
Copy files in folders.
-
#create_git_files ⇒ Object
Create git files.
-
#generate_from_templates ⇒ Object
Generate files with template variables.
-
#set_variables ⇒ Object
Set template variables.
Class Method Details
.source_root ⇒ Object
Declare source files directory
9 10 11 |
# File 'lib/squareone/generator.rb', line 9 def self.source_root File.(File.join(File.dirname(__FILE__), "..", "..", "lib", "templates")) end |
Instance Method Details
#copy_files ⇒ Object
Copy files in the root directory
43 44 45 46 47 |
# File 'lib/squareone/generator.rb', line 43 def copy_files %w{_config.dev.yml about.md feed.xml gulpfile.js index.html}.each do |file| copy_file file end end |
#copy_folders ⇒ Object
Copy files in folders
21 22 23 24 25 |
# File 'lib/squareone/generator.rb', line 21 def copy_folders %w{_includes _layouts _posts _sass assets}.each do |dir| directory dir end end |
#create_git_files ⇒ Object
Create git files
28 29 30 31 32 33 |
# File 'lib/squareone/generator.rb', line 28 def create_git_files %w{assets/images/.gitkeep assets/stylesheets/.gitkeep}.each do |file| create_file file end copy_file ".gitignore" end |
#generate_from_templates ⇒ Object
Generate files with template variables
36 37 38 39 40 |
# File 'lib/squareone/generator.rb', line 36 def generate_from_templates %w{package.json _config.yml}.each do |file| template file end end |
#set_variables ⇒ Object
Set template variables
14 15 16 17 18 |
# File 'lib/squareone/generator.rb', line 14 def set_variables name = destination_root.split(/\//).last @project_name = name.downcase @project_title = name.split(/[- _]/).map(&:capitalize).join(' ') end |