Sha256: aa45e8501c622cb174f44aea88ef6152140604523529968b986ad54b0caf0025

Contents?: true

Size: 1.43 KB

Versions: 4

Compression:

Stored size: 1.43 KB

Contents

require 'rails/generators'

module KurentoRails
  module Generators
    class InstallGenerator < Rails::Generators::Base
      include Rails::Generators::Migration
      source_root File.expand_path("../templates", __FILE__)


      desc "This generator copies and modifies the files necessary for integration with Kurento"

      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
      # run 'rails g websocket_rails:install'

      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

      def self.next_migration_number(path)
        sleep 1
        Time.now.utc.strftime("%Y%m%d%H%M%S")
      end

      def copy_assets
        directory "javascript", "app/assets/javascripts"
        directory "config", "config"
        directory "controllers", "app/controllers"
        directory "models", "app/models"
        directory "views", "app/views"
      end

      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

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
kurento_rails-0.1.5 lib/generators/kurento_rails/install_generator.rb
kurento_rails-0.1.4 lib/generators/kurento_rails/install_generator.rb
kurento_rails-0.1.1 lib/generators/kurento_rails/install_generator.rb
kurento_rails-0.1.0 lib/generators/kurento_rails/install_generator.rb