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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +24 -0
- data/Gemfile +3 -0
- data/lib/generators/modulorails/bundleraudit/bundleraudit_generator.rb +13 -8
- data/lib/generators/modulorails/docker/docker_generator.rb +58 -15
- data/lib/generators/modulorails/docker/templates/config/cable.yml.tt +6 -6
- data/lib/generators/modulorails/docker/templates/config/database.yml.tt +3 -15
- data/lib/generators/modulorails/docker/templates/config/initializers/0_redis.rb +2 -0
- data/lib/generators/modulorails/docker/templates/config/puma.rb +41 -0
- data/lib/generators/modulorails/docker/templates/docker-compose.yml.tt +14 -7
- data/lib/generators/modulorails/docker/templates/{Dockerfile.prod.tt → dockerfiles/modulotech/Dockerfile.prod.tt} +9 -7
- data/lib/generators/modulorails/docker/templates/{Dockerfile.tt → dockerfiles/modulotech/Dockerfile.tt} +3 -1
- data/lib/generators/modulorails/docker/templates/dockerfiles/rails/Dockerfile.prod.tt +87 -0
- data/lib/generators/modulorails/docker/templates/entrypoints/docker-entrypoint.sh.tt +13 -9
- data/lib/generators/modulorails/githooks/githooks_generator.rb +57 -0
- data/lib/generators/modulorails/githooks/templates/dockeruby.sh +112 -0
- data/lib/generators/modulorails/githooks/templates/post-rewrite.sh +5 -0
- data/lib/generators/modulorails/githooks/templates/pre-merge-commit.sh +2 -0
- data/lib/generators/modulorails/githooks/templates/refresh_generations.sh +25 -0
- data/lib/generators/modulorails/gitlabci/gitlabci_generator.rb +5 -19
- data/lib/generators/modulorails/gitlabci/templates/.gitlab-ci.yml.tt +15 -3
- data/lib/generators/modulorails/gitlabci/templates/config/deploy/production.yaml.tt +15 -0
- data/lib/generators/modulorails/gitlabci/templates/config/deploy/review.yaml.tt +15 -0
- data/lib/generators/modulorails/gitlabci/templates/config/deploy/staging.yaml.tt +15 -0
- data/lib/generators/modulorails/health_check/health_check_generator.rb +29 -0
- data/lib/generators/modulorails/{healthcheck → health_check}/templates/.modulorails-health_check +2 -0
- data/lib/generators/modulorails/moduloproject/moduloproject_generator.rb +42 -0
- data/lib/generators/modulorails/moduloproject/templates/config/environments/production.rb.tt +109 -0
- data/lib/generators/modulorails/rubocop/rubocop_generator.rb +1 -0
- data/lib/generators/modulorails/self_update/self_update_generator.rb +3 -2
- data/lib/generators/modulorails/service/service_generator.rb +2 -2
- data/lib/generators/modulorails/service/templates/service.rb.tt +4 -11
- data/lib/generators/modulorails/sidekiq/sidekiq_generator.rb +41 -45
- data/lib/modulorails/data.rb +10 -6
- data/lib/modulorails/generators/base.rb +79 -0
- data/lib/modulorails/railtie.rb +6 -0
- data/lib/modulorails/services/base_service.rb +22 -12
- data/lib/modulorails/services/logs_for_method_service.rb +5 -0
- data/lib/modulorails/version.rb +1 -1
- data/lib/modulorails.rb +23 -12
- data/modulorails.gemspec +9 -10
- metadata +37 -54
- data/lib/generators/modulorails/docker/templates/docker-compose.prod.yml.tt +0 -49
- data/lib/generators/modulorails/healthcheck/health_check_generator.rb +0 -40
- /data/lib/generators/modulorails/{healthcheck → health_check}/templates/config/initializers/health_check.rb.tt +0 -0
@@ -9,11 +9,11 @@ class Modulorails::SidekiqGenerator < Rails::Generators::Base
|
|
9
9
|
desc 'This generator adds Sidekiq to the project'
|
10
10
|
|
11
11
|
def add_to_docker_compose
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
12
|
+
if Rails.root.join('compose.yml').exist?
|
13
|
+
add_to_docker_compose_yml_file(Rails.root.join('compose.yml'))
|
14
|
+
elsif Rails.root.join('docker-compose.yml').exist?
|
15
|
+
add_to_docker_compose_yml_file(Rails.root.join('docker-compose.yml'))
|
16
|
+
end
|
17
17
|
end
|
18
18
|
|
19
19
|
def add_to_deploy_files
|
@@ -26,18 +26,16 @@ class Modulorails::SidekiqGenerator < Rails::Generators::Base
|
|
26
26
|
gemfile_path = Rails.root.join('Gemfile')
|
27
27
|
|
28
28
|
# Add gem redis unless already present
|
29
|
-
unless File.read(gemfile_path).match?(/^\s*gem ['"]redis['"]/)
|
30
|
-
append_to_file(gemfile_path, "gem 'redis'\n")
|
31
|
-
end
|
29
|
+
append_to_file(gemfile_path, "gem 'redis'\n") unless File.read(gemfile_path).match?(/^\s*gem ['"]redis['"]/)
|
32
30
|
|
33
31
|
# Add gem sidekiq unless already present
|
34
|
-
|
35
|
-
|
36
|
-
|
32
|
+
return if File.read(gemfile_path).match?(/^\s*gem ['"]sidekiq['"]/)
|
33
|
+
|
34
|
+
append_to_file(gemfile_path, "gem 'sidekiq'\n")
|
37
35
|
end
|
38
36
|
|
39
37
|
def add_to_config
|
40
|
-
|
38
|
+
Rails.root.glob('config/environments/*.rb') do |file|
|
41
39
|
add_to_config_file(file)
|
42
40
|
end
|
43
41
|
end
|
@@ -49,23 +47,24 @@ class Modulorails::SidekiqGenerator < Rails::Generators::Base
|
|
49
47
|
def add_routes
|
50
48
|
routes_path = Rails.root.join('config/routes.rb')
|
51
49
|
|
52
|
-
|
53
|
-
|
54
|
-
|
50
|
+
return if File.read(routes_path).match?(%r{require ['"]sidekiq/web["']})
|
51
|
+
|
52
|
+
inject_into_file routes_path, after: "Rails.application.routes.draw do\n" do
|
53
|
+
<<-RUBY
|
55
54
|
require 'sidekiq/web'
|
56
55
|
mount Sidekiq::Web => '/sidekiq'
|
57
56
|
|
58
|
-
|
59
|
-
end
|
57
|
+
RUBY
|
60
58
|
end
|
61
59
|
end
|
62
60
|
|
63
61
|
def add_health_check
|
64
62
|
file_path = Rails.root.join('config/initializers/health_check.rb')
|
65
63
|
|
66
|
-
|
67
|
-
|
68
|
-
|
64
|
+
return if File.read(file_path).match?(/add_custom_check\s*\(?\s*['"]sidekiq-queues['"]\s*\)?/)
|
65
|
+
|
66
|
+
inject_into_file file_path, after: /^HealthCheck.setup do \|config\|\n$/ do
|
67
|
+
<<-RUBY
|
69
68
|
|
70
69
|
# Add one or more custom checks that return a blank string if ok, or an error message if there is an error
|
71
70
|
config.add_custom_check('sidekiq-queues') do
|
@@ -87,14 +86,13 @@ class Modulorails::SidekiqGenerator < Rails::Generators::Base
|
|
87
86
|
# Less than 200 jobs to retry, ok!
|
88
87
|
retry_jobs_count < 200 ? '' : "\#{retry_jobs_count} are waiting for retry."
|
89
88
|
end
|
90
|
-
|
91
|
-
end
|
89
|
+
RUBY
|
92
90
|
end
|
93
91
|
end
|
94
92
|
|
95
93
|
def add_entrypoint
|
96
|
-
template 'entrypoints/sidekiq-entrypoint.sh'
|
97
|
-
chmod '
|
94
|
+
template 'entrypoints/sidekiq-entrypoint.sh', 'bin/sidekiq-entrypoint'
|
95
|
+
chmod 'bin/sidekiq-entrypoint', 0o755
|
98
96
|
end
|
99
97
|
|
100
98
|
private
|
@@ -103,10 +101,7 @@ class Modulorails::SidekiqGenerator < Rails::Generators::Base
|
|
103
101
|
@image_name ||= Modulorails.data.name.parameterize
|
104
102
|
|
105
103
|
# Create docker-compose.yml unless present
|
106
|
-
unless File.exist?(file_path)
|
107
|
-
# Modulorails::GitlabciGenerator.new([], {}, {}).invoke_all
|
108
|
-
invoke(Modulorails::DockerGenerator, [])
|
109
|
-
end
|
104
|
+
invoke(Modulorails::DockerGenerator, []) unless File.exist?(file_path)
|
110
105
|
|
111
106
|
return if File.read(file_path).match?(/^ {2}sidekiq:$/)
|
112
107
|
|
@@ -129,7 +124,7 @@ class Modulorails::SidekiqGenerator < Rails::Generators::Base
|
|
129
124
|
#{@image_name.upcase}_DATABASE_HOST: database
|
130
125
|
#{@image_name.upcase}_DATABASE_NAME: #{@image_name}
|
131
126
|
REDIS_URL: redis://redis:6379/1
|
132
|
-
entrypoint: ./
|
127
|
+
entrypoint: ./bin/sidekiq-entrypoint
|
133
128
|
stdin_open: true
|
134
129
|
tty: true
|
135
130
|
YAML
|
@@ -156,23 +151,24 @@ class Modulorails::SidekiqGenerator < Rails::Generators::Base
|
|
156
151
|
|
157
152
|
# Add sidekiq to deploy file
|
158
153
|
insert_into_file file_path do
|
159
|
-
|
160
|
-
|
161
|
-
sidekiq:
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
154
|
+
<<~YAML
|
155
|
+
|
156
|
+
sidekiq:
|
157
|
+
enabled: true
|
158
|
+
resources:
|
159
|
+
requests:
|
160
|
+
cpu: 100m
|
161
|
+
memory: 512Mi
|
162
|
+
limits:
|
163
|
+
cpu: 100m
|
164
|
+
memory: 512Mi
|
165
|
+
autoscaling:
|
166
|
+
enabled: true
|
167
|
+
minReplicas: 1
|
168
|
+
maxReplicas: 10
|
169
|
+
targetCPUUtilizationPercentage: 80
|
175
170
|
YAML
|
176
171
|
end
|
177
172
|
end
|
173
|
+
|
178
174
|
end
|
data/lib/modulorails/data.rb
CHANGED
@@ -125,23 +125,27 @@ module Modulorails
|
|
125
125
|
loaded_specs = Gem.loaded_specs
|
126
126
|
|
127
127
|
# The Rails version used by the application
|
128
|
-
@rails_version = loaded_specs['rails']
|
128
|
+
@rails_version = gem_version(loaded_specs['rails'])
|
129
129
|
|
130
130
|
# The bundler version used by the application (especially useful since Bundler 2 and
|
131
131
|
# Bundler 1 are not compatible)
|
132
|
-
@bundler_version = loaded_specs['bundler']
|
132
|
+
@bundler_version = gem_version(loaded_specs['bundler'])
|
133
133
|
|
134
134
|
# The version of the ActiveRecord adapter
|
135
|
-
@adapter_version = loaded_specs[@adapter]
|
135
|
+
@adapter_version = gem_version(loaded_specs[@adapter])
|
136
136
|
|
137
137
|
# The version of the webpacker gem - might be nil
|
138
|
-
@webpacker_version = loaded_specs['webpacker']
|
138
|
+
@webpacker_version = gem_version(loaded_specs['webpacker'])
|
139
139
|
|
140
140
|
# The version of the importmap-rails gem - might be nil
|
141
|
-
@importmap_version = loaded_specs['importmap-rails']
|
141
|
+
@importmap_version = gem_version(loaded_specs['importmap-rails'])
|
142
142
|
|
143
143
|
# The version of the jsbundling-rails gem - might be nil
|
144
|
-
@jsbundling_version = loaded_specs['jsbundling-rails']
|
144
|
+
@jsbundling_version = gem_version(loaded_specs['jsbundling-rails'])
|
145
|
+
end
|
146
|
+
|
147
|
+
def gem_version(spec)
|
148
|
+
spec&.version&.version
|
145
149
|
end
|
146
150
|
|
147
151
|
def initialize_from_git
|
@@ -0,0 +1,79 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rails/generators'
|
4
|
+
|
5
|
+
module Modulorails
|
6
|
+
|
7
|
+
module Generators
|
8
|
+
|
9
|
+
class Base < Rails::Generators::Base
|
10
|
+
|
11
|
+
def self.base_root
|
12
|
+
File.expand_path('../../generators', __dir__)
|
13
|
+
end
|
14
|
+
|
15
|
+
class_option :force, type: :boolean, default: false
|
16
|
+
|
17
|
+
def call
|
18
|
+
return if keep_file_present? && !options['force']
|
19
|
+
|
20
|
+
begin
|
21
|
+
create_config
|
22
|
+
create_keep_file
|
23
|
+
rescue StandardError => e
|
24
|
+
warn("[Modulorails][#{generator_name}] Error: #{e.message}")
|
25
|
+
warn(e.backtrace.join("\n"))
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
protected
|
30
|
+
|
31
|
+
def version
|
32
|
+
self.class.const_get('VERSION')
|
33
|
+
rescue NameError
|
34
|
+
1
|
35
|
+
end
|
36
|
+
|
37
|
+
def generator_name
|
38
|
+
self.class.name.split('::').last.gsub('Generator', '').parameterize
|
39
|
+
end
|
40
|
+
|
41
|
+
def keep_file_name
|
42
|
+
".modulorails-#{generator_name}"
|
43
|
+
end
|
44
|
+
|
45
|
+
def keep_file_present?
|
46
|
+
pathname = Rails.root.join(keep_file_name)
|
47
|
+
|
48
|
+
res = pathname.exist?
|
49
|
+
return res if version < 2
|
50
|
+
|
51
|
+
res && pathname.readlines(keep_file_name).first
|
52
|
+
.match(/version: (\d+)/i)&.send(:[], 1).to_i >= version
|
53
|
+
end
|
54
|
+
|
55
|
+
def create_keep_file
|
56
|
+
file = keep_file_name
|
57
|
+
|
58
|
+
remove_file(file)
|
59
|
+
|
60
|
+
content = <<~TEXT
|
61
|
+
Version: #{version}
|
62
|
+
|
63
|
+
If you want to reset your configuration, you can run `rails g modulorails:#{generator_name} --force`.
|
64
|
+
TEXT
|
65
|
+
create_file(file, content)
|
66
|
+
|
67
|
+
say "Add #{file} to git"
|
68
|
+
git add: file
|
69
|
+
end
|
70
|
+
|
71
|
+
def create_config
|
72
|
+
raise NotImplementedError
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
76
|
+
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|
data/lib/modulorails/railtie.rb
CHANGED
@@ -43,12 +43,18 @@ module Modulorails
|
|
43
43
|
# Effectively send the data to the intranet
|
44
44
|
Modulorails.send_data
|
45
45
|
|
46
|
+
# Generate a template for Docker configuration
|
47
|
+
Modulorails.generate_docker_template
|
48
|
+
|
46
49
|
# Generate a template for CI/CD
|
47
50
|
Modulorails.generate_ci_template
|
48
51
|
|
49
52
|
# Add/update Rubocop config
|
50
53
|
Modulorails.generate_rubocop_template
|
51
54
|
|
55
|
+
# Add git hooks
|
56
|
+
Modulorails.generate_git_hooks_template
|
57
|
+
|
52
58
|
# Add/update Bundler-audit config
|
53
59
|
Modulorails.generate_bundleraudit_template
|
54
60
|
|
@@ -4,7 +4,7 @@
|
|
4
4
|
class Modulorails::BaseService
|
5
5
|
|
6
6
|
# Allow to instantiate the service and call the service in one go.
|
7
|
-
if
|
7
|
+
if Gem::Version.new('3.0') > Modulorails::COMPARABLE_RUBY_VERSION
|
8
8
|
def self.call(*args, &block)
|
9
9
|
new(*args, &block).call
|
10
10
|
end
|
@@ -45,18 +45,22 @@ class Modulorails::BaseService
|
|
45
45
|
# @param method [#to_s] The method calling `#log`
|
46
46
|
# @param message [Hash,#to_s] The message to log; Hash will be logged after a #to_json call
|
47
47
|
def log(method, message)
|
48
|
+
ActiveSupport::Deprecation.warn(<<~MESSAGE)
|
49
|
+
Modulorails::BaseService#log is deprecated and will be removed with version 2.0.
|
50
|
+
Use Rails.logger.debug directly with objects instead.
|
51
|
+
MESSAGE
|
52
|
+
|
48
53
|
Modulorails::LogsForMethodService.call(method: method, message: message, tags: [self])
|
49
54
|
end
|
50
55
|
|
56
|
+
# @param data [Object] The data to pass to the block
|
51
57
|
# @yield Wrap the given block in an ActiveRecord transaction.
|
52
58
|
# @yieldreturn [Object] Will be available as data of the `SuccessData` returned by the method
|
53
59
|
# @return [SuccessData] If the transaction was not rollbacked; give access to the block's return.
|
54
60
|
# @return [ErrorData] If the transaction was rollbacked; give access to the rollbacking exception.
|
55
|
-
def with_transaction
|
56
|
-
data =
|
57
|
-
|
58
|
-
ActiveRecord::Base.transaction do
|
59
|
-
data = yield
|
61
|
+
def with_transaction(data: nil)
|
62
|
+
data = ActiveRecord::Base.transaction do
|
63
|
+
yield(data)
|
60
64
|
end
|
61
65
|
|
62
66
|
::Modulorails::SuccessData.new(data)
|
@@ -65,22 +69,28 @@ class Modulorails::BaseService
|
|
65
69
|
::Modulorails::ErrorData.new(e.message, exception: e)
|
66
70
|
rescue StandardError => e
|
67
71
|
# Unknown error, log the error
|
68
|
-
|
69
|
-
Rails.logger.error("Local variables: #{local_variables.map! { |v|
|
70
|
-
{ v => binding.local_variable_get(v) }
|
71
|
-
} }")
|
72
|
-
Rails.logger.error(e.backtrace&.join("\n"))
|
72
|
+
log_exception(e, caller: self, method: __method__)
|
73
73
|
|
74
74
|
# Return the error
|
75
75
|
::Modulorails::ErrorData.new(e.message, exception: e)
|
76
76
|
end
|
77
77
|
|
78
|
+
def log_exception(exception, user: nil, caller: self, method: __method__)
|
79
|
+
message = {
|
80
|
+
controller: caller.class.name, action: method,
|
81
|
+
error: { kind: exception.class.name, message: exception.message, stack: exception.backtrace },
|
82
|
+
time: Time.zone.now.iso8601, user: user
|
83
|
+
}
|
84
|
+
|
85
|
+
Rails.logger.error(message.to_json)
|
86
|
+
end
|
87
|
+
|
78
88
|
# Cast the date/datetime parameters to time with zones.
|
79
89
|
# @param from [String,ActiveSupport::TimeWithZone] the minimum date
|
80
90
|
# @param to [String,ActiveSupport::TimeWithZone] the maximum date
|
81
91
|
# @return [[ActiveSupport::TimeWithZone, ActiveSupport::TimeWithZone]] The given dates casted.
|
82
92
|
def params_to_time(from, to=nil)
|
83
|
-
from = from.is_a?(String) && from.present?
|
93
|
+
from = from.to_time_with_zone if from.is_a?(String) && from.present?
|
84
94
|
to = if to.is_a?(String) && to.present?
|
85
95
|
to = to.to_time_with_zone
|
86
96
|
|
@@ -14,6 +14,11 @@ class Modulorails::LogsForMethodService < Modulorails::BaseService
|
|
14
14
|
|
15
15
|
# Write a formatted debug log using given initialization parameters
|
16
16
|
def call
|
17
|
+
ActiveSupport::Deprecation.warn(<<~MESSAGE)
|
18
|
+
Modulorails::LogsForMethodService is deprecated and will be removed with version 2.0.
|
19
|
+
Use Rails.logger.debug directly with objects instead.
|
20
|
+
MESSAGE
|
21
|
+
|
17
22
|
# Map the tags (either objects responding to #to_tag or strings) to prefix the log body
|
18
23
|
tag_strings = @tags.map do |tag|
|
19
24
|
tag.respond_to?(:to_tag) ? "[#{tag.to_tag}]" : "[#{tag}]"
|
data/lib/modulorails/version.rb
CHANGED
data/lib/modulorails.rb
CHANGED
@@ -2,11 +2,13 @@ require 'modulorails/version'
|
|
2
2
|
require 'modulorails/configuration'
|
3
3
|
require 'modulorails/data'
|
4
4
|
require 'modulorails/railtie' if defined?(Rails::Railtie)
|
5
|
+
require 'generators/modulorails/docker/docker_generator'
|
5
6
|
require 'generators/modulorails/gitlabci/gitlabci_generator'
|
6
|
-
require 'generators/modulorails/
|
7
|
+
require 'generators/modulorails/health_check/health_check_generator'
|
7
8
|
require 'generators/modulorails/self_update/self_update_generator'
|
8
9
|
require 'generators/modulorails/rubocop/rubocop_generator'
|
9
10
|
require 'generators/modulorails/bundleraudit/bundleraudit_generator'
|
11
|
+
require 'generators/modulorails/githooks/githooks_generator'
|
10
12
|
require 'httparty'
|
11
13
|
require 'modulorails/error_data'
|
12
14
|
require 'modulorails/success_data'
|
@@ -75,9 +77,7 @@ module Modulorails
|
|
75
77
|
# If no endpoint and/or no API key is configured, it is impossible to send the data to the
|
76
78
|
# intranet and thus we raise an error: it is the only error we want to raise since it goes
|
77
79
|
# against one of the main goals of the gem and the gem's user is responsible.
|
78
|
-
unless configuration.endpoint && configuration.api_key
|
79
|
-
raise Error.new('No endpoint or api key')
|
80
|
-
end
|
80
|
+
raise Error.new('No endpoint or api key') unless configuration.endpoint && configuration.api_key
|
81
81
|
|
82
82
|
# Define the headers of the request ; sending JSON and API key to authenticate the gem on
|
83
83
|
# the intranet
|
@@ -97,25 +97,31 @@ module Modulorails
|
|
97
97
|
# went wrong with an `errors` field. We do not want to raise since the gem's user is not
|
98
98
|
# (necessarily) responsible for the error but we still need to display it somewhere to warn
|
99
99
|
# the user something went wrong.
|
100
|
-
|
100
|
+
Rails.logger.debug { "[Modulorails] Error: #{response['errors'].join(', ')}" } if response.code == 400
|
101
101
|
|
102
102
|
# Return the response to allow users to do some more
|
103
103
|
response
|
104
104
|
rescue StandardError => e
|
105
105
|
# Still need to notify the user
|
106
|
-
|
107
|
-
|
106
|
+
Rails.logger.debug { "[Modulorails] Error: Could not post to #{configuration.endpoint}" }
|
107
|
+
Rails.logger.debug e.message
|
108
108
|
nil
|
109
109
|
end
|
110
110
|
end
|
111
111
|
|
112
|
+
# @author Matthieu 'ciappa_m' Ciappara
|
113
|
+
#
|
114
|
+
# Generate a Docker config template unless it was already done.
|
115
|
+
# The check is done using a 'keepfile'.
|
116
|
+
def generate_docker_template
|
117
|
+
Modulorails::DockerGenerator.new([], {}, {}).invoke_all
|
118
|
+
end
|
119
|
+
|
112
120
|
# @author Matthieu 'ciappa_m' Ciappara
|
113
121
|
#
|
114
122
|
# Generate a CI/CD template unless it was already done.
|
115
123
|
# The check is done using a 'keepfile'.
|
116
124
|
def generate_ci_template
|
117
|
-
return if File.exist?(Rails.root.join('.modulorails-gitlab-ci'))
|
118
|
-
|
119
125
|
Modulorails::GitlabciGenerator.new([], {}, {}).invoke_all
|
120
126
|
end
|
121
127
|
|
@@ -128,7 +134,7 @@ module Modulorails
|
|
128
134
|
|
129
135
|
Modulorails::SelfUpdateGenerator.new([], {}, {}).invoke_all
|
130
136
|
rescue StandardError => e
|
131
|
-
|
137
|
+
Rails.logger.debug { "[Modulorails] An error occured: #{e.class} - #{e.message}" }
|
132
138
|
end
|
133
139
|
|
134
140
|
# @author Matthieu 'ciappa_m' Ciappara
|
@@ -136,8 +142,6 @@ module Modulorails
|
|
136
142
|
# Generate a health_check configuration unless it was already done.
|
137
143
|
# The check is done using a 'keepfile'.
|
138
144
|
def generate_healthcheck_template
|
139
|
-
return if File.exist?(Rails.root.join('.modulorails-health_check'))
|
140
|
-
|
141
145
|
Modulorails::HealthCheckGenerator.new([], {}, {}).invoke_all
|
142
146
|
end
|
143
147
|
|
@@ -155,6 +159,13 @@ module Modulorails
|
|
155
159
|
Modulorails::BundlerauditGenerator.new([], {}, {}).invoke_all
|
156
160
|
end
|
157
161
|
|
162
|
+
# @author Matthieu 'ciappa_m' Ciappara
|
163
|
+
#
|
164
|
+
# Generate git hooks.
|
165
|
+
def generate_git_hooks_template
|
166
|
+
Modulorails::GithooksGenerator.new([], {}, {}).invoke_all
|
167
|
+
end
|
168
|
+
|
158
169
|
end
|
159
170
|
|
160
171
|
end
|
data/modulorails.gemspec
CHANGED
@@ -29,15 +29,14 @@ Gem::Specification.new do |spec|
|
|
29
29
|
end
|
30
30
|
spec.require_paths = ['lib']
|
31
31
|
|
32
|
-
spec.
|
33
|
-
spec.
|
34
|
-
spec.
|
35
|
-
spec.
|
36
|
-
spec.
|
37
|
-
spec.
|
38
|
-
spec.
|
39
|
-
spec.
|
32
|
+
spec.add_dependency 'bundler-audit', '~> 0.9.1'
|
33
|
+
spec.add_dependency 'git', '~> 1.7', '>= 1.7.0'
|
34
|
+
spec.add_dependency 'health_check', '~> 3.1'
|
35
|
+
spec.add_dependency 'httparty', '>= 0.13.3'
|
36
|
+
spec.add_dependency 'i18n', '>= 0.9.5'
|
37
|
+
spec.add_dependency 'railties', '>= 4.2.0'
|
38
|
+
spec.add_dependency 'rubocop', '>= 1.28.2'
|
39
|
+
spec.add_dependency 'rubocop-rails', '>= 2.14.2'
|
40
40
|
|
41
|
-
spec.
|
42
|
-
spec.add_development_dependency 'appraisal'
|
41
|
+
spec.metadata['rubygems_mfa_required'] = 'true'
|
43
42
|
end
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: modulorails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0.pre2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthieu Ciappara
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-10-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler-audit
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.9.1
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.9.1
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: git
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -114,48 +128,6 @@ dependencies:
|
|
114
128
|
- - ">="
|
115
129
|
- !ruby/object:Gem::Version
|
116
130
|
version: 2.14.2
|
117
|
-
- !ruby/object:Gem::Dependency
|
118
|
-
name: bundler-audit
|
119
|
-
requirement: !ruby/object:Gem::Requirement
|
120
|
-
requirements:
|
121
|
-
- - "~>"
|
122
|
-
- !ruby/object:Gem::Version
|
123
|
-
version: 0.9.1
|
124
|
-
type: :runtime
|
125
|
-
prerelease: false
|
126
|
-
version_requirements: !ruby/object:Gem::Requirement
|
127
|
-
requirements:
|
128
|
-
- - "~>"
|
129
|
-
- !ruby/object:Gem::Version
|
130
|
-
version: 0.9.1
|
131
|
-
- !ruby/object:Gem::Dependency
|
132
|
-
name: activerecord
|
133
|
-
requirement: !ruby/object:Gem::Requirement
|
134
|
-
requirements:
|
135
|
-
- - ">="
|
136
|
-
- !ruby/object:Gem::Version
|
137
|
-
version: 4.2.0
|
138
|
-
type: :development
|
139
|
-
prerelease: false
|
140
|
-
version_requirements: !ruby/object:Gem::Requirement
|
141
|
-
requirements:
|
142
|
-
- - ">="
|
143
|
-
- !ruby/object:Gem::Version
|
144
|
-
version: 4.2.0
|
145
|
-
- !ruby/object:Gem::Dependency
|
146
|
-
name: appraisal
|
147
|
-
requirement: !ruby/object:Gem::Requirement
|
148
|
-
requirements:
|
149
|
-
- - ">="
|
150
|
-
- !ruby/object:Gem::Version
|
151
|
-
version: '0'
|
152
|
-
type: :development
|
153
|
-
prerelease: false
|
154
|
-
version_requirements: !ruby/object:Gem::Requirement
|
155
|
-
requirements:
|
156
|
-
- - ">="
|
157
|
-
- !ruby/object:Gem::Version
|
158
|
-
version: '0'
|
159
131
|
description: |
|
160
132
|
Modulorails is the common base for the Ruby on Rails project at Modulotech
|
161
133
|
(https://www.modulotech.fr/).
|
@@ -200,23 +172,32 @@ files:
|
|
200
172
|
- gemfiles/rails_70.gemfile
|
201
173
|
- lib/generators/modulorails/bundleraudit/bundleraudit_generator.rb
|
202
174
|
- lib/generators/modulorails/docker/docker_generator.rb
|
203
|
-
- lib/generators/modulorails/docker/templates/Dockerfile.prod.tt
|
204
|
-
- lib/generators/modulorails/docker/templates/Dockerfile.tt
|
205
175
|
- lib/generators/modulorails/docker/templates/config/cable.yml.tt
|
206
176
|
- lib/generators/modulorails/docker/templates/config/database.yml.tt
|
207
|
-
- lib/generators/modulorails/docker/templates/
|
177
|
+
- lib/generators/modulorails/docker/templates/config/initializers/0_redis.rb
|
178
|
+
- lib/generators/modulorails/docker/templates/config/puma.rb
|
208
179
|
- lib/generators/modulorails/docker/templates/docker-compose.yml.tt
|
180
|
+
- lib/generators/modulorails/docker/templates/dockerfiles/modulotech/Dockerfile.prod.tt
|
181
|
+
- lib/generators/modulorails/docker/templates/dockerfiles/modulotech/Dockerfile.tt
|
182
|
+
- lib/generators/modulorails/docker/templates/dockerfiles/rails/Dockerfile.prod.tt
|
209
183
|
- lib/generators/modulorails/docker/templates/entrypoints/docker-entrypoint.sh.tt
|
210
184
|
- lib/generators/modulorails/docker/templates/entrypoints/webpack-entrypoint.sh.tt
|
185
|
+
- lib/generators/modulorails/githooks/githooks_generator.rb
|
186
|
+
- lib/generators/modulorails/githooks/templates/dockeruby.sh
|
187
|
+
- lib/generators/modulorails/githooks/templates/post-rewrite.sh
|
188
|
+
- lib/generators/modulorails/githooks/templates/pre-merge-commit.sh
|
189
|
+
- lib/generators/modulorails/githooks/templates/refresh_generations.sh
|
211
190
|
- lib/generators/modulorails/gitlabci/gitlabci_generator.rb
|
212
191
|
- lib/generators/modulorails/gitlabci/templates/.gitlab-ci.yml.tt
|
213
192
|
- lib/generators/modulorails/gitlabci/templates/.modulorails-gitlab-ci
|
214
193
|
- lib/generators/modulorails/gitlabci/templates/config/deploy/production.yaml.tt
|
215
194
|
- lib/generators/modulorails/gitlabci/templates/config/deploy/review.yaml.tt
|
216
195
|
- lib/generators/modulorails/gitlabci/templates/config/deploy/staging.yaml.tt
|
217
|
-
- lib/generators/modulorails/
|
218
|
-
- lib/generators/modulorails/
|
219
|
-
- lib/generators/modulorails/
|
196
|
+
- lib/generators/modulorails/health_check/health_check_generator.rb
|
197
|
+
- lib/generators/modulorails/health_check/templates/.modulorails-health_check
|
198
|
+
- lib/generators/modulorails/health_check/templates/config/initializers/health_check.rb.tt
|
199
|
+
- lib/generators/modulorails/moduloproject/moduloproject_generator.rb
|
200
|
+
- lib/generators/modulorails/moduloproject/templates/config/environments/production.rb.tt
|
220
201
|
- lib/generators/modulorails/rubocop/rubocop_generator.rb
|
221
202
|
- lib/generators/modulorails/rubocop/templates/rubocop.yml.tt
|
222
203
|
- lib/generators/modulorails/self_update/self_update_generator.rb
|
@@ -234,6 +215,7 @@ files:
|
|
234
215
|
- lib/modulorails/errors/errors.rb
|
235
216
|
- lib/modulorails/errors/invalid_format_error.rb
|
236
217
|
- lib/modulorails/errors/invalid_value_error.rb
|
218
|
+
- lib/modulorails/generators/base.rb
|
237
219
|
- lib/modulorails/railtie.rb
|
238
220
|
- lib/modulorails/services/base_service.rb
|
239
221
|
- lib/modulorails/services/logs_for_method_service.rb
|
@@ -248,7 +230,8 @@ metadata:
|
|
248
230
|
homepage_uri: https://github.com/moduloTech/modulorails
|
249
231
|
source_code_uri: https://github.com/moduloTech/modulorails
|
250
232
|
changelog_uri: https://github.com/moduloTech/modulorails/blob/master/CHANGELOG.md
|
251
|
-
|
233
|
+
rubygems_mfa_required: 'true'
|
234
|
+
post_install_message:
|
252
235
|
rdoc_options: []
|
253
236
|
require_paths:
|
254
237
|
- lib
|
@@ -263,8 +246,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
263
246
|
- !ruby/object:Gem::Version
|
264
247
|
version: '0'
|
265
248
|
requirements: []
|
266
|
-
rubygems_version: 3.3
|
267
|
-
signing_key:
|
249
|
+
rubygems_version: 3.5.3
|
250
|
+
signing_key:
|
268
251
|
specification_version: 4
|
269
252
|
summary: Common base for Ruby on Rails projects at Modulotech
|
270
253
|
test_files: []
|