rocket_cms 0.24.0 → 0.25.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +4 -4
  3. data/app/views/blocks/_counters.html +6 -0
  4. data/app/views/blocks/_footer.slim +1 -1
  5. data/app/views/blocks/_header.slim +1 -1
  6. data/app/views/contact_mailer/{new_message_email.html.haml → new_message_email.html.slim} +8 -8
  7. data/app/views/contacts/{new.html.haml → new.slim} +1 -0
  8. data/app/views/contacts/sent.slim +4 -0
  9. data/app/views/errors/_base.slim +3 -0
  10. data/app/views/errors/{error_403.html.haml → error_403.slim} +0 -0
  11. data/app/views/errors/{error_404.html.haml → error_404.slim} +0 -0
  12. data/app/views/errors/{error_500.html.haml → error_500.slim} +0 -0
  13. data/app/views/home/index.slim +1 -0
  14. data/app/views/layouts/application.slim +39 -0
  15. data/app/views/news/{index.html.haml → index.slim} +2 -2
  16. data/app/views/news/show.slim +11 -0
  17. data/app/views/pages/{show.html.haml → show.slim} +0 -0
  18. data/app/views/rails_admin/main/_check_boxes.html.haml +1 -1
  19. data/app/views/search/index.html.haml +8 -8
  20. data/app/views/shared/{_admin_link.html.haml → _admin_link.slim} +1 -1
  21. data/app/views/shared/{_messages.html.haml → _messages.slim} +2 -2
  22. data/app/views/shared/{_meta.html.haml → _meta.slim} +3 -3
  23. data/app/views/shared/{_obj.html.haml → _obj.slim} +1 -1
  24. data/app/views/shared/_og.slim +8 -0
  25. data/lib/generators/rocket_cms/layout_generator.rb +5 -2
  26. data/lib/generators/rocket_cms/templates/.babelrc +6 -3
  27. data/lib/generators/rocket_cms/templates/Capfile +3 -2
  28. data/lib/generators/rocket_cms/templates/admin.erb +4 -4
  29. data/lib/generators/rocket_cms/templates/deploy.erb +2 -35
  30. data/lib/generators/rocket_cms/templates/package.json +21 -15
  31. data/lib/generators/rocket_cms/templates/webpack.config.js +87 -53
  32. data/lib/generators/rocket_cms/templates/webpack/analytics.es6 +29 -0
  33. data/lib/generators/rocket_cms/templates/webpack/application.es6 +23 -13
  34. data/lib/generators/rocket_cms/templates/webpack/blocks/footer/index.sass +2 -0
  35. data/lib/generators/rocket_cms/templates/webpack/blocks/header/index.sass +1 -0
  36. data/lib/generators/rocket_cms/templates/webpack/blocks/index.es6 +4 -0
  37. data/lib/generators/rocket_cms/templates/webpack/common/index.sass +2 -0
  38. data/lib/generators/rocket_cms/templates/webpack/common/mixins.sass +5 -0
  39. data/lib/generators/rocket_cms/templates/webpack/common/variables.sass +1 -0
  40. data/lib/generators/rocket_cms/templates/webpack/errors/errors.pug +7 -0
  41. data/lib/generators/rocket_cms/templates/webpack/errors/index.es6 +1 -1
  42. data/lib/generators/rocket_cms/templates/webpack/fonts/index.sass +6 -0
  43. data/lib/generators/rocket_cms/templates/webpack/fonts/mixin.sass +25 -0
  44. data/lib/generators/rocket_cms/templates/webpack/layout/buttons.sass +23 -0
  45. data/lib/generators/rocket_cms/templates/webpack/layout/index.sass +5 -0
  46. data/lib/generators/rocket_cms/templates/webpack/layout/main.sass +20 -0
  47. data/lib/generators/rocket_cms/templates/webpack/layout/typography.sass +4 -0
  48. data/lib/generators/rocket_cms/templates/webpack/pages/home/index.es6 +1 -0
  49. data/lib/generators/rocket_cms/templates/webpack/pages/index.es6 +2 -0
  50. data/lib/generators/rocket_cms/webpack_generator.rb +26 -4
  51. data/lib/rocket_cms/version.rb +1 -1
  52. data/template.rb +65 -111
  53. metadata +36 -21
  54. data/app/views/contacts/sent.html.haml +0 -4
  55. data/app/views/errors/_base.html.haml +0 -3
  56. data/app/views/home/index.html.haml +0 -1
  57. data/app/views/layouts/application.html.slim +0 -33
  58. data/app/views/news/show.html.haml +0 -8
  59. data/app/views/shared/_og.html.haml +0 -8
  60. data/lib/generators/rocket_cms/templates/webpack/application.sass +0 -6
  61. data/lib/generators/rocket_cms/templates/webpack/errors/errors.handlebars +0 -9
