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