blueberry_rails 0.4.1 → 1.0.0

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 (90) hide show
  1. checksums.yaml +5 -5
  2. data/.circleci/config.yml +47 -0
  3. data/.eslintrc +21 -0
  4. data/.hound.yml +0 -3
  5. data/.rubocop.yml +22 -13
  6. data/.ruby-version +1 -1
  7. data/README.md +1 -53
  8. data/blueberry_rails.gemspec +2 -2
  9. data/lib/blueberry_rails/app_builder.rb +45 -74
  10. data/lib/blueberry_rails/generators/app_generator.rb +21 -25
  11. data/lib/blueberry_rails/version.rb +3 -3
  12. data/spec/blueberry_rails_spec.rb +7 -23
  13. data/templates/Gemfile_custom.erb +24 -39
  14. data/templates/Procfile +1 -0
  15. data/templates/app.json.erb +2 -2
  16. data/templates/circle.yml.erb +68 -10
  17. data/templates/config/initializers/translation_engine.rb +1 -1
  18. data/templates/gitignore_custom.erb +7 -5
  19. data/templates/puma.rb +2 -3
  20. data/templates/spec/controllers/root_controller_spec.rb +2 -4
  21. data/templates/spec/drivers.rb +16 -0
  22. data/templates/spec/factories/administrators.rb +2 -2
  23. data/templates/spec/factories/users.rb +2 -2
  24. data/templates/spec/factories_spec.rb +3 -3
  25. data/templates/spec/factory_bot_syntax.rb +3 -0
  26. data/templates/spec/spec_helper.rb +0 -7
  27. data/templates/views/layouts/admin.html.slim.erb +3 -3
  28. data/templates/views/layouts/application.html.slim.erb +3 -3
  29. data/templates/views/layouts/mailer.html.slim.erb +7 -0
  30. metadata +13 -68
  31. data/circle.yml +0 -5
  32. data/templates/admin_assets/javascripts/admin.coffee +0 -6
  33. data/templates/admin_assets/javascripts/admin/.keep +0 -0
  34. data/templates/admin_assets/stylesheets/admin.sass +0 -4
  35. data/templates/admin_assets/stylesheets/admin/.keep +0 -0
  36. data/templates/assets/icons/_font_icons.scss +0 -18
  37. data/templates/assets/images/blueberry-logo.png +0 -0
  38. data/templates/assets/javascripts/application.coffee +0 -6
  39. data/templates/assets/javascripts/common/.keep +0 -0
  40. data/templates/assets/javascripts/frontend/.keep +0 -0
  41. data/templates/assets/stylesheets/application.sass +0 -9
  42. data/templates/assets/stylesheets/frontend/base/buttons.sass +0 -3
  43. data/templates/assets/stylesheets/frontend/base/typo.sass +0 -3
  44. data/templates/assets/stylesheets/frontend/common/bootstrap-ms.sass +0 -128
  45. data/templates/assets/stylesheets/frontend/common/bootstrap-override.sass +0 -3
  46. data/templates/assets/stylesheets/frontend/common/bootstrap.sass +0 -50
  47. data/templates/assets/stylesheets/frontend/common/variables.sass +0 -37
  48. data/templates/assets/stylesheets/frontend/components/.keep +0 -0
  49. data/templates/assets/stylesheets/frontend/components/blocks.sass +0 -19
  50. data/templates/assets/stylesheets/frontend/components/navbar.sass +0 -0
  51. data/templates/assets/stylesheets/frontend/layout/body.sass +0 -3
  52. data/templates/assets/stylesheets/frontend/layout/footer.sass +0 -3
  53. data/templates/assets/stylesheets/frontend/layout/header.sass +0 -3
  54. data/templates/assets/stylesheets/frontend/pages/.keep +0 -0
  55. data/templates/assets/stylesheets/frontend/third-party/includes.sass +0 -1
  56. data/templates/assets/stylesheets/frontend/utils/functions.sass +0 -23
  57. data/templates/assets/stylesheets/frontend/utils/make-columns.sass +0 -67
  58. data/templates/assets/stylesheets/frontend/utils/mixins.sass +0 -29
  59. data/templates/assets/stylesheets/frontend/utils/render-to.sass +0 -66
  60. data/templates/assets/stylesheets/frontend/utils/renderto-debug.sass +0 -22
  61. data/templates/gulp/application.js.coffee +0 -11
  62. data/templates/gulp/application.sass +0 -10
  63. data/templates/gulp/config.coffee +0 -47
  64. data/templates/gulp/global.coffee +0 -3
  65. data/templates/gulp/global.sass +0 -8
  66. data/templates/gulp/gulp_helper.rb +0 -16
  67. data/templates/gulp/gulpfile.js +0 -20
  68. data/templates/gulp/message.coffee +0 -1
  69. data/templates/gulp/package.json +0 -53
  70. data/templates/gulp/rev_manifest.rb +0 -5
  71. data/templates/gulp/tasks/browserSync.coffee +0 -6
  72. data/templates/gulp/tasks/browserify.coffee +0 -50
  73. data/templates/gulp/tasks/build.coffee +0 -25
  74. data/templates/gulp/tasks/clean.coffee +0 -6
  75. data/templates/gulp/tasks/default.coffee +0 -3
  76. data/templates/gulp/tasks/fontIcons/generateIconSass.coffee +0 -23
  77. data/templates/gulp/tasks/fontIcons/index.coffee +0 -9
  78. data/templates/gulp/tasks/fontIcons/template.sass +0 -33
  79. data/templates/gulp/tasks/images.coffee +0 -12
  80. data/templates/gulp/tasks/rev/index.coffee +0 -12
  81. data/templates/gulp/tasks/rev/rev-assets.coffee +0 -11
  82. data/templates/gulp/tasks/rev/rev-font-workaround.coffee +0 -49
  83. data/templates/gulp/tasks/sass.coffee +0 -24
  84. data/templates/gulp/tasks/watch.coffee +0 -14
  85. data/templates/gulp/tasks/watchify.coffee +0 -6
  86. data/templates/gulp/util/bundleLogger.coffee +0 -23
  87. data/templates/gulp/util/handleErrors.coffee +0 -11
  88. data/templates/secret_token.rb.erb +0 -18
  89. data/templates/spec/factory_girl_syntax.rb +0 -3
  90. data/templates/tasks/icons.rake +0 -19
