cybele 2.1.0 → 2.2.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 (83) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -1
  3. data/CHANGELOG.md +27 -0
  4. data/cybele.gemspec +0 -1
  5. data/lib/cybele/generators/app_generator.rb +4 -5
  6. data/lib/cybele/helpers/active_storage.rb +8 -22
  7. data/lib/cybele/helpers/devise.rb +5 -0
  8. data/lib/cybele/helpers/general.rb +0 -6
  9. data/lib/cybele/helpers/pronto.rb +1 -1
  10. data/lib/cybele/version.rb +2 -2
  11. data/spec/features/cli_help_spec.rb +5 -0
  12. data/spec/features/new_default_project_spec.rb +30 -175
  13. data/spec/features/new_not_default_no_skip_docker_project_spec.rb +18 -0
  14. data/spec/features/new_not_default_no_skip_sidekiq_project_spec.rb +18 -0
  15. data/spec/features/new_not_default_project_spec.rb +30 -118
  16. data/spec/files/README_DEFAULT.md +39 -0
  17. data/spec/files/README_ONLY_NO_SKIP_DOCKER.md +36 -0
  18. data/spec/files/README_ONLY_NO_SKIP_SIDEKIQ.md +26 -0
  19. data/spec/files/README_SKIP_ALL.md +23 -0
  20. data/spec/spec_helper.rb +0 -9
  21. data/spec/support/cybele_test_helpers.rb +10 -2
  22. data/spec/support/shared_examples/better_errors_test_helper.rb +11 -0
  23. data/spec/support/shared_examples/bullet_test_helper.rb +13 -0
  24. data/spec/support/shared_examples/colorize_test_helper.rb +10 -0
  25. data/spec/support/shared_examples/config_test_helper.rb +36 -0
  26. data/spec/support/shared_examples/cybele_test_helper.rb +10 -0
  27. data/spec/support/shared_examples/default_view_test_helper.rb +11 -0
  28. data/spec/support/shared_examples/devise_test_helper.rb +45 -0
  29. data/spec/support/shared_examples/docker_development_environment.rb +74 -0
  30. data/spec/support/shared_examples/dotenv_test_helper.rb +31 -0
  31. data/spec/support/shared_examples/error_pages_test_helper.rb +24 -0
  32. data/spec/support/shared_examples/force_ssl_test_helper.rb +24 -0
  33. data/spec/support/shared_examples/git_ignore_test_helper.rb +12 -0
  34. data/spec/support/shared_examples/locale_language_test_helper.rb +43 -0
  35. data/spec/support/shared_examples/mailer_test_helper.rb +13 -0
  36. data/spec/support/shared_examples/model_test_helper.rb +13 -0
  37. data/spec/support/shared_examples/pronto_test_helper.rb +41 -0
  38. data/spec/support/shared_examples/rails_i18n_test_helper.rb +10 -0
  39. data/spec/support/shared_examples/ransack_test_helper.rb +10 -0
  40. data/spec/support/shared_examples/recipient_interceptor_test_helper.rb +13 -0
  41. data/spec/support/shared_examples/responder_test_helper.rb +32 -0
  42. data/spec/support/shared_examples/rollbar_test_helper.rb +13 -0
  43. data/spec/support/shared_examples/roo_test_helper.rb +10 -0
  44. data/spec/support/shared_examples/roo_xls_test_helper.rb +10 -0
  45. data/spec/support/shared_examples/sidekiq_environment.rb +29 -0
  46. data/spec/support/shared_examples/to_xls_test_helper.rb +10 -0
  47. data/spec/support/shared_examples/will_paginate_test_helper.rb +11 -0
  48. data/spec/support/shared_examples/write_xlsx_test_helper.rb +10 -0
  49. data/templates/Gemfile.erb +11 -12
  50. data/templates/README.md.erb +14 -2
  51. data/templates/active_storage/active_storage.yml.erb +8 -0
  52. data/templates/active_storage/amazon_env_all.erb +1 -3
  53. data/templates/app_files/app/views/hq/admins/_form.html.haml +2 -2
  54. data/templates/app_files/app/views/hq/admins/edit.html.haml +1 -1
  55. data/templates/app_files/app/views/hq/users/_form.html.haml +2 -2
  56. data/templates/app_files/app/views/hq/users/edit.html.haml +1 -1
  57. data/templates/app_files/app/views/user/profile/_form.html.haml +1 -1
  58. data/templates/bullet/bullet_settings.rb.erb +1 -1
  59. data/templates/cybele_gitignore +1 -1
  60. data/templates/docker/Dockerfile.erb +1 -1
  61. data/templates/docker/docker_env_local_sample.erb +2 -5
  62. data/templates/docker/docker_env_local_sample_host.erb +1 -1
  63. data/templates/docker/docker_env_local_sample_sidekiq.erb +1 -1
  64. data/templates/docker/docker_env_staging_production_sidekiq.erb +1 -1
  65. data/templates/dotenv/.env.local.erb +2 -0
  66. data/templates/dotenv/.env.production.erb +2 -0
  67. data/templates/dotenv/.env.staging.erb +2 -0
  68. data/templates/mailer/.env.local.erb +1 -2
  69. data/templates/pronto/.erb-lint.yml.erb +9 -0
  70. data/templates/ruby-version +1 -1
  71. data/templates/sidekiq/sidekiq.rb.erb +1 -1
  72. metadata +75 -41
  73. data/spec/support/config_test_helper.rb +0 -36
  74. data/spec/support/devise_test_helper.rb +0 -45
  75. data/spec/support/dotenv_test_helper.rb +0 -31
  76. data/spec/support/error_pages_test_helper.rb +0 -24
  77. data/spec/support/force_ssl_test_helper.rb +0 -24
  78. data/spec/support/git_ignore_test_helper.rb +0 -10
  79. data/spec/support/locale_language_test_helper.rb +0 -43
  80. data/spec/support/pronto_test_helpers.rb +0 -41
  81. data/spec/support/responder_test_helper.rb +0 -32
  82. data/templates/guardfile/guardfile_settings.rb.erb +0 -49
  83. data/templates/pronto/config.reek.erb +0 -42
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ RSpec.describe 'Create new project without default configuration and no-skip docker' do
6
+ before(:all) do
7
+ remove_project_directory
8
+ run_cybele(cybele_not_default_parameters(no_skips: %w[docker]))
9
+ setup_app_dependencies
10
+ end
11
+
12
+ it_behaves_like 'uses docker development environment without sidekiq'
13
+
14
+ it 'match readme' do
15
+ gemfile_file = content('README.md')
16
+ expect(gemfile_file).to match(file_content('README_ONLY_NO_SKIP_DOCKER.md'))
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ RSpec.describe 'Create new project without default configuration and no-skip sidekiq' do
6
+ before(:all) do
7
+ remove_project_directory
8
+ run_cybele(cybele_not_default_parameters(no_skips: %w[sidekiq]))
9
+ setup_app_dependencies
10
+ end
11
+
12
+ it_behaves_like 'uses sidekiq'
13
+
14
+ it 'match readme' do
15
+ gemfile_file = content('README.md')
16
+ expect(gemfile_file).to match(file_content('README_ONLY_NO_SKIP_SIDEKIQ.md'))
17
+ end
18
+ end
@@ -45,63 +45,27 @@ RSpec.describe 'Create new project without default configuration' do
45
45
  expect(routes_file).not_to match("^require 'sidekiq/cron/web'")
