RailsCasts Pro episodes are now free!

Learn more or hide this

Erwin Boskma's Profile

GitHub User: eboskma

Site: http://www.datarift.nl

Comments by Erwin Boskma

Avatar

I've looked into the at_exit callback, and thought of this:

app_builder.rb
class AppBuilder < Rails::AppBuilder
  def initialize(generator)
    super(generator)

    at_exit do
      postprocess
    end
  end
  def test
    gem_group :test, :development do
      gem 'rspec-rails'
    end

  end

  def postprocess
    generate 'rspec:install'
  end
end

This way, you have a single method for postprocessing which is called after bundler.

Avatar

You can work around the issue with running bundle install multiple times with the --skip-bundle-option for the rails-command and calling bundle_command('install') from the leftovers-method:

app_builder.rb
class AppBuilder < Rails::AppBuilder
  def test
    @generator.gem 'rspec-rails', group: [:test, :development]
  end

  def leftovers
    bundle_command('install')
    generate 'rspec:install'
  end
end
terminal
rails new foo --skip-bundle -b app_builder.rb

It isn't the most elegant solution, but it saves a little time by calling bundler only once. It would be nice if you could modify the options-variable in the AppBase-class

Avatar

Nevermind, accidentally had two bootstrap gems included (one based on 1.4 and one based on 2.0) and the wrong version was included.

Avatar

I'm having trouble getting the navbar working. I'm using bootstrap-sass, haml and simple_form. What could be wrong?

Here is a screenshot of what is happening

It's like some of the CSS is not applied.