Skip to content

Commit

Permalink
$ bundle exec standardrb --fix
Browse files Browse the repository at this point in the history
  • Loading branch information
schneems committed Sep 26, 2023
1 parent 58a0c48 commit 729f560
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
3 changes: 1 addition & 2 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,9 @@ end

desc "Output the Rubygems version for a given binary"
task :rubygems_version, [:version, :stack] do |t, args|

command = DockerCommand.gem_version_from_tar(
stack: args[:stack],
ruby_version: RubyVersion.new(args[:version]),
ruby_version: RubyVersion.new(args[:version])
)
puts "Running: #{command}"
pipe(command)
Expand Down
2 changes: 1 addition & 1 deletion lib/docker_command.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module DockerCommand
def self.gem_version_from_tar(ruby_version: , stack: )
def self.gem_version_from_tar(ruby_version:, stack:)
"docker run -v $(pwd)/builds/#{stack}:/tmp/output hone/ruby-builder:#{stack} bash -c \"mkdir /tmp/unzipped && tar xzf /tmp/output/#{ruby_version.tar_file_name_output} -C /tmp/unzipped && echo 'Rubygems version is: ' && /tmp/unzipped/bin/gem -v\""
end
end
4 changes: 2 additions & 2 deletions spec/unit/docker_command_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
describe DockerCommand do
it "Generates docker command for outputting rubygems versions" do
actual = DockerCommand.gem_version_from_tar(ruby_version: RubyVersion.new("3.1.4"), stack: "heroku-22")
expected = %Q{docker run -v $(pwd)/builds/heroku-22:/tmp/output hone/ruby-builder:heroku-22 bash -c "mkdir /tmp/unzipped && tar xzf /tmp/output/ruby-3.1.4.tgz -C /tmp/unzipped && echo 'Rubygems version is: ' && /tmp/unzipped/bin/gem -v"}
expected = %{docker run -v $(pwd)/builds/heroku-22:/tmp/output hone/ruby-builder:heroku-22 bash -c "mkdir /tmp/unzipped && tar xzf /tmp/output/ruby-3.1.4.tgz -C /tmp/unzipped && echo 'Rubygems version is: ' && /tmp/unzipped/bin/gem -v"}
expect(actual).to eq(expected)
end

it "works with preview releases" do
actual = DockerCommand.gem_version_from_tar(ruby_version: RubyVersion.new("3.3.0-preview2"), stack: "heroku-22")
expected = %Q{docker run -v $(pwd)/builds/heroku-22:/tmp/output hone/ruby-builder:heroku-22 bash -c "mkdir /tmp/unzipped && tar xzf /tmp/output/ruby-3.3.0.tgz -C /tmp/unzipped && echo 'Rubygems version is: ' && /tmp/unzipped/bin/gem -v"}
expected = %{docker run -v $(pwd)/builds/heroku-22:/tmp/output hone/ruby-builder:heroku-22 bash -c "mkdir /tmp/unzipped && tar xzf /tmp/output/ruby-3.3.0.tgz -C /tmp/unzipped && echo 'Rubygems version is: ' && /tmp/unzipped/bin/gem -v"}
expect(actual).to eq(expected)
end
end

0 comments on commit 729f560

Please sign in to comment.