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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3fe2d0f598707dfac6d652a257c8883cca3eca8910d474e1cc2026114e78f8b4
4
- data.tar.gz: b066f980ee3c24962243ffe99764a645343795e840b2aac9f0b18c03376abbf6
3
+ metadata.gz: 6e0ab401e9fd40efd2e05fad1c76c6240c1f654d0209fa9d8c80a238be311508
4
+ data.tar.gz: fa4d2b8af528c01fa1a5beb6a6f8731a928d4cd8185b48cd88d85df26d79bdb3
5
5
  SHA512:
6
- metadata.gz: 90a3709daabb49372375756dab532f34cccb9bcd6f621a353509b935ad3e8ce7d6c73e27d009b9d67e7fb563ab3a99ed58a537a73ecf8f4595e09ccb1bc1651f
7
- data.tar.gz: 07a579fffd8afcd4378e12533e27b741b498bc3c17aa3ee763f0ffc750d25bbfa0c8a9d5ede639904015ed359959dbfac3e9f12802c2b9680ed4c2e1ea4a9169
6
+ metadata.gz: 0ed2a0a6e04d337e1fa4b4c6cc0d1c9497ab21bcd313d9b77960929bc8701f02b255799f62a8741223bd43eb4261ab5c6aaf825c396f1bba9922368133a36c46
7
+ data.tar.gz: 24d1425541b755ae5a4f1a4296b5e2fcd9eb412ca9358bb26a8e2d0af418ea1ea1f48b8bf27135a6e129d6821c1e0b32a1cc6a7d8faceea7977e826c92bb51c8
data/CHANGELOG.md CHANGED
@@ -1,3 +1,5 @@
1
- # 1.0.0
1
+ # 1.1.0
2
+ * Allow each .gemfile to come with a sidecar .dockerfile that will be built into an image and used to run the given command instead of the default Ruby images.
2
3
 
4
+ # 1.0.0
3
5
  * Birthday!
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
- gemfile = Gemfile.load(gemfile_path)
28
- ruby_version = gemfile.ruby_version&.gsub(/[^\d\.]*/, "")
29
- ruby_version ||= RUBY_VERSION
30
- ruby_tag = "ruby:#{ruby_version}"
31
- docker_run_prefix = "docker run --rm -t -v \"#{Dir.getwd}:/src\" -w /src -e \"BUNDLE_GEMFILE=#{gemfile_path}\" -e \"BUNDLE_PATH=/src/vendor/bundle\" #{ruby_tag} "
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AppraisalRun
4
- VERSION = "1.0.0"
4
+ VERSION = "1.1.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appraisal-run
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cameron Dutro