appraisal-run 1.0.0 → 1.1.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/CHANGELOG.md +3 -1
- data/README.md +6 -0
- data/bin/appraisal-run +17 -6
- data/lib/appraisal-run/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6e0ab401e9fd40efd2e05fad1c76c6240c1f654d0209fa9d8c80a238be311508
|
|
4
|
+
data.tar.gz: fa4d2b8af528c01fa1a5beb6a6f8731a928d4cd8185b48cd88d85df26d79bdb3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0ed2a0a6e04d337e1fa4b4c6cc0d1c9497ab21bcd313d9b77960929bc8701f02b255799f62a8741223bd43eb4261ab5c6aaf825c396f1bba9922368133a36c46
|
|
7
|
+
data.tar.gz: 24d1425541b755ae5a4f1a4296b5e2fcd9eb412ca9358bb26a8e2d0af418ea1ea1f48b8bf27135a6e129d6821c1e0b32a1cc6a7d8faceea7977e826c92bb51c8
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
|
@@ -46,6 +46,12 @@ appraisal-run will iterate over each gemfile and:
|
|
|
46
46
|
|
|
47
47
|
appraisal-run mounts the current working directory inside the container so it has access to your project's code, tests, etc.
|
|
48
48
|
|
|
49
|
+
## Cusomizing the Docker Image
|
|
50
|
+
|
|
51
|
+
By default, appraisal-run pulls and runs the official Docker image for the version of Ruby specified in the gemfile (eg. ruby:3.4, ruby:2.7, etc). However, custom Docker images are also supported. If appraisal-run detects a Dockerfile with the same name as the gemfile, it will be used to build an image, and that image will be used to execute the given command.
|
|
52
|
+
|
|
53
|
+
For example, given a gemfile at gemfiles/foo.gemfile, appraisal-run will look for a Dockerfile at gemfiles/foo.dockerfile.
|
|
54
|
+
|
|
49
55
|
## License
|
|
50
56
|
|
|
51
57
|
Licensed under the MIT license. See LICENSE for details.
|
data/bin/appraisal-run
CHANGED
|
@@ -24,13 +24,24 @@ module AppraisalRun
|
|
|
24
24
|
|
|
25
25
|
def run!
|
|
26
26
|
gemfile_paths.each do |gemfile_path|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
gemfile_name = File.basename(gemfile_path).chomp(File.extname(gemfile_path))
|
|
28
|
+
dockerfile_path = File.join(File.dirname(gemfile_path), "#{gemfile_name}.dockerfile")
|
|
29
|
+
|
|
30
|
+
if File.exist?(dockerfile_path)
|
|
31
|
+
project_name = File.basename(Dir.getwd)
|
|
32
|
+
image_url = "#{project_name}:#{gemfile_name.gsub(/[^a-zA-Z0-9_]/, "_")}"
|
|
33
|
+
puts "Dockerfile detected"
|
|
34
|
+
system "docker build -f #{dockerfile_path} -t #{image_url} ."
|
|
35
|
+
else
|
|
36
|
+
gemfile = Gemfile.load(gemfile_path)
|
|
37
|
+
ruby_version = gemfile.ruby_version&.gsub(/[^\d\.]*/, "")
|
|
38
|
+
ruby_version ||= RUBY_VERSION
|
|
39
|
+
image_url = "ruby:#{ruby_version}"
|
|
40
|
+
system("docker pull #{image_url}")
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
docker_run_prefix = "docker run --rm -t -v \"#{Dir.getwd}:/src\" -w /src -e \"BUNDLE_GEMFILE=#{gemfile_path}\" -e \"BUNDLE_PATH=/src/vendor/bundle\" #{image_url} "
|
|
32
44
|
|
|
33
|
-
system("docker pull #{ruby_tag}")
|
|
34
45
|
system("#{docker_run_prefix} bundle install")
|
|
35
46
|
system("#{docker_run_prefix} #{cmd}")
|
|
36
47
|
end
|