@@ -1,3 +1,3 @@
1
1
  module RocketCMS
2
- VERSION = "0.24.0"
2
+ VERSION = "0.25.0"
3
3
  end
@@ -3,6 +3,7 @@ version = rails_spec.version.to_s
3
3
 
4
4
  mongoid = options[:skip_active_record]
5
5
  yarn = !options[:skip_yarn]
6
+ is_dev = !options[:is_dev]
6
7
  spring = !options[:skip_spring]
7
8
 
8
9
  if Gem::Version.new(version) < Gem::Version.new('5.0.0')
@@ -17,21 +18,30 @@ git :init
17
18
  remove_file 'Gemfile'
18
19
  create_file 'Gemfile' do <<-TEXT
19
20
  source 'https://rubygems.org'
20
-
21
- gem 'rails', '5.1.4'
21
+ #{'
22
+ git_source(:github) do |repo_name|
23
+ repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
24
+ "https://github.com/#{repo_name}.git"
25
+ end
26
+ '}
27
+ gem 'rails', '5.2.0.rc2'
22
28
  #{if mongoid then "gem 'mongoid', '~> 6.1.0'" else "gem 'pg', '~> 0.21.0'" end}
23
29
 
24
30
  gem 'sass'
25
31
 
26
- #{if mongoid then "gem 'rocket_cms_mongoid'" else "gem 'rocket_cms_activerecord'" end}
27
- gem 'rails_admin', github: 'crowdtask/rails_admin'
32
+ #{
33
+ "#{if mongoid then "gem 'rocket_cms_mongoid', path: '/data/rocket_cms'" else "gem 'rocket_cms_activerecord', path: '/data/rocket_cms'" end}
34
+ gem 'rocket_cms', path: '/data/rocket_cms'" if is_dev}
35
+ #{"#{if mongoid then "gem 'rocket_cms_mongoid'" else "gem 'rocket_cms_activerecord'" end}" unless is_dev}
36
+
37
+ gem 'rails_admin', github: 'rs-pro/rails_admin'
28
38
  #{"gem 'friendly_id', github: 'norman/friendly_id'" unless mongoid}
29
39
 
30
40
  gem 'slim'
31
41
  gem 'haml'
32
42
 
33
43
  gem 'sass-rails'
34
- gem 'webpack-rails'
44
+ gem 'rs-webpack-rails', '~> 0.11.1'
35
45
 
36
46
  gem 'devise'
37
47
  gem 'devise-i18n'
@@ -46,17 +56,22 @@ gem 'sentry-raven'
46
56
  gem 'uglifier'
47
57
 
48
58
  gem 'rs_russian'
59
+ #gem 'enumerize'
60
+ #gem 'active_model_serializers'
49
61
 
50
62
  # windows
51
63
  gem 'tzinfo-data' if Gem.win_platform?
52
64
  gem 'wdm', '>= 0.1.0' if Gem.win_platform?
53
65
 
66
+ gem 'bootsnap', require: false
67
+
54
68
  group :development do
55
- gem 'binding_of_caller'
56
- gem 'better_errors', github: 'charliesome/better_errors'
57
- gem 'pry-rails'
69
+ #gem 'binding_of_caller'
70
+ #gem 'better_errors', github: 'charliesome/better_errors'
71
+ #gem 'pry-rails'
58
72
  gem 'listen'
