rocket_cms 0.18.0 → 0.18.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e1ab7d984edb267c64290200e1cfac357ac83755
4
- data.tar.gz: 442812da272f60b2b8b43ef2684bf651ea1f82cf
3
+ metadata.gz: 996722169fbbf791a12b6483d6e2853916c06827
4
+ data.tar.gz: 55f62c4dbafac606514ce7202f631bc026682f26
5
5
  SHA512:
6
- metadata.gz: 016c3c3ae20e6a98c069dc0f263938d054507d06f0ce0c7513f9c48d43ae288000efd54edabf4faace0b5b404852287c2afdbf47089368157a68851331ccd786
7
- data.tar.gz: 372b8609dadce95ef5b42b7bf7db4db2210ace9626e2f78c7f6e443de96f9d3035476e634b446bf9d20672096e0e0b7ee61b2eca0498e4f27671ae84f9853bbd
6
+ metadata.gz: ed077d4fd1bab074b52ed1ebea4dbe50e89f680cc0cb086185b8ae743ce659cf770db5ba45d455319b3fe02a226c2ee3e5f53450ce95fdf3d93c7db6608c8be4
7
+ data.tar.gz: 288e7caf4dec5cf4694698c7759711fa56ea6aacbb3da1f6e74ab20460ad16d54c4347ae32f4739dae6efa032a2d020b8bd88c61b15d4a24527ca64420d830d3
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rocket_cms (0.18.0)
4
+ rocket_cms (0.18.1)
5
5
  addressable
6
6
  coffee-rails
7
7
  jquery-rails
@@ -0,0 +1,12 @@
1
+ module RsCookies
2
+ extend ActiveSupport::Concern
3
+ included do
4
+ def set_cookies_on!
5
+ cookies.permanent['cookies_on'] = {
6
+ value: "1",
7
+ httponly: false,
8
+ } if cookies['cookies_on'].nil? || cookies['cookies_on'] != "1"
9
+ end
10
+ before_action :set_cookies_on!
11
+ end
12
+ end
@@ -4,14 +4,22 @@ require 'capistrano/setup'
4
4
  # Includes default deployment tasks
5
5
  require 'capistrano/deploy'
6
6
 
7
- require 'rvm1/capistrano3'
8
7
  require 'capistrano/bundler'
9
8
  require 'capistrano/rails/assets'
9
+ require 'capistrano/rails/migrations'
10
10
  #require "whenever/capistrano"
11
11
 
12
- require 'capistrano/unicorn'
12
+ require 'capistrano/rtrack'
13
+ require 'capistrano/npm'
13
14
 
14
- # require 'capistrano/rails/console'
15
+ require 'capistrano/puma'
16
+
17
+ install_plugin Capistrano::Puma
18
+ install_plugin Capistrano::Puma::Workers
19
+ install_plugin Capistrano::Puma::Jungle
20
+
21
+ require "capistrano/scm/git"
22
+ install_plugin Capistrano::SCM::Git
15
23
 
16
24
  # Loads custom tasks from `lib/capistrano/tasks' if you have any defined.
17
25
  Dir.glob('lib/capistrano/tasks/*.cap').each { |r| import r }
@@ -1,6 +1,5 @@
1
1
  set :user, "<%= app_name.downcase %>"
2
2
  set :application, '<%= app_name.downcase %>'
3
- set :scm, :git
4
3
  set :repo_url, 'git@rscz.ru:rocket-science/<%= app_name.downcase %>.git'
5
4
 
6
5
  set :branch, ENV["REVISION"] || "master"
@@ -12,36 +11,49 @@ set :deploy_to, "<%= deploy_to %>"
12
11
  # set :hipchat_room_name, "<%= app_name %>"
13
12
  # set :hipchat_announce, false
14
13
 
15
- set :rvm_type, :user
16
- set :rvm_ruby_version, "2.2.0@#{fetch :application}"
14
+ #set :rvm_type, :user
15
+ #set :rvm_ruby_version, "2.4.1@#{fetch :application}"
17
16
  set :use_sudo, false
18
17
 
19
18
  set :keep_releases, 20
20
19
 
20
+ <% if RocketCMS.mongoid? %>
21
21
  set :linked_files, %w{config/mongoid.yml config/secrets.yml}
22
+ <% else %>
23
+ set :linked_files, %w{config/database.yml config/secrets.yml}
24
+ <% end %>
22
25
  set :linked_dirs, %w{log tmp vendor/bundle public/assets public/system public/uploads public/ckeditor_assets public/sitemap}
23
26
 