46
46
  end
47
47
 
48
- it 'uses responders' do
49
- responder_test
50
- end
48
+ it_behaves_like 'uses responders'
51
49
 
52
- it 'uses rollbar' do
53
- gemfile_file = content('Gemfile')
54
- expect(gemfile_file).to match(/^gem 'rollbar'/)
50
+ it_behaves_like 'uses rollbar'
55
51
 
56
- config_file = content('config/initializers/rollbar.rb')
57
- expect(config_file).to match(/^Rollbar.configure/)
58
- end
52
+ it_behaves_like 'uses ransack'
59
53
 
60
- it 'uses ransack' do
61
- gemfile_file = content('Gemfile')
62
- expect(gemfile_file).to match(/^gem 'ransack'/)
63
- end
54
+ it_behaves_like 'uses will_paginate'
64
55
 
65
- it 'uses will_paginate' do
66
- gemfile_file = content('Gemfile')
67
- expect(gemfile_file).to match(/^gem 'will_paginate'/)
68
- expect(gemfile_file).to match(/^gem 'will_paginate-bootstrap'/)
69
- end
56
+ it_behaves_like 'uses to_xls'
70
57
 
71
- it 'uses to_xls' do
72
- gemfile_file = content('Gemfile')
73
- expect(gemfile_file).to match(/^gem 'to_xls'/)
74
- end
58
+ it_behaves_like 'uses roo'
75
59
 