59
- #{"gem 'spring'" if spring}
73
+ gem 'annotate'
74
+ #{" gem 'spring'" if spring}
60
75
 
61
76
  gem 'capistrano', require: false
62
77
  gem 'capistrano-bundler', require: false
@@ -68,9 +83,9 @@ group :test do
68
83
  gem 'rspec-rails'
69
84
  gem 'database_cleaner'
70
85
  gem 'email_spec'
71
- #{if mongoid then "gem 'mongoid-rspec'" else "" end}
86
+ #{if mongoid then " gem 'mongoid-rspec'" else "" end}
72
87
  gem 'ffaker'
73
- gem 'factory_girl_rails'
88
+ gem 'factory_bot_rails'
74
89
  end
75
90
 
76
91
  TEXT
@@ -124,47 +139,20 @@ ORM: #{if mongoid then 'Mongoid' else 'ActiveRecord' end}
124
139
 
125
140
  To run (windows):
126
141
  ```
127
- .\node_modules\.bin\webpack-dev-server.cmd --config config\webpack.config.js --hot --inline
142
+ npm start
128
143
  bundle exec rails s webrick
129
144
  ```
130
145
 
131
146
 
132
147
  To run (nix/mac):
133
148
  ```
134
- ./node_modules/.bin/webpack-dev-server --config config/webpack.config.js --hot --inline
149
+ npm start
135
150
  puma
136
151
  ```
137
152
 
138
- ## ngrok
139
- В одном терминале запускаем ngrok на `webpack`
140
- ```
141
- ngrok http -host-header=rewrite 0.0.0.0:3808
142
- ```
143
- В ответе ищем строку, похожую на
144
- ```
145
- Forwarding http://7c68e072.ngrok.io -> 0.0.0.0:3808
146
- ```
147
- Достаём из неё хост. В данном примере это ``7c68e072.ngrok.io``
148
-
149
- Запускаем webpack
150
- ```
151
- HOST=0.0.0.0 ./node_modules/.bin/webpack-dev-server --config config/webpack.config.js --hot --inline
152
- ```
153
-
154
- Запускаем пуму (меняем ``7c68e072.ngrok.io`` на тот хост, который дал `ngrok`)
155
- ```
156
- WEBPACK_HOST=7c68e072.ngrok.io puma
157
- ```
158
-
159
- И запускаем `ngrok` второй раз уже для `puma`
160
- ```
161
- ngrok http #{port}
162
- ```
163
-
164
- Сайт будет доступен по хосту из последнего запущенного `ngrok`
165
153
  "
166
154
 
167
- #create_file '.ruby-version', "2.4.0\n"
155
+ #create_file '.ruby-version', "2.5.0\n"
168
156
  #create_file '.ruby-gemset', "#{app_name}\n"
169
157
 
170
158
  run 'bundle install --without production'
@@ -177,8 +165,6 @@ development:
177
165
  database: #{app_name.downcase}_development
178
166
  hosts:
179
167
  - localhost:27017
180
- options:
181
- belongs_to_required_by_default: false
182
168
 
183
169
  test:
184
170
  clients:
@@ -186,8 +172,6 @@ test:
186
172
  database: #{app_name.downcase}_test
187
173
  hosts:
188
174
  - localhost:27017
189
- options:
190
- belongs_to_required_by_default: false
191
175
 
192
176
  TEXT
193
177
  end
@@ -241,7 +225,7 @@ end
241
225
  generate "rocket_cms:admin"
242
226
  generate "rocket_cms:ability"
243
227
  generate "rocket_cms:layout"
244
- generate "rocket_cms:webpack"
228
+ generate "rocket_cms:webpack", port+1
245
229
 
246
230
  unless mongoid
247
231
  rake "db:migrate"
@@ -327,66 +311,6 @@ TEXT
327
311
  end
328
312
 
329
313
  create_file 'app/assets/stylesheets/rails_admin/custom/theming.css.sass' do <<-TEXT
