Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 373
- Log:
Initial import of Radiant 0.9.1, which is now packaged as a gem. This is an
import of the tagged 0.9.1 source checked out from GitHub, which isn't quite
the same as the gem distribution - but it doesn't seem to be available in an
archived form and the installed gem already has modifications, so this is
the closest I can get.
- Author:
- rool
- Date:
- Mon Mar 21 13:40:05 +0000 2011
- Size:
- 1500 Bytes
1 | class UsersDataset < Dataset::Base |
2 | |
3 | def load |
4 | create_user "Existing" |
5 | create_user "Another" |
6 | create_user "Admin", :admin => true |
7 | create_user "Designer", :designer => true, :email => '' |
8 | create_user "Non_admin", :admin => false |
9 | end |
10 | |
11 | helpers do |
12 | def create_user(name, attributes={}) |
13 | user = create_model :user, name.downcase.to_sym, user_attributes(attributes.update(:name => name)) |
14 | if user.nil? |
15 | throw "Error creating user dataset for #{name}" |
16 | end |
17 | end |
18 | |
19 | def user_attributes(attributes={}) |
20 | name = attributes[:name] |
21 | if name.nil? |
22 | throw "name attribute is required" |
23 | end |
24 | |
25 | attributes = { |
26 | :name => name, |
27 | :email => "#{name.downcase}@example.com", |
28 | :login => name.downcase, |
29 | :password => "password" |
30 | }.merge(attributes) |
31 | attributes[:password_confirmation] = attributes[:password] |
32 | attributes |
33 | end |
34 | |
35 | def user_params(options = {}) |
36 | { |
37 | :name => 'John Doe', |
38 | :login => 'jdoe', |
39 | :password => 'password', |
40 | :password_confirmation => 'password', |
41 | :email => 'jdoe@gmail.com' |
42 | }.merge(options) |
43 | end |
44 | |
45 | def login_as(user) |
46 | login_user = user.is_a?(User) ? user : users(user) |
47 | flunk "Can't login as non-existing user #{user.to_s}." unless login_user |
48 | request.session['user_id'] = login_user.id |
49 | login_user |
50 | end |
51 | |
52 | def logout |
53 | request.session['user_id'] = nil |
54 | end |
55 | end |
56 | end |