modulorails 1.4.0.1 → 1.5.0.pre2

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 (45) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +24 -0
  3. data/Gemfile +3 -0
  4. data/lib/generators/modulorails/bundleraudit/bundleraudit_generator.rb +13 -8
  5. data/lib/generators/modulorails/docker/docker_generator.rb +58 -15
  6. data/lib/generators/modulorails/docker/templates/config/cable.yml.tt +6 -6
  7. data/lib/generators/modulorails/docker/templates/config/database.yml.tt +3 -15
  8. data/lib/generators/modulorails/docker/templates/config/initializers/0_redis.rb +2 -0
  9. data/lib/generators/modulorails/docker/templates/config/puma.rb +41 -0
  10. data/lib/generators/modulorails/docker/templates/docker-compose.yml.tt +14 -7
  11. data/lib/generators/modulorails/docker/templates/{Dockerfile.prod.tt → dockerfiles/modulotech/Dockerfile.prod.tt} +9 -7
  12. data/lib/generators/modulorails/docker/templates/{Dockerfile.tt → dockerfiles/modulotech/Dockerfile.tt} +3 -1
  13. data/lib/generators/modulorails/docker/templates/dockerfiles/rails/Dockerfile.prod.tt +87 -0
  14. data/lib/generators/modulorails/docker/templates/entrypoints/docker-entrypoint.sh.tt +13 -9
  15. data/lib/generators/modulorails/githooks/githooks_generator.rb +57 -0
  16. data/lib/generators/modulorails/githooks/templates/dockeruby.sh +112 -0
  17. data/lib/generators/modulorails/githooks/templates/post-rewrite.sh +5 -0
  18. data/lib/generators/modulorails/githooks/templates/pre-merge-commit.sh +2 -0
  19. data/lib/generators/modulorails/githooks/templates/refresh_generations.sh +25 -0
  20. data/lib/generators/modulorails/gitlabci/gitlabci_generator.rb +5 -19
  21. data/lib/generators/modulorails/gitlabci/templates/.gitlab-ci.yml.tt +15 -3
  22. data/lib/generators/modulorails/gitlabci/templates/config/deploy/production.yaml.tt +15 -0
  23. data/lib/generators/modulorails/gitlabci/templates/config/deploy/review.yaml.tt +15 -0
  24. data/lib/generators/modulorails/gitlabci/templates/config/deploy/staging.yaml.tt +15 -0
  25. data/lib/generators/modulorails/health_check/health_check_generator.rb +29 -0
  26. data/lib/generators/modulorails/{healthcheck → health_check}/templates/.modulorails-health_check +2 -0
  27. data/lib/generators/modulorails/moduloproject/moduloproject_generator.rb +42 -0
  28. data/lib/generators/modulorails/moduloproject/templates/config/environments/production.rb.tt +109 -0
  29. data/lib/generators/modulorails/rubocop/rubocop_generator.rb +1 -0
  30. data/lib/generators/modulorails/self_update/self_update_generator.rb +3 -2
  31. data/lib/generators/modulorails/service/service_generator.rb +2 -2
  32. data/lib/generators/modulorails/service/templates/service.rb.tt +4 -11
  33. data/lib/generators/modulorails/sidekiq/sidekiq_generator.rb +41 -45
  34. data/lib/modulorails/data.rb +10 -6
  35. data/lib/modulorails/generators/base.rb +79 -0
  36. data/lib/modulorails/railtie.rb +6 -0
  37. data/lib/modulorails/services/base_service.rb +22 -12
  38. data/lib/modulorails/services/logs_for_method_service.rb +5 -0
  39. data/lib/modulorails/version.rb +1 -1
  40. data/lib/modulorails.rb +23 -12
  41. data/modulorails.gemspec +9 -10
  42. metadata +37 -54
  43. data/lib/generators/modulorails/docker/templates/docker-compose.prod.yml.tt +0 -49
  44. data/lib/generators/modulorails/healthcheck/health_check_generator.rb +0 -40
  45. /data/lib/generators/modulorails/{healthcheck → health_check}/templates/config/initializers/health_check.rb.tt +0 -0
@@ -1,49 +0,0 @@
1
- version: '3.7'
2
-
3
- services:
4
- app:
5
- image: modulotechgroup/<%= @image_name %>
6
- build:
7
- context: .
8
- dockerfile: Dockerfile.prod
9
- depends_on:
10
- - database
11
- - redis
12
- ports:
13
- - '3000:3000'
14
- environment:
15
- RAILS_ENV: production
16
- URL: http://localhost:3000
17
- <%= @environment_name %>_DATABASE_HOST: database
18
- <%= @environment_name %>_DATABASE_NAME: <%= @image_name %>
19
- RAILS_SERVE_STATIC_FILES: 'true'
20
- REDIS_URL: redis://redis:6379/1
21
-
22
- <%- if @adapter =~ /mysql/ -%>
23
- database:
24
- image: mysql/mysql-server:8.0
25
- volumes:
26
- - db_data:/var/lib/mysql
27
- environment:
28
- MYSQL_ALLOW_EMPTY_PASSWORD: 'true'
29
- MYSQL_DATABASE: <%= @image_name %>
30
- MYSQL_ROOT_HOST: '%'
31
- <%- else -%>
32
- database:
33
- image: postgres:16-alpine
34
- volumes:
35
- - db_data:/var/lib/postgresql/data
36
- environment:
37
- POSTGRES_USER: postgres
38
- POSTGRES_PASSWORD: postgres
39
- POSTGRES_DB: <%= @image_name %>
40
- LC_COLLATE: 'en_US.UTF-8'
41
- LC_CTYPE: 'en_US.UTF-8'
42
- <%- end -%>
43
-
44
- redis:
45
- image: redis:7-alpine
46
-
47
- # Define the volumes references in the services
48
- volumes:
49
- db_data:
@@ -1,40 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'rails/generators'
4
-
5
- class Modulorails::HealthCheckGenerator < Rails::Generators::Base
6
-
7
- source_root File.expand_path('templates', __dir__)
8
- desc 'This generator creates a configuration for the health_check gem'
9
-
10
- def create_config_file
11
- # Update the template
12
- template 'config/initializers/health_check.rb'
13
-
14
- # Add the route
15
- unless File.read(Rails.root.join('config/routes.rb')).match?('health_check_routes')
16
- inject_into_file 'config/routes.rb', " health_check_routes\n\n", after: "Rails.application.routes.draw do\n"
17
- end
18
-
19
- # Update the gem and the Gemfile.lock
20
- system('bundle install')
21
-
22
- # Create file to avoid this generator on next modulorails launch
23
- create_keep_file
24
- rescue StandardError => e
25
- warn("[Modulorails] Error: cannot generate health_check configuration: #{e.message}")
26
- end
27
-
28
- private
29
-
30
- def create_keep_file
31
- file = '.modulorails-health_check'
32
-
33
- # Create file to avoid this generator on next modulorails launch
34
- copy_file(file, file)
35
-
36
- say "Add #{file} to git"
37
- `git add #{file}`
38
- end
39
-
40
- end