330
- .navbar-brand
331
- margin-left: 0 !important
332
-
333
- .input-small
334
- width: 150px
335
-
336
- .container-fluid
337
- input[type=text]
338
- width: 380px !important
339
- input.ra-filtering-select-input[type=text]
340
- width: 180px !important
341
- input.hasDatepicker
342
- width: 180px !important
343
-
344
- .sidebar-nav
345
- a
346
- padding: 6px 10px !important
347
- .dropdown-header
348
- padding: 10px 0px 3px 9px
349
-
350
- .label-important
351
- background-color: #d9534f
352
- .alert-notice
353
- color: #5bc0de
354
-
355
- .page-header
356
- display: none
357
- .breadcrumb
358
- margin-top: 20px
359
-
360
- .control-group
361
- clear: both
362
-
363
- .container-fluid
364
- padding-left: 0
365
- > .row
366
- margin: 0
367
-
368
- .last.links
369
- a
370
- display: inline-block
371
- padding: 3px
372
- font-size: 20px
373
-
374
- .remove_nested_fields
375
- opacity: 1 !important
376
-
377
- .model-dialog
378
- width: 800px !important
379
-
380
- .content > .alert
381
- margin-top: 20px
382
-
383
- .badge-important
384
- background: red
385
- .badge-success
386
- background: green
387
-
388
- .sidebar-nav i
389
- margin-right: 5px
390
314
  TEXT
391
315
  end
392
316
 
@@ -397,6 +321,19 @@ Disallow: /
397
321
  TEXT
398
322
  end
399
323
 
324
+ remove_file 'app/helpers/application_helper.rb'
325
+ create_file 'app/helpers/application_helper.rb' do <<-TEXT
326
+ module ApplicationHelper
327
+ def body_class
328
+ r = []
329
+ #{'r.push "b-#{params[:controller].gsub("/", "_")}"'}
330
+ #{'r.push "b-#{params[:controller].gsub("/", "_")}-#{params[:action]}"'}
331
+ r.join(" ")
332
+ end
333
+ end
334
+ TEXT
335
+ end
336
+
400
337
 
401
338
 
402
339
  remove_file 'config/puma.rb'
@@ -407,7 +344,6 @@ threads 1, 3
407
344
  current_dir = File.expand_path("../..", __FILE__)
408
345
  base_dir = File.expand_path("../../..", __FILE__)
409
346
 
410
-
411
347
  # rackup DefaultRackup
412
348
 
413
349
  # Default to production
@@ -464,6 +400,7 @@ require "action_controller/railtie"
464
400
  require "action_mailer/railtie"
465
401
  require "action_view/railtie"
466
402
  require "action_cable/engine"
403
+ require "active_storage/engine"
467
404
  require "sprockets/railtie"
468
405
  # require "rails/test_unit/railtie"
469
406
 
@@ -482,20 +419,26 @@ module #{app_name.camelize}
482
419
  g.stylesheets false
483
420
  g.javascripts false
484
421
  g.helper false
485
- g.fixture_replacement :factory_girl, :dir => 'spec/factories'
422
+ g.fixture_replacement :factory_bot, :dir => 'spec/factories'
486
423
  end
487
424
 
488
425
  config.i18n.locale = :ru
489
426
  config.i18n.default_locale = :ru
490
427
  config.i18n.available_locales = [:ru, :en]
428
+
491
429
  config.i18n.enforce_available_locales = true
492
- #{'config.active_record.schema_format = :sql' unless mongoid}
430
+ # #{'config.active_record.schema_format = :sql' unless mongoid}
493
431
 
494
432
  #{'config.autoload_paths += %W(#{config.root}/extra)'}
495
433
  #{'config.eager_load_paths += %W(#{config.root}/extra)'}
496
434
 
497
435
  config.time_zone = 'Europe/Moscow'
498
- config.assets.paths << Rails.root.join("app", "assets", "fonts")
436
+
437
+ config.webpack.dev_server.manifest_port = #{port+1}
438
+ #config.webpack.dev_server.manifest_host = "192.168.1.1"
439
+ config.webpack.dev_server.host = proc { request.host }
440
+ config.webpack.dev_server.port = #{port+1}
441
+ config.webpack.manifest_type = "manifest"
499
442
  end
500
443
  end
501
444
 
