lib/orchestra/operation.rb in ntl-orchestra-0.9.0 vs lib/orchestra/operation.rb in ntl-orchestra-0.9.1
- old
+ new
@@ -1,6 +1,16 @@
module Orchestra
class Operation < Module
+ def self.new *args, &block
+ return super unless block_given?
+ unless args.empty?
+ raise ArgumentError, "wrong number of arguments (#{args.size} for 0)"
+ end
+ builder = DSL::Operations::Builder.new
+ DSL::Operations::Context.evaluate builder, &block
+ builder.build_operation
+ end
+
extend Forwardable
def_delegators :@default_run_list, :node_names, :provisions, :dependencies,
:optional_dependencies, :required_dependencies