Class: ReactOnRails::Generators::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
GeneratorHelper
Defined in:
lib/generators/react_on_rails/install_generator.rb

Overview

rubocop:disable Metrics/ClassLength

Instance Method Summary collapse

Methods included from GeneratorHelper

#add_documentation_reference, #add_npm_dependencies, #component_extension, #copy_file_and_missing_parent_directories, #dest_dir_exists?, #dest_file_exists?, #empty_directory_with_keep_file, #keep_file, #package_json, #setup_file_error, #symlink_dest_file_to_dest_file

Instance Method Details

#run_generatorsObject

Removed: –skip-shakapacker-install (Shakapacker is now a required dependency)



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/generators/react_on_rails/install_generator.rb', line 39

def run_generators
  if installation_prerequisites_met? || options.ignore_warnings?
    invoke_generators
    add_bin_scripts
    # Only add the post install message if not using Redux
    # Redux generator handles its own messages
    add_post_install_message unless options.redux?
  else
    error = <<~MSG.strip
      🚫 React on Rails generator prerequisites not met!

      Please resolve the issues listed above before continuing.
      All prerequisites must be satisfied for a successful installation.

      Use --ignore-warnings to bypass checks (not recommended).
    MSG
    GeneratorMessages.add_error(error)
  end
ensure
  print_generator_messages
end