Module: Albacore

Defined in:
lib/version.rb,
lib/albacore/ilmerge.rb,
lib/albacore/albacoretask.rb,
lib/albacore/config/config.rb,
lib/albacore/support/createtask.rb,
lib/albacore/support/runcommand.rb

Defined Under Namespace

Modules: Configuration, RunCommand, Task Classes: ConfigData, IlMergeResolver

Constant Summary collapse

VERSION =
'0.3.5'

Class Method Summary collapse

Class Method Details

.configurationObject



18
19
20
# File 'lib/albacore/config/config.rb', line 18

def configuration
  @configuration ||= ConfigData.new
end

.configure {|configuration| ... } ⇒ Object

Yields:



13
14
15
16
# File 'lib/albacore/config/config.rb', line 13

def configure
  yield(configuration) if block_given?
  configuration
end

.create_task(taskname, taskclass) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/albacore/support/createtask.rb', line 2

def self.create_task(taskname, taskclass)
  # this style of creating tasks is not really what i
  # want to do. but it's necessary for ruby 1.8.6
  # because that version doesn't support the foo do |*args, &block|
  # block signature. it supports *args, but not &block.
  # so that limitation is worked around with string eval
  Object.class_eval(<<-EOF, __FILE__, __LINE__)
    def #{taskname}(name=:#{taskname}, *args, &configblock)
      task name, *args do |t, task_args|
        obj = #{taskclass}.new
        obj.load_config_by_task_name(name) if obj.respond_to?(:load_config_by_task_name)

        if !configblock.nil?
          case configblock.arity
            when 0
              configblock.call
            when 1
              configblock.call(obj)
            when 2
              configblock.call(obj, task_args)
          end
        end

        obj.execute if obj.respond_to?(:execute)
      end
    end

    def #{taskname}!(name=:#{taskname}, *args, &configblock)
      task name, *args do |t, task_args|
        obj = #{taskclass}.new
        obj.load_config_by_task_name(name) if obj.respond_to?(:load_config_by_task_name)

        if !configblock.nil?
          case configblock.arity
            when 0
              configblock.call
            when 1
              configblock.call(obj)
            when 2
              configblock.call(obj, task_args)
          end
        end

        obj.execute if obj.respond_to?(:execute)
      end.invoke
    end
  EOF
end