76
- it 'uses roo' do
77
- gemfile_file = content('Gemfile')
78
- expect(gemfile_file).to match(/^gem 'roo'/)
79
- end
60
+ it_behaves_like 'uses roo-xls'
80
61
 
81
- it 'uses roo-xls' do
82
- gemfile_file = content('Gemfile')
83
- expect(gemfile_file).to match(/^gem 'roo-xls'/)
84
- end
62
+ it_behaves_like 'uses write_xlsx'
85
63
 
86
- it 'uses write_xlsx' do
87
- gemfile_file = content('Gemfile')
88
- expect(gemfile_file).to match(/^gem 'write_xlsx'/)
89
- end
64
+ it_behaves_like 'uses colorize'
90
65
 
91
- it 'uses colorize' do
92
- gemfile_file = content('Gemfile')
93
- expect(gemfile_file).to match("gem 'colorize'")
94
- end
66
+ it_behaves_like 'uses better_errors'
95
67
 
96
- it 'uses better_errors' do
97
- gemfile_file = content('Gemfile')
98
- expect(gemfile_file).to match("gem 'better_errors'")
99
- end
100
-
101
- it 'uses rails-i18n' do
102
- gemfile_file = content('Gemfile')
103
- expect(gemfile_file).to match(/^gem 'rails-i18n'/)
104
- end
68
+ it_behaves_like 'uses rails-i18n'
105
69
 
106
70
  it 'do not use show_for' do
107
71
  gemfile_file = content('Gemfile')
@@ -115,34 +79,15 @@ RSpec.describe 'Create new project without default configuration' do
115
79
  )
116
80
  end
117
81
 
118
- it 'uses config and staging file' do
119
- config_test
120
- end
121
-
122
- it 'uses locale_language' do
123
- locale_language_test
124
- end
125
-
126
- it 'uses recipient_interceptor' do
127
- gemfile_file = content('Gemfile')
128
- expect(gemfile_file).to match(/^gem 'recipient_interceptor'/)
82
+ it_behaves_like 'uses config'
129
83
 
130
- config_staging_file = content('config/environments/staging.rb')
131
- expect(config_staging_file).to match('RecipientInterceptor.new')
132
- end
84
+ it_behaves_like 'uses locale_language'
133
85
 
134
- it 'uses cybele_version' do
135
- expect(File).to exist(file_project_path('VERSION.txt'))
136
- expect(File).to exist(file_project_path('public/VERSION.txt'))
137
- end
86
+ it_behaves_like 'uses recipient_interceptor'
138
87
 
139
- it 'uses bullet' do
140
- gemfile_file = content('Gemfile')
141
- expect(gemfile_file).to match("gem 'bullet'")
88
+ it_behaves_like 'uses cybele_version'
142
89
 
