rocket_cms 0.18.1 → 0.18.2

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.
Files changed (29) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/README.md +19 -7
  4. data/app/assets/javascripts/rocket_cms.js.coffee +0 -7
  5. data/app/assets/stylesheets/rocket_cms.css.sass +0 -6
  6. data/app/views/blocks/_footer.slim +2 -0
  7. data/app/views/blocks/_header.slim +2 -0
  8. data/app/views/layouts/application.html.slim +16 -10
  9. data/lib/generators/rocket_cms/templates/.babelrc +5 -0
  10. data/lib/generators/rocket_cms/templates/package.json +43 -0
  11. data/lib/generators/rocket_cms/templates/webpack.config.js +144 -0
  12. data/lib/generators/rocket_cms/templates/webpack/application.es6 +16 -0
  13. data/lib/generators/rocket_cms/templates/webpack/application.sass +6 -0
  14. data/lib/generators/rocket_cms/templates/webpack/errors/errors.handlebars +9 -0
  15. data/lib/generators/rocket_cms/templates/webpack/errors/index.es6 +30 -0
  16. data/lib/generators/rocket_cms/templates/webpack/errors/index.sass +49 -0
  17. data/lib/generators/rocket_cms/templates/webpack/flash/index.es6 +12 -0
  18. data/{app/assets/stylesheets/rocket_cms/flash.css.sass → lib/generators/rocket_cms/templates/webpack/flash/index.sass} +6 -7
  19. data/lib/generators/rocket_cms/webpack_generator.rb +30 -0
  20. data/lib/rocket_cms/version.rb +1 -1
  21. data/template.rb +26 -242
  22. metadata +14 -9
  23. data/app/assets/javascripts/head.load.js +0 -707
  24. data/app/assets/javascripts/jquery.placeholder.js +0 -157
  25. data/app/assets/javascripts/rocket_cms/flash.js.coffee +0 -3
  26. data/app/assets/javascripts/rocket_cms/map.js.coffee +0 -22
  27. data/app/assets/stylesheets/rocket_cms/normalize.css.scss +0 -461
  28. data/app/views/blocks/_footer.html.haml +0 -1
  29. data/app/views/layouts/application.html.haml +0 -21
@@ -0,0 +1,12 @@
1
+ import './index.sass';
2
+
3
+ $(document).on("click", 'a.close_flash', function() {
4
+ $(this).parent().fadeOut(function() {
5
+ let $box = $(this).parents('.flash');
6
+ $(this).remove();
7
+ if ($box.children().length == 0) {
8
+ $box.remove();
9
+ }
10
+ })
11
+ });
12
+
@@ -1,18 +1,18 @@
1
-
2
-
3
1
  .flash
4
- margin: 0 auto
5
- padding: 10px 0
6
- width: 530px
2
+ position: fixed
3
+ top: 10px
4
+ right: 10px
5
+ z-index: 1000;
7
6
 
8
7
  .message
9
8
  border-radius: 3px
10
- text-align: center
9
+ text-align: left
11
10
  margin: 0 auto 15px
12
11
  color: white
13
12
  font-family: Tahoma
14
13
  font-size: 17px
15
14
  position: relative
15
+ padding: 1px 10px 1px 1px
16
16
  a.close_flash
17
17
  cursor: pointer
18
18
  position: absolute
@@ -62,4 +62,3 @@
62
62
  text-shadow: 0px 1px #d71012
63
63
  a.close_flash
64
64
  color: #782124
