rails_blog_engine 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +24 -65
- data/TODO.txt +1 -0
- data/app/controllers/rails_blog_engine/application_controller.rb +11 -0
- data/app/models/rails_blog_engine/ability.rb +36 -0
- data/lib/generators/rails_blog_engine/install/templates/rails_blog_engine.rb +14 -0
- data/lib/rails_blog_engine.rb +0 -1
- data/lib/rails_blog_engine/engine.rb +2 -0
- data/lib/rails_blog_engine/version.rb +1 -1
- data/spec/dummy/app/models/user.rb +6 -0
- metadata +55 -56
- data/lib/rails_blog_engine/ability.rb +0 -16
- data/spec/dummy/app/models/ability.rb +0 -11
data/README.md
CHANGED
@@ -2,9 +2,8 @@
|
|
2
2
|
|
3
3
|
**Pre-beta release. Public APIs may change.**
|
4
4
|
|
5
|
-
Add a blog to any Rails 3.1 site using `rails_blog_engine`.
|
6
|
-
|
7
|
-
your `Gemfile`:
|
5
|
+
Add a blog to any Rails 3.1 site using `rails_blog_engine`. First, add the
|
6
|
+
following line to your `Gemfile`:
|
8
7
|
|
9
8
|
gem 'rails_blog_engine'
|
10
9
|
|
@@ -14,31 +13,26 @@ your `Gemfile`:
|
|
14
13
|
rails generate rails_blog_engine:install
|
15
14
|
rake db:migrate
|
16
15
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
#
|
31
|
-
if user
|
32
|
-
can_manage_blog
|
33
|
-
end
|
16
|
+
Check the configuration in the newly-generated
|
17
|
+
`config/initializers/rails_blog_engine.rb` and tweak as necessary.
|
18
|
+
|
19
|
+
If you're using Devise, or another framework which defines `current_user`
|
20
|
+
on `ActionController::Base`, then all you need to do is add a `blog_admin?`
|
21
|
+
method to your user model:
|
22
|
+
|
23
|
+
class User
|
24
|
+
# ...other stuff here...
|
25
|
+
|
26
|
+
# Return true if the user is allowed to post to the blog,
|
27
|
+
# moderate comments, etc.
|
28
|
+
def blog_admin?
|
29
|
+
# Your code here.
|
34
30
|
end
|
35
31
|
end
|
36
32
|
|
37
33
|
You should now be able to access your blog at `http://0.0.0.0:3000/blog`
|
38
34
|
and start posting!
|
39
35
|
|
40
|
-
If you're not using CanCan, keep reading for setup instructions.
|
41
|
-
|
42
36
|
## Philosophy and planned features
|
43
37
|
|
44
38
|
`rails_blog_engine` should...
|
@@ -64,54 +58,19 @@ The following features are on my wishlist:
|
|
64
58
|
In other words, we want just enough features to make blogging pleasant, and
|
65
59
|
nothing more.
|
66
60
|
|
67
|
-
## What if I'm
|
68
|
-
|
69
|
-
You can still use `rails_blog_engine`! First, install `rails_blog_engine`
|
70
|
-
as described above, and then add the following lines to your `Gemfile`:
|
71
|
-
|
72
|
-
gem 'devise' # Optional.
|
73
|
-
gem 'cancan'
|
74
|
-
|
75
|
-
You don't have to use `devise`—you can use `rails_blog_engine` with the
|
76
|
-
authentication framework of your choice. If you are using Devise, however,
|
77
|
-
you will now need to generate a user class:
|
78
|
-
|
79
|
-
rails generate devise:install
|
80
|
-
rails generate devise User
|
81
|
-
|
82
|
-
To prevent random members of the public from signing up for a user account,
|
83
|
-
edit `app/models/user.rb` and remove `:registerable`. To create a new user,
|
84
|
-
you must now run the following command from the Rails console:
|
61
|
+
## What if I'm don't have `ActionController::Base#current_user`?
|
85
62
|
|
86
|
-
|
87
|
-
|
63
|
+
Add something like the following to
|
64
|
+
`config/initializers/rails_blog_engine.rb`:
|
88
65
|
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
Once you have a working user model, you can generate a new
|
93
|
-
`app/models/ability.rb` file:
|
94
|
-
|
95
|
-
rails generate cancan:ability
|
96
|
-
|
97
|
-
...and edit it as described above.
|
98
|
-
|
99
|
-
### How can I make this work without a Devise `User` class?
|
100
|
-
|
101
|
-
Basically, all CanCan cares about is whether your controller defines a
|
102
|
-
`current_ability` class. So for example, if you don't use Devise, but the
|
103
|
-
currently logged-in administrator is available as `current_admin`, you can
|
104
|
-
edit `app/controllers/application_controller.rb` to override
|
105
|
-
`current_ability`:
|
106
|
-
|
107
|
-
class ApplicationController < ActionController::Base
|
108
|
-
# ...other stuff here...
|
109
|
-
|
110
|
-
def current_ability
|
111
|
-
@current_ability ||= ::Ability.new(current_admin)
|
66
|
+
class RailsBlogEngine::ApplicationController
|
67
|
+
def current_user
|
68
|
+
# Check session, etc., here.
|
112
69
|
end
|
113
70
|
end
|
114
71
|
|
72
|
+
Please open an issue if you have any questions or problems.
|
73
|
+
|
115
74
|
## Setting up titles and <head> tags
|
116
75
|
|
117
76
|
To set up titles, add the two following `yield` lines to the `<head>` tag
|
data/TODO.txt
CHANGED
@@ -7,6 +7,17 @@ module RailsBlogEngine
|
|
7
7
|
|
8
8
|
protected
|
9
9
|
|
10
|
+
# Construct a CanCan Ability object to control access to the blog.
|
11
|
+
def current_ability
|
12
|
+
method = Rails.configuration.rails_blog_engine.current_user_method
|
13
|
+
if respond_to?(method)
|
14
|
+
user = send(method)
|
15
|
+
else
|
16
|
+
raise "You must define #{method} on RailsBlogEngine::ApplicationController, as described in README.md"
|
17
|
+
end
|
18
|
+
RailsBlogEngine::Ability.new(user)
|
19
|
+
end
|
20
|
+
|
10
21
|
# We normally use one of our parent application's layouts, so that we
|
11
22
|
# "auto-blend" into the existing look-and-feel of the site. The
|
12
23
|
# specific layout is specified by our initializer.
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module RailsBlogEngine
|
2
|
+
class Ability
|
3
|
+
include CanCan::Ability
|
4
|
+
|
5
|
+
def initialize(user)
|
6
|
+
can_read_blog
|
7
|
+
if user && blog_admin?(user)
|
8
|
+
can_manage_blog
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
protected
|
13
|
+
|
14
|
+
def blog_admin?(user)
|
15
|
+
method = Rails.configuration.rails_blog_engine.blog_admin_method
|
16
|
+
if user.respond_to?(method)
|
17
|
+
user.send(method)
|
18
|
+
else
|
19
|
+
raise "You must define #{method} on your user model, as described in README.md"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def can_read_blog
|
24
|
+
can :read, RailsBlogEngine::Post
|
25
|
+
can [:read, :create], RailsBlogEngine::Comment
|
26
|
+
end
|
27
|
+
|
28
|
+
def can_manage_blog
|
29
|
+
alias_action :mark_as_spam, :to => :update
|
30
|
+
alias_action :mark_as_ham, :to => :update
|
31
|
+
|
32
|
+
can :manage, RailsBlogEngine::Post
|
33
|
+
can :update, RailsBlogEngine::Comment
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -1,5 +1,19 @@
|
|
1
1
|
# Configure RailsBlogEngine here.
|
2
2
|
|
3
|
+
# Retrieve the current user. This is currently used together with
|
4
|
+
# blog_admin_method to determine whether the user is an administrator.
|
5
|
+
#
|
6
|
+
# Note that this method will be called on controllers that subclass
|
7
|
+
# RailsBlogEngine::ApplicationController, which means that methods
|
8
|
+
# defined on your main ApplicationController are _not_ available. This
|
9
|
+
# doesn't present any challenges if you're using Devise, or another
|
10
|
+
# library which defines current_user on ActionController::Base.
|
11
|
+
#Rails.application.config.rails_blog_engine.current_user_method = :current_user
|
12
|
+
|
13
|
+
# Does the current user have administrator privileges? This will be called
|
14
|
+
# on the values returned by current_user_method, above.
|
15
|
+
#Rails.application.config.rails_blog_engine.blog_admin_method = :blog_admin?
|
16
|
+
|
3
17
|
# Which application layout should we use to render the blog?
|
4
18
|
#Rails.application.config.rails_blog_engine.layout = 'application'
|
5
19
|
|
data/lib/rails_blog_engine.rb
CHANGED
@@ -5,6 +5,8 @@ module RailsBlogEngine
|
|
5
5
|
# Define some initialization parameters and their default values.
|
6
6
|
config.rails_blog_engine = ActiveSupport::OrderedOptions.new
|
7
7
|
config.rails_blog_engine.layout = 'application'
|
8
|
+
config.rails_blog_engine.current_user_method = :current_user
|
9
|
+
config.rails_blog_engine.blog_admin_method = :blog_admin?
|
8
10
|
|
9
11
|
config.to_prepare do
|
10
12
|
::ApplicationHelper.class_eval do
|
@@ -6,4 +6,10 @@ class User < ActiveRecord::Base
|
|
6
6
|
|
7
7
|
# Setup accessible (or protected) attributes for your model
|
8
8
|
attr_accessible :email, :password, :password_confirmation, :remember_me
|
9
|
+
|
10
|
+
# Is the current user a blog administrator? Always true for this example
|
11
|
+
# application.
|
12
|
+
def blog_admin?
|
13
|
+
true
|
14
|
+
end
|
9
15
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_blog_engine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2012-01-10 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
16
|
-
requirement: &
|
16
|
+
requirement: &13187680 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 3.1.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *13187680
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: jquery-rails
|
27
|
-
requirement: &
|
27
|
+
requirement: &13187180 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '1.0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *13187180
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: sass-rails
|
38
|
-
requirement: &
|
38
|
+
requirement: &13186720 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '3.1'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *13186720
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: coffee-script
|
49
|
-
requirement: &
|
49
|
+
requirement: &13186260 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '2.2'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *13186260
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: haml
|
60
|
-
requirement: &
|
60
|
+
requirement: &13185800 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '3.1'
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *13185800
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: kaminari
|
71
|
-
requirement: &
|
71
|
+
requirement: &13185340 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ~>
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: 0.12.4
|
77
77
|
type: :runtime
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *13185340
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: cancan
|
82
|
-
requirement: &
|
82
|
+
requirement: &13217000 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ~>
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: '1.6'
|
88
88
|
type: :runtime
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *13217000
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: rakismet
|
93
|
-
requirement: &
|
93
|
+
requirement: &13216540 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ~>
|
@@ -98,10 +98,10 @@ dependencies:
|
|
98
98
|
version: '1.1'
|
99
99
|
type: :runtime
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *13216540
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
103
|
name: simple_form
|
104
|
-
requirement: &
|
104
|
+
requirement: &13216080 !ruby/object:Gem::Requirement
|
105
105
|
none: false
|
106
106
|
requirements:
|
107
107
|
- - ~>
|
@@ -109,10 +109,10 @@ dependencies:
|
|
109
109
|
version: '1.4'
|
110
110
|
type: :runtime
|
111
111
|
prerelease: false
|
112
|
-
version_requirements: *
|
112
|
+
version_requirements: *13216080
|
113
113
|
- !ruby/object:Gem::Dependency
|
114
114
|
name: state_machine
|
115
|
-
requirement: &
|
115
|
+
requirement: &13215620 !ruby/object:Gem::Requirement
|
116
116
|
none: false
|
117
117
|
requirements:
|
118
118
|
- - ~>
|
@@ -120,10 +120,10 @@ dependencies:
|
|
120
120
|
version: 1.0.0
|
121
121
|
type: :runtime
|
122
122
|
prerelease: false
|
123
|
-
version_requirements: *
|
123
|
+
version_requirements: *13215620
|
124
124
|
- !ruby/object:Gem::Dependency
|
125
125
|
name: rdiscount
|
126
|
-
requirement: &
|
126
|
+
requirement: &13215160 !ruby/object:Gem::Requirement
|
127
127
|
none: false
|
128
128
|
requirements:
|
129
129
|
- - ~>
|
@@ -131,10 +131,10 @@ dependencies:
|
|
131
131
|
version: '1.6'
|
132
132
|
type: :runtime
|
133
133
|
prerelease: false
|
134
|
-
version_requirements: *
|
134
|
+
version_requirements: *13215160
|
135
135
|
- !ruby/object:Gem::Dependency
|
136
136
|
name: sanitize
|
137
|
-
requirement: &
|
137
|
+
requirement: &13214700 !ruby/object:Gem::Requirement
|
138
138
|
none: false
|
139
139
|
requirements:
|
140
140
|
- - ~>
|
@@ -142,10 +142,10 @@ dependencies:
|
|
142
142
|
version: '2.0'
|
143
143
|
type: :runtime
|
144
144
|
prerelease: false
|
145
|
-
version_requirements: *
|
145
|
+
version_requirements: *13214700
|
146
146
|
- !ruby/object:Gem::Dependency
|
147
147
|
name: sqlite3
|
148
|
-
requirement: &
|
148
|
+
requirement: &13214320 !ruby/object:Gem::Requirement
|
149
149
|
none: false
|
150
150
|
requirements:
|
151
151
|
- - ! '>='
|
@@ -153,10 +153,10 @@ dependencies:
|
|
153
153
|
version: '0'
|
154
154
|
type: :development
|
155
155
|
prerelease: false
|
156
|
-
version_requirements: *
|
156
|
+
version_requirements: *13214320
|
157
157
|
- !ruby/object:Gem::Dependency
|
158
158
|
name: devise
|
159
|
-
requirement: &
|
159
|
+
requirement: &13213860 !ruby/object:Gem::Requirement
|
160
160
|
none: false
|
161
161
|
requirements:
|
162
162
|
- - ! '>='
|
@@ -164,10 +164,10 @@ dependencies:
|
|
164
164
|
version: '0'
|
165
165
|
type: :development
|
166
166
|
prerelease: false
|
167
|
-
version_requirements: *
|
167
|
+
version_requirements: *13213860
|
168
168
|
- !ruby/object:Gem::Dependency
|
169
169
|
name: steak
|
170
|
-
requirement: &
|
170
|
+
requirement: &13213440 !ruby/object:Gem::Requirement
|
171
171
|
none: false
|
172
172
|
requirements:
|
173
173
|
- - ! '>='
|
@@ -175,10 +175,10 @@ dependencies:
|
|
175
175
|
version: '0'
|
176
176
|
type: :development
|
177
177
|
prerelease: false
|
178
|
-
version_requirements: *
|
178
|
+
version_requirements: *13213440
|
179
179
|
- !ruby/object:Gem::Dependency
|
180
180
|
name: foreman
|
181
|
-
requirement: &
|
181
|
+
requirement: &13213020 !ruby/object:Gem::Requirement
|
182
182
|
none: false
|
183
183
|
requirements:
|
184
184
|
- - ! '>='
|
@@ -186,10 +186,10 @@ dependencies:
|
|
186
186
|
version: '0'
|
187
187
|
type: :development
|
188
188
|
prerelease: false
|
189
|
-
version_requirements: *
|
189
|
+
version_requirements: *13213020
|
190
190
|
- !ruby/object:Gem::Dependency
|
191
191
|
name: capybara-webkit
|
192
|
-
requirement: &
|
192
|
+
requirement: &13212520 !ruby/object:Gem::Requirement
|
193
193
|
none: false
|
194
194
|
requirements:
|
195
195
|
- - ~>
|
@@ -197,10 +197,10 @@ dependencies:
|
|
197
197
|
version: 0.6.1
|
198
198
|
type: :development
|
199
199
|
prerelease: false
|
200
|
-
version_requirements: *
|
200
|
+
version_requirements: *13212520
|
201
201
|
- !ruby/object:Gem::Dependency
|
202
202
|
name: database_cleaner
|
203
|
-
requirement: &
|
203
|
+
requirement: &13212100 !ruby/object:Gem::Requirement
|
204
204
|
none: false
|
205
205
|
requirements:
|
206
206
|
- - ! '>='
|
@@ -208,10 +208,10 @@ dependencies:
|
|
208
208
|
version: '0'
|
209
209
|
type: :development
|
210
210
|
prerelease: false
|
211
|
-
version_requirements: *
|
211
|
+
version_requirements: *13212100
|
212
212
|
- !ruby/object:Gem::Dependency
|
213
213
|
name: shoulda-matchers
|
214
|
-
requirement: &
|
214
|
+
requirement: &13211640 !ruby/object:Gem::Requirement
|
215
215
|
none: false
|
216
216
|
requirements:
|
217
217
|
- - ! '>='
|
@@ -219,10 +219,10 @@ dependencies:
|
|
219
219
|
version: '0'
|
220
220
|
type: :development
|
221
221
|
prerelease: false
|
222
|
-
version_requirements: *
|
222
|
+
version_requirements: *13211640
|
223
223
|
- !ruby/object:Gem::Dependency
|
224
224
|
name: generator_spec
|
225
|
-
requirement: &
|
225
|
+
requirement: &13211220 !ruby/object:Gem::Requirement
|
226
226
|
none: false
|
227
227
|
requirements:
|
228
228
|
- - ! '>='
|
@@ -230,10 +230,10 @@ dependencies:
|
|
230
230
|
version: '0'
|
231
231
|
type: :development
|
232
232
|
prerelease: false
|
233
|
-
version_requirements: *
|
233
|
+
version_requirements: *13211220
|
234
234
|
- !ruby/object:Gem::Dependency
|
235
235
|
name: vcr
|
236
|
-
requirement: &
|
236
|
+
requirement: &13210720 !ruby/object:Gem::Requirement
|
237
237
|
none: false
|
238
238
|
requirements:
|
239
239
|
- - ! '>='
|
@@ -241,10 +241,10 @@ dependencies:
|
|
241
241
|
version: 2.0.0.beta2
|
242
242
|
type: :development
|
243
243
|
prerelease: false
|
244
|
-
version_requirements: *
|
244
|
+
version_requirements: *13210720
|
245
245
|
- !ruby/object:Gem::Dependency
|
246
246
|
name: fakeweb
|
247
|
-
requirement: &
|
247
|
+
requirement: &13210300 !ruby/object:Gem::Requirement
|
248
248
|
none: false
|
249
249
|
requirements:
|
250
250
|
- - ! '>='
|
@@ -252,10 +252,10 @@ dependencies:
|
|
252
252
|
version: '0'
|
253
253
|
type: :development
|
254
254
|
prerelease: false
|
255
|
-
version_requirements: *
|
255
|
+
version_requirements: *13210300
|
256
256
|
- !ruby/object:Gem::Dependency
|
257
257
|
name: guard-rspec
|
258
|
-
requirement: &
|
258
|
+
requirement: &13209840 !ruby/object:Gem::Requirement
|
259
259
|
none: false
|
260
260
|
requirements:
|
261
261
|
- - ! '>='
|
@@ -263,10 +263,10 @@ dependencies:
|
|
263
263
|
version: '0'
|
264
264
|
type: :development
|
265
265
|
prerelease: false
|
266
|
-
version_requirements: *
|
266
|
+
version_requirements: *13209840
|
267
267
|
- !ruby/object:Gem::Dependency
|
268
268
|
name: rb-inotify
|
269
|
-
requirement: &
|
269
|
+
requirement: &13209420 !ruby/object:Gem::Requirement
|
270
270
|
none: false
|
271
271
|
requirements:
|
272
272
|
- - ! '>='
|
@@ -274,10 +274,10 @@ dependencies:
|
|
274
274
|
version: '0'
|
275
275
|
type: :development
|
276
276
|
prerelease: false
|
277
|
-
version_requirements: *
|
277
|
+
version_requirements: *13209420
|
278
278
|
- !ruby/object:Gem::Dependency
|
279
279
|
name: libnotify
|
280
|
-
requirement: &
|
280
|
+
requirement: &13209000 !ruby/object:Gem::Requirement
|
281
281
|
none: false
|
282
282
|
requirements:
|
283
283
|
- - ! '>='
|
@@ -285,10 +285,10 @@ dependencies:
|
|
285
285
|
version: '0'
|
286
286
|
type: :development
|
287
287
|
prerelease: false
|
288
|
-
version_requirements: *
|
288
|
+
version_requirements: *13209000
|
289
289
|
- !ruby/object:Gem::Dependency
|
290
290
|
name: launchy
|
291
|
-
requirement: &
|
291
|
+
requirement: &13231200 !ruby/object:Gem::Requirement
|
292
292
|
none: false
|
293
293
|
requirements:
|
294
294
|
- - ! '>='
|
@@ -296,7 +296,7 @@ dependencies:
|
|
296
296
|
version: '0'
|
297
297
|
type: :development
|
298
298
|
prerelease: false
|
299
|
-
version_requirements: *
|
299
|
+
version_requirements: *13231200
|
300
300
|
description: Rails 3.1 drop-in blog engine for existing Rails applications
|
301
301
|
email:
|
302
302
|
- eric@kiddsoftware.com
|
@@ -326,6 +326,7 @@ files:
|
|
326
326
|
- app/helpers/rails_blog_engine/application_helper.rb
|
327
327
|
- app/helpers/rails_blog_engine/comments_helper.rb
|
328
328
|
- app/helpers/rails_blog_engine/posts_helper.rb
|
329
|
+
- app/models/rails_blog_engine/ability.rb
|
329
330
|
- app/models/rails_blog_engine/comment.rb
|
330
331
|
- app/models/rails_blog_engine/post.rb
|
331
332
|
- app/views/layouts/rails_blog_engine/_blog_page.html.haml
|
@@ -362,7 +363,6 @@ files:
|
|
362
363
|
- lib/generators/rails_blog_engine/install/install_generator.rb
|
363
364
|
- lib/generators/rails_blog_engine/install/templates/rails_blog_engine.rb
|
364
365
|
- lib/rails_blog_engine.rb
|
365
|
-
- lib/rails_blog_engine/ability.rb
|
366
366
|
- lib/rails_blog_engine/engine.rb
|
367
367
|
- lib/rails_blog_engine/filters.rb
|
368
368
|
- lib/rails_blog_engine/filters/base.rb
|
@@ -388,7 +388,6 @@ files:
|
|
388
388
|
- spec/dummy/app/helpers/application_helper.rb
|
389
389
|
- spec/dummy/app/mailers/.gitkeep
|
390
390
|
- spec/dummy/app/models/.gitkeep
|
391
|
-
- spec/dummy/app/models/ability.rb
|
392
391
|
- spec/dummy/app/models/user.rb
|
393
392
|
- spec/dummy/app/views/home/index.html.haml
|
394
393
|
- spec/dummy/app/views/layouts/application.html.erb
|
@@ -1,16 +0,0 @@
|
|
1
|
-
module RailsBlogEngine
|
2
|
-
module Ability
|
3
|
-
def can_read_blog
|
4
|
-
can :read, RailsBlogEngine::Post
|
5
|
-
can [:read, :create], RailsBlogEngine::Comment
|
6
|
-
end
|
7
|
-
|
8
|
-
def can_manage_blog
|
9
|
-
alias_action :mark_as_spam, :to => :update
|
10
|
-
alias_action :mark_as_ham, :to => :update
|
11
|
-
|
12
|
-
can :manage, RailsBlogEngine::Post
|
13
|
-
can :update, RailsBlogEngine::Comment
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|