Class: MoshGenerator::AppBuilder
- Inherits:
-
Rails::AppBuilder
- Object
- Rails::AppBuilder
- MoshGenerator::AppBuilder
- Defined in:
- lib/mosh_generator/app_builder.rb
Overview
Override Rails default AppBuilder
Instance Method Summary collapse
-
#configure_grunt ⇒ Object
Configures Grunt to compile, concat and minify assets.
-
#create_editorconfig_file ⇒ Object
Creates an .editorconfig.
-
#create_helpers ⇒ Object
Creates the initial helpers for the application.
-
#create_layout ⇒ Object
Creates the layout for the application.
-
#create_partial_views ⇒ Object
Creates the partial views directory with some partial for the application.
-
#create_ruby_gemset_file ⇒ Object
Creates a .ruby-gemset file to Ruby version managers.
-
#create_ruby_version_file ⇒ Object
Creates a .ruby-version file to Ruby version managers.
-
#create_staging_environment_file ⇒ Object
Creates a staging.rb file on config/environments directory.
-
#database_yml ⇒ Object
Create the database.yml.
-
#gemfile ⇒ Object
Create the Gemfile.
-
#gitignore ⇒ Object
Create the .gitignore.
-
#public_directory ⇒ Object
Creates public directory.
-
#readme ⇒ Object
Create the README file.
-
#remove_assets_directories ⇒ Object
Removes the assets directories on app, lib and vendor directories.
-
#remove_doc_directory ⇒ Object
Removes the doc directory.
-
#remove_public_index ⇒ Object
Removes the index.html file on the public directory.
Instance Method Details
#configure_grunt ⇒ Object
Configures Grunt to compile, concat and minify assets.
126 127 128 129 130 131 132 133 |
# File 'lib/mosh_generator/app_builder.rb', line 126 def configure_grunt if [:skip_sprockets] template 'package.json.tt' copy_file 'Gruntfile.js' copy_file '.jshintrc' run 'npm install' end end |
#create_editorconfig_file ⇒ Object
Creates an .editorconfig.
77 78 79 |
# File 'lib/mosh_generator/app_builder.rb', line 77 def create_editorconfig_file copy_file '.editorconfig' end |
#create_helpers ⇒ Object
Creates the initial helpers for the application.
105 106 107 |
# File 'lib/mosh_generator/app_builder.rb', line 105 def create_helpers template 'app_directory/helpers/application_helper.rb.tt', 'app/helpers/application_helper.rb', force: true end |
#create_layout ⇒ Object
Creates the layout for the application.
112 113 114 |
# File 'lib/mosh_generator/app_builder.rb', line 112 def create_layout template 'app_directory/views/layouts/application.html.erb.tt', 'app/views/layouts/application.html.erb', force: true end |
#create_partial_views ⇒ Object
Creates the partial views directory with some partial for the application.
119 120 121 |
# File 'lib/mosh_generator/app_builder.rb', line 119 def create_partial_views directory 'app_directory/views/application', 'app/views/application' end |
#create_ruby_gemset_file ⇒ Object
Creates a .ruby-gemset file to Ruby version managers.
91 92 93 |
# File 'lib/mosh_generator/app_builder.rb', line 91 def create_ruby_gemset_file template '.ruby-gemset' end |
#create_ruby_version_file ⇒ Object
Creates a .ruby-version file to Ruby version managers.
84 85 86 |
# File 'lib/mosh_generator/app_builder.rb', line 84 def create_ruby_version_file template '.ruby-version' end |
#create_staging_environment_file ⇒ Object
Creates a staging.rb file on config/environments directory.
98 99 100 |
# File 'lib/mosh_generator/app_builder.rb', line 98 def create_staging_environment_file run 'cp config/environments/production.rb config/environments/staging.rb' end |
#database_yml ⇒ Object
Create the database.yml.
32 33 34 |
# File 'lib/mosh_generator/app_builder.rb', line 32 def database_yml copy_file 'config/database.yml' end |
#gemfile ⇒ Object
Create the Gemfile.
18 19 20 |
# File 'lib/mosh_generator/app_builder.rb', line 18 def gemfile template 'Gemfile.tt' end |
#gitignore ⇒ Object
Create the .gitignore.
25 26 27 |
# File 'lib/mosh_generator/app_builder.rb', line 25 def gitignore copy_file '.gitignore' end |
#public_directory ⇒ Object
Creates public directory.
39 40 41 42 43 44 45 46 47 |
# File 'lib/mosh_generator/app_builder.rb', line 39 def public_directory super directory 'public_directory', 'public', recursive: false, force: true if [:skip_sprockets] directory 'public_directory/images', 'public/images' directory 'public_directory/javascripts', 'public/javascripts' directory 'public_directory/stylesheets', 'public/stylesheets' end end |
#readme ⇒ Object
Create the README file.
11 12 13 |
# File 'lib/mosh_generator/app_builder.rb', line 11 def readme template 'README.md.tt' end |
#remove_assets_directories ⇒ Object
Removes the assets directories on app, lib and vendor directories.
59 60 61 62 63 64 65 |
# File 'lib/mosh_generator/app_builder.rb', line 59 def remove_assets_directories if [:skip_sprockets] remove_dir 'app/assets' remove_dir 'lib/assets' remove_dir 'vendor/assets' end end |
#remove_doc_directory ⇒ Object
Removes the doc directory.
70 71 72 |
# File 'lib/mosh_generator/app_builder.rb', line 70 def remove_doc_directory remove_dir 'doc' end |
#remove_public_index ⇒ Object
Removes the index.html file on the public directory.
52 53 54 |
# File 'lib/mosh_generator/app_builder.rb', line 52 def remove_public_index remove_file 'public/index.html' end |