24
- namespace :db do
25
- desc "Create the indexes defined on your mongoid models"
26
- task :create_mongoid_indexes do
27
- on roles(:app) do
28
- execute :rake, "db:mongoid:create_indexes"
29
- end
27
+ Rake::Task["puma:check"].clear
28
+ Rake::Task["puma:config"].clear
29
+ namespace :puma do
30
+ task :check do
31
+ end
32
+ task :config do
30
33
  end
31
34
  end
32
35
 
33
36
  namespace :deploy do
34
- task :restart do
37
+ desc "webpack"
38
+ task :webpack do
39
+ on roles(:app) do
40
+ within release_path do
41
+ with rails_env: fetch(:rails_env) do
42
+ execute :rake, "webpack:compile"
43
+ end
44
+ end
45
+ end
35
46
  end
36
- desc "Update the crontab"
37
- task :update_crontab do
47
+ end
48
+
49
+ after "deploy:updated", "deploy:webpack"
50
+
51
+ namespace :db do
52
+ desc "Create the indexes defined on your mongoid models"
53
+ task :create_mongoid_indexes do
38
54
  on roles(:app) do
39
- execute "cd #{release_path}; #{fetch(:tmp_dir)}/#{fetch :application}/rvm-auto.sh . bundle exec whenever --update-crontab #{fetch :user} --set \'environment=#{fetch :stage}&current_path=#{release_path}\'; true"
55
+ execute :rake, "db:mongoid:create_indexes"
40
56
  end
41
57
  end
42
58
  end
43
59
 
44
- after 'deploy:publishing', 'deploy:restart'
45
- after 'deploy:restart', 'unicorn:duplicate'
46
- #before "deploy:update_crontab", 'rvm1:hook'
47
- #after "deploy:restart", "deploy:update_crontab"
@@ -4,6 +4,7 @@ module RocketCMS::Controller
4
4
  include RsErrors
5
5
  include RsPages
6
6
  include RsMenu
7
+ include RsCookies
7
8
  protect_from_forgery with: :exception
8
9
  helper_method :page_title
9
10
  helper_method :app_url
@@ -1,3 +1,3 @@
1
1
  module RocketCMS
2
- VERSION = "0.18.0"
2
+ VERSION = "0.18.1"
3
3
  end
data/template.rb CHANGED
@@ -22,9 +22,12 @@ gem 'rails', '5.1.0.rc1'
22
22
  gem 'sass'
23
23
 
24
24
  #{if mongoid then "gem 'rocket_cms_mongoid'" else "gem 'rocket_cms_activerecord'" end}
25
+ gem 'rails_admin', github: 'crowdtask/rails_admin'
25
26
 
27
+ gem 'slim', github: 'slim-template/slim'
28
+ gem 'haml', github: 'haml/haml'
26
29
  gem 'sass-rails'
27
- gem 'slim-rails'
30
+ gem 'webpack-rails'
28
31
 
29
32
  gem 'devise'
30
33
  gem 'devise-i18n'
@@ -32,9 +35,16 @@ gem 'cancancan'
32
35
 
33
36
  gem 'cloner'
34
37
  gem 'puma'
38
+
35
39
  gem 'x-real-ip'
36
40
  gem 'sentry-raven'
37
41
 
42
+ gem 'uglifier'
43
+
44
+ # windows
45
+ gem 'tzinfo-data'
46
+ gem 'wdm', '>= 0.1.0' if Gem.win_platform?
47
+
38
48
  group :development do
39
49
  gem 'better_errors'
40
50
  gem 'binding_of_caller'
@@ -437,11 +447,237 @@ TEXT
437
447
  end
438
448
 
439
449
  remove_file 'app/assets/javascripts/application.js'
440
- create_file 'app/assets/javascripts/application.js.coffee' do <<-TEXT
441
- #= require rocket_cms
450
+ create_file 'app/assets/javascripts/application.js' do <<-TEXT
451
+ TEXT
452
+ end
453
+
454
+ remove_file 'app/assets/javascripts/application.css'
455
+ create_file 'app/assets/javascripts/application.css' do <<-TEXT
456
+ TEXT
457
+ end
458
+
459
+ create_file 'webpack/application.sass' do <<-TEXT
460
+ html
461
+ font-family: Tahoma, Geneva, sans-serif
462
+ font-size: 14px
463
+ text-rendering: optimizeLegibility
464
+ -webkit-font-smoothing: antialiased
465
+ -moz-osx-font-smoothing: grayscale
466
+ TEXT
467
+ end
468
+
469
+ create_file 'webpack/application.es6' do <<-TEXT
470
+ html
471
+ font-family: Tahoma, Geneva, sans-serif
472
+ font-size: 14px
473
+ text-rendering: optimizeLegibility
474
+ -webkit-font-smoothing: antialiased
475
+ -moz-osx-font-smoothing: grayscale
442
476
  TEXT
