lib/mina/commands.rb in mina-1.0.0.beta1 vs lib/mina/commands.rb in mina-1.0.0.beta2
- old
+ new
@@ -1,13 +1,13 @@
module Mina
class Commands
extend Forwardable
include Helpers::Internal
+ include Configuration::DSL
attr_reader :queue
attr_accessor :stage
- def_delegators :queue, :find, :fetch, :process
def initialize(stage = :default)
@stage = stage
@queue = Hash.new { |hash, key| hash[key] = [] }
end
@@ -17,29 +17,31 @@
queue[stage] << (quiet ? code : echo_cmd(code))
end
def comment(code, indent: nil)
if indent
- queue[stage] << indent(indent, "echo '-----> #{code}'")
+ queue[stage] << indent(indent, %(echo "-----> #{code}"))
else
- queue[stage] << "echo '-----> #{code}'"
+ queue[stage] << %(echo "-----> #{code}")
end
end
- def fetch(stage)
+ def delete(stage)
queue.delete(stage) || []
end
def process(path = nil)
if path
- queue[stage].unshift("echo '$ cd #{path}'") if Mina::Configuration.instance.fetch(:verbose)
+ queue[stage].unshift("echo '$ cd #{path}'") if fetch(:verbose)
"(cd #{path} && #{queue[stage].join(' && ')})"
else
- fetch(stage).join("\n")
+ queue[stage].join("\n")
end
end
def run(backend)
- Mina::Runner.new(process, backend).run
+ report_time do
+ Mina::Runner.new(process, backend).run
+ end
end
end
end