@@ -25,18 +25,12 @@ module BlueberryRails
25
25
  class_option :skip_turbolinks, type: :boolean, default: true,
26
26
  desc: 'Skip turbolinks gem'
27
27
 
28
- class_option :skip_bundle, type: :boolean, aliases: '-B', default: true,
28
+ class_option :skip_bundle, type: :boolean, aliases: '-B', default: false,
29
29
  desc: 'Don\'t run bundle install'
30
30
 
31
- class_option :gulp, type: :boolean, aliases: '-g', default: false,
32
- desc: 'Include Gulp asset pipeline'
33
-
34
31
  class_option :administration, type: :boolean, aliases: '-a', default: false,
35
32
  desc: 'Include Admin part of application'
36
33
 
37
- class_option :fontcustom, type: :boolean, aliases: '-fc', default: false,
38
- desc: 'Include Fontcustom'
39
-
40
34
  class_option :translation_engine, type: :boolean, aliases: '-te', default: false,
41
35
  desc: 'Include Tranlsation Engine'
42
36
 
@@ -46,6 +40,9 @@ module BlueberryRails
46
40
  class_option :heroku, type: :boolean, aliases: '-he', default: true,
47
41
  desc: 'Heroku reviews app config'
48
42
 
43
+ class_option :webpack, type: :string, aliases: '-w', default: 'stimulus',
44
+ desc: 'Preconfigure for app-like JavaScript with Webpack (options: react/vue/angular/elm/stimulus)'
45
+
49
46
  def finish_template
50
47
  if options[:administration] && (!options[:devise] || !options[:bootstrap])
51
48
  raise 'Administration depends on bootstrap and devise!'
@@ -60,20 +57,20 @@ module BlueberryRails
60
57
  invoke :setup_development_environment
61
58
  invoke :setup_test_environment
62
59
  invoke :setup_staging_environment
