Skip to content

Commit

Permalink
Merge pull request #16 from JTabel/master
Browse files Browse the repository at this point in the history
Allow to set temp directory for downloads
  • Loading branch information
JTabel committed Dec 11, 2018
2 parents 1462f23 + 40e1d00 commit aef3f02
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion lib/fpm/fry/command.rb
Expand Up @@ -13,6 +13,9 @@ class Command < Clamp::Command
option '--debug', :flag, 'Turns on debugging'
option '--[no-]tls', :flag, 'Turns on tls ( default is false for schema unix, tcp and http and true for https )'
option '--[no-]tlsverify', :flag, 'Turns off tls peer verification', default:true, environment_variable: 'DOCKER_TLS_VERIFY'
option ["-t", "--tmpdir"], "PATH", 'Write tmp data to PATH', default: '/tmp/fpm-fry', attribute_name: :dir do |s|
String(s)
end

subcommand 'fpm', 'Works like fpm but with docker support', FPM::Command

Expand All @@ -22,7 +25,7 @@ class Command < Clamp::Command

def initialize(invocation_path, ctx = {}, parent_attribute_values = {})
super
@ui = ctx.fetch(:ui){ UI.new }
@ui = ctx.fetch(:ui){ UI.new(tmpdir: dir) }
@client = ctx[:client]
end

Expand Down
2 changes: 1 addition & 1 deletion lib/fpm/fry/ui.rb
Expand Up @@ -3,7 +3,7 @@
module FPM; module Fry
class UI < Struct.new(:out, :err, :logger, :tmpdir)

def initialize( out = STDOUT, err = STDERR, logger = nil , tmpdir = '/tmp/fpm-fry' )
def initialize( out: STDOUT, err: STDERR, logger: nil , tmpdir: '/tmp/fpm-fry' )
logger ||= Channel.new.tap{|chan| chan.subscribe(Cabin::NiceOutput.new(out)) }
FileUtils.mkdir_p( tmpdir )
super( out, err, logger, tmpdir )
Expand Down
2 changes: 1 addition & 1 deletion spec/command/cook_spec.rb
Expand Up @@ -12,7 +12,7 @@
end

let(:ui) do
FPM::Fry::UI.new(StringIO.new,StringIO.new,nil,tmpdir)
FPM::Fry::UI.new(out: StringIO.new, err: StringIO.new, logger: nil, tmpdir: tmpdir)
end

after(:each) do
Expand Down

0 comments on commit aef3f02

Please sign in to comment.