class New::Task
Public Class Methods
inherited(task_class)
click to toggle source
# File lib/new/task.rb, line 4 def self.inherited task_class task_class.name = caller.first[/[a-z_]+?(?=\.rb)/].to_sym end
name()
click to toggle source
# File lib/new/task.rb, line 16 def self.name; @name; end
name=(name)
click to toggle source
# File lib/new/task.rb, line 13 def self.name= name @name = name end
new(project_config)
click to toggle source
# File lib/new/task.rb, line 8 def initialize project_config @project_config = project_config run end
Public Instance Methods
name()
click to toggle source
# File lib/new/task.rb, line 17 def name; self.class.name.to_sym; end
options()
click to toggle source
Return only the options for the given task
# File lib/new/task.rb, line 35 def options default_options = self.class::OPTIONS rescue {} @options ||= default_options.deep_merge(project_options[:tasks][name]) end
project_options()
click to toggle source
Return ALL available options
# File lib/new/task.rb, line 21 def project_options custom_options = New.custom_config all_options = custom_options.deep_merge(@project_config) # Groom tasks (prevent tasks from the custom config from polluting the project config) all_options[:tasks].each_key do |task| all_options[:tasks].delete(task) unless @project_config[:tasks].has_key?(task) end @project_options ||= all_options end