60
+ invoke :setup_integration_environment
63
61
  invoke :create_views
64
62
  invoke :create_assets
65
63
  invoke :configure_app
66
64
  invoke :remove_routes_comment_lines
67
65
  invoke :setup_gems
68
66
  invoke :setup_git
69
- invoke :setup_gulp
70
67
  invoke :setup_admin
71
68
  invoke :rake_tasks
72
69
  invoke :setup_custom_errors
73
70
  invoke :setup_initializers
74
- invoke :setup_fontcustom
75
71
  invoke :setup_heroku
76
72
  invoke :setup_cache_and_compress
73
+ invoke :setup_linters
77
74
  end
78
75
 
79
76
  def customize_gemfile
@@ -112,7 +109,11 @@ module BlueberryRails
112
109
  def setup_staging_environment
113
110
  say 'Setting up the staging environment'
114
111
  build :setup_staging_environment
115
- build :setup_secret_token
112
+ end
113
+
114
+ def setup_integration_environment
115
+ say 'Setting up the integration environment'
116
+ build :setup_integration_environment
116
117
  end
117
118
 
118
119
  def setup_initializers
@@ -120,13 +121,6 @@ module BlueberryRails
120
121
  build :copy_initializers
121
122
  end
122
123
 
123
- def setup_fontcustom
124
- if options[:fontcustom]
125
- say 'Setting up fontcustom'
126
- build :copy_fontcustom_config
127
- end
128
- end
129
-
130
124
  def setup_admin
131
125
  if options[:administration]
132
126
  build :setup_admin
@@ -156,7 +150,6 @@ module BlueberryRails
156
150
  build :create_procfile
157
151
  build :create_puma_config
158
152
  build :add_ruby_version_file
159
- build :hound_config
160
153
  build :configure_i18n
161
154
  build :configure_bin_setup
162
155
  end
@@ -189,13 +182,6 @@ module BlueberryRails
189
182
  build :init_git
190
183
  end
191
184
 
192
- def setup_gulp
193
- if options[:gulp]
194
- say 'Adding Gulp asset pipeline'
195
- build :gulp_files
196
- end
197
- end
198
-
199
185
  def setup_heroku
200
186
  if options[:heroku]
201
187
  say 'Add heroku reviews apps config'
@@ -203,6 +189,16 @@ module BlueberryRails
203
189
  end
204
190
  end
205
191
 
192
+ def setup_linters
193
+ say 'Setting up linters'
194
+ build :hound_config
195
+ end
196
+
197
+ def setup_cocoon
198
+ say 'Setting up Cocoon'
199
+ build :cocoon_config
200
+ end
201
+
206
202
  def rake_tasks
207
203
  build :copy_rake_tasks
208
204
  end
@@ -1,7 +1,7 @@
1
1
  module BlueberryRails
2
- VERSION = '0.4.1'.freeze
2
+ VERSION = '1.0.0'.freeze
3
3
 
4
- RUBY_VERSION = '2.4.0'.freeze
4
+ RUBY_VERSION = '2.5.1'.freeze
5
5
 
6
- RAILS_VERSION = '5.1.1'.freeze
6
+ RAILS_VERSION = '5.2.1.1'.freeze
7
7
  end
@@ -21,9 +21,12 @@ class BlueberryRailsTest < Minitest::Test
21
21
  assert_exist_file 'config/initializers/plurals.rb'
22
22
  assert_exist_file '.hound.yml'
23
23
  assert_exist_file '.rubocop.yml'
24
- assert_exist_file 'circle.yml'
24
+ assert_exist_file '.eslintrc'
25
+ assert_exist_file '.circleci/config.yml'
25
26
  assert_exist_file '.rspec'
26
27
  assert_exist_file 'app.json'
28
+ assert_exist_file 'spec/support/drivers.rb'
29
+ assert_file_have_content '.ruby-version', BlueberryRails::RUBY_VERSION
27
30
  assert_file_have_content 'README.md', 'Test Project'
28
31
  assert_file_have_content 'bin/setup', 'bundle install --deployment'
29
32
  assert_file_have_content 'Procfile', 'bundle exec puma'
