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.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/CHANGELOG.md +27 -0
- data/cybele.gemspec +0 -1
- data/lib/cybele/generators/app_generator.rb +4 -5
- data/lib/cybele/helpers/active_storage.rb +8 -22
- data/lib/cybele/helpers/devise.rb +5 -0
- data/lib/cybele/helpers/general.rb +0 -6
- data/lib/cybele/helpers/pronto.rb +1 -1
- data/lib/cybele/version.rb +2 -2
- data/spec/features/cli_help_spec.rb +5 -0
- data/spec/features/new_default_project_spec.rb +30 -175
- data/spec/features/new_not_default_no_skip_docker_project_spec.rb +18 -0
- data/spec/features/new_not_default_no_skip_sidekiq_project_spec.rb +18 -0
- data/spec/features/new_not_default_project_spec.rb +30 -118
- data/spec/files/README_DEFAULT.md +39 -0
- data/spec/files/README_ONLY_NO_SKIP_DOCKER.md +36 -0
- data/spec/files/README_ONLY_NO_SKIP_SIDEKIQ.md +26 -0
- data/spec/files/README_SKIP_ALL.md +23 -0
- data/spec/spec_helper.rb +0 -9
- data/spec/support/cybele_test_helpers.rb +10 -2
- data/spec/support/shared_examples/better_errors_test_helper.rb +11 -0
- data/spec/support/shared_examples/bullet_test_helper.rb +13 -0
- data/spec/support/shared_examples/colorize_test_helper.rb +10 -0
- data/spec/support/shared_examples/config_test_helper.rb +36 -0
- data/spec/support/shared_examples/cybele_test_helper.rb +10 -0
- data/spec/support/shared_examples/default_view_test_helper.rb +11 -0
- data/spec/support/shared_examples/devise_test_helper.rb +45 -0
- data/spec/support/shared_examples/docker_development_environment.rb +74 -0
- data/spec/support/shared_examples/dotenv_test_helper.rb +31 -0
- data/spec/support/shared_examples/error_pages_test_helper.rb +24 -0
- data/spec/support/shared_examples/force_ssl_test_helper.rb +24 -0
- data/spec/support/shared_examples/git_ignore_test_helper.rb +12 -0
- data/spec/support/shared_examples/locale_language_test_helper.rb +43 -0
- data/spec/support/shared_examples/mailer_test_helper.rb +13 -0
- data/spec/support/shared_examples/model_test_helper.rb +13 -0
- data/spec/support/shared_examples/pronto_test_helper.rb +41 -0
- data/spec/support/shared_examples/rails_i18n_test_helper.rb +10 -0
- data/spec/support/shared_examples/ransack_test_helper.rb +10 -0
- data/spec/support/shared_examples/recipient_interceptor_test_helper.rb +13 -0
- data/spec/support/shared_examples/responder_test_helper.rb +32 -0
- data/spec/support/shared_examples/rollbar_test_helper.rb +13 -0
- data/spec/support/shared_examples/roo_test_helper.rb +10 -0
- data/spec/support/shared_examples/roo_xls_test_helper.rb +10 -0
- data/spec/support/shared_examples/sidekiq_environment.rb +29 -0
- data/spec/support/shared_examples/to_xls_test_helper.rb +10 -0
- data/spec/support/shared_examples/will_paginate_test_helper.rb +11 -0
- data/spec/support/shared_examples/write_xlsx_test_helper.rb +10 -0
- data/templates/Gemfile.erb +11 -12
- data/templates/README.md.erb +14 -2
- data/templates/active_storage/active_storage.yml.erb +8 -0
- data/templates/active_storage/amazon_env_all.erb +1 -3
- data/templates/app_files/app/views/hq/admins/_form.html.haml +2 -2
- data/templates/app_files/app/views/hq/admins/edit.html.haml +1 -1
- data/templates/app_files/app/views/hq/users/_form.html.haml +2 -2
- data/templates/app_files/app/views/hq/users/edit.html.haml +1 -1
- data/templates/app_files/app/views/user/profile/_form.html.haml +1 -1
- data/templates/bullet/bullet_settings.rb.erb +1 -1
- data/templates/cybele_gitignore +1 -1
- data/templates/docker/Dockerfile.erb +1 -1
- data/templates/docker/docker_env_local_sample.erb +2 -5
- data/templates/docker/docker_env_local_sample_host.erb +1 -1
- data/templates/docker/docker_env_local_sample_sidekiq.erb +1 -1
- data/templates/docker/docker_env_staging_production_sidekiq.erb +1 -1
- data/templates/dotenv/.env.local.erb +2 -0
- data/templates/dotenv/.env.production.erb +2 -0
- data/templates/dotenv/.env.staging.erb +2 -0
- data/templates/mailer/.env.local.erb +1 -2
- data/templates/pronto/.erb-lint.yml.erb +9 -0
- data/templates/ruby-version +1 -1
- data/templates/sidekiq/sidekiq.rb.erb +1 -1
- metadata +75 -41
- data/spec/support/config_test_helper.rb +0 -36
- data/spec/support/devise_test_helper.rb +0 -45
- data/spec/support/dotenv_test_helper.rb +0 -31
- data/spec/support/error_pages_test_helper.rb +0 -24
- data/spec/support/force_ssl_test_helper.rb +0 -24
- data/spec/support/git_ignore_test_helper.rb +0 -10
- data/spec/support/locale_language_test_helper.rb +0 -43
- data/spec/support/pronto_test_helpers.rb +0 -41
- data/spec/support/responder_test_helper.rb +0 -32
- data/templates/guardfile/guardfile_settings.rb.erb +0 -49
- data/templates/pronto/config.reek.erb +0 -42
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
shared_examples 'uses bullet' do
|
4
|
+
context do
|
5
|
+
it do
|
6
|
+
gemfile_file = content('Gemfile')
|
7
|
+
expect(gemfile_file).to match("gem 'bullet'")
|
8
|
+
|
9
|
+
locale_file = content('config/environments/development.rb')
|
10
|
+
expect(locale_file).to match('Bullet')
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
shared_examples 'uses config' do
|
4
|
+
context do
|
5
|
+
it do
|
6
|
+
gemfile_file = content('Gemfile')
|
7
|
+
expect(gemfile_file).to match(/^gem 'config'/)
|
8
|
+
expect(File).not_to exist(file_project_path('config/settings.local.yml'))
|
9
|
+
|
10
|
+
config_development_file_test
|
11
|
+
config_staging_file_test
|
12
|
+
config_production_file_test
|
13
|
+
config_test_file_test
|
14
|
+
end
|
15
|
+
|
16
|
+
def config_development_file_test
|
17
|
+
config_development_file = content('config/environments/development.rb')
|
18
|
+
expect(config_development_file).to match(/^Rails.application.configure/)
|
19
|
+
end
|
20
|
+
|
21
|
+
def config_staging_file_test
|
22
|
+
config_staging_file = content('config/environments/staging.rb')
|
23
|
+
expect(config_staging_file).to match(/^Rails.application.configure/)
|
24
|
+
end
|
25
|
+
|
26
|
+
def config_production_file_test
|
27
|
+
config_production_file = content('config/environments/production.rb')
|
28
|
+
expect(config_production_file).to match(/^Rails.application.configure/)
|
29
|
+
end
|
30
|
+
|
31
|
+
def config_test_file_test
|
32
|
+
config_test_file = content('config/environments/test.rb')
|
33
|
+
expect(config_test_file).to match(/^Rails.application.configure/)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
shared_examples 'uses devise' do
|
4
|
+
context do
|
5
|
+
it do
|
6
|
+
gemfile_file = content('Gemfile')
|
7
|
+
expect(gemfile_file).to match(/^gem 'devise'/)
|
8
|
+
|
9
|
+
devise_initializers_test
|
10
|
+
devise_route_file_test
|
11
|
+
devise_model_file_test
|
12
|
+
file_control_test
|
13
|
+
end
|
14
|
+
|
15
|
+
def devise_initializers_test
|
16
|
+
initializers_devise = content('config/initializers/devise.rb')
|
17
|
+
expect(initializers_devise).to match('mailer')
|
18
|
+
expect(initializers_devise).to match('mailer_sender')
|
19
|
+
|
20
|
+
filter_parameter_logging = content('config/initializers/filter_parameter_logging.rb')
|
21
|
+
expect(filter_parameter_logging).to match(':password')
|
22
|
+
expect(filter_parameter_logging).to match(':password_confirmation')
|
23
|
+
end
|
24
|
+
|
25
|
+
def devise_route_file_test
|
26
|
+
devise_route = content('config/routes.rb')
|
27
|
+
expect(devise_route).to match('devise_for :users')
|
28
|
+
end
|
29
|
+
|
30
|
+
def devise_model_file_test # rubocop:disable Metrics/AbcSize
|
31
|
+
devise_model_file = content('app/models/user.rb')
|
32
|
+
expect(devise_model_file).to match(':database_authenticatable')
|
33
|
+
expect(devise_model_file).to match(':registerable')
|
34
|
+
expect(devise_model_file).to match(':recoverable')
|
35
|
+
expect(devise_model_file).to match(':rememberable')
|
36
|
+
expect(devise_model_file).to match(':trackable')
|
37
|
+
expect(devise_model_file).to match(':validatable')
|
38
|
+
end
|
39
|
+
|
40
|
+
def file_control_test
|
41
|
+
expect(File).to exist(file_project_path('config/locales/devise.en.yml'))
|
42
|
+
expect(File).to exist(file_project_path('config/locales/devise.tr.yml'))
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
shared_examples 'uses docker development environment' do
|
4
|
+
it do
|
5
|
+
file_exist_test(
|
6
|
+
%w[
|
7
|
+
docker-compose.yml
|
8
|
+
Dockerfile
|
9
|
+
bin/start-app.sh
|
10
|
+
bin/start-sidekiq.sh
|
11
|
+
]
|
12
|
+
)
|
13
|
+
|
14
|
+
file_exist_test(
|
15
|
+
%w[
|
16
|
+
.env.sample
|
17
|
+
.env.local
|
18
|
+
.environments/.env.local
|
19
|
+
]
|
20
|
+
) do |env|
|
21
|
+
file = content(env)
|
22
|
+
expect(file).to match('REDIS_URL=redis://redis:6379/0')
|
23
|
+
expect(file).to match('RACK_ENV=development')
|
24
|
+
expect(file).to match('POSTGRESQL_HOST=postgres')
|
25
|
+
expect(file).to match('REDIS_HOST=redis')
|
26
|
+
end
|
27
|
+
|
28
|
+
file_exist_test(
|
29
|
+
%w[
|
30
|
+
.environments/.env.staging
|
31
|
+
.environments/.env.production
|
32
|
+
]
|
33
|
+
) do |env|
|
34
|
+
expect(content(env)).to match('REDIS_URL=')
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
shared_examples 'uses docker development environment without sidekiq' do
|
40
|
+
it do
|
41
|
+
file_exist_test(
|
42
|
+
%w[
|
43
|
+
docker-compose.yml
|
44
|
+
Dockerfile
|
45
|
+
bin/start-app.sh
|
46
|
+
]
|
47
|
+
)
|
48
|
+
|
49
|
+
file_not_exist_test(%w[bin/start-sidekiq.sh])
|
50
|
+
|
51
|
+
file_exist_test(
|
52
|
+
%w[
|
53
|
+
.env.sample
|
54
|
+
.env.local
|
55
|
+
.environments/.env.local
|
56
|
+
]
|
57
|
+
) do |env|
|
58
|
+
file = content(env)
|
59
|
+
expect(file).not_to match('REDIS_URL=redis://redis:6379/0')
|
60
|
+
expect(file).to match('RACK_ENV=development')
|
61
|
+
expect(file).to match('POSTGRESQL_HOST=postgres')
|
62
|
+
expect(file).not_to match('REDIS_HOST=redis')
|
63
|
+
end
|
64
|
+
|
65
|
+
file_exist_test(
|
66
|
+
%w[
|
67
|
+
.environments/.env.staging
|
68
|
+
.environments/.env.production
|
69
|
+
]
|
70
|
+
) do |env|
|
71
|
+
expect(content(env)).not_to match('REDIS_URL=')
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
shared_examples 'has .env files' do
|
4
|
+
context do
|
5
|
+
it do
|
6
|
+
gemfile_file = content('Gemfile')
|
7
|
+
expect(gemfile_file).to match(/^gem 'dotenv-rails'/)
|
8
|
+
|
9
|
+
env_file_test
|
10
|
+
env_staging_file_test
|
11
|
+
env_production_file_test
|
12
|
+
end
|
13
|
+
|
14
|
+
def env_file_test
|
15
|
+
%w[.env.sample .env.local .environments/.env.local].each do |env|
|
16
|
+
expect(File).to exist(file_project_path(env))
|
17
|
+
expect(content(env)).to match('ROOT_PATH=http://localhost:3000')
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def env_staging_file_test
|
22
|
+
env_staging_file = content('.environments/.env.staging')
|
23
|
+
expect(env_staging_file).to match('ROOT_PATH=https://staging-dummy_app.herokuapp.com')
|
24
|
+
end
|
25
|
+
|
26
|
+
def env_production_file_test
|
27
|
+
env_production_file = content('.environments/.env.production')
|
28
|
+
expect(env_production_file).to match('ROOT_PATH=https://dummy_app.herokuapp.com')
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
shared_examples 'uses error_pages' do
|
4
|
+
context do
|
5
|
+
it do
|
6
|
+
controller_file_test
|
7
|
+
routes_file_test
|
8
|
+
end
|
9
|
+
|
10
|
+
def controller_file_test # rubocop:disable Metrics/AbcSize
|
11
|
+
application_controller_file = content('app/controllers/application_controller.rb')
|
12
|
+
expect(application_controller_file).to match('rescue_from Exception')
|
13
|
+
expect(application_controller_file).to match('rescue_from ActiveRecord::RecordNotFound')
|
14
|
+
expect(application_controller_file).to match('rescue_from ActionController::RoutingError')
|
15
|
+
expect(application_controller_file).to match('server_error')
|
16
|
+
expect(application_controller_file).to match('page_not_found')
|
17
|
+
end
|
18
|
+
|
19
|
+
def routes_file_test
|
20
|
+
route_file = content('config/routes.rb')
|
21
|
+
expect(route_file).to match('unmatched_route')
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
shared_examples 'uses ssl_setting' do
|
4
|
+
context do
|
5
|
+
it do
|
6
|
+
%w[staging production].each do |env|
|
7
|
+
expect(content("config/environments/#{env}.rb")).to match('config.force_ssl')
|
8
|
+
end
|
9
|
+
force_ssl_environment_test
|
10
|
+
end
|
11
|
+
|
12
|
+
def force_ssl_environment_test
|
13
|
+
%w[
|
14
|
+
.env.sample
|
15
|
+
.environments/.env.local
|
16
|
+
.environments/.env.staging
|
17
|
+
.environments/.env.production
|
18
|
+
].each do |env|
|
19
|
+
expect(File).to exist(file_project_path(env))
|
20
|
+
expect(content(env)).to match('RAILS_FORCE_SSL=')
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
shared_examples 'uses gitignore' do
|
4
|
+
context do
|
5
|
+
it do
|
6
|
+
application_controller_file = content('.gitignore')
|
7
|
+
expect(application_controller_file).to match('.DS_Store')
|
8
|
+
expect(application_controller_file).to match('.secret')
|
9
|
+
expect(application_controller_file).to match('.env')
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
shared_examples 'uses locale_language' do
|
4
|
+
context do
|
5
|
+
it do
|
6
|
+
expect(File).to exist(file_project_path('config/locales/en.yml'))
|
7
|
+
|
8
|
+
file_content_control_test
|
9
|
+
english_file_test
|
10
|
+
turkish_file_test
|
11
|
+
end
|
12
|
+
|
13
|
+
def file_content_control_test
|
14
|
+
locale_file = content('config/locales/tr.yml')
|
15
|
+
expect(locale_file).to match('phone:')
|
16
|
+
expect(locale_file).to match('date:')
|
17
|
+
expect(locale_file).to match('time:')
|
18
|
+
expect(locale_file).to match('number:')
|
19
|
+
end
|
20
|
+
|
21
|
+
def english_file_test
|
22
|
+
locale_file = content('config/locales/mailer.en.yml')
|
23
|
+
expect(locale_file).to match('mailer:')
|
24
|
+
|
25
|
+
locale_file = content('config/locales/models.en.yml')
|
26
|
+
expect(locale_file).to match('activerecord:')
|
27
|
+
|
28
|
+
locale_file = content('config/locales/view.en.yml')
|
29
|
+
expect(locale_file).to match('view:')
|
30
|
+
end
|
31
|
+
|
32
|
+
def turkish_file_test
|
33
|
+
locale_file = content('config/locales/mailer.tr.yml')
|
34
|
+
expect(locale_file).to match('mailer:')
|
35
|
+
|
36
|
+
locale_file = content('config/locales/models.tr.yml')
|
37
|
+
expect(locale_file).to match('activerecord:')
|
38
|
+
|
39
|
+
locale_file = content('config/locales/view.tr.yml')
|
40
|
+
expect(locale_file).to match('view:')
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
shared_examples 'uses mailer files' do
|
4
|
+
context do
|
5
|
+
it do
|
6
|
+
admin_mailer = content('app/mailers/admin_mailer.rb')
|
7
|
+
expect(admin_mailer).to match('class AdminMailer')
|
8
|
+
|
9
|
+
application_mailer = content('app/mailers/application_mailer.rb')
|
10
|
+
expect(application_mailer).to match('Settings.email.noreply')
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
shared_examples 'uses model files' do
|
4
|
+
context do
|
5
|
+
it do
|
6
|
+
admin_model = content('app/models/admin.rb')
|
7
|
+
expect(admin_model).to match('login_info_mailer')
|
8
|
+
|
9
|
+
audit_model = content('app/models/audit.rb')
|
10
|
+
expect(audit_model).to match('class Audit')
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
shared_examples 'uses pronto' do
|
4
|
+
context do
|
5
|
+
it do
|
6
|
+
gemfile_file = content('Gemfile')
|
7
|
+
pronto_gems.each do |gem|
|
8
|
+
expect(gemfile_file).to match(gem)
|
9
|
+
end
|
10
|
+
file_exist_test(
|
11
|
+
%w[
|
12
|
+
example.pronto.yml
|
13
|
+
.pronto.yml
|
14
|
+
.haml-lint.yml
|
15
|
+
.erb-lint.yml
|
16
|
+
.rubocop.yml
|
17
|
+
bin/rubo
|
18
|
+
]
|
19
|
+
)
|
20
|
+
pronto_gitignore_test
|
21
|
+
end
|
22
|
+
|
23
|
+
def pronto_gems
|
24
|
+
[
|
25
|
+
"gem 'pronto'",
|
26
|
+
"gem 'pronto-brakeman'",
|
27
|
+
"gem 'pronto-erb_lint'",
|
28
|
+
"gem 'pronto-fasterer'",
|
29
|
+
"gem 'pronto-flay'",
|
30
|
+
"gem 'pronto-haml'",
|
31
|
+
"gem 'pronto-poper'",
|
32
|
+
"gem 'pronto-rubocop'"
|
33
|
+
]
|
34
|
+
end
|
35
|
+
|
36
|
+
def pronto_gitignore_test
|
37
|
+
gemfile_file = content('.gitignore')
|
38
|
+
expect(gemfile_file).to match('.pronto.yml')
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|