Module: BridgetownPluginNano::Commands::Nano::GeneralHelpers
- Included in:
- BridgetownPluginNano::Commands::Nano
- Defined in:
- lib/bridgetown-plugin-nano/command_helpers/general_helpers.rb
Instance Method Summary collapse
-
#configure_new_nano_app ⇒ Object
rubocop:disable Metrics/MethodLength.
Instance Method Details
#configure_new_nano_app ⇒ Object
rubocop:disable Metrics/MethodLength
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/bridgetown-plugin-nano/command_helpers/general_helpers.rb', line 7 def configure_new_nano_app # rubocop:disable Metrics/MethodLength template "bridgetown_root/config.ru", "config.ru" copy_file "bridgetown_root/Rakefile", "Rakefile" gsub_file "start.js", 'sleep 4; yarn serve --port " + port', 'sleep 4; bundle exec rake nano:start -- --port=" + port' gsub_file "webpack.config.js", %(const path = require("path");\n), %(const path = require("path");\nconst webpack = require("webpack");\n) inject_into_file "webpack.config.js", " new webpack.DefinePlugin({\n NANO_API_URL: JSON.stringify(process.env.NANO_API_URL || \"\")\n }),\n JS\n\n append_to_file \"Gemfile\" do\n <<~RUBY\n\n # Gems required by the Nano backend:\n gem \"dotenv\"\n gem \"puma\"\n gem \"rails\"\n gem \"rack-cors\"\n RUBY\n end\n Bridgetown.with_unbundled_env do\n run \"bundle install\", abort_on_failure: true\n end\n\n logger = Bridgetown.logger\n logger.info \"\"\n logger.info \"Success!\".green, \"\u{1F389} Your Nano backend was\" \\\n \" generated in \#{folder_name.cyan}.\"\nend\n", after: "\n plugins: [\n" |