65
-
@@ -0,0 +1,30 @@
1
+ require 'rails/generators'
2
+
3
+ module RocketCms
4
+ class WebpackGenerator < Rails::Generators::Base
5
+ source_root File.expand_path('../templates', __FILE__)
6
+ def app_name
7
+ Rails.application.class.name.split("::")[0]
8
+ end
9
+
10
+ desc 'RocketCMS webpack generator'
11
+ def install
12
+ copy_file ".babelrc", ".babelrc"
13
+ copy_file "webpack.config.js", "config/webpack.config.js"
14
+
15
+ copy_file "webpack/application.es6", "webpack/application.es6"
16
+ copy_file "webpack/application.sass", "webpack/application.sass"
17
+
18
+ copy_file "webpack/errors/index.es6", "webpack/errors/index.es6"
19
+ copy_file "webpack/errors/index.sass", "webpack/errors/index.sass"
20
+ copy_file "webpack/errors/errors.handlebars", "webpack/errors/errors.handlebars"
21
+
22
+ copy_file "webpack/flash/index.es6", "webpack/flash/index.es6"
23
+ copy_file "webpack/flash/index.sass", "webpack/flash/index.sass"
24
+
25
+ remove_file "package.json"
26
+ template "package.json", "package.json"
27
+ end
28
+ end
29
+ end
30
+
@@ -1,3 +1,3 @@
1
1
  module RocketCMS
2
- VERSION = "0.18.1"
2
+ VERSION = "0.18.2"
3
3
  end
data/template.rb CHANGED
@@ -2,6 +2,7 @@ rails_spec = (Gem.loaded_specs["railties"] || Gem.loaded_specs["rails"])
2
2
  version = rails_spec.version.to_s
3
3
 
4
4
  mongoid = options[:skip_active_record]
5
+ yarn = options[:yarn]
5
6
 
6
7
  if Gem::Version.new(version) < Gem::Version.new('5.0.0')
7
8
  puts "You are using an old version of Rails (#{version})"
@@ -110,10 +111,27 @@ TEXT
110
111
  end
111
112
 
112
113
  remove_file 'README.md'
113
- create_file 'README.md', "## #{app_name}\nProject generated by RocketCMS\n\nORM: #{if mongoid then 'Mongoid' else 'ActiveRecord' end}\n\n"
114
+ create_file 'README.md', "## #{app_name}
115
+ Project generated by RocketCMS
114
116
 
115
- create_file '.ruby-version', "2.4.0\n"
116
- create_file '.ruby-gemset', "#{app_name}\n"
117
+ ORM: #{if mongoid then 'Mongoid' else 'ActiveRecord' end}
118
+
119
+ To run (windows):
120
+ ```
121
+ .\node_modules\.bin\webpack-dev-server.cmd --config config\webpack.config.js --hot --inline
122
+ bundle exec rails s webrick
123
+ ```
124
+
125
+
126
+ To run (nix/mac):
127
+ ```
128
+ ./node_modules/.bin/webpack-dev-server --config config/webpack.config.js --hot --inline
129
+ puma
130
+ ```
131
+ "
132
+
133
+ #create_file '.ruby-version', "2.4.0\n"
134
+ #create_file '.ruby-gemset', "#{app_name}\n"
117
135
 
118
136
  run 'bundle install --without production'
119
137
 
@@ -429,23 +447,6 @@ end
429
447
  TEXT
430
448
  end
431
449
 
432
- remove_file 'app/assets/stylesheets/application.css'
433
- create_file 'app/assets/stylesheets/application.css.sass' do <<-TEXT
434
- @import 'rocket_cms'
435
-
436
- #wrapper
437
- width: 960px
438
- margin: 0 auto
439
- #sidebar
440
- float: left
441
- width: 200px
442
- #content
443
- float: right
444
- width: 750px
445
-
446
- TEXT
447
- end
448
-
449
450
  remove_file 'app/assets/javascripts/application.js'
450
451
  create_file 'app/assets/javascripts/application.js' do <<-TEXT
451
452
  TEXT
@@ -456,227 +457,6 @@ create_file 'app/assets/javascripts/application.css' do <<-TEXT
456
457
  TEXT
457
458
  end
458
459
 
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
476
- TEXT
477
- end
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
460
 
681
461
  if mongoid
682
462
  FileUtils.cp(Pathname.new(destination_root).join('config', 'mongoid.yml').to_s, Pathname.new(destination_root).join('config', 'mongoid.yml.example').to_s)
