Class: ReactWebpackRails::Install::CoreGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- ReactWebpackRails::Install::CoreGenerator
- Defined in:
- lib/generators/react_webpack_rails/install/core_generator.rb
Instance Method Summary collapse
Instance Method Details
#base ⇒ Object
13 14 15 16 17 18 |
# File 'lib/generators/react_webpack_rails/install/core_generator.rb', line 13 def base copy_file '.babelrc', '.babelrc' create_file 'app/assets/javascripts/react_bundle.js' require_bundles_in_application_js template 'react/index.js', 'app/react/index.js' end |
#gitignore ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/generators/react_webpack_rails/install/core_generator.rb', line 24 def gitignore append_file '.gitignore' do <<-'TEXT'.strip_heredoc /node_modules /app/assets/javascripts/react_bundle.js /app/assets/stylesheets/react_bundle.css TEXT end end |
#package ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/generators/react_webpack_rails/install/core_generator.rb', line 33 def package if .tmp_package copy_file 'packages/core.json', 'tmp/package.json', force: true else copy_file 'packages/core.json', 'package.json' end end |
#structure ⇒ Object
20 21 22 |
# File 'lib/generators/react_webpack_rails/install/core_generator.rb', line 20 def structure create_file 'app/react/components/.keep' end |
#webpack ⇒ Object
41 42 43 44 45 |
# File 'lib/generators/react_webpack_rails/install/core_generator.rb', line 41 def webpack copy_file 'webpack.config.js', 'webpack.config.js' copy_file 'webpack/dev.config.js', 'webpack/dev.config.js' copy_file 'webpack/production.config.js', 'webpack/production.config.js' end |