143
- locale_file = content('config/environments/development.rb')
144
- expect(locale_file).to match('Bullet')
145
- end
90
+ it_behaves_like 'uses bullet'
146
91
 
147
92
  it 'do not use simple_form' do
148
93
  gemfile_file = content('Gemfile')
@@ -158,14 +103,9 @@ RSpec.describe 'Create new project without default configuration' do
158
103
  )
159
104
  end
160
105
 
161
- it 'control .env files' do
162
- dotenv_test
163
- end
106
+ it_behaves_like 'has .env files'
164
107
 
165
108
  it 'uses mailer' do
166
- gemfile_file = content('Gemfile')
167
- expect(gemfile_file).to match("gem 'mailtrap'")
168
-
169
109
  file_exist_test(
170
110
  %w[
171
111
  config/settings/production.yml
@@ -188,17 +128,11 @@ RSpec.describe 'Create new project without default configuration' do
188
128
  expect(File).not_to exist(file_project_path('app/views/layouts/application.html.haml'))
189
129
  end
190
130
 
191
- it 'uses devise' do
192
- devise_test
193
- end
131
+ it_behaves_like 'uses devise'
194
132
 
195
- it 'uses error_pages' do
196
- error_pages_test
197
- end
133
+ it_behaves_like 'uses error_pages'
198
134
 
199
- it 'uses gitignore' do
200
- git_ignore_test
201
- end
135
+ it_behaves_like 'uses gitignore'
202
136
 
203
137
  it 'do not use asset files' do
204
138
  gemfile_file = content('Gemfile')
@@ -329,36 +263,18 @@ RSpec.describe 'Create new project without default configuration' do
329
263
  end
330
264
  end
331
265
 
332
- it 'uses default view files' do
333
- # Mailer files
334
- hq_admins_view = content('app/views/admin_mailer/login_info.html.haml')
335
- expect(hq_admins_view).to match('@admin')
336
- end
266
+ it_behaves_like 'uses default view files'
337
267
 
338
268
  it 'not configure routes file' do
339
269
  route_file = content('config/routes.rb')
340
270
  expect(route_file).not_to match('concern :activeable')
341
271
  end
342
272
 
343
- it 'uses model files' do
344
- admin_model = content('app/models/admin.rb')
345
- expect(admin_model).to match('login_info_mailer')
273
+ it_behaves_like 'uses model files'
346
274
 
347
- audit_model = content('app/models/audit.rb')
348
- expect(audit_model).to match('class Audit')
349
- end
350
-
351
- it 'uses mailer files' do
352
- admin_mailer = content('app/mailers/admin_mailer.rb')
353
- expect(admin_mailer).to match('class AdminMailer')
275
+ it_behaves_like 'uses mailer files'
354
276
 
355
- application_mailer = content('app/mailers/application_mailer.rb')
356
- expect(application_mailer).to match('Settings.email.noreply')
357
- end
358
-
359
- it 'uses ssl_setting' do
360
- force_ssl_test
361
- end
277
+ it_behaves_like 'uses ssl_setting'
362
278
 
363
279
  it "don't use docker development environment" do
364
280
  file_not_exist_test(
@@ -377,7 +293,7 @@ RSpec.describe 'Create new project without default configuration' do
377
293
  .environments/.env.local
378
294
  ]
379
295
  ) do |env|
380
- expect(content(env)).not_to match('REDISTOGO_URL=redis://redis:6379/0')
296
+ expect(content(env)).not_to match('REDIS_URL=redis://redis:6379/0')
381
297
  end
382
298
 
383
299
  file_exist_test(
@@ -386,18 +302,14 @@ RSpec.describe 'Create new project without default configuration' do
386
302
  .environments/.env.production
387
303
  ]
388
304
  ) do |env|
389
- expect(content(env)).not_to match('REDISTOGO_URL=')
305
+ expect(content(env)).not_to match('REDIS_URL=')
390
306
  end
391
307
  end
392
308
 
