Sha256: adb4b384b3feb23790bcc9ffc1d68527d6d95ce1da51ec7527ef1f9867820f8e

Contents?: true

Size: 1.05 KB

Versions: 33

Compression:

Stored size: 1.05 KB

Contents

require "rails/generators"
require_relative "generator_helper"

module ReactOnRails
  module Generators
    class ReactNoReduxGenerator < Rails::Generators::Base
      include GeneratorHelper
      Rails::Generators.hide_namespace(namespace)
      source_root(File.expand_path("../templates", __FILE__))

      def copy_base_files
        base_path = "base/base/"
        base_files = %w(client/app/bundles/HelloWorld/components/HelloWorld.jsx)
        base_files.each { |file| copy_file("#{base_path}#{file}", file) }
      end

      def create_appropriate_templates
        base_path = "base/base/"
        location = "client/app/bundles/HelloWorld/"
        source = base_path + location
        config = {
          component_name: "HelloWorld",
          app_relative_path: "../components/HelloWorld"
        }
        template("#{source}/startup/registration.jsx.tt", "#{location}/startup/registration.jsx", config)
        template("#{base_path}app/views/hello_world/index.html.erb.tt", "app/views/hello_world/index.html.erb", config)
      end
    end
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
react_on_rails-8.0.1 lib/generators/react_on_rails/react_no_redux_generator.rb
react_on_rails-8.0.0 lib/generators/react_on_rails/react_no_redux_generator.rb
react_on_rails-8.0.0.beta.3 lib/generators/react_on_rails/react_no_redux_generator.rb
react_on_rails-8.0.0.beta.2 lib/generators/react_on_rails/react_no_redux_generator.rb
react_on_rails-8.0.0.beta.1 lib/generators/react_on_rails/react_no_redux_generator.rb
react_on_rails-7.1.0.beta.3 lib/generators/react_on_rails/react_no_redux_generator.rb
react_on_rails-7.0.4 lib/generators/react_on_rails/react_no_redux_generator.rb
react_on_rails-7.1.0.beta.2 lib/generators/react_on_rails/react_no_redux_generator.rb
react_on_rails-7.0.3 lib/generators/react_on_rails/react_no_redux_generator.rb
react_on_rails-7.1.0.beta.1 lib/generators/react_on_rails/react_no_redux_generator.rb
react_on_rails-7.0.2 lib/generators/react_on_rails/react_no_redux_generator.rb
react_on_rails-7.0.1 lib/generators/react_on_rails/react_no_redux_generator.rb
react_on_rails-7.0.0 lib/generators/react_on_rails/react_no_redux_generator.rb
react_on_rails-6.10.1 lib/generators/react_on_rails/react_no_redux_generator.rb
react_on_rails-6.10.0 lib/generators/react_on_rails/react_no_redux_generator.rb
react_on_rails-6.9.3 lib/generators/react_on_rails/react_no_redux_generator.rb
react_on_rails-6.9.2 lib/generators/react_on_rails/react_no_redux_generator.rb
react_on_rails-6.9.1 lib/generators/react_on_rails/react_no_redux_generator.rb
react_on_rails-6.9.0 lib/generators/react_on_rails/react_no_redux_generator.rb
react_on_rails-6.8.2 lib/generators/react_on_rails/react_no_redux_generator.rb