class ReactOnRails::Generators::ReactNoReduxGenerator

Public Instance Methods

copy_base_files() click to toggle source
# File lib/generators/react_on_rails/react_no_redux_generator.rb, line 13
def copy_base_files
  base_js_path = "base/base"
  base_files = %w[app/javascript/bundles/HelloWorld/components/HelloWorld.jsx]
  base_files.each { |file| copy_file("#{base_js_path}/#{file}", file) }
end
create_appropriate_templates() click to toggle source
# File lib/generators/react_on_rails/react_no_redux_generator.rb, line 19
def create_appropriate_templates
  base_path = "base/base"
  config = {
    component_name: "HelloWorld",
    app_relative_path: "../bundles/HelloWorld/components/HelloWorld"
  }

  template("#{base_path}/app/javascript/packs/registration.js.tt",
           "app/javascript/packs/hello-world-bundle.js", config)
  template("#{base_path}/app/views/hello_world/index.html.erb.tt",
           "app/views/hello_world/index.html.erb", config)
end