Improve coding standards
This commit is contained in:
parent
0b68a8165d
commit
9251c6af8e
@ -1,10 +1,10 @@
|
||||
module Producer
|
||||
module Core
|
||||
class CLI
|
||||
attr_reader :arguments
|
||||
|
||||
USAGE = "Usage: #{File.basename $0} recipe_file"
|
||||
|
||||
attr_reader :arguments
|
||||
|
||||
def initialize(arguments, stdout = $stdout)
|
||||
@stdout = stdout
|
||||
@arguments = arguments
|
||||
|
@ -1,12 +1,14 @@
|
||||
module Producer
|
||||
module Core
|
||||
class Recipe
|
||||
attr_accessor :tasks
|
||||
|
||||
def self.evaluate_from_file(filepath, env)
|
||||
DSL.evaluate(File.read(filepath), env)
|
||||
class << self
|
||||
def evaluate_from_file(filepath, env)
|
||||
DSL.evaluate(File.read(filepath), env)
|
||||
end
|
||||
end
|
||||
|
||||
attr_accessor :tasks
|
||||
|
||||
def initialize(tasks = [])
|
||||
@tasks = tasks
|
||||
end
|
||||
|
@ -2,13 +2,15 @@ module Producer
|
||||
module Core
|
||||
class Recipe
|
||||
class DSL
|
||||
attr_reader :tasks
|
||||
|
||||
def self.evaluate(code, env)
|
||||
dsl = new(code).evaluate(env)
|
||||
Recipe.new(dsl.tasks)
|
||||
class << self
|
||||
def evaluate(code, env)
|
||||
dsl = new(code).evaluate(env)
|
||||
Recipe.new(dsl.tasks)
|
||||
end
|
||||
end
|
||||
|
||||
attr_reader :tasks
|
||||
|
||||
def initialize(code = nil, &block)
|
||||
@code = code
|
||||
@block = block
|
||||
|
@ -1,12 +1,14 @@
|
||||
module Producer
|
||||
module Core
|
||||
class Task
|
||||
attr_reader :name, :actions, :condition
|
||||
|
||||
def self.evaluate(name, env, &block)
|
||||
DSL.evaluate(name, env, &block)
|
||||
class << self
|
||||
def evaluate(name, env, &block)
|
||||
DSL.evaluate(name, env, &block)
|
||||
end
|
||||
end
|
||||
|
||||
attr_reader :name, :actions, :condition
|
||||
|
||||
def initialize(name, actions = [], condition = true)
|
||||
@name = name
|
||||
@actions = actions
|
||||
|
Loading…
x
Reference in New Issue
Block a user