-
Notifications
You must be signed in to change notification settings - Fork 81
Setup
Add Storytime to your Gemfile:
gem "storytime"
Run the bundle command to install it.
After you install Storytime and add it to your Gemfile, you can setup Storytime through a variety of methods, including:
Note: To use the image upload feature, Storytime requires you to have Imagemagick installed on your system beforehand.
Storytime can set up your routes file, initializer, user model, copy migrations, migrate your database, and copy views into your app through a simple command line interface (CLI). In order to use the CLI, first create a binstub of Storytime by running the following command:
$ bundle binstub storytime
After creating the binstub just run the following command to get started with the guided setup:
$ storytime install
After answering the prompts, fire up your Rails server and access the Storytime dashboard, by default located at http://localhost:3000/storytime
.
The automated setup goes through all of the steps in the Guided Setup, but instead of prompting you for values it just uses all the defaults, allowing you to setup Storytime in seconds.
In order to use the automated setup, first create a binstub of Storytime (see Guided Setup). Next, run the install command with the -d option:
$ storytime install -d
After the setup is complete, fire up your Rails server and access the Storytime dashboard, by default located at http://localhost:3000/storytime
.
Manual setup of Storytime assumes that your host app has an authentication system, like Devise, already installed. Before proceeding make sure you have properly set up Devise.
After you install Storytime and add it to your Gemfile, you should run the install generator:
$ rails generate storytime:install
The install generator will create a Storytime initializer containing various configuration options. Be sure to review and update the generated initializer file as necessary.
Running the install generator will also insert a line into your routes file responsible for mounting the Storytime engine.
By default, Storytime is mounted at /
. If you want to keep that mount point make sure that the Storytime mount is the last entry in your routes file:
mount Storytime::Engine => "/"
Install migrations:
rake storytime:install:migrations
rake db:migrate
Add storytime_user
to your user class:
class User < ActiveRecord::Base
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
storytime_user
end
Finally, fire up your Rails server and access the Storytime dashboard, by default located at http://localhost:3000/storytime
.
While not necessary, you may want to copy over Storytime's non-dashboard views to your host app for customization. The views are automagically copied over if you used the Automated Setup step, and in the Guided Setup you are prompted whether or not you want to copy views to your host app.
To copy non-dashboard views, use the storytime:views
generator:
$ rails generate storytime:views
To copy over specific view folders, use the -v
option followed by the view folder(s) that you want to copy. Run rails generate storytime:views -h
to view the list of folders than can be copied.
$ rails generate storytime:views -v dashboard pages posts
To copy all of the Storytime views, including those of the dashboard, run the generator with the -v
option and all the view folders, as shown below:
$ rails generate storytime:views -v application blogs comments dashboard pages posts sites snippets subscription_mailer subscriptions