@@ -31,8 +34,10 @@ class BlueberryRailsTest < Minitest::Test
31
34
  assert_file_have_content 'config/environments/production.rb', 'Cache-Control'
32
35
  assert_file_have_content 'config/environments/production.rb', 'Rack::Deflater'
33
36
  assert_file_have_content 'Guardfile', 'factories'
34
- assert_file_have_content 'config/secrets.yml', 'staging'
35
37
  assert_file_have_content 'config/initializers/airbrake.rb', 'config.blacklist_keys'
38
+ assert_file_have_content 'package.json', 'eslint'
39
+ assert_file_have_content 'package.json', 'cocoon'
40
+ assert_file_have_content 'app/javascript/packs/application.js', 'cocoon'
36
41
 
37
42
  assert run_rake
38
43
  end
@@ -82,27 +87,6 @@ class BlueberryRailsTest < Minitest::Test
82
87
  assert run_rake
83
88
  end
84
89
 
85
- def test_rake_runs_with_fontcustom_option
86
- create_project '--fontcustom'
87
-
88
- assert_exist_file 'lib/tasks/icons.rake'
89
- assert_exist_file 'fontcustom.yml'
90
- assert_exist_file "app/assets/icons/_font_icons.scss"
91
-
92
- assert run_rake
93
- end
94
-
95
- def test_rake_runs_with_gulp_option
96
- create_project '--gulp'
97
-
98
- assert_file_have_content 'config/environments/development.rb',
99
- 'config.assets.digest = false'
100
- assert_exist_file 'gulp/tasks/default.coffee'
101
- assert_exist_file 'gulpfile.js'
102
- assert_exist_file 'package.json'
103
- assert run_rake
104
- end
105
-
106
90
  def test_rake_runs_with_heroku_option
107
91
  create_project '--heroku'
108
92
 
@@ -1,78 +1,63 @@
1
1
  source 'https://rubygems.org'
2
+ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
2
3
 
3
4
  ruby '<%= BlueberryRails::RUBY_VERSION %>'
4
5
 
5
6
  gem 'airbrake'
6
- <% if !options[:gulp] -%>
7
- gem 'autoprefixer-rails'
8
- <% end -%>
9
- <% if options[:administration] -%>
10
- gem 'blueberry_admin'
11
- <% end -%>
12
- gem 'coffee-rails', '~> 4.2'
7
+ gem 'bootsnap', require: false
8
+ gem 'cocoon', '~> 1.2'
13
9
  <% if options[:devise] -%>
14
- gem 'devise'
10
+ gem 'devise', '~> 4.5'
15
11
  <% end -%>
16
- gem 'dotenv-rails'
12
+ gem 'dotenv-rails', '~> 2.5'
13
+ gem 'draper', '~> 3.0'
17
14
  gem 'flutie'
18
- gem 'jquery-rails'
15
+ gem 'inky-rb', require: 'inky'
19
16
  gem 'metamagic'
20
- gem 'pg'
21
- gem 'puma', '~> 3.0'
17
+ gem 'pg', '>= 0.18', '< 2.0'
18
+ gem 'premailer-rails', '~> 1.10', '>= 1.10.2'
19
+ gem 'puma', '~> 3.11'
22
20
  gem 'rails', '~> <%= BlueberryRails::RAILS_VERSION %>'
23
- gem 'sassc-rails'
24
- gem 'simple_form'
25
- gem 'slim-rails'
21
+ gem 'sassc-rails', '~> 2.0'
22
+ gem 'simple_form', '~> 4.1'
23
+ gem 'slim-rails', '~> 3.2'
26
24
  <% if options[:translation_engine] -%>
27
25
  gem 'translation_engine', github: 'blueberryapps/translation-engine'
28
26
  <% end -%>
29
- gem 'uglifier', '>= 1.3.0'
30
-
31
- source 'https://rails-assets.org' do
32
- <% if options[:bootstrap] -%>
33
- gem 'rails-assets-bootstrap-sass'
27
+ <% unless options[:skip_turbolinks] -%>
28
+ gem 'turbolinks', '~> 5'
34
29
  <% end -%>
35
- gem 'rails-assets-jquery-ujs'
36
- end
30
+ gem 'uglifier', '>= 1.3.0'
31
+ gem 'webpacker', '~> 3.3'
37
32
 
