Class: Wox::Tasks

Inherits:
Object
  • Object
show all
Includes:
TasksScope
Defined in:
lib/wox/tasks.rb

Instance Attribute Summary

Attributes included from TasksScope

#environment, #parent_task

Class Method Summary collapse

Instance Method Summary collapse

Methods included from TasksScope

#initialize

Class Method Details

.create(options = {}, &block) ⇒ Object



13
14
15
16
17
# File 'lib/wox/tasks.rb', line 13

def self.create options = {}, &block
  tasks = self.new(BuildEnvironment.new(options))
  tasks.default_tasks
  tasks.instance_eval &block if block_given?
end

Instance Method Details

#build(name, options, &block) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
# File 'lib/wox/tasks.rb', line 40

def build name, options, &block
  environment.apply options do |e|
    t = nil
    namespace :build do
      desc "Build #{e[:full_name]} with #{e[:configuration]} configuration"
      t = task(name) { Builder.new(e).build }
    end
    tasks = BuildTasks.new(e, t)
    tasks.instance_eval &block if block_given?
  end
end

#default_tasksObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/wox/tasks.rb', line 21

def default_tasks
  namespace :info do
    desc "List available sdks"
    task :sdks do
      puts environment.sdks.join("\n")
    end
  
    desc "List available configurations"
    task :configurations do
      puts environment.configurations.join("\n")
    end
    
    desc "List project targets"
    task :targets do
      puts environment.targets.join("\n")
    end
  end
end