Skip to content

Commit 2d4bf9b

Browse files
committed
Rename curlbash to container.
I feel like this better suits the purpose, as we could curlbash things but this feature can also just do regular Dockerfile/Containerfile things.
1 parent 0815d47 commit 2d4bf9b

File tree

5 files changed

+17
-18
lines changed

5 files changed

+17
-18
lines changed
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
require "fpm/package"
22
require "json"
33

4-
class FPM::Package::CurlBash < FPM::Package
4+
class FPM::Package::Container < FPM::Package
55

6-
option "--container-image", "IMAGE", "The container image to use when running the command", :default => "ubuntu:latest"
6+
option "--image", "IMAGE", "The container image to use when running the command", :default => "ubuntu:latest"
77

88
option "--setup", "SHELL COMMANDS", "Commands to run but not to include in the resulting package. For example, 'apt-get update' or other setup.", :multivalued => true
99

@@ -27,8 +27,8 @@ def input(entry)
2727
name = "whatever-#{$$}"
2828

2929
if File.exists?(entry)
30-
if attributes[:curlbash_setup_list]
31-
logger.warn("When the argument given is a file or directory, the --curlbash-setup flags are ignored. This is because fpm assumes any setup you want to do is done inside of your Dockerfile or Containerfile, and also because fpm does not know how to edit a Dockerfile to append these setup steps.")
30+
if attributes[:container_setup_list]
31+
logger.warn("When the argument given is a file or directory, the --container-setup flags are ignored. This is because fpm assumes any setup you want to do is done inside of your Dockerfile or Containerfile, and also because fpm does not know how to edit a Dockerfile to append these setup steps.")
3232
end
3333

3434
entryinfo = File.stat(entry)
@@ -44,7 +44,7 @@ def input(entry)
4444
# The given argument is not a path, so let's assume it's a shell command to run.
4545
# We'll need to generate a
4646

47-
content = template("curlbash.erb").result(binding)
47+
content = template("container.erb").result(binding)
4848
containerfile = build_path("Containerfile")
4949
File.write(containerfile, content)
5050

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
require "spec_setup"
2-
require "fpm/package/curlbash"
2+
require "fpm/package/container"
33
require "stud/temporary"
44

55
require "fpm/package/dir"
66

7-
describe FPM::Package::CurlBash do
7+
describe FPM::Package::Container do
88
context "with commands" do
99
after { subject.cleanup }
1010

@@ -18,7 +18,7 @@
1818

1919
context "with setup steps" do
2020
before do
21-
subject.attributes[:curlbash_setup_list] = [
21+
subject.attributes[:container_setup_list] = [
2222
"touch /usr/bin/example",
2323
"mkdir -p /hello/world",
2424
]
@@ -54,7 +54,7 @@
5454
end
5555

5656
context "and specifying the file directly" do
57-
let(:dockerfile) { File.expand_path("../../fixtures/curlbash/Dockerfile", File.dirname(__FILE__)) }
57+
let(:dockerfile) { File.expand_path("../../fixtures/container/Dockerfile", File.dirname(__FILE__)) }
5858

5959
before do
6060
subject.input(dockerfile)
@@ -66,10 +66,9 @@
6666
end
6767

6868
context "and giving a directory containing a Dockerfile or Containerfile" do
69-
let(:path) { File.expand_path("../../fixtures/curlbash", File.dirname(__FILE__)) }
69+
let(:path) { File.expand_path("../../fixtures/container", File.dirname(__FILE__)) }
7070

7171
before do
72-
p path
7372
subject.input(path)
7473
end
7574

templates/container.erb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FROM <%= attributes[:container_image] %>
2+
3+
<% attributes.fetch(:container_setup_list, []).each do |step| %>
4+
RUN <%= step %>
5+
<% end %>
6+
7+
RUN <%= entry %>

templates/curlbash.erb

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)