38
33
  group :development do
39
34
  gem 'awesome_print'
40
- gem 'better_errors'
41
- gem 'binding_of_caller'
42
- <% if options[:fontcustom] -%>
43
- gem 'fontcustom'
44
- <% end -%>
45
35
  gem 'guard-rspec'
46
- gem 'i18n_yaml_sorter'
47
36
  gem 'image_optimizer', '~> 1.3.0'
48
37
  gem 'listen', '~> 3.0.5'
49
- gem 'mailcatcher'
50
38
  gem 'pry-rails'
51
39
  gem 'rails-i18n-debug', github: 'XeeD/rails-i18n-debug'
52
40
  gem 'rubocop', require: false
53
41
  gem 'spring'
54
42
  gem 'spring-watcher-listen', '~> 2.0.0'
55
- <% if options[:fontcustom] -%>
56
- gem 'svg_optimizer'
57
- <% end -%>
43
+ gem 'web-console', '>= 3.3.0'
58
44
  end
59
45
 
60
46
  group :development, :test do
61
- gem 'factory_girl_rails'
47
+ gem 'factory_bot_rails', '~> 4.11'
62
48
  gem 'pry-byebug'
63
49
  gem 'pry-doc'
64
- gem 'rspec-rails', '>= 3.1'
65
- end
66
-
67
- group :staging, :production do
68
- gem 'newrelic_rpm', '>= 3.9.6'
50
+ gem 'rspec-rails', '>= 3.8'
69
51
  end
70
52
 
71
53
  group :test do
72
54
  gem 'capybara-screenshot'
55
+ gem 'capybara-selenium'
73
56
  gem 'database_cleaner'
74
57
  gem 'launchy'
75
- gem 'poltergeist', '>= 1.5.0'
58
+ gem 'rails-controller-testing'
59
+ gem 'rspec_junit_formatter'
60
+ gem 'shoulda-matchers'
76
61
  gem 'simplecov', require: false
77
62
  gem 'webmock'
78
63
  end
@@ -1 +1,2 @@
1
+ release: bundle exec rails db:migrate
1
2
  web: bundle exec puma -C config/puma.rb
@@ -25,10 +25,10 @@
25
25
  ],
26
26
  "buildpacks": [
27
27
  {
28
- "url": "urn:buildpack:heroku/ruby"
28
+ "url": "https://github.com/heroku/heroku-buildpack-activestorage-preview"
29
29
  },
30
30
  {
31
- "url": "https://github.com/gunpowderlabs/buildpack-ruby-rake-deploy-tasks"
31
+ "url": "urn:buildpack:heroku/ruby"
32
32
  }
33
33
  ]
34
34
  }
@@ -1,13 +1,71 @@
1
- machine:
2
- services:
3
- - postgresql
1
+ version: 2
2
+ jobs:
3
+ build:
4
+ docker:
5
+ # specify the version you desire here
6
+ - image: circleci/ruby:<%= BlueberryRails::RUBY_VERSION %>-node-browsers
7
+ environment:
8
+ BUNDLE_JOBS: 3
9
+ BUNDLE_RETRY: 3
10
+ BUNDLE_PATH: vendor/bundle
11
+ RAILS_ENV: test
12
+ DATABASE_URL: "postgres://<%= app_name.gsub('_', '-') %>@localhost:5432/<%= app_name.gsub('_', '-') %>-test"
13
+ - image: circleci/postgres:9.5-alpine
14
+ environment:
15
+ POSTGRES_USER: <%= app_name.gsub('_', '-') %>
16
+ POSTGRES_DB: <%= app_name.gsub('_', '-') %>-test
17
+ POSTGRES_PASSWORD: ""
4
18
 
5
- # Version of ruby to use
6
- ruby:
7
- version:
8
- <%= BlueberryRails::RUBY_VERSION %>
19
+ working_directory: ~/repo
9
20
 
21
+ steps:
22
+ - checkout
10
23
 