443
477
  end
444
478
 
479
+ create_file '.babelrc' do <<-TEXT
480
+ {
481
+ "presets": ["es2015", "stage-0"],
482
+ "plugins": []
483
+ }
484
+ TEXT
485
+ end
486
+
487
+ create_file 'package.json' do <<-TEXT
488
+ {
489
+ "name": "#{app_name.camelize}",
490
+ "version": "0.0.1",
491
+ "license": "UNLICENSED",
492
+ "private": true,
493
+ "repository": "git@rscz.ru:rocket-science/#{app_name}.git",
494
+ "dependencies": {
495
+ "autoprefixer": "^6.5.3",
496
+ "axios": "^0.16.1",
497
+ "babel-cli": "^6.18.0",
498
+ "babel-core": "^6.18.2",
499
+ "babel-loader": "^7.0.0",
500
+ "babel-plugin-lodash": "^3.2.9",
501
+ "babel-plugin-transform-runtime": "^6.15.0",
502
+ "babel-preset-es2015": "^6.18.0",
503
+ "babel-preset-stage-0": "^6.16.0",
504
+ "babel-runtime": "^6.20.0",
505
+ "bootstrap": "4.0.0-alpha.6",
506
+ "compression-webpack-plugin": "^0.4.0",
507
+ "css-loader": "^0.28.0",
508
+ "extract-text-webpack-plugin": "^2.0.0-rc.3",
509
+ "file-loader": "^0.11.1",
510
+ "font-awesome": "^4.7.0",
511
+ "handlebars": "^4.0.6",
512
+ "handlebars-loader": "^1.4.0",
513
+ "html-loader": "^0.4.4",
514
+ "jquery": "^3.1.1",
515
+ "jquery-ujs": "^1.2.2",
516
+ "js-cookie": "^2.1.3",
517
+ "node-sass": "^4.0.0",
518
+ "postcss-functions": "^2.1.0",
519
+ "postcss-loader": "^1.3.0",
520
+ "sass-loader": "^6.0.0",
521
+ "stats-webpack-plugin": "^0.6.0",
522
+ "style-loader": "^0.16.1",
523
+ "turbolinks": "^5.0.0",
524
+ "url-loader": "^0.5.7",
525
+ "webpack": "^2.2.1",
526
+ "webpack-dev-server": "^2.3.0",
527
+ "webpack-hot-middleware": "^2.7.1"
528
+ }
529
+ }
530
+ TEXT
531
+ end
532
+
533
+ create_file 'config/webpack.config.js' do <<-TEXT
534
+ 'use strict';
535
+
536
+ var path = require('path');
537
+ var webpack = require('webpack');
538
+ var functions = require('postcss-functions');
539
+ var StatsPlugin = require('stats-webpack-plugin');
540
+
541
+ var ExtractTextPlugin = require("extract-text-webpack-plugin");
542
+
543
+ var autoprefixer = require('autoprefixer');
544
+ var CompressionPlugin = require("compression-webpack-plugin");
545
+
546
+ var host = process.env.HOST || 'localhost'
547
+ var devServerPort = 3808;
548
+
549
+ var production = process.env.NODE_ENV === 'production';
550
+
551
+ const extractSass = new ExtractTextPlugin({
552
+ filename: "[name].[contenthash].css",
553
+ disable: !production
554
+ });
555
+
556
+ console.log("dir:", __dirname)
557
+
558
+ var sassExtractor = () => {
559
+ return extractSass.extract({
560
+ use: [{
561
+ loader: "style-loader"
562
+ }, {
563
+ loader: "css-loader",
564
+ options: {
565
+ sourceMap: true
566
+ }
567
+ }, {
568
+ loader: "sass-loader",
569
+ options: {
570
+ sourceMap: true
571
+ }
572
+ }],
573
+ fallback: "style-loader"
574
+ })
575
+ }
576
+
577
+ var config = {
578
+ entry: {
579
+ // Sources are expected to live in $app_root/webpack
580
+ vendor: [
581
+ 'babel-polyfill',
582
+ 'axios',
583
+ 'jquery',
584
+ 'lodash',
585
+ ],
586
+ application: 'application.es6'
587
+ },
588
+
589
+ module: {
590
+ rules: [
591
+ { test: /\.es6/, use: "babel-loader" },
592
+ { test: /\.handlebars$/, use: "handlebars-loader" },
593
+ { test: /\.(jpe?g|png|gif)$/i, use: "file-loader" },
594
+ {
595
+ test: /\.woff($|\?)|\.woff2($|\?)|\.ttf($|\?)|\.eot($|\?)|\.svg($|\?)/,
596
+ use: production ? 'file-loader' : 'url-loader'
597
+ },
598
+ { test: /\.sass$/, use: sassExtractor() },
599
+ { test: /\.scss$/, use: sassExtractor() },
600
+ { test: /\.css$/, use: sassExtractor() }
601
+ ]
602
+ },
603
+
604
+ output: {
605
+ // Build assets directly in to public/webpack/, let webpack know
606
+ // that all webpacked assets start with webpack/
607
+
608
+ // must match config.webpack.output_dir
609
+ path: path.join(__dirname, '..', 'public', 'webpack'),
610
+ publicPath: '/webpack/',
611
+
612
+ filename: production ? '[name]-[chunkhash].js' : '[name].js'
613
+ },
614
+
615
+ resolve: {
616
+ modules: [path.resolve(__dirname, "..", "webpack"), path.resolve(__dirname, "..", "node_modules")],
617
+ extensions: [".js", ".es6", ".css", ".sass", ".scss"],
618
+ },
619
+
620
+ plugins: [
621
+ extractSass,
622
+ new StatsPlugin('manifest.json', {
623
+ chunkModules: false,
624
+ source: false,
625
+ chunks: false,
626
+ modules: false,
627
+ assets: true
628
+ }),
629
+ new webpack.ProvidePlugin({
630
+ $: "jquery/dist/jquery",
631
+ jQuery: "jquery/dist/jquery",
632
+ "window.jQuery": "jquery/dist/jquery",
633
+ //Tether: "tether",
634
+ //"window.Tether": "tether",
635
+ "_": "lodash",
636
+ "window._": "lodash",
637
+ //Alert: "exports-loader?Alert!bootstrap/js/dist/alert",
638
+ //Button: "exports-loader?Button!bootstrap/js/dist/button",
639
+ })
640
+ ]
641
+ };
642
+
643
+ if (production) {
644
+ config.plugins.push(
645
+ new webpack.optimize.CommonsChunkPlugin({name: 'vendor', filename: 'vendor-[chunkhash].js'}),
646
+ new webpack.optimize.UglifyJsPlugin({
647
+ compressor: { warnings: false },
648
+ sourceMap: false
649
+ }),
650
+ new webpack.DefinePlugin({ // <--key to reduce React's size
651
+ 'process.env': { NODE_ENV: JSON.stringify('production') }
652
+ }),
653
+ new CompressionPlugin({
654
+ asset: "[path].gz",
655
+ algorithm: "gzip",
656
+ test: /\.js$|\.css$/,
657
+ threshold: 4096,
658
+ minRatio: 0.8
659
+ })
660
+ );
661
+ } else {
662
+ config.plugins.push(
663
+ new webpack.optimize.CommonsChunkPlugin({name: 'vendor', filename: 'vendor.js'}),
664
+ new webpack.NamedModulesPlugin()
665
+ )
666
+
667
+ config.devServer = {
668
+ port: devServerPort,
669
+ headers: { 'Access-Control-Allow-Origin': '*' },
670
+ };
671
+ config.output.publicPath = 'http://' + host + ':' + devServerPort + '/webpack/';
672
+ config.devtool = 'source-map';
673
+ }
674
+
675
+ module.exports = config;
676
+
677
+ TEXT
678
+ end
679
+
680
+
445
681
  if mongoid
446
682
  FileUtils.cp(Pathname.new(destination_root).join('config', 'mongoid.yml').to_s, Pathname.new(destination_root).join('config', 'mongoid.yml.example').to_s)
447
683
  else
@@ -456,6 +692,8 @@ unless mongoid
456
692
  rake "db:migrate"
457
693
  end
458
694
 
695
+ run 'npm install'
696
+
459
697
  git :init
460
698
  git add: "."
461
699
  git commit: %Q{ -m 'Initial commit' }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rocket_cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.18.0
4
+ version: 0.18.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - glebtv
@@ -210,6 +210,7 @@ files:
210
210
  - app/assets/stylesheets/rocket_cms/flash.css.sass
211
211
  - app/assets/stylesheets/rocket_cms/normalize.css.scss
212
212
  - app/controllers/concerns/no_cache.rb
213
+ - app/controllers/concerns/rs_cookies.rb
213
214
  - app/controllers/concerns/rs_errors.rb
214
215
  - app/controllers/concerns/rs_localizeable.rb
215
216
  - app/controllers/concerns/rs_menu.rb