rocket_cms 0.3.2 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +47 -73
- data/app/assets/stylesheets/rocket_cms.css.sass +1 -0
- data/app/models/concerns/seoable.rb +7 -7
- data/lib/rocket_cms.rb +0 -3
- data/lib/rocket_cms/configuration.rb +4 -0
- data/lib/rocket_cms/models/menu.rb +6 -0
- data/lib/rocket_cms/models/news.rb +3 -3
- data/lib/rocket_cms/models/page.rb +1 -1
- data/lib/rocket_cms/rails_admin_menu.rb +1 -1
- data/lib/rocket_cms/version.rb +1 -1
- data/rocket_cms.gemspec +3 -5
- data/template.rb +110 -87
- metadata +3 -60
- data/lib/smart_excerpt.rb +0 -98
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc958ba10567b7dbd2c47d0ad77d1f87b430f3f6
|
4
|
+
data.tar.gz: 3dd62cbefa7c6cb9b0ce1fc6187c3f76570bb430
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ed182f2578e649d18f96cbceffa934d3938dd26afc46b4282f38ded8896703dbfa9d409264ca3eb670459c0ed2d5817362a73fe372eac9ad0a5b501f4147fea3
|
7
|
+
data.tar.gz: 241c23002b1b73a8b3fd225f9d321909307e1302a1d9275edc4ca86df975defbea665173b1556b6839e0f982da611867cbc83afdf9ee71e015d0a38448d0e313
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rocket_cms (0.
|
4
|
+
rocket_cms (0.4.2)
|
5
5
|
addressable
|
6
6
|
coffee-rails
|
7
7
|
devise
|
@@ -10,7 +10,6 @@ PATH
|
|
10
10
|
glebtv-mongoid-paperclip
|
11
11
|
glebtv-mongoid_nested_set
|
12
12
|
glebtv-simple_captcha
|
13
|
-
htmlentities
|
14
13
|
jquery-rails
|
15
14
|
kaminari
|
16
15
|
mongoid (~> 4.0.0)
|
@@ -21,41 +20,38 @@ PATH
|
|
21
20
|
rails_admin_nested_set
|
22
21
|
rails_admin_settings (~> 0.8.0)
|
23
22
|
rails_admin_toggleable
|
24
|
-
sanitize
|
25
23
|
simple-navigation
|
26
24
|
simple_form
|
27
25
|
sitemap_generator
|
26
|
+
smart_excerpt
|
28
27
|
thor
|
29
28
|
turbolinks
|
30
|
-
uglifier
|
31
|
-
unicorn
|
32
29
|
validates_email_format_of
|
33
|
-
x-real-ip
|
34
30
|
|
35
31
|
GEM
|
36
32
|
remote: https://rubygems.org/
|
37
33
|
specs:
|
38
|
-
actionmailer (4.1.
|
39
|
-
actionpack (= 4.1.
|
40
|
-
actionview (= 4.1.
|
41
|
-
mail (~> 2.5.4)
|
42
|
-
actionpack (4.1.
|
43
|
-
actionview (= 4.1.
|
44
|
-
activesupport (= 4.1.
|
34
|
+
actionmailer (4.1.6)
|
35
|
+
actionpack (= 4.1.6)
|
36
|
+
actionview (= 4.1.6)
|
37
|
+
mail (~> 2.5, >= 2.5.4)
|
38
|
+
actionpack (4.1.6)
|
39
|
+
actionview (= 4.1.6)
|
40
|
+
activesupport (= 4.1.6)
|
45
41
|
rack (~> 1.5.2)
|
46
42
|
rack-test (~> 0.6.2)
|
47
|
-
actionview (4.1.
|
48
|
-
activesupport (= 4.1.
|
43
|
+
actionview (4.1.6)
|
44
|
+
activesupport (= 4.1.6)
|
49
45
|
builder (~> 3.1)
|
50
46
|
erubis (~> 2.7.0)
|
51
|
-
activemodel (4.1.
|
52
|
-
activesupport (= 4.1.
|
47
|
+
activemodel (4.1.6)
|
48
|
+
activesupport (= 4.1.6)
|
53
49
|
builder (~> 3.1)
|
54
|
-
activerecord (4.1.
|
55
|
-
activemodel (= 4.1.
|
56
|
-
activesupport (= 4.1.
|
50
|
+
activerecord (4.1.6)
|
51
|
+
activemodel (= 4.1.6)
|
52
|
+
activesupport (= 4.1.6)
|
57
53
|
arel (~> 5.0.0)
|
58
|
-
activesupport (4.1.
|
54
|
+
activesupport (4.1.6)
|
59
55
|
i18n (~> 0.6, >= 0.6.9)
|
60
56
|
json (~> 1.7, >= 1.7.7)
|
61
57
|
minitest (~> 5.1)
|
@@ -76,9 +72,8 @@ GEM
|
|
76
72
|
coffee-script (2.3.0)
|
77
73
|
coffee-script-source
|
78
74
|
execjs
|
79
|
-
coffee-script-source (1.
|
75
|
+
coffee-script-source (1.8.0)
|
80
76
|
connection_pool (2.0.0)
|
81
|
-
crass (0.2.1)
|
82
77
|
devise (3.3.0)
|
83
78
|
bcrypt (~> 3.0)
|
84
79
|
orm_adapter (~> 0.1)
|
@@ -88,10 +83,10 @@ GEM
|
|
88
83
|
easy_diff (0.0.3)
|
89
84
|
erubis (2.7.0)
|
90
85
|
execjs (2.2.1)
|
91
|
-
font-awesome-rails (4.
|
86
|
+
font-awesome-rails (4.2.0.0)
|
92
87
|
railties (>= 3.2, < 5.0)
|
93
|
-
geocoder (1.2.
|
94
|
-
glebtv-ckeditor (4.4.3.
|
88
|
+
geocoder (1.2.5)
|
89
|
+
glebtv-ckeditor (4.4.3.3)
|
95
90
|
mime-types
|
96
91
|
orm_adapter (~> 0.5.0)
|
97
92
|
rails (~> 4.0)
|
@@ -100,7 +95,7 @@ GEM
|
|
100
95
|
paperclip (>= 2.3.6)
|
101
96
|
glebtv-mongoid_nested_set (0.4.3)
|
102
97
|
mongoid (>= 3.1.0, < 4.1)
|
103
|
-
glebtv-simple_captcha (0.6.
|
98
|
+
glebtv-simple_captcha (0.6.5)
|
104
99
|
glebtv_mongoid_userstamp (0.4.1)
|
105
100
|
mongoid (~> 4.0.0.beta1)
|
106
101
|
haml (4.0.5)
|
@@ -108,7 +103,7 @@ GEM
|
|
108
103
|
hike (1.2.3)
|
109
104
|
htmlentities (4.3.2)
|
110
105
|
i18n (0.6.11)
|
111
|
-
jquery-rails (3.1.
|
106
|
+
jquery-rails (3.1.2)
|
112
107
|
railties (>= 3.0, < 5.0)
|
113
108
|
thor (>= 0.14, < 2.0)
|
114
109
|
jquery-ui-rails (4.2.1)
|
@@ -117,19 +112,17 @@ GEM
|
|
117
112
|
kaminari (0.16.1)
|
118
113
|
actionpack (>= 3.0.0)
|
119
114
|
activesupport (>= 3.0.0)
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
treetop (~> 1.4.8)
|
124
|
-
mime-types (1.25.1)
|
115
|
+
mail (2.6.1)
|
116
|
+
mime-types (>= 1.16, < 3)
|
117
|
+
mime-types (2.3)
|
125
118
|
mini_portile (0.6.0)
|
126
|
-
minitest (5.4.
|
119
|
+
minitest (5.4.1)
|
127
120
|
mongoid (4.0.0)
|
128
121
|
activemodel (~> 4.0)
|
129
122
|
moped (~> 2.0.0)
|
130
123
|
origin (~> 2.1)
|
131
124
|
tzinfo (>= 0.3.37)
|
132
|
-
mongoid-audit (1.0.0
|
125
|
+
mongoid-audit (1.0.0)
|
133
126
|
activesupport
|
134
127
|
glebtv_mongoid_userstamp
|
135
128
|
kaminari
|
@@ -150,8 +143,6 @@ GEM
|
|
150
143
|
nested_form (0.3.2)
|
151
144
|
nokogiri (1.6.3.1)
|
152
145
|
mini_portile (= 0.6.0)
|
153
|
-
nokogumbo (1.1.9)
|
154
|
-
nokogiri
|
155
146
|
optionable (0.2.0)
|
156
147
|
origin (2.1.1)
|
157
148
|
orm_adapter (0.5.0)
|
@@ -160,22 +151,21 @@ GEM
|
|
160
151
|
activesupport (>= 3.0.0)
|
161
152
|
cocaine (~> 0.5.3)
|
162
153
|
mime-types
|
163
|
-
polyglot (0.3.5)
|
164
154
|
rack (1.5.2)
|
165
155
|
rack-pjax (0.8.0)
|
166
156
|
nokogiri (~> 1.5)
|
167
157
|
rack (~> 1.1)
|
168
158
|
rack-test (0.6.2)
|
169
159
|
rack (>= 1.0)
|
170
|
-
rails (4.1.
|
171
|
-
actionmailer (= 4.1.
|
172
|
-
actionpack (= 4.1.
|
173
|
-
actionview (= 4.1.
|
174
|
-
activemodel (= 4.1.
|
175
|
-
activerecord (= 4.1.
|
176
|
-
activesupport (= 4.1.
|
160
|
+
rails (4.1.6)
|
161
|
+
actionmailer (= 4.1.6)
|
162
|
+
actionpack (= 4.1.6)
|
163
|
+
actionview (= 4.1.6)
|
164
|
+
activemodel (= 4.1.6)
|
165
|
+
activerecord (= 4.1.6)
|
166
|
+
activesupport (= 4.1.6)
|
177
167
|
bundler (>= 1.3.0, < 2.0)
|
178
|
-
railties (= 4.1.
|
168
|
+
railties (= 4.1.6)
|
179
169
|
sprockets-rails (~> 2.0)
|
180
170
|
rails_admin (0.6.3)
|
181
171
|
builder (~> 3.1)
|
@@ -195,21 +185,15 @@ GEM
|
|
195
185
|
rails_admin_settings (0.8.0)
|
196
186
|
mongoid (>= 3.0, < 4.1)
|
197
187
|
rails_admin_toggleable (0.4.1)
|
198
|
-
railties (4.1.
|
199
|
-
actionpack (= 4.1.
|
200
|
-
activesupport (= 4.1.
|
188
|
+
railties (4.1.6)
|
189
|
+
actionpack (= 4.1.6)
|
190
|
+
activesupport (= 4.1.6)
|
201
191
|
rake (>= 0.8.7)
|
202
192
|
thor (>= 0.18.1, < 2.0)
|
203
|
-
raindrops (0.13.0)
|
204
193
|
rake (10.3.2)
|
205
194
|
remotipart (1.2.1)
|
206
|
-
rpatricia (1.0.1)
|
207
195
|
safe_yaml (1.0.3)
|
208
|
-
|
209
|
-
crass (~> 0.2.0)
|
210
|
-
nokogiri (>= 1.4.4)
|
211
|
-
nokogumbo (= 1.1.9)
|
212
|
-
sass (3.4.0)
|
196
|
+
sass (3.4.5)
|
213
197
|
sass-rails (4.0.1)
|
214
198
|
railties (>= 4.0.0, < 5.0)
|
215
199
|
sass (>= 3.1.10)
|
@@ -221,7 +205,10 @@ GEM
|
|
221
205
|
activemodel (~> 4.0)
|
222
206
|
sitemap_generator (5.0.5)
|
223
207
|
builder
|
224
|
-
|
208
|
+
smart_excerpt (0.1.2)
|
209
|
+
activesupport
|
210
|
+
htmlentities
|
211
|
+
sprockets (2.12.2)
|
225
212
|
hike (~> 1.2)
|
226
213
|
multi_json (~> 1.0)
|
227
214
|
rack (~> 1.0)
|
@@ -234,27 +221,14 @@ GEM
|
|
234
221
|
thor (0.19.1)
|
235
222
|
thread_safe (0.3.4)
|
236
223
|
tilt (1.4.1)
|
237
|
-
|
238
|
-
polyglot
|
239
|
-
polyglot (>= 0.3.1)
|
240
|
-
turbolinks (2.2.3)
|
224
|
+
turbolinks (2.3.0)
|
241
225
|
coffee-rails
|
242
226
|
tzinfo (1.2.2)
|
243
227
|
thread_safe (~> 0.1)
|
244
|
-
|
245
|
-
|
246
|
-
json (>= 1.8.0)
|
247
|
-
unicorn (4.8.3)
|
248
|
-
kgio (~> 2.6)
|
249
|
-
rack
|
250
|
-
raindrops (~> 0.7)
|
251
|
-
validates_email_format_of (1.5.3)
|
228
|
+
validates_email_format_of (1.6.1)
|
229
|
+
i18n
|
252
230
|
warden (1.2.3)
|
253
231
|
rack (>= 1.0)
|
254
|
-
x-real-ip (0.1.2)
|
255
|
-
activesupport
|
256
|
-
rack
|
257
|
-
rpatricia (~> 1.0)
|
258
232
|
|
259
233
|
PLATFORMS
|
260
234
|
ruby
|
@@ -3,15 +3,15 @@ module Seoable
|
|
3
3
|
include Mongoid::Paperclip
|
4
4
|
|
5
5
|
included do
|
6
|
-
field :name, type: String
|
7
|
-
field :h1, type: String
|
6
|
+
field :name, type: String, localize: RocketCMS.configuration.localize
|
7
|
+
field :h1, type: String, localize: RocketCMS.configuration.localize
|
8
8
|
|
9
|
-
field :title, type: String
|
10
|
-
field :keywords, type: String
|
11
|
-
field :description, type: String
|
12
|
-
field :robots, type: String
|
9
|
+
field :title, type: String, localize: RocketCMS.configuration.localize
|
10
|
+
field :keywords, type: String, localize: RocketCMS.configuration.localize
|
11
|
+
field :description, type: String, localize: RocketCMS.configuration.localize
|
12
|
+
field :robots, type: String, localize: RocketCMS.configuration.localize
|
13
13
|
|
14
|
-
field :og_title, type: String
|
14
|
+
field :og_title, type: String, localize: RocketCMS.configuration.localize
|
15
15
|
has_mongoid_attached_file :og_image, styles: {thumb: "800x600>"}
|
16
16
|
end
|
17
17
|
|
data/lib/rocket_cms.rb
CHANGED
@@ -9,8 +9,6 @@ require 'glebtv-simple_captcha'
|
|
9
9
|
|
10
10
|
require 'validates_email_format_of'
|
11
11
|
|
12
|
-
require 'htmlentities'
|
13
|
-
require 'sanitize'
|
14
12
|
require 'smart_excerpt'
|
15
13
|
|
16
14
|
# uploads
|
@@ -29,7 +27,6 @@ require 'mongoid-audit'
|
|
29
27
|
|
30
28
|
require 'mongoid_slug'
|
31
29
|
|
32
|
-
require 'x-real-ip'
|
33
30
|
require 'sitemap_generator'
|
34
31
|
require 'kaminari'
|
35
32
|
require 'addressable/uri'
|
@@ -23,6 +23,8 @@ module RocketCMS
|
|
23
23
|
attr_accessor :contacts_fields
|
24
24
|
attr_accessor :contacts_message_required
|
25
25
|
|
26
|
+
attr_accessor :localize
|
27
|
+
|
26
28
|
def initialize
|
27
29
|
@news_image_styles = {
|
28
30
|
main: '400x200>',
|
@@ -41,6 +43,8 @@ module RocketCMS
|
|
41
43
|
@contacts_captcha = false
|
42
44
|
@contacts_fields = {}
|
43
45
|
@contacts_message_required = true
|
46
|
+
|
47
|
+
@localize = false
|
44
48
|
end
|
45
49
|
|
46
50
|
def search_enabled=(val)
|
@@ -7,6 +7,12 @@ module RocketCMS
|
|
7
7
|
include ManualSlug
|
8
8
|
|
9
9
|
included do
|
10
|
+
after_save do
|
11
|
+
Rails.cache.delete 'menus'
|
12
|
+
end
|
13
|
+
after_destroy do
|
14
|
+
Rails.cache.delete 'menus'
|
15
|
+
end
|
10
16
|
field :name, type: String
|
11
17
|
manual_slug :name
|
12
18
|
has_and_belongs_to_many :pages, inverse_of: :menus
|
@@ -12,14 +12,14 @@ module RocketCMS
|
|
12
12
|
include Mongoid::Paperclip
|
13
13
|
end
|
14
14
|
include ManualSlug
|
15
|
-
|
15
|
+
|
16
16
|
included do
|
17
17
|
field :time, type: Time
|
18
18
|
index({enabled: 1, time: 1})
|
19
19
|
scope :after_now, -> { where(:time.lt => Time.now) }
|
20
20
|
|
21
|
-
field :excerpt, type: String
|
22
|
-
field :content, type: String
|
21
|
+
field :excerpt, type: String, localize: RocketCMS.configuration.localize
|
22
|
+
field :content, type: String, localize: RocketCMS.configuration.localize
|
23
23
|
|
24
24
|
unless RocketCMS.configuration.news_image_styles.nil?
|
25
25
|
has_mongoid_attached_file :image, styles: RocketCMS.configuration.news_image_styles
|
@@ -14,7 +14,7 @@ module RocketCMS
|
|
14
14
|
included do
|
15
15
|
field :regexp, type: String
|
16
16
|
field :redirect, type: String
|
17
|
-
field :content, type: String
|
17
|
+
field :content, type: String, localize: RocketCMS.configuration.localize
|
18
18
|
field :fullpath, type: String
|
19
19
|
|
20
20
|
scope :sorted, -> { order_by([:lft, :asc]) }
|
@@ -10,7 +10,7 @@ module RailsAdmin
|
|
10
10
|
register_instance_option :pretty_value do
|
11
11
|
obj = bindings[:object]
|
12
12
|
ret = []
|
13
|
-
menus = Rails.cache.fetch 'menus', expires_in:
|
13
|
+
menus = Rails.cache.fetch 'menus', expires_in: 10.minutes do
|
14
14
|
::Menu.all.map { |m| {id: m.id.to_s, name: m.name } }
|
15
15
|
end
|
16
16
|
menus.each do |m|
|
data/lib/rocket_cms/version.rb
CHANGED
data/rocket_cms.gemspec
CHANGED
@@ -23,12 +23,11 @@ Gem::Specification.new do |spec|
|
|
23
23
|
|
24
24
|
spec.add_dependency 'rails', [">= 4.1.0", "< 5.0.0"]
|
25
25
|
spec.add_dependency 'mongoid', '~> 4.0.0'
|
26
|
+
|
26
27
|
spec.add_dependency 'jquery-rails'
|
27
28
|
spec.add_dependency 'glebtv-mongoid_nested_set'
|
28
29
|
spec.add_dependency 'simple_form'
|
29
30
|
spec.add_dependency 'glebtv-simple_captcha'
|
30
|
-
spec.add_dependency 'htmlentities'
|
31
|
-
spec.add_dependency 'sanitize'
|
32
31
|
spec.add_dependency 'coffee-rails'
|
33
32
|
spec.add_dependency 'devise'
|
34
33
|
spec.add_dependency 'turbolinks'
|
@@ -43,12 +42,11 @@ Gem::Specification.new do |spec|
|
|
43
42
|
spec.add_dependency 'mongoid-audit', '~> 1.0.0.alpha.1'
|
44
43
|
spec.add_dependency 'mongoid_slug'
|
45
44
|
spec.add_dependency 'simple-navigation'
|
46
|
-
spec.add_dependency 'unicorn'
|
47
|
-
spec.add_dependency 'x-real-ip'
|
48
45
|
spec.add_dependency 'sitemap_generator'
|
49
46
|
spec.add_dependency 'kaminari'
|
50
47
|
spec.add_dependency 'addressable'
|
51
48
|
spec.add_dependency 'thor'
|
52
|
-
|
49
|
+
|
50
|
+
spec.add_dependency 'smart_excerpt'
|
53
51
|
end
|
54
52
|
|
data/template.rb
CHANGED
@@ -13,6 +13,50 @@ create_file 'Gemfile' do <<-TEXT
|
|
13
13
|
source 'https://rubygems.org'
|
14
14
|
|
15
15
|
gem 'spring', group: 'development'
|
16
|
+
gem 'rails', '4.1.6'
|
17
|
+
|
18
|
+
gem 'mongoid', '~> 4.0.0'
|
19
|
+
gem 'sass', '~> 3.4.4'
|
20
|
+
|
21
|
+
gem 'rocket_cms'
|
22
|
+
|
23
|
+
gem 'sass-rails', github: 'rails/sass-rails', ref: '3a9e47db7d769221157c82229fc1bade55b580f0'
|
24
|
+
gem 'compass-rails', '~> 2.0.0'
|
25
|
+
gem 'compass', '~> 1.0.0'
|
26
|
+
|
27
|
+
gem 'slim-rails'
|
28
|
+
gem 'rs_russian'
|
29
|
+
gem 'cancancan'
|
30
|
+
|
31
|
+
gem 'unicorn'
|
32
|
+
gem 'x-real-ip'
|
33
|
+
|
34
|
+
gem 'sentry-raven'
|
35
|
+
|
36
|
+
group :development do
|
37
|
+
gem 'better_errors'
|
38
|
+
gem 'binding_of_caller'
|
39
|
+
gem 'pry-rails'
|
40
|
+
|
41
|
+
gem 'capistrano', '~> 3.2.0', require: false
|
42
|
+
gem 'rvm1-capistrano3', require: false
|
43
|
+
gem 'glebtv-capistrano-unicorn', require: false
|
44
|
+
gem 'capistrano-bundler', require: false
|
45
|
+
gem 'capistrano-rails', require: false
|
46
|
+
|
47
|
+
gem 'hipchat'
|
48
|
+
gem 'coffee-rails-source-maps'
|
49
|
+
gem 'compass-rails-source-maps'
|
50
|
+
end
|
51
|
+
|
52
|
+
group :test do
|
53
|
+
gem 'rspec-rails'
|
54
|
+
gem 'database_cleaner'
|
55
|
+
gem 'email_spec'
|
56
|
+
gem 'glebtv-mongoid-rspec'
|
57
|
+
gem 'ffaker'
|
58
|
+
gem 'factory_girl_rails'
|
59
|
+
end
|
16
60
|
|
17
61
|
TEXT
|
18
62
|
end
|
@@ -66,73 +110,9 @@ create_file 'config/navigation.rb' do <<-TEXT
|
|
66
110
|
TEXT
|
67
111
|
end
|
68
112
|
|
69
|
-
#gsub_file 'Gemfile', /^(.*)sass-rails(.*)$/, ''
|
70
|
-
|
71
|
-
gem 'rails', '4.1.4'
|
72
|
-
|
73
|
-
gem 'mongoid', '~> 4.0.0'
|
74
|
-
gem 'sass', '~> 3.3.9'
|
75
|
-
|
76
|
-
gem 'rocket_cms'
|
77
|
-
|
78
|
-
gem 'sass-rails', github: 'rails/sass-rails', ref: '3a9e47db7d769221157c82229fc1bade55b580f0'
|
79
|
-
gem 'compass-rails', '~> 2.0.0'
|
80
|
-
gem 'compass', '~> 1.0.0.alpha.20'
|
81
|
-
gem 'slim-rails'
|
82
|
-
gem 'rs_russian'
|
83
|
-
gem 'sentry-raven'
|
84
|
-
gem 'cancancan'
|
85
|
-
|
86
|
-
gem_group :development do
|
87
|
-
gem 'better_errors'
|
88
|
-
gem 'binding_of_caller'
|
89
|
-
gem 'pry-rails'
|
90
|
-
gem 'capistrano', '~> 3.2.0', require: false
|
91
|
-
gem 'rvm1-capistrano3', require: false
|
92
|
-
gem 'glebtv-capistrano-unicorn', require: false
|
93
|
-
gem 'capistrano-bundler', require: false
|
94
|
-
gem 'capistrano-rails', require: false
|
95
|
-
gem 'capistrano-rails-console'
|
96
|
-
gem 'hipchat'
|
97
|
-
gem 'coffee-rails-source-maps'
|
98
|
-
gem 'compass-rails-source-maps'
|
99
|
-
end
|
100
|
-
|
101
|
-
gem_group :test do
|
102
|
-
#gem 'capybara'
|
103
|
-
#gem 'poltergeist'
|
104
|
-
#gem 'simplecov', require: false
|
105
|
-
gem 'rspec-rails'
|
106
|
-
gem 'database_cleaner'
|
107
|
-
gem 'email_spec'
|
108
|
-
gem 'glebtv-mongoid-rspec'
|
109
|
-
#gem 'rspec-collection_matchers'
|
110
|
-
#gem 'timecop'
|
111
|
-
gem 'ffaker'
|
112
|
-
gem 'factory_girl_rails'
|
113
|
-
end
|
114
|
-
|
115
|
-
remove_file 'config/routes.rb'
|
116
|
-
create_file 'config/routes.rb' do <<-TEXT
|
117
|
-
Rails.application.routes.draw do
|
118
|
-
end
|
119
|
-
TEXT
|
120
|
-
end
|
121
|
-
|
122
|
-
application "config.i18n.enforce_available_locales = true"
|
123
|
-
application "config.i18n.available_locales = [:ru, :en]"
|
124
|
-
application "config.i18n.default_locale = :ru"
|
125
|
-
application "config.i18n.locale = :ru"
|
126
|
-
|
127
|
-
application 'config.autoload_paths += %W(#{config.root}/extra)'
|
128
|
-
application 'config.eager_load_paths += %W(#{config.root}/extra)'
|
129
|
-
|
130
|
-
application 'config.time_zone = "Europe/Moscow"'
|
131
|
-
application 'config.assets.paths << Rails.root.join("app", "assets", "fonts")'
|
132
|
-
|
133
113
|
create_file 'README.md', "## Project generated by RocketCMS\n\n"
|
134
114
|
|
135
|
-
create_file '.ruby-version', "
|
115
|
+
create_file '.ruby-version', "2.1.2\n"
|
136
116
|
create_file '.ruby-gemset', "#{app_name}\n"
|
137
117
|
|
138
118
|
run 'bundle install --without production'
|
@@ -169,21 +149,28 @@ generate "rocket_cms:layout"
|
|
169
149
|
|
170
150
|
generate "rspec:install"
|
171
151
|
|
172
|
-
|
173
|
-
|
174
|
-
|
152
|
+
remove_file 'config/routes.rb'
|
153
|
+
create_file 'config/routes.rb' do <<-TEXT
|
154
|
+
Rails.application.routes.draw do
|
155
|
+
devise_for :users
|
156
|
+
mount RailsAdmin::Engine => '/admin', as: 'rails_admin'
|
157
|
+
mount Ckeditor::Engine => '/ckeditor'
|
175
158
|
|
176
|
-
|
159
|
+
get 'contacts' => 'contacts#index', as: :contacts
|
160
|
+
post 'contacts' => 'contacts#create', as: :create_contacts
|
161
|
+
get 'contacts/sent' => 'contacts#sent', as: :contacts_sent
|
177
162
|
|
178
|
-
|
179
|
-
route "post 'contacts' => 'contacts#create', as: :create_contacts"
|
180
|
-
route "get 'contacts' => 'contacts#new', as: :contacts"
|
163
|
+
get 'search' => 'search#index', as: :search
|
181
164
|
|
182
|
-
|
165
|
+
resources :news, only: [:index, :show]
|
183
166
|
|
184
|
-
|
167
|
+
root to: 'home#index'
|
185
168
|
|
186
|
-
#
|
169
|
+
get '*slug' => 'pages#show'
|
170
|
+
resources :pages, only: [:show]
|
171
|
+
end
|
172
|
+
TEXT
|
173
|
+
end
|
187
174
|
|
188
175
|
remove_file 'db/seeds.rb'
|
189
176
|
admin_pw = (0...8).map { (65 + rand(26)).chr }.join
|
@@ -297,7 +284,7 @@ after_fork do |server, worker|
|
|
297
284
|
# pid-ы дочерних процессов
|
298
285
|
#{'child_pid_file = server.config[:pid].sub(".pid", ".#{worker.nr}.pid")'}
|
299
286
|
#{'system( "echo #{Process.pid} > #{child_pid_file}" )'}
|
300
|
-
end
|
287
|
+
end
|
301
288
|
TEXT
|
302
289
|
end
|
303
290
|
|
@@ -464,18 +451,51 @@ TEXT
|
|
464
451
|
end
|
465
452
|
remove_file 'app/views/layouts/application.html.erb'
|
466
453
|
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
454
|
+
|
455
|
+
remove_file 'config/application.rb'
|
456
|
+
create_file 'config/application.rb' do <<-TEXT
|
457
|
+
require File.expand_path('../boot', __FILE__)
|
458
|
+
|
459
|
+
# Pick the frameworks you want:
|
460
|
+
require "active_model/railtie"
|
461
|
+
# require "active_record/railtie"
|
462
|
+
require "action_controller/railtie"
|
463
|
+
require "action_mailer/railtie"
|
464
|
+
require "action_view/railtie"
|
465
|
+
require "sprockets/railtie"
|
466
|
+
# require "rails/test_unit/railtie"
|
467
|
+
|
468
|
+
# Require the gems listed in Gemfile, including any gems
|
469
|
+
# you've limited to :test, :development, or :production.
|
470
|
+
Bundler.require(*Rails.groups)
|
471
|
+
|
472
|
+
module #{app_name.camelize}
|
473
|
+
class Application < Rails::Application
|
474
|
+
config.generators do |g|
|
475
|
+
g.test_framework :rspec
|
476
|
+
g.view_specs false
|
477
|
+
g.helper_specs false
|
478
|
+
g.feature_specs false
|
479
|
+
g.template_engine :slim
|
480
|
+
g.stylesheets false
|
481
|
+
g.javascripts false
|
482
|
+
g.helper false
|
483
|
+
g.fixture_replacement :factory_girl, :dir => 'spec/factories'
|
484
|
+
end
|
485
|
+
|
486
|
+
config.i18n.locale = :ru
|
487
|
+
config.i18n.default_locale = :ru
|
488
|
+
config.i18n.available_locales = [:ru, :en]
|
489
|
+
config.i18n.enforce_available_locales = true
|
490
|
+
|
491
|
+
#{'config.autoload_paths += %W(#{config.root}/extra)'}
|
492
|
+
#{'config.eager_load_paths += %W(#{config.root}/extra)'}
|
493
|
+
|
494
|
+
config.time_zone = 'Europe/Moscow'
|
495
|
+
config.assets.paths << Rails.root.join("app", "assets", "fonts")
|
478
496
|
end
|
497
|
+
end
|
498
|
+
|
479
499
|
TEXT
|
480
500
|
end
|
481
501
|
|
@@ -505,6 +525,9 @@ create_file 'app/assets/javascripts/application.js.coffee' do <<-TEXT
|
|
505
525
|
TEXT
|
506
526
|
end
|
507
527
|
|
528
|
+
FileUtils.cp(Pathname.new(destination_root).join('config', 'mongoid.yml').to_s, Pathname.new(destination_root).join('config', 'mongoid.yml.example').to_s)
|
529
|
+
FileUtils.cp(Pathname.new(destination_root).join('config', 'secrets.yml').to_s, Pathname.new(destination_root).join('config', 'secrets.yml.example').to_s)
|
530
|
+
|
508
531
|
git :init
|
509
532
|
git add: "."
|
510
533
|
git commit: %Q{ -m 'Initial commit' }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rocket_cms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- glebtv
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-09-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -128,34 +128,6 @@ dependencies:
|
|
128
128
|
- - ">="
|
129
129
|
- !ruby/object:Gem::Version
|
130
130
|
version: '0'
|
131
|
-
- !ruby/object:Gem::Dependency
|
132
|
-
name: htmlentities
|
133
|
-
requirement: !ruby/object:Gem::Requirement
|
134
|
-
requirements:
|
135
|
-
- - ">="
|
136
|
-
- !ruby/object:Gem::Version
|
137
|
-
version: '0'
|
138
|
-
type: :runtime
|
139
|
-
prerelease: false
|
140
|
-
version_requirements: !ruby/object:Gem::Requirement
|
141
|
-
requirements:
|
142
|
-
- - ">="
|
143
|
-
- !ruby/object:Gem::Version
|
144
|
-
version: '0'
|
145
|
-
- !ruby/object:Gem::Dependency
|
146
|
-
name: sanitize
|
147
|
-
requirement: !ruby/object:Gem::Requirement
|
148
|
-
requirements:
|
149
|
-
- - ">="
|
150
|
-
- !ruby/object:Gem::Version
|
151
|
-
version: '0'
|
152
|
-
type: :runtime
|
153
|
-
prerelease: false
|
154
|
-
version_requirements: !ruby/object:Gem::Requirement
|
155
|
-
requirements:
|
156
|
-
- - ">="
|
157
|
-
- !ruby/object:Gem::Version
|
158
|
-
version: '0'
|
159
131
|
- !ruby/object:Gem::Dependency
|
160
132
|
name: coffee-rails
|
161
133
|
requirement: !ruby/object:Gem::Requirement
|
@@ -352,34 +324,6 @@ dependencies:
|
|
352
324
|
- - ">="
|
353
325
|
- !ruby/object:Gem::Version
|
354
326
|
version: '0'
|
355
|
-
- !ruby/object:Gem::Dependency
|
356
|
-
name: unicorn
|
357
|
-
requirement: !ruby/object:Gem::Requirement
|
358
|
-
requirements:
|
359
|
-
- - ">="
|
360
|
-
- !ruby/object:Gem::Version
|
361
|
-
version: '0'
|
362
|
-
type: :runtime
|
363
|
-
prerelease: false
|
364
|
-
version_requirements: !ruby/object:Gem::Requirement
|
365
|
-
requirements:
|
366
|
-
- - ">="
|
367
|
-
- !ruby/object:Gem::Version
|
368
|
-
version: '0'
|
369
|
-
- !ruby/object:Gem::Dependency
|
370
|
-
name: x-real-ip
|
371
|
-
requirement: !ruby/object:Gem::Requirement
|
372
|
-
requirements:
|
373
|
-
- - ">="
|
374
|
-
- !ruby/object:Gem::Version
|
375
|
-
version: '0'
|
376
|
-
type: :runtime
|
377
|
-
prerelease: false
|
378
|
-
version_requirements: !ruby/object:Gem::Requirement
|
379
|
-
requirements:
|
380
|
-
- - ">="
|
381
|
-
- !ruby/object:Gem::Version
|
382
|
-
version: '0'
|
383
327
|
- !ruby/object:Gem::Dependency
|
384
328
|
name: sitemap_generator
|
385
329
|
requirement: !ruby/object:Gem::Requirement
|
@@ -437,7 +381,7 @@ dependencies:
|
|
437
381
|
- !ruby/object:Gem::Version
|
438
382
|
version: '0'
|
439
383
|
- !ruby/object:Gem::Dependency
|
440
|
-
name:
|
384
|
+
name: smart_excerpt
|
441
385
|
requirement: !ruby/object:Gem::Requirement
|
442
386
|
requirements:
|
443
387
|
- - ">="
|
@@ -561,7 +505,6 @@ files:
|
|
561
505
|
- lib/rocket_cms/rails_admin_menu.rb
|
562
506
|
- lib/rocket_cms/tasks.rb
|
563
507
|
- lib/rocket_cms/version.rb
|
564
|
-
- lib/smart_excerpt.rb
|
565
508
|
- rocket_cms.gemspec
|
566
509
|
- template.rb
|
567
510
|
homepage: https://github.com/rs-pro/rocket_cms
|
data/lib/smart_excerpt.rb
DELETED
@@ -1,98 +0,0 @@
|
|
1
|
-
module SmartExcerpt
|
2
|
-
class Helper
|
3
|
-
include ActionView::Helpers::TextHelper
|
4
|
-
|
5
|
-
def smart_truncate(s, opts = {})
|
6
|
-
return '' if s.blank?
|
7
|
-
opts = {words: 25}.merge(opts)
|
8
|
-
if opts[:sentences]
|
9
|
-
return s.split(/\.(\s|$)+/)[0, opts[:sentences]].map{|s| s.strip}.join('. ') + '.'
|
10
|
-
end
|
11
|
-
if opts[:letters]
|
12
|
-
return truncate(s, length: opts[:letters], separator: ' ', omission: '...')
|
13
|
-
end
|
14
|
-
a = s.split(/\s/) # or /[ ]+/ to only split on spaces
|
15
|
-
n = opts[:words]
|
16
|
-
r = a[0...n].join(' ') + (a.size > n ? '...' : '')
|
17
|
-
|
18
|
-
# replace with regular spaces
|
19
|
-
r.gsub!(' ', ' ')
|
20
|
-
|
21
|
-
# strip newlines
|
22
|
-
r = r.strip.gsub("\r", '').gsub("\n", ' ')
|
23
|
-
|
24
|
-
r.gsub(/\s+/, ' ')
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
@@h = Helper.new
|
29
|
-
@@he = HTMLEntities.new
|
30
|
-
|
31
|
-
def smart_truncate(obj, base_field, excerpt_field, words)
|
32
|
-
if obj.send(excerpt_field).blank?
|
33
|
-
tx = obj.send(base_field)
|
34
|
-
else
|
35
|
-
tx = obj.send(excerpt_field)
|
36
|
-
words *= 1.2 if words.is_a?(Fixnum)
|
37
|
-
end
|
38
|
-
|
39
|
-
if words.is_a?(Numeric)
|
40
|
-
options = {words: words.to_i}
|
41
|
-
elsif words.is_a?(Hash)
|
42
|
-
options = words
|
43
|
-
else
|
44
|
-
raise 'bad parameter for get_excerpt'
|
45
|
-
end
|
46
|
-
|
47
|
-
if tx.blank?
|
48
|
-
''
|
49
|
-
else
|
50
|
-
# kill headers and newlines
|
51
|
-
tx = tx.gsub(/<h\d[^>]*?>(.*?)<\/h\d>/mi, '').gsub("\n", ' ').gsub("\r", '').gsub("\t", '').strip
|
52
|
-
tx = @@he.decode(tx)
|
53
|
-
tx = @@h.strip_tags(tx)
|
54
|
-
@@h.smart_truncate(tx, options)
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
def self.included(base)
|
59
|
-
base.send(:extend, ClassMethods)
|
60
|
-
base.send(:include, InstanceMethods)
|
61
|
-
end
|
62
|
-
|
63
|
-
def self.decode(str)
|
64
|
-
@@he.decode(str)
|
65
|
-
end
|
66
|
-
|
67
|
-
def self.encode(str)
|
68
|
-
@@he.encode(str)
|
69
|
-
end
|
70
|
-
|
71
|
-
def self.strip_tags(str)
|
72
|
-
@@h.strip_tags(str)
|
73
|
-
end
|
74
|
-
|
75
|
-
def self.decode_and_strip(str)
|
76
|
-
self.strip_tags(self.decode(str))
|
77
|
-
end
|
78
|
-
|
79
|
-
def self.truncate(str, opts = {})
|
80
|
-
return '' if str.blank?
|
81
|
-
tx = str.gsub(/<h\d[^>]*?>(.*)<\/h\d>/mi, '').gsub("\n", ' ').gsub("\r", '').gsub("\t", '').strip
|
82
|
-
tx = @@he.decode(tx)
|
83
|
-
tx = @@h.strip_tags(tx)
|
84
|
-
@@h.smart_truncate(tx, opts)
|
85
|
-
end
|
86
|
-
|
87
|
-
module ClassMethods
|
88
|
-
def smart_excerpt(excerpt_field, base_field, words = 25)
|
89
|
-
define_method("get_#{excerpt_field}".to_sym) do |c_words = words|
|
90
|
-
smart_truncate(self, base_field, excerpt_field, c_words)
|
91
|
-
end
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
module InstanceMethods
|
96
|
-
|
97
|
-
end
|
98
|
-
end
|