Sha256: 18b5506d0ad339cc11f4444dbf0d0f913760dac99d94ab5ba24e06448cc0aa98

Contents?: true

Size: 1.34 KB

Versions: 2

Compression:

Stored size: 1.34 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/hyperloop_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 add_gems
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hyperloop-0.5.1 lib/generators/hyperloop/install_generator.rb
hyperloop-0.5.0 lib/generators/hyperloop/install_generator.rb