Sha256: 71ad049e94bf0889fb120655af92288a947108ffa7679f7047f2799ded0069fb

Contents?: true

Size: 841 Bytes

Versions: 1

Compression:

Stored size: 841 Bytes

Contents

require 'rails'

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

      def create_events_initializer_file
        js_path = File.join('app', 'assets', 'javascripts')
        template 'main.js.coffee', File.join(js_path, 'webrtc_rails', 'main.js.coffee')
        append_to_file File.join(js_path, 'application.js') do
          out = ''
          out << '//= require webrtc_rails/main'
          out << "\n"
        end
      end

      def create_webrtc_controller
        controller_path = File.join('app', 'controllers')
        template 'webrtc_controller.rb', File.join(controller_path, 'webrtc_controller.rb')
      end

      def add_route
        route "post '/webrtc', :to => 'webrtc#send_message'"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
webrtc-rails-0.1.0 lib/generators/webrtc_rails/install/install_generator.rb