Implement `mkdir' task action
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
require 'producer/core/action'
|
||||
require 'producer/core/actions/echo'
|
||||
require 'producer/core/actions/shell_command'
|
||||
require 'producer/core/actions/mkdir'
|
||||
require 'producer/core/actions/file_writer'
|
||||
|
||||
# condition tests (need to be defined before the condition DSL)
|
||||
|
15
lib/producer/core/actions/mkdir.rb
Normal file
15
lib/producer/core/actions/mkdir.rb
Normal file
@@ -0,0 +1,15 @@
|
||||
module Producer
|
||||
module Core
|
||||
module Actions
|
||||
class Mkdir < Action
|
||||
def apply
|
||||
fs.mkdir path
|
||||
end
|
||||
|
||||
def path
|
||||
arguments.first
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@@ -26,6 +26,10 @@ module Producer
|
||||
false
|
||||
end
|
||||
|
||||
def mkdir(path)
|
||||
sftp.mkdir! path
|
||||
end
|
||||
|
||||
def file_write(path, content)
|
||||
sftp.file.open path, 'w' do |f|
|
||||
f.write content
|
||||
|
@@ -13,6 +13,7 @@ module Producer
|
||||
define_action :echo, Actions::Echo
|
||||
define_action :sh, Actions::ShellCommand
|
||||
|
||||
define_action :mkdir, Actions::Mkdir
|
||||
define_action :file_write, Actions::FileWriter
|
||||
|
||||
attr_reader :env, :block, :actions
|
||||
|
Reference in New Issue
Block a user