Sha256: 4cdb75bdb7d5e431ee971a1f7d8565a60acc6ac656b5447c9a05a5ce74fb776f

Contents?: true

Size: 1.08 KB

Versions: 18

Compression:

Stored size: 1.08 KB

Contents

# frozen_string_literal: true

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

18 entries across 18 versions & 1 rubygems

Version Path
react_on_rails-9.0.0.beta.11 lib/generators/react_on_rails/react_no_redux_generator.rb
react_on_rails-9.0.0.beta.10 lib/generators/react_on_rails/react_no_redux_generator.rb
react_on_rails-9.0.0.beta.9 lib/generators/react_on_rails/react_no_redux_generator.rb
react_on_rails-9.0.0.beta.8 lib/generators/react_on_rails/react_no_redux_generator.rb
react_on_rails-9.0.0.beta.7 lib/generators/react_on_rails/react_no_redux_generator.rb
react_on_rails-9.0.0.beta.6 lib/generators/react_on_rails/react_no_redux_generator.rb
react_on_rails-9.0.0.beta.5 lib/generators/react_on_rails/react_no_redux_generator.rb
react_on_rails-9.0.0.beta.4 lib/generators/react_on_rails/react_no_redux_generator.rb
react_on_rails-9.0.0.beta.3 lib/generators/react_on_rails/react_no_redux_generator.rb
react_on_rails-9.0.0.beta.2 lib/generators/react_on_rails/react_no_redux_generator.rb
react_on_rails-9.0.0.beta.1 lib/generators/react_on_rails/react_no_redux_generator.rb
react_on_rails-8.0.6 lib/generators/react_on_rails/react_no_redux_generator.rb
react_on_rails-8.0.6.rc.1 lib/generators/react_on_rails/react_no_redux_generator.rb
react_on_rails-8.0.6.rc.0 lib/generators/react_on_rails/react_no_redux_generator.rb
react_on_rails-8.0.5 lib/generators/react_on_rails/react_no_redux_generator.rb
react_on_rails-8.0.4 lib/generators/react_on_rails/react_no_redux_generator.rb
react_on_rails-8.0.3 lib/generators/react_on_rails/react_no_redux_generator.rb
react_on_rails-8.0.2 lib/generators/react_on_rails/react_no_redux_generator.rb