-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathmerit.rb
More file actions
127 lines (121 loc) · 3.75 KB
/
Copy pathmerit.rb
File metadata and controls
127 lines (121 loc) · 3.75 KB
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# Use this hook to configure merit parameters
Merit.setup do |config|
# Check rules on each request or in background
# config.checks_on_each_request = true
# Define ORM. Could be :active_record (default) and :mongoid
config.orm = :active_record
# Add application observers to get notifications when reputation changes.
# config.add_observer 'MyObserverClassName'
# Define :user_model_name. This model will be used to grand badge if no
# `:to` option is given. Default is 'User'.
config.user_model_name = 'User'
# Define :current_user_method. Similar to previous option. It will be used
# to retrieve :user_model_name object if no `:to` option is given. Default
# is "current_#{user_model_name.downcase}".
config.current_user_method = 'current_user'
end
# Create application badges (uses https://github.com/norman/ambry)
badge_id = 0
[{
id: (badge_id = badge_id+1),
name: 'first-login',
level: 1,
custom_fields: { difficulty: :bronce }
}, {
id: (badge_id = badge_id+1),
name: 'commentator',
level: 10,
description: 'leave 10 comments',
custom_fields: { difficulty: :bronce }
}, {
id: (badge_id = badge_id+1),
name: 'blogger',
level: 10,
description: 'create 10 blog posts with 100 or more characters',
custom_fields: { difficulty: :bronce }
}, {
id: (badge_id = badge_id+1),
name: 'autobiographer',
description: 'create an about-myself profile field with 100 or more characters',
custom_fields: { difficulty: :bronce }
}, {
id: (badge_id = badge_id+1),
name: 'editor',
description: 'edit a page or blog post created by another user',
custom_fields: { difficulty: :bronce }
}, {
id: (badge_id = badge_id+1),
name: 'yearling',
description: 'sign in when your first sign in has been over a year ago',
custom_fields: { difficulty: :silver }
}, {
id: (badge_id = badge_id+1),
name: 'global-admin',
description: 'become a global administrator',
custom_fields: { difficulty: :gold }
}, {
id: (badge_id = badge_id+1),
name: 'admin',
description: 'become an administrator',
custom_fields: { difficulty: :silver }
}, {
id: (badge_id = badge_id+1),
name: 'compliant',
description: 'accept the terms of use',
custom_fields: { difficulty: :bronce },
multiple: true
}, {
id: (badge_id = badge_id+1),
name: 'data-kraken',
description: 'download 10 exported lists',
level: 10,
custom_fields: { difficulty: :bronce }
}, {
id: (badge_id = badge_id+1),
name: 'post-office',
description: 'download 10 exported address label pdfs',
level: 10,
custom_fields: { difficulty: :bronce }
}, {
id: (badge_id = badge_id+1),
name: 'captain-of-the-enterprise',
description: 'create a post or comment containing the legendary phrase "make it so"',
custom_fields: { difficulty: :silver }
}, {
id: (badge_id = badge_id+1),
name: 'damsel-in-distress',
description: 'only a true hero is honest enough to ask for help: create a support-request with the help button',
custom_fields: { difficulty: :silver }
}, {
id: (badge_id = badge_id+1),
name: 'detective',
description: 'Seek, and ye shall find: search something with the search button',
level: 1,
custom_fields: { difficulty: :bronce }
}, {
id: (badge_id = badge_id+1),
name: 'host',
description: 'creates 2 events',
level: 3,
custom_fields: { difficulty: :bronce }
}, {
id: (badge_id = badge_id+1),
name: 'great host',
description: 'creates 10 events',
level: 30,
custom_fields: { difficulty: :silver }
}, {
id: (badge_id = badge_id+1),
name: 'participant',
description: 'creates 2 events',
level: 2,
custom_fields: { difficulty: :bronce }
}, {
id: (badge_id = badge_id+1),
name: 'party checker',
description: 'creates 40 events',
level: 40,
custom_fields: { difficulty: :silver }
}].each do |attrs|
Merit::Badge.create! attrs
end