Module: GeneratorMessages
- Defined in:
- lib/generators/react_on_rails/generator_messages.rb
Class Method Summary collapse
- .add_error(message) ⇒ Object
- .add_info(message) ⇒ Object
- .add_warning(message) ⇒ Object
- .clear ⇒ Object
- .format_error(msg) ⇒ Object
- .format_info(msg) ⇒ Object
- .format_warning(msg) ⇒ Object
- .helpful_message_after_installation(component_name: "HelloWorld") ⇒ Object
- .messages ⇒ Object
- .output ⇒ Object
Class Method Details
.add_error(message) ⇒ Object
9 10 11 |
# File 'lib/generators/react_on_rails/generator_messages.rb', line 9 def add_error() output << format_error() end |
.add_info(message) ⇒ Object
17 18 19 |
# File 'lib/generators/react_on_rails/generator_messages.rb', line 17 def add_info() output << format_info() end |
.add_warning(message) ⇒ Object
13 14 15 |
# File 'lib/generators/react_on_rails/generator_messages.rb', line 13 def add_warning() output << format_warning() end |
.clear ⇒ Object
37 38 39 |
# File 'lib/generators/react_on_rails/generator_messages.rb', line 37 def clear @output = [] end |
.format_error(msg) ⇒ Object
25 26 27 |
# File 'lib/generators/react_on_rails/generator_messages.rb', line 25 def format_error(msg) Rainbow("ERROR: #{msg}").red end |
.format_info(msg) ⇒ Object
33 34 35 |
# File 'lib/generators/react_on_rails/generator_messages.rb', line 33 def format_info(msg) Rainbow(msg.to_s).green end |
.format_warning(msg) ⇒ Object
29 30 31 |
# File 'lib/generators/react_on_rails/generator_messages.rb', line 29 def format_warning(msg) Rainbow("WARNING: #{msg}").orange end |
.helpful_message_after_installation(component_name: "HelloWorld") ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/generators/react_on_rails/generator_messages.rb', line 41 def (component_name: "HelloWorld") process_manager_section = build_process_manager_section testing_section = build_testing_section package_manager = detect_package_manager shakapacker_status = build_shakapacker_status_section <<~MSG ╔════════════════════════════════════════════════════════════════════════╗ ║ 🎉 React on Rails Successfully Installed! ║ ╚════════════════════════════════════════════════════════════════════════╝ #{process_manager_section}#{shakapacker_status} 📋 QUICK START: ───────────────────────────────────────────────────────────────────────── 1. Install dependencies: #{Rainbow("bundle && #{package_manager} install").cyan} 2. Start the app: ./bin/dev # HMR (Hot Module Replacement) mode ./bin/dev static # Static bundles (no HMR, faster initial load) ./bin/dev prod # Production-like mode for testing ./bin/dev help # See all available options 3. Visit: #{Rainbow('http://localhost:3000/hello_world').cyan.underline} ✨ KEY FEATURES: ───────────────────────────────────────────────────────────────────────── • Auto-registration enabled - Your layout only needs: <%= javascript_pack_tag %> <%= stylesheet_pack_tag %> • Server-side rendering - Enabled with prerender option in app/views/hello_world/index.html.erb: <%= react_component("#{component_name}", props: @hello_world_props, prerender: true) %> 📚 LEARN MORE: ───────────────────────────────────────────────────────────────────────── • Documentation: #{Rainbow('https://www.shakacode.com/react-on-rails/docs/').cyan.underline} • Webpack customization: #{Rainbow('https://github.com/shakacode/shakapacker#webpack-configuration').cyan.underline} 💡 TIP: Run 'bin/dev help' for development server options and troubleshooting#{testing_section} MSG end |
.messages ⇒ Object
21 22 23 |
# File 'lib/generators/react_on_rails/generator_messages.rb', line 21 def output end |
.output ⇒ Object
5 6 7 |
# File 'lib/generators/react_on_rails/generator_messages.rb', line 5 def output @output ||= [] end |