class Railbus::Generators::InstallGenerator

Public Instance Methods

install() click to toggle source
# File lib/generators/railbus/install_generator.rb, line 8
      def install
        # It's important to reset `Dir.pwd` because it's set to
        # parent dir of `Rails.root` while running `rails new` command.
        Dir.chdir(::Rails.root) do
          exit unless run 'yarn add @crosspath/yambus @crosspath/yambus-axios'
        end

        create_file('app/javascript/lib/routes.js.erb') do |f|
          <<-LINE
/* rails-erb-loader-dependencies ../config/routes */
<%= Railbus.generate %>
          LINE
        end

        puts 'Railbus installed!'
      end