appraisal-run 1.0.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 3fe2d0f598707dfac6d652a257c8883cca3eca8910d474e1cc2026114e78f8b4
4
+ data.tar.gz: b066f980ee3c24962243ffe99764a645343795e840b2aac9f0b18c03376abbf6
5
+ SHA512:
6
+ metadata.gz: 90a3709daabb49372375756dab532f34cccb9bcd6f621a353509b935ad3e8ce7d6c73e27d009b9d67e7fb563ab3a99ed58a537a73ecf8f4595e09ccb1bc1651f
7
+ data.tar.gz: 07a579fffd8afcd4378e12533e27b741b498bc3c17aa3ee763f0ffc750d25bbfa0c8a9d5ede639904015ed359959dbfac3e9f12802c2b9680ed4c2e1ea4a9169
data/CHANGELOG.md ADDED
@@ -0,0 +1,3 @@
1
+ # 1.0.0
2
+
3
+ * Birthday!
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
4
+
5
+ group :development, :test do
6
+ gem "debug"
7
+ gem "rake"
8
+ end
9
+
10
+ group :test do
11
+ gem "rspec"
12
+ end
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2025 Cameron Dutro
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,55 @@
1
+ ## appraisal-run
2
+
3
+ Builds individual Docker containers from each of your gemfiles and runs the given command.
4
+
5
+ ## Intro
6
+
7
+ appraisal-run is a super simple CLI tool for running commands inside Docker containers. It's designed to operate across multiple gemfiles, such as the ones produced by the [Appraisal](https://github.com/thoughtbot/appraisal) tool.
8
+
9
+ Appraisal doesn't really have a way to run commands across all your gemfiles. It can _install_ gems from each gemfile, but often you need to specify a version of Ruby as well. Appraisal does not come with a mechanism for running installs across multiple versions of Ruby. That's where appraisal-run comes in.
10
+
11
+ ## Usage
12
+
13
+ The following examples use the following Appraisal file:
14
+
15
+ ```ruby
16
+ appraise 'rails-7.2' do
17
+ ruby '~> 3.3'
18
+ gem 'rails', '~> 7.2.0'
19
+ end
20
+
21
+ appraise 'rails-8.0' do
22
+ ruby '~> 3.4'
23
+ gem 'rails', '~> 8.0.0'
24
+ end
25
+ ```
26
+
27
+ Use the `ruby` gemfile method to lock each generated gemfile to a particular version of Ruby. If no ruby version is specified, appraisal-run will use the version of the currently running ruby executable.
28
+
29
+ After running `appraisal generate`, there should be two gemfiles in the gemfiles/ directory.
30
+
31
+ Make sure you have [Docker](https://www.docker.com/) (or [Podman](https://podman.io/)) installed. If you're using Podman, make sure you have the Docker compatibility settings turned on so the `docker` executable is available.
32
+
33
+ Finally, install appraisal-run by adding it to your gemfile or installing it via `gem install`, and run it like so:
34
+
35
+ ```
36
+ appraisal-run gemfiles/*.gemfile -- bundle exec rake
37
+ ```
38
+
39
+ The appraisal-run executable accepts a list of gemfile paths as arguments. The command to run in each container is specified after an `--` argument separator.
40
+
41
+ appraisal-run will iterate over each gemfile and:
42
+
43
+ 1. pull the Docker image for the appropriate version of Ruby.
44
+ 1. run `bundle install` inside a new container. Gems from the bundle are installed into vendor/bundle so they can be re-used across invocations.
45
+ 1. run the specified command.
46
+
47
+ appraisal-run mounts the current working directory inside the container so it has access to your project's code, tests, etc.
48
+
49
+ ## License
50
+
51
+ Licensed under the MIT license. See LICENSE for details.
52
+
53
+ ## Authors
54
+
55
+ * Cameron C. Dutro: http://github.com/camertron
data/Rakefile ADDED
@@ -0,0 +1,4 @@
1
+ require "bundler"
2
+ require "rubygems/package_task"
3
+
4
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1,17 @@
1
+ $:.unshift File.join(File.dirname(__FILE__), 'lib')
2
+ require "appraisal-run/version"
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = "appraisal-run"
6
+ s.version = ::AppraisalRun::VERSION
7
+ s.authors = ["Cameron Dutro"]
8
+ s.email = ["camertron@gmail.com"]
9
+ s.homepage = "http://github.com/camertron/appraisal-run"
10
+ s.description = s.summary = "Builds individual Docker containers from each of your gemfiles and runs the given command."
11
+ s.platform = Gem::Platform::RUBY
12
+
13
+ s.require_path = "lib"
14
+ s.executables << "appraisal-run"
15
+
16
+ s.files = Dir["{lib}/**/*", "Gemfile", "LICENSE", "CHANGELOG.md", "README.md", "Rakefile", "appraisal-run.gemspec"]
17
+ end
data/bin/appraisal-run ADDED
@@ -0,0 +1,41 @@
1
+ #! /usr/bin/env ruby
2
+
3
+ require "appraisal-run"
4
+
5
+ module AppraisalRun
6
+ class CLI
7
+ def initialize(argv)
8
+ @argv = argv
9
+ end
10
+
11
+ def gemfile_paths
12
+ @gemfile_paths ||= begin
13
+ idx = @argv.index("--")
14
+ @argv[0...idx]
15
+ end
16
+ end
17
+
18
+ def cmd
19
+ @cmd ||= begin
20
+ idx = @argv.index("--")
21
+ @argv[(idx + 1)..-1].join(" ")
22
+ end
23
+ end
24
+
25
+ def run!
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} "
32
+
33
+ system("docker pull #{ruby_tag}")
34
+ system("#{docker_run_prefix} bundle install")
35
+ system("#{docker_run_prefix} #{cmd}")
36
+ end
37
+ end
38
+ end
39
+ end
40
+
41
+ AppraisalRun::CLI.new(ARGV).run!
@@ -0,0 +1,44 @@
1
+ require 'set'
2
+
3
+ module AppraisalRun
4
+ class Gemfile
5
+ def self.load(gemfile_path)
6
+ new(gemfile_path)
7
+ end
8
+
9
+ attr_reader :ruby_version
10
+
11
+ def initialize(gemfile_path)
12
+ @gemfile_path = gemfile_path
13
+ instance_eval(File.read(gemfile_path), gemfile_path, 0)
14
+ end
15
+
16
+ def ruby(version)
17
+ @ruby_version = version
18
+ end
19
+
20
+ # this is probably the wrong thing to do
21
+ def git_source(*)
22
+ end
23
+
24
+ def gem(*)
25
+ end
26
+
27
+ def path(*)
28
+ end
29
+
30
+ def source(*)
31
+ end
32
+
33
+ def group(*)
34
+ end
35
+
36
+ def gemspec(*)
37
+ end
38
+
39
+ def eval_gemfile(path)
40
+ path = File.expand_path(path)
41
+ instance_eval(File.read(path), path, 0)
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module AppraisalRun
4
+ VERSION = "1.0.0"
5
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module AppraisalRun
4
+ autoload :Gemfile, "appraisal-run/gemfile"
5
+ end
metadata ADDED
@@ -0,0 +1,52 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: appraisal-run
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Cameron Dutro
8
+ bindir: bin
9
+ cert_chain: []
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies: []
12
+ description: Builds individual Docker containers from each of your gemfiles and runs
13
+ the given command.
14
+ email:
15
+ - camertron@gmail.com
16
+ executables:
17
+ - appraisal-run
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - CHANGELOG.md
22
+ - Gemfile
23
+ - LICENSE
24
+ - README.md
25
+ - Rakefile
26
+ - appraisal-run.gemspec
27
+ - bin/appraisal-run
28
+ - lib/appraisal-run.rb
29
+ - lib/appraisal-run/gemfile.rb
30
+ - lib/appraisal-run/version.rb
31
+ homepage: http://github.com/camertron/appraisal-run
32
+ licenses: []
33
+ metadata: {}
34
+ rdoc_options: []
35
+ require_paths:
36
+ - lib
37
+ required_ruby_version: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ required_rubygems_version: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ requirements: []
48
+ rubygems_version: 3.6.7
49
+ specification_version: 4
50
+ summary: Builds individual Docker containers from each of your gemfiles and runs the
51
+ given command.
52
+ test_files: []