Class: Output

Inherits:
Object
  • Object
show all
Includes:
Albacore::Task
Defined in:
lib/albacore/output.rb

Instance Attribute Summary

Attributes included from Logging

#current_log_device, #logger

Instance Method Summary collapse

Methods included from Albacore::Task

clean_dirname, create_rake_task, include_config, included

Methods included from UpdateAttributes

#<<, #update_attributes

Methods included from YAMLConfig

#configure, #load_config_by_task_name

Methods included from Logging

#create_logger, #log_device=, #log_level, #log_level=

Methods included from Failure

#fail_with_message

Constructor Details

#initializeOutput

Returns a new instance of Output.



58
59
60
61
62
63
64
65
# File 'lib/albacore/output.rb', line 58

def initialize
  super()

  @files = []
  @erbs = []
  @directories = []
  @keep_to = false
end

Instance Method Details

#dir(d) ⇒ Object



91
92
93
# File 'lib/albacore/output.rb', line 91

def dir(d)
  @directories << d
end

#erb(f, opts = {}) ⇒ Object



86
87
88
89
# File 'lib/albacore/output.rb', line 86

def erb(f, opts={})
  f_to = opts[:as] || f
  @erbs << [f,f_to,opts[:locals]||{}]
end

#executeObject



67
68
69
70
71
72
73
74
75
76
# File 'lib/albacore/output.rb', line 67

def execute()
  fail_with_message 'No base dir' if @from_dir.nil?
  fail_with_message 'No output dir' if @to_dir.nil?

  OutputBuilder.output_to(@to_dir, @from_dir, @keep_to)  do |o|
    @directories.each { |f| o.dir f }
    @files.each { |f| o.file *f }
    @erbs.each { |f| o.erb *f }
  end
end

#file(f, opts = {}) ⇒ Object



78
79
80
81
# File 'lib/albacore/output.rb', line 78

def file(f, opts={})
  f_to = opts[:as] || f
  @files << [f,f_to]
end

#from(from_dir) ⇒ Object



95
96
97
# File 'lib/albacore/output.rb', line 95

def from(from_dir)
  @from_dir = from_dir
end

#keep_toObject



83
84
85
# File 'lib/albacore/output.rb', line 83

def keep_to
 @keep_to = true
end

#to(to_dir) ⇒ Object



99
100
101
# File 'lib/albacore/output.rb', line 99

def to(to_dir)
  @to_dir = to_dir
end