393
- it 'uses pronto' do
394
- pronto_test
395
- end
396
-
397
- it 'uses guardfile' do
398
- gemfile_file = content('Gemfile')
399
- expect(gemfile_file).to match("gem 'guard'")
309
+ it_behaves_like 'uses pronto'
400
310
 
401
- expect(File).to exist(file_project_path('Guardfile'))
311
+ it 'match readme' do
312
+ gemfile_file = content('README.md')
313
+ expect(gemfile_file).to match(file_content('README_SKIP_ALL.md'))
402
314
  end
403
315
  end
@@ -0,0 +1,39 @@
1
+ # Dummy_app
2
+
3
+ # TODOs
4
+ - Change email sender domain address and basic_auth info in `config/settings.yml`
5
+ - Change email sender domain address in `config/initializers/devise.rb`
6
+ - Create `.pronto.yml` file from `example.pronto.yml` file
7
+
8
+ # Infos
9
+ - Edit secret keys
10
+ ➜ ✗ EDITOR=vi bin/rails credentials:edit
11
+
12
+
13
+ # Docker development
14
+ - run following commands on terminal
15
+ ➜ ✗ docker-compose build
16
+ ➜ ✗ docker-compose run app bundle install
17
+ ➜ ✗ docker-compose run app bundle exec rails db:create db:migrate db:seed
18
+ ➜ ✗ docker-compose up
19
+ - open in your browser localhost:3000 or lvh.me:3000
20
+ - If you want to access rails console run this command before
21
+ ➜ ✗ docker-compose run app bundle install --binstubs
22
+ ➜ ✗ docker-compose run app bundle exec rails c
23
+
24
+ # Local development
25
+
26
+ - Change REDIS_URL and POSTGRESQL_HOST environment in `.env.local` file
27
+
28
+ - run following commands on terminal
29
+ ➜ ✗ bundle exec rails server
30
+ - open in your browser localhost:3000 or lvh.me:3000
31
+
32
+ ➜ ✗ redis-server
33
+ ➜ ✗ bundle exec rake sidekiq:start
34
+
35
+ # Development
36
+ ➜ ✗ pronto run
37
+ ➜ ✗ pronto run -r haml
38
+ - On feature branch
39
+ ➜ ✗ pronto run -c origin/develop
@@ -0,0 +1,36 @@
1
+ # Dummy_app
2
+
3
+ # TODOs
4
+ - Change email sender domain address and basic_auth info in `config/settings.yml`
5
+ - Change email sender domain address in `config/initializers/devise.rb`
6
+ - Create `.pronto.yml` file from `example.pronto.yml` file
7
+
8
+ # Infos
9
+ - Edit secret keys
10
+ ➜ ✗ EDITOR=vi bin/rails credentials:edit
11
+
12
+
13
+ # Docker development
14
+ - run following commands on terminal
15
+ ➜ ✗ docker-compose build
16
+ ➜ ✗ docker-compose run app bundle install
17
+ ➜ ✗ docker-compose run app bundle exec rails db:create db:migrate db:seed
18
+ ➜ ✗ docker-compose up
19
+ - open in your browser localhost:3000 or lvh.me:3000
20
+ - If you want to access rails console run this command before
21
+ ➜ ✗ docker-compose run app bundle install --binstubs
22
+ ➜ ✗ docker-compose run app bundle exec rails c
23
+
24
+ # Local development
25
+
26
+ - Change POSTGRESQL_HOST environment in `.env.local` file
27
+
28
+ - run following commands on terminal
29
+ ➜ ✗ bundle exec rails server
30
+ - open in your browser localhost:3000 or lvh.me:3000
31
+
32
+ # Development
33
+ ➜ ✗ pronto run
34
+ ➜ ✗ pronto run -r haml
35
+ - On feature branch
36
+ ➜ ✗ pronto run -c origin/develop
@@ -0,0 +1,26 @@
1
+ # Dummy_app
2
+
3
+ # TODOs
4
+ - Change email sender domain address and basic_auth info in `config/settings.yml`
5
+ - Change email sender domain address in `config/initializers/devise.rb`
6
+ - Create `.pronto.yml` file from `example.pronto.yml` file
7
+
8
+ # Infos
9
+ - Edit secret keys
10
+ ➜ ✗ EDITOR=vi bin/rails credentials:edit
11
+
12
+
13
+ # Local development
14
+
15
+ - run following commands on terminal
16
+ ➜ ✗ bundle exec rails server
17
+ - open in your browser localhost:3000 or lvh.me:3000
18
+
19
+ ➜ ✗ redis-server
20
+ ➜ ✗ bundle exec rake sidekiq:start
21
+
22
+ # Development
23
+ ➜ ✗ pronto run
24
+ ➜ ✗ pronto run -r haml
25
+ - On feature branch
26
+ ➜ ✗ pronto run -c origin/develop
@@ -0,0 +1,23 @@
1
+ # Dummy_app
2
+
3
+ # TODOs
4
+ - Change email sender domain address and basic_auth info in `config/settings.yml`
5
+ - Change email sender domain address in `config/initializers/devise.rb`
6
+ - Create `.pronto.yml` file from `example.pronto.yml` file
7
+
8
+ # Infos
9
+ - Edit secret keys
10
+ ➜ ✗ EDITOR=vi bin/rails credentials:edit
11
+
12
+
13
+ # Local development
14
+
15
+ - run following commands on terminal
16
+ ➜ ✗ bundle exec rails server
17
+ - open in your browser localhost:3000 or lvh.me:3000
18
+
19
+ # Development
20
+ ➜ ✗ pronto run
21
+ ➜ ✗ pronto run -r haml
22
+ - On feature branch
23
+ ➜ ✗ pronto run -c origin/develop
@@ -11,16 +11,7 @@ Dir['./spec/support/**/*.rb'].each { |file| require file }
11
11
 
