Sha256: 92927a6461abc37cd344e8c5501504e9b8bed81e3e9ae69bb1114ae8ccd212d5

Contents?: true

Size: 1.57 KB

Versions: 1

Compression:

Stored size: 1.57 KB

Contents

require 'rails/generators'
module Hyperloop
  class InstallGenerator < Rails::Generators::Base

    def inject_react_file_js
      append_file 'app/assets/javascripts/application.js' do
        <<-'JS'
//= require hyperloop-loader
        JS
      end
    end

    def inject_engine_to_routes
        route 'mount Hyperloop::Engine => \'/hyperloop\''
    end

    def create_hyperloop_directories
      create_file 'app/hyperloop/components/.keep', ''
      create_file 'app/hyperloop/operations/.keep', ''
      create_file 'app/hyperloop/stores/.keep', ''
      create_file 'app/hyperloop/models/.keep', ''
    end

    def create_policies_directory
      create_file 'app/policies/application_policy.rb', <<-RUBY
        # app/policies/application_policy

        # Policies regulate access to your public models
        # The following policy will open up full access (but only in development)
        # The policy system is very flexible and powerful.  See the documentation
        # for complete details.
class Hyperloop::ApplicationPolicy
  # Allow any session to connect:
  always_allow_connection
  # Send all attributes from all public models
  regulate_all_broadcasts { |policy| policy.send_all }
  # Allow all changes to public models
  allow_change(to: :all, on: [:create, :update, :destroy]) { true }
end unless Rails.env.production?
        RUBY
    end

    def create_initializer
      create_file 'config/initializers/hyperloop.rb', <<-RUBY
        
Hyperloop.configuration do |config|
  config.transport = :simple_poller
end

        RUBY

    end

    def add_gems
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hyperloop-0.5.6 lib/generators/hyperloop/install_generator.rb