dockerfile-rails 1.6.9 → 1.6.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8273f4e7e16fa5763ebfee285648dfede6ec020e51d51e3e9b8caf5b70333aba
4
- data.tar.gz: 16824fb5f76c53dcf5fb0ebca40335591def91034e9cdfea59d12f0b44fb1fed
3
+ metadata.gz: d778306a922152b1b8fa89406d1afcb45d977c0d5b9bb468340464dbfa9dddbe
4
+ data.tar.gz: e9bf92490211e18e117ccc5164761e2fa5ff3d32d886762e3bbb95d7e506b37c
5
5
  SHA512:
6
- metadata.gz: 682c85b4a0a4d5e7157e39bb300b17ec4eff7be7beb98a6431b74d36d7e4f0dfa3d9b3bb81bfe5d31852423fc750595366ca503b9a44ac05a83acb5187afe1c1
7
- data.tar.gz: c015796534771823bf606a22165d76899dd21745ac580d6bcc0b8aa780ef0ddf1427818536120616bf91eb3ea686838cf5f42b718b5d36804db6f59b3abc2a58
6
+ metadata.gz: e5be4fcf0d992d8c3fedf4fa3ccc216fddf02c132eeae4313498a11bdee40ea67f2680d7933339ad36ffc339294501cbc06b9377d70aee544c6c37e112d1bcce
7
+ data.tar.gz: f23457093b3fd65b398770231cfc805efef41acf90419a742e7ac1e9d804e6bbddb3c1943cec9b47f8fd11a56833a31367d72dcd834595a6f15bd6b671d2bc09
@@ -364,6 +364,30 @@ class DockerfileGenerator < Rails::Generators::Base
364
364
  elsif File.exist? "config/dockerfile.yml"
365
365
  remove_file "config/dockerfile.yml"
366
366
  end
367
+
368
+ # check Dockerfile for common errors: missing packages, mismatched Ruby version
369
+ if options.skip? && File.exist?("Dockerfile")
370
+ message = nil
371
+ shell = Thor::Base.shell.new
372
+
373
+ dockerfile = IO.read("Dockerfile")
374
+ missing = Set.new(base_packages + build_packages) -
375
+ Set.new(dockerfile.scan(/[-\w]+/))
376
+
377
+ unless missing.empty?
378
+ message = "The following packages are missing from the Dockerfile: #{missing.to_a.join(", ")}"
379
+ STDERR.puts "\n" + shell.set_color(message, Thor::Shell::Color::RED, Thor::Shell::Color::BOLD)
380
+ end
381
+
382
+ ruby_version = dockerfile.match(/ARG RUBY_VERSION=(\d+\.\d+\.\d+)/)[1]
383
+
384
+ if ruby_version && ruby_version != RUBY_VERSION
385
+ message = "The Ruby version in the Dockerfile (#{ruby_version}) does not match the Ruby version of the Rails app (#{RUBY_VERSION})"
386
+ STDERR.puts "\n" + shell.set_color(message, Thor::Shell::Color::RED, Thor::Shell::Color::BOLD)
387
+ end
388
+
389
+ exit 42 if message
390
+ end
367
391
  end
368
392
 
369
393
  private
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dockerfile-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.9
4
+ version: 1.6.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Ruby
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-04-25 00:00:00.000000000 Z
11
+ date: 2024-05-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -74,7 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  requirements: []
77
- rubygems_version: 3.5.4
77
+ rubygems_version: 3.5.9
78
78
  signing_key:
79
79
  specification_version: 4
80
80
  summary: Dockerfile generator for Rails