-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathINSTALL
83 lines (65 loc) · 3.91 KB
/
INSTALL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
Installing Repertoire Core into your application gives you access to Hyperstudio user registration, password management, and authorization control features in your merb application.
To install Repertoire Core:
# configure your Gemfile:
gem "repertoire_core" # or pull directly from the git sources on github
# alter your router to mount the Repertoire Core slice
Merb::Router.prepare do
authenticate do
... your application routes that require login
end
slice(:merb_auth_slice_password, :name_prefix => nil, :path_prefix => "") # i.e. user login/logout
slice(:repertoire_core, :name_prefix => nil, :path_prefix => "") # i.e. user registration/activation/profile/password mgmt
# see the merb slices documentation for info on name_prefix and path_prefix
end
# add the Repertoire user mixins to the default merb user (app/models/user.rb). then comment out or delete the
# 'login' property, since Repertoire uses email logins. Your entire user model might look like this:
class User
include DataMapper::Resource
include RepertoireCore::UserMixin
property :id, Serial
# property :login, String <<< n.b. commented out
end
# tell Merb's password login slice that you want to use User.email rather than User.login to identify users. there's already a
configuration suggestion to do this - just uncomment it (merb/merb-auth/setup.rb)
Merb::Plugins.config[:"merb-auth"][:login_param] = :email
# Install the repertoire-assets system: in <app>/config/rack.rb (Mongrel) and <app>/config.ru, (Passenger):
* require 'repertoire-assets'
* use Repertoire::Assets::Processor, Merb::Config, Merb.logger
run Merb::Rack::Application.new
and in <app>/config/environments/production.rb:
* c[:compress_assets] = true
and in <app>/public/javascripts/application.js:
//= require <rep.core>
# If Merb installed a useless version of jquery, remove it:
rm public/javascripts/jquery.js
# Insure that your database is set up according to Repertoire standards, with your application tables loaded into a
# separate PostgreSQL schema and connecting by a project-specific user.
# http://hyperstudio.mit.edu:81/groups/developer/wiki/c6a82/Repertoire_Database_Layout.html
# Alter database.yml to give the rake tasks access to your PostgreSQL public schema, which will store user, role, membership models:
# (Snippet below does not need to be configured)
rake:
<<: *defaults
repositories:
core:
# admin access to public repertoire core tables
adapter: postgresql
database: hyperstudio_development
username: postgres
password:
host: localhost
# run the rake install task to transfer templates and assets to your application and prime your database
rake slices:repertoire_core:install
# start up your application, and view the registration registration pages at http://localhost:4000/signup
# now would be a good time to double-check the email and database configuration by attempting to sign up for an account
# type rake audit:routes in your app for other relevant URLs
PRODUCTION DEPLOYMENT
# N.B. do not run rake slices:repertoire_core:install on a production environment!! It uses DataMapper auto_migrate, which will
# immediately delete all of your users and roles. Instead, use the task just once to set up the tables on the server, and thereafter
# you can re-use the ones that are already there.
# to ensure your project has access to the tables shared across all projects (users & roles),
# you'll need to duplicate the effects of rake slices:repertoire_core:install's grants, but on the
# production database:
> psql -Upostgres hyperstudio_development -hmenzinga.mit.edu
> GRANT ALL ON roles TO <project_abbr>; GRANT ALL ON roles_id_seq TO <project_abbr>;
> GRANT ALL ON users TO <project_abbr>; GRANT ALL ON users_id_seq TO <project_abbr>;
> GRANT ALL ON memberships TO <project_abbr>; GRANT ALL ON memberships_id_seq TO <project_abbr>;