modulorails 1.5.0.pre2 → 1.5.0.pre3

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: 928b92b50a47d10967876fd9fec84d9f1e0da9b9082d642a48cb2ee0eb49be89
4
- data.tar.gz: 599f3d7b1546dfa9b294e8c09d9f1d429ad9d2b2ce69914c62f53e45cf213776
3
+ metadata.gz: 2e6eab252232df18bbd0d7cd328d568ed4dda0d254cf4db3842de66759be6349
4
+ data.tar.gz: 43051d6b7f325d46150a348a7fafd1efbff924bf43569311bb103e55392b2d4e
5
5
  SHA512:
6
- metadata.gz: 3bcc2bc9acd9c84f41dd80c60036adffdcc85eb4c79c549209852d8dd918806e5d488d40df6b222648512e056b4d09f0f94f894a97215472577d222eea1d996e
7
- data.tar.gz: '09cad76576542012ce824cd16891309d6d6e1b380b808e9839799294d099da9b9f6406a71be92a2d7ac8345044fd11c46bf9b8c28580fbb876b12ff06a8d86d3'
6
+ metadata.gz: 3f23a3e4df54aef59a6ee1f7aae9616b2554da45c9f6f625b040e3c2c5f47939073df02cfc41dab8f3a7e1b92f229e4b94d9de12b578c69a9b96dc3d73cf8db1
7
+ data.tar.gz: a2a3c61713a40049024c0905da304a0260750e922dedb4494068a7f03541b7a1d148d93f927405a4cba3aaf1cccfad3ee75c06774e3db2ad4975606cffe4dc42
@@ -67,7 +67,7 @@ class Modulorails::DockerGenerator < Modulorails::Generators::Base
67
67
 
68
68
  def create_new_file(old_file, new_file, executable: true)
69
69
  if File.exist?(old_file)
70
- copy_file old_file, new_file
70
+ copy_original_file old_file, new_file
71
71
  remove_file old_file
72
72
  else
73
73
  template old_file, new_file
@@ -75,4 +75,20 @@ class Modulorails::DockerGenerator < Modulorails::Generators::Base
75
75
  chmod new_file, 0o755 if executable
76
76
  end
77
77
 
78
+ def copy_original_file(source, *args, &block)
79
+ config = args.last.is_a?(Hash) ? args.pop : {}
80
+ destination = args.first || source
81
+ source = File.expand_path(source, destination_root)
82
+
83
+ create_file destination, nil, config do
84
+ content = File.binread(source)
85
+ content = yield(content) if block
86
+ content
87
+ end
88
+ if config[:mode] == :preserve
89
+ mode = File.stat(source).mode
90
+ chmod(destination, mode, config)
91
+ end
92
+ end
93
+
78
94
  end
@@ -3,6 +3,7 @@ set -e
3
3
 
4
4
  # shellcheck disable=SC2016
5
5
  VALID_LAST_INSTRUCTION='exec "${@}"'
6
+ VALID_LAST_INSTRUCTION2='exec "$@"'
6
7
 
7
8
  # Check if the Dockerfile exists
8
9
  check_dockerfile() {
@@ -39,7 +40,7 @@ check_entrypoint() {
39
40
 
40
41
  last_line=$(tail -n 1 "$el" | xargs)
41
42
 
42
- if [ "$last_line" != "$VALID_LAST_INSTRUCTION" ]; then
43
+ if [ "$last_line" != "$VALID_LAST_INSTRUCTION" ] && [ "$last_line" != "$VALID_LAST_INSTRUCTION2" ]; then
43
44
  echo "Invalid entrypoint: Last instruction should be '$VALID_LAST_INSTRUCTION' instead of '$last_line'"
44
45
  return 1
45
46
  fi
@@ -1,6 +1,6 @@
1
1
  module Modulorails
2
2
 
3
- VERSION = '1.5.0.pre2'.freeze
3
+ VERSION = '1.5.0.pre3'.freeze
4
4
 
5
5
  # Useful to compare the current Ruby version
6
6
  COMPARABLE_RUBY_VERSION = Gem::Version.new(RUBY_VERSION)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: modulorails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0.pre2
4
+ version: 1.5.0.pre3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthieu Ciappara
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-10-22 00:00:00.000000000 Z
11
+ date: 2024-10-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler-audit