Skip to content

Manual Install

EXPERIMENTAL Pivotal Labs Projects edited this page Sep 25, 2013 · 2 revisions

Manual Installation

This article assumes you are developing on OSX, although conventions in Linux are not very different. Windows is currently untested.

Let's say your application lives in ~/workspace/client-app for simplicity. When you see this, just mentally replace it with your application's directory.

This application is just a stock Rails application. For information about creating a new Rails app, consult the Rails Getting Started page.

Here Be Bitrot

Despite the best intentions of everyone involved, this documentation, like all documentation, is obsolete. Consult the source for the install generator for a somewhat-comprehensible depiction of what will happen.

Minimal Install

This relies on Bundler.require running in your config/application.rb file. If that does not happen, you will need to do require "style_guide" manually.

Bundler

Add the following line to your Gemfile:

gem "style-guide"

Use Bundler to install it:

$ bundle install

Rails Configuration

Add the following line to your config/routes.rb file:

mount StyleGuide::Engine => "/style-guide" unless Rails.env.production?

Specifying a Section

This assumes you've got a path containing directories of partials you want to display, like app/views/style-guide.

Add the following line to application.rb:

config.style_guide.paths << Rails.root.join("app/views/style-guide/**/*")

This will load all directories under the path. It'll also recursively add other directories. Replace << with = if you don't want to use the built-in partials.

Using LiveReload

Bundler

Add the following lines to your Gemfile:

group :development do
  gem "rack-livereload"
  gem "guard-livereload"
end

Use Bundler to install them:

$ bundle install

Guard Configuration

Run the following command to generate a Guardfile entry for guard-livereload:

$ guard init livereload

You should see this:

14:59:55 - INFO - livereload guard added to Guardfile, feel free to edit it

Rails Configuration

Add the following line to config/environments/development.rb:

config.middleware.insert_before(::Rack::Lock, ::Rack::LiveReload)

Now you're all ready to start Rails and watch Style Guide do its thing!