@@ -519,6 +462,18 @@ else
519
462
  FileUtils.cp(Pathname.new(destination_root).join('config', 'database.yml').to_s, Pathname.new(destination_root).join('config', 'database.yml.example').to_s)
520
463
  end
521
464
 
465
+ remove_file 'config/secrets.yml'
466
+ key = SecureRandom.hex(64)
467
+ create_file 'config/secrets.yml' do <<-TEXT
468
+ development:
469
+ secret_key_base: #{key}
470
+ production:
471
+ secret_key_base: #{key}
472
+ TEXT
473
+ end
474
+ remove_file 'config/credentials.yml.enc'
475
+ remove_file 'config/master.key'
476
+
522
477
  FileUtils.cp(Pathname.new(destination_root).join('config', 'secrets.yml').to_s, Pathname.new(destination_root).join('config', 'secrets.yml.example').to_s)
523
478
 
524
479
  unless mongoid
@@ -534,6 +489,5 @@ else
534
489
  run 'npm install'
535
490
  end
536
491
 
537
- git :init
538
492
  git add: "."
539
493
  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.24.0
4
+ version: 0.25.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - glebtv
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-22 00:00:00.000000000 Z
11
+ date: 2018-03-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -227,30 +227,31 @@ files:
227
227
  - app/models/news.rb
228
228
  - app/models/page.rb
229
229
  - app/models/seo.rb
230
+ - app/views/blocks/_counters.html
230
231
  - app/views/blocks/_footer.slim
231
232
  - app/views/blocks/_header.slim
232
- - app/views/contact_mailer/new_message_email.html.haml
233
- - app/views/contacts/new.html.haml
234
- - app/views/contacts/sent.html.haml
235
- - app/views/errors/_base.html.haml
236
- - app/views/errors/error_403.html.haml
237
- - app/views/errors/error_404.html.haml
238
- - app/views/errors/error_500.html.haml
239
- - app/views/home/index.html.haml
240
- - app/views/layouts/application.html.slim
241
- - app/views/news/index.html.haml
242
- - app/views/news/show.html.haml
243
- - app/views/pages/show.html.haml
233
+ - app/views/contact_mailer/new_message_email.html.slim
234
+ - app/views/contacts/new.slim
235
+ - app/views/contacts/sent.slim
236
+ - app/views/errors/_base.slim
237
+ - app/views/errors/error_403.slim
238
+ - app/views/errors/error_404.slim
239
+ - app/views/errors/error_500.slim
240
+ - app/views/home/index.slim
241
+ - app/views/layouts/application.slim
242
+ - app/views/news/index.slim
243
+ - app/views/news/show.slim
244
+ - app/views/pages/show.slim
244
245
  - app/views/rails_admin/main/_check_boxes.html.haml
245
246
  - app/views/rails_admin/main/_enum_check_boxes.html.haml
246
247
  - app/views/rails_admin/main/_enum_radio_buttons.html.haml
247
248
  - app/views/rails_admin/main/_form_raw.html.haml
248
249
  - app/views/search/index.html.haml
249
- - app/views/shared/_admin_link.html.haml
250
- - app/views/shared/_messages.html.haml
251
- - app/views/shared/_meta.html.haml
252
- - app/views/shared/_obj.html.haml
253
- - app/views/shared/_og.html.haml
250
+ - app/views/shared/_admin_link.slim
251
+ - app/views/shared/_messages.slim
252
+ - app/views/shared/_meta.slim
253
+ - app/views/shared/_obj.slim
254
+ - app/views/shared/_og.slim
254
255
  - config/locales/en.rocket_admin.yml
255
256
  - config/locales/en.rs.yml
256
257
  - config/locales/ru.cancan.yml
@@ -283,13 +284,27 @@ files:
283
284
  - lib/generators/rocket_cms/templates/production.erb
284
285
  - lib/generators/rocket_cms/templates/unicorn.erb
285
286
  - lib/generators/rocket_cms/templates/webpack.config.js
287
+ - lib/generators/rocket_cms/templates/webpack/analytics.es6
286
288
  - lib/generators/rocket_cms/templates/webpack/application.es6
