Extract make_directory_for
This commit is contained in:
@@ -14,12 +14,8 @@ class Mrsk::Cli::Accessory < Mrsk::Cli::Base
|
||||
accessory = MRSK.accessory(name)
|
||||
on(accessory.host) do
|
||||
accessory.files.each do |(local, remote)|
|
||||
if Pathname.new(local).exist?
|
||||
execute :mkdir, "-p", Pathname.new(remote).dirname.to_s
|
||||
upload! local.to_s, remote.to_s
|
||||
else
|
||||
raise "Missing file: #{local}"
|
||||
end
|
||||
execute *accessory.make_directory_for(local, remote)
|
||||
upload! local, remote
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -46,6 +46,14 @@ class Mrsk::Commands::Accessory < Mrsk::Commands::Base
|
||||
).join(" "), host: host
|
||||
end
|
||||
|
||||
def make_directory_for(local, remote)
|
||||
if Pathname.new(local).exist?
|
||||
[ :mkdir, "-p", Pathname.new(remote).dirname.to_s ]
|
||||
else
|
||||
raise "Missing file: #{local}"
|
||||
end
|
||||
end
|
||||
|
||||
def remove_files
|
||||
[ :rm, "-rf", service_name ]
|
||||
end
|
||||
|
||||
@@ -66,7 +66,7 @@ class Mrsk::Configuration::Assessory
|
||||
end
|
||||
|
||||
def expand_local_file_path(local_file)
|
||||
Pathname.new(File.expand_path(local_file))
|
||||
Pathname.new(File.expand_path(local_file)).to_s
|
||||
end
|
||||
|
||||
def expand_remote_file_path(remote_file)
|
||||
|
||||
Reference in New Issue
Block a user