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 19 |
# File 'lib/generators/react_webpack_rails/install/core_generator.rb', line 13 def base copy_file '.babelrc', '.babelrc' copy_file '.eslintrc', '.eslintrc' create_file 'app/assets/javascripts/react_bundle.js' require_bundles_in_application_js template 'react/index.js', 'app/react/index.js' end |
#gitignore ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/generators/react_webpack_rails/install/core_generator.rb', line 25 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
34 35 36 37 38 39 40 |
# File 'lib/generators/react_webpack_rails/install/core_generator.rb', line 34 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
21 22 23 |
# File 'lib/generators/react_webpack_rails/install/core_generator.rb', line 21 def structure create_file 'app/react/components/.keep' end |
#webpack ⇒ Object
42 43 44 45 46 |
# File 'lib/generators/react_webpack_rails/install/core_generator.rb', line 42 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 |