287
- - lib/generators/rocket_cms/templates/webpack/application.sass
288
- - lib/generators/rocket_cms/templates/webpack/errors/errors.handlebars
289
+ - lib/generators/rocket_cms/templates/webpack/blocks/footer/index.sass
290
+ - lib/generators/rocket_cms/templates/webpack/blocks/header/index.sass
291
+ - lib/generators/rocket_cms/templates/webpack/blocks/index.es6
292
+ - lib/generators/rocket_cms/templates/webpack/common/index.sass
293
+ - lib/generators/rocket_cms/templates/webpack/common/mixins.sass
294
+ - lib/generators/rocket_cms/templates/webpack/common/variables.sass
295
+ - lib/generators/rocket_cms/templates/webpack/errors/errors.pug
289
296
  - lib/generators/rocket_cms/templates/webpack/errors/index.es6
290
297
  - lib/generators/rocket_cms/templates/webpack/errors/index.sass
291
298
  - lib/generators/rocket_cms/templates/webpack/flash/index.es6
292
299
  - lib/generators/rocket_cms/templates/webpack/flash/index.sass
300
+ - lib/generators/rocket_cms/templates/webpack/fonts/index.sass
301
+ - lib/generators/rocket_cms/templates/webpack/fonts/mixin.sass
302
+ - lib/generators/rocket_cms/templates/webpack/layout/buttons.sass
303
+ - lib/generators/rocket_cms/templates/webpack/layout/index.sass
304
+ - lib/generators/rocket_cms/templates/webpack/layout/main.sass
305
+ - lib/generators/rocket_cms/templates/webpack/layout/typography.sass
306
+ - lib/generators/rocket_cms/templates/webpack/pages/home/index.es6
307
+ - lib/generators/rocket_cms/templates/webpack/pages/index.es6
293
308
  - lib/generators/rocket_cms/utils.rb
294
309
  - lib/generators/rocket_cms/webpack_generator.rb
295
310
  - lib/rails_admin/custom_show_in_app.rb
@@ -1,4 +0,0 @@
1
- #rocket_cms_contact_sent
2
- %h1 Обратная связь
3
- %h2 Ваше сообщение отправлено
4
- %div Если оно требует ответа, мы постараемся ответить в ближайшее время
@@ -1,3 +0,0 @@
1
- #rocket_cms_error{class: "error-#{code}"}
2
- %h1= t('rs.errors.title', code: code)
3
- %p #{text}
@@ -1 +0,0 @@
1
- RocketCMS test app
@@ -1,33 +0,0 @@
1
- doctype html
2
- html lang="ru"
3
- head
4
- meta charset="UTF-8"
5
- meta name="viewport" content="width=device-width, maximum-scale=1"
6
- title= page_title
7
- = yield :meta
8
- = csrf_meta_tags
9
- = favicon_link_tag '/favicon.ico'
10
- - if !ENV["WEBPACK_HOST"].blank? && Rails.env.development?
11
- script src="http://#{ENV["WEBPACK_HOST"]}/webpack/vendor.js"
12
- script src="http://#{ENV["WEBPACK_HOST"]}/webpack/application.js"
13
- - else
14
- = stylesheet_link_tag *webpack_asset_paths('vendor', extension: 'css')
15
- = stylesheet_link_tag *webpack_asset_paths('application', extension: 'css')
16
- = javascript_include_tag *webpack_asset_paths('vendor', extension: 'js')
17
- = javascript_include_tag *webpack_asset_paths('application', extension: 'js')
18
-
19
- body.no-js
20
- = render 'blocks/header'
21
- script.no-js-script
22
- | document.body.classList.remove('no-js');
23
- .no-js-error.alert.alert-error
24
- | К сожалению, в вашем браузере отключен JavaScript
25
- span Включите его, чтобы зайти на сайт
26
- a class="btn-transparent" target="_blank" href="https://yandex.ru/support/common/browsers-settings/browsers-java-js-settings.xml" Включить JavaScript
27
-
28
- .container
29
- = render 'shared/messages'
30
- = yield
31
- #footer
32
- = render 'blocks/footer'
33
-