12
12
  RSpec.configure do |config|
13
13
  config.include CybeleTestHelpers
14
- config.include DotenvTestHelper
15
- config.include ConfigTestHelper
16
- config.include DeviseTestHelper
17
- config.include LocaleLanguageTestHelper
18
- config.include ResponderTestHelper
19
- config.include ErrorPagesTestHelper
20
- config.include GitIgnoreTestHelper
21
14
  config.include MailTestHelpers
22
- config.include ForceSSLTestHelper
23
- config.include ProntoTestHelpers
24
15
 
25
16
  config.before(:all) do
26
17
  create_tmp_directory
@@ -23,8 +23,12 @@ module CybeleTestHelpers
23
23
  end
24
24
  end
25
25
 
26
- def cybele_not_default_parameters
27
- '--database=sqlite3 --skip-create-database --skip-sidekiq --skip-simple-form --skip-show-for --skip-haml --skip-docker --skip-view-files'
26
+ def cybele_not_default_parameters(no_skips: [])
27
+ commands = %w[sidekiq simple-form show-for haml docker view-files] - no_skips
28
+ skips = commands.map do |command|
29
+ "--skip-#{command}"
30
+ end
31
+ '--database=sqlite3 ' + skips.join(' ')
28
32
  end
29
33
 
30
34
  def content(file_path)
@@ -99,6 +103,10 @@ module CybeleTestHelpers
99
103
  end
100
104
  end
101
105
 
106
+ def file_content(fixture_name)
107
+ IO.read(Pathname.new("#{root_path}/spec/files/#{fixture_name}"))
108
+ end
109
+
102
110
  private
103
111
 
104
112
  def tmp_path
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ shared_examples 'uses better_errors' do
4
+ context do
5
+ it do
6
+ gemfile_file = content('Gemfile')
7
+ expect(gemfile_file).to match("gem 'better_errors'")
8
+ expect(gemfile_file).to match("gem 'binding_of_caller'")
9
+ end
10
+ end
11
+ end