Replace env.output interface with an IO like object
This commit is contained in:
1 parent
e8b0900721
commit
d670d5dbdd
6 files changed
+23
-21
No files matched your search
@@ -3,7 +3,7 @@ module Producer
|
||||
module Actions
|
||||
class Echo < Action
|
||||
def apply
|
||||
env.output arguments.first
|
||||
env.output.puts arguments.first
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3,7 +3,7 @@ module Producer
|
||||
module Actions
|
||||
class ShellCommand < Action
|
||||
def apply
|
||||
env.output env.remote.execute(arguments.first)
|
||||
env.output.puts env.remote.execute(arguments.first)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,18 +1,13 @@
|
||||
module Producer
|
||||
module Core
|
||||
class Env
|
||||
attr_writer :output
|
||||
attr_accessor :target
|
||||
attr_accessor :output, :target
|
||||
|
||||
def initialize
|
||||
@output = $stdout
|
||||
def initialize(output: $stdout)
|
||||
@output = output
|
||||
@target = nil
|
||||
end
|
||||
|
||||
def output(str)
|
||||
@output.puts str
|
||||
end
|
||||
|
||||
def remote
|
||||
@remote ||= Remote.new(target)
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user