Class: KurentoRails::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- KurentoRails::Generators::InstallGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/kurento_rails/install_generator.rb
Class Method Summary collapse
Instance Method Summary collapse
- #copy_assets ⇒ Object
- #create_migrations ⇒ Object
-
#disable_rack_lock_in_dev ⇒ Object
run ‘rails g websocket_rails:install’.
- #run_websocket_rails_installer ⇒ Object
Class Method Details
.next_migration_number(path) ⇒ Object
23 24 25 26 |
# File 'lib/generators/kurento_rails/install_generator.rb', line 23 def self.next_migration_number(path) sleep 1 Time.now.utc.strftime("%Y%m%d%H%M%S") end |
Instance Method Details
#copy_assets ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/generators/kurento_rails/install_generator.rb', line 28 def copy_assets directory "javascript", "app/assets/javascripts" directory "config", "config" directory "controllers", "app/controllers" directory "models", "app/models" directory "views", "app/views" end |
#create_migrations ⇒ Object
36 37 38 39 40 41 |
# File 'lib/generators/kurento_rails/install_generator.rb', line 36 def create_migrations Dir["#{self.class.source_root}/migrations/*.rb"].sort.each do |filepath| name = File.basename(filepath) migration_template "migrations/#{name}", "db/migrate/#{name}" end end |
#disable_rack_lock_in_dev ⇒ Object
run ‘rails g websocket_rails:install’
19 20 21 |
# File 'lib/generators/kurento_rails/install_generator.rb', line 19 def disable_rack_lock_in_dev inject_into_file 'config/environments/development.rb', " config.middleware.delete Rack::Lock\n", after: /Rails.application.configure do.*\n/ end |
#run_websocket_rails_installer ⇒ Object
12 13 14 15 16 |
# File 'lib/generators/kurento_rails/install_generator.rb', line 12 def run_websocket_rails_installer generate "websocket_rails:install" # we don't want their version of the events config, so we should just delete it File.delete("config/events.rb") if File.exists?("config/events.rb") end |