@@ -692,7 +472,11 @@ unless mongoid
692
472
  rake "db:migrate"
693
473
  end
694
474
 
695
- run 'npm install'
475
+ if yarn
476
+ run 'yarn install'
477
+ else
478
+ run 'npm install'
479
+ end
696
480
 
697
481
  git :init
698
482
  git add: "."
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.1
4
+ version: 0.18.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - glebtv
@@ -201,14 +201,8 @@ files:
201
201
  - LICENSE.txt
202
202
  - README.md
203
203
  - Rakefile
204
- - app/assets/javascripts/head.load.js
205
- - app/assets/javascripts/jquery.placeholder.js
206
204
  - app/assets/javascripts/rocket_cms.js.coffee
207
- - app/assets/javascripts/rocket_cms/flash.js.coffee
208
- - app/assets/javascripts/rocket_cms/map.js.coffee
209
205
  - app/assets/stylesheets/rocket_cms.css.sass
210
- - app/assets/stylesheets/rocket_cms/flash.css.sass
211
- - app/assets/stylesheets/rocket_cms/normalize.css.scss
212
206
  - app/controllers/concerns/no_cache.rb
213
207
  - app/controllers/concerns/rs_cookies.rb
214
208
  - app/controllers/concerns/rs_errors.rb
@@ -233,7 +227,8 @@ files:
233
227
  - app/models/news.rb
234
228
  - app/models/page.rb
235
229
  - app/models/seo.rb
236
- - app/views/blocks/_footer.html.haml
230
+ - app/views/blocks/_footer.slim
231
+ - app/views/blocks/_header.slim
237
232
  - app/views/contact_mailer/new_message_email.html.haml
238
233
  - app/views/contacts/new.html.haml
239
234
  - app/views/contacts/sent.html.haml
@@ -242,7 +237,6 @@ files:
242
237
  - app/views/errors/error_404.html.haml
243
238
  - app/views/errors/error_500.html.haml
244
239
  - app/views/home/index.html.haml
245
- - app/views/layouts/application.html.haml
246
240
  - app/views/layouts/application.html.slim
247
241
  - app/views/news/index.html.haml
248
242
  - app/views/news/show.html.haml
@@ -275,6 +269,7 @@ files:
275
269
  - lib/generators/rocket_cms/capify_generator.rb
276
270
  - lib/generators/rocket_cms/layout_generator.rb
277
271
  - lib/generators/rocket_cms/migration_generator.rb
272
+ - lib/generators/rocket_cms/templates/.babelrc
278
273
  - lib/generators/rocket_cms/templates/Capfile
279
274
  - lib/generators/rocket_cms/templates/ability.erb
280
275
  - lib/generators/rocket_cms/templates/admin.erb
@@ -284,9 +279,19 @@ files:
284
279
  - lib/generators/rocket_cms/templates/migration_news.rb
285
280
  - lib/generators/rocket_cms/templates/migration_pages.rb
286
281
  - lib/generators/rocket_cms/templates/migration_seos.rb
282
+ - lib/generators/rocket_cms/templates/package.json
287
283
  - lib/generators/rocket_cms/templates/production.erb
288
284
  - lib/generators/rocket_cms/templates/unicorn.erb
285
+ - lib/generators/rocket_cms/templates/webpack.config.js
286
+ - 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/errors/index.es6
290
+ - lib/generators/rocket_cms/templates/webpack/errors/index.sass
291
+ - lib/generators/rocket_cms/templates/webpack/flash/index.es6
292
+ - lib/generators/rocket_cms/templates/webpack/flash/index.sass
289
293
  - lib/generators/rocket_cms/utils.rb
294
+ - lib/generators/rocket_cms/webpack_generator.rb
290
295
  - lib/manual_slug.rb
291
296
  - lib/manual_slug/active_record.rb
292
297
  - lib/manual_slug/mongoid.rb