class Kleiber::Symphony
Model describes session of performances your vagrants. Provides api for control your symphony. @author Bobykin Kirill <qelphybox@gmail.com>
Attributes
name[R]
projects[R]
Public Class Methods
new(name, projects, options)
click to toggle source
# File lib/kleiber/symphony.rb, line 10 def initialize(name, projects, options) @name = name @projects = projects @tasks = options[:tasks] @env = options[:env] end
Public Instance Methods
env()
click to toggle source
# File lib/kleiber/symphony.rb, line 21 def env @env || {} end
environment()
click to toggle source
Returns hash with definition all env variables of this symphony @return [Hash] env variables hash
# File lib/kleiber/symphony.rb, line 58 def environment projects.reduce(env) do |result, project| result.merge(project.environment) end end
select_projects(only)
click to toggle source
Selects project from projects @param only [Array] projects for filter @return [Array] result array
# File lib/kleiber/symphony.rb, line 43 def select_projects(only) only.empty? ? projects : projects.select { |p| only.include?(p.name) } end
task_list(list)
click to toggle source
Defines symphony task values and environment varaibles, if it exists @param [Hash] list list of tasks to run @return [Hash] task list with symphony values
# File lib/kleiber/symphony.rb, line 50 def task_list(list) list.each_with_object({}) do |(name, task), hash| hash[name] = tasks[name] || task end end
tasks()
click to toggle source
# File lib/kleiber/symphony.rb, line 17 def tasks @tasks || {} end