11
- # Add some environment variables
12
- environment:
13
- CIRCLE_ENV: test
24
+ - run:
25
+ name: Update bundler
26
+ command: sudo gem update bundler
27
+
28
+ # Download and cache dependencies
29
+ - restore_cache:
30
+ keys:
31
+ - v1-dependencies-{{ checksum "Gemfile.lock" }}
32
+ # fallback to using the latest cache if no exact match is found
33
+ - v1-dependencies-
34
+
35
+ - run:
36
+ name: install dependencies
37
+ command: |
38
+ bundle install --jobs=4 --retry=3 --path vendor/bundle
39
+
40
+ - save_cache:
41
+ paths:
42
+ - ./vendor/bundle
43
+ key: v1-dependencies-{{ checksum "Gemfile.lock" }}
44
+
45
+ - run:
46
+ name: Install yarn dependencies
47
+ command: yarn install
48
+
49
+ # Database setup
50
+ - run: bundle exec rails db:create
51
+ - run: bundle exec rails db:schema:load
52
+
53
+ # run tests!
54
+ - run:
55
+ name: run tests
56
+ command: |
57
+ mkdir /tmp/test-results
58
+ TEST_FILES="$(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)"
59
+
60
+ bundle exec rspec --format progress \
61
+ --format RspecJunitFormatter \
62
+ --out /tmp/test-results/rspec.xml \
63
+ --format progress \
64
+ $TEST_FILES
65
+
66
+ # collect reports
67
+ - store_test_results:
68
+ path: /tmp/test-results
69
+ - store_artifacts:
70
+ path: /tmp/test-results
71
+ destination: test-results
@@ -1,4 +1,4 @@
1
- if %w(production staging).include? Rails.env
1
+ if %w(production integration staging).include? Rails.env
2
2
  TranslationEngine.config do |config|
3
3
  # key for user
4
4
  config.api_key = 'API_KEY'
@@ -6,16 +6,18 @@
6
6
  .env
7
7
  .pry_history
8
8
  .sass-cache/
9
- coverage/*
9
+ .yarn-integrity
10
10
  config/database.yml
11
+ config/master.key
11
12
  db/*.sqlite3
12
13
  log/*.log
14
+ node_modules
15
+ public/packs
16
+ public/packs-test
13
17
  public/system
14
18
  rerun.txt
19
+ storage/*
15
20
  tags
16
21
  tmp/*
17
22
  tmp/**/*
18
- <% if options[:gulp] -%>
19
- node_modules
20
- /public/assets/*
21
- <% end -%>
23
+ yarn-debug.log*
@@ -4,9 +4,8 @@ threads Integer(threads_count / 2), threads_count
4
4
 
5
5
  preload_app!
6
6
 
7
- rackup DefaultRackup
8
- port ENV['PORT'] || 3000
9
- environment ENV['RACK_ENV'] || 'development'
7
+ port ENV.fetch('PORT') { 3000 }
8
+ environment ENV.fetch('RACK_ENV') { 'development' }
10
9
 
11
10
  on_worker_boot do
12
11
  # Worker specific setup for Rails 4.1+
@@ -1,12 +1,10 @@
1
- require 'spec_helper'
2
-
3
- describe RootController, type: :controller do
1
+ require 'rails_helper'
4
2
 
3
+ RSpec.describe RootController, type: :controller do
5
4
  describe 'GET index' do
6
5
  it 'returns http success' do
7
6
  get :index
8
7
  expect(response).to be_success
9
8
  end
10
9
  end
11
-
12
10
  end
@@ -0,0 +1,16 @@
1
+ require 'selenium/webdriver'
2
+
3
+ Capybara.register_driver :chrome do |app|
4
+ Capybara::Selenium::Driver.new(app, browser: :chrome)
5
+ end
6
+
7
+ Capybara.register_driver :headless_chrome do |app|
8
+ Capybara::Selenium::Driver.new app,
9
+ browser: :chrome,
10
+ desired_capabilities: Selenium::WebDriver::Remote::Capabilities.chrome(
11
+ chromeOptions: { args: %w(headless disable-gpu window-size=1366,768) }
12
+ )
13
+ end
14
+
15
+ Capybara.javascript_driver = :headless_chrome
16
+ # Capybara.javascript_driver = :chrome