Class: Barista::RakeTask

Inherits:
Rake::TaskLib
  • Object
show all
Includes:
Rake::DSL
Defined in:
lib/barista/rake_task.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize {|_self| ... } ⇒ RakeTask

Returns a new instance of RakeTask.

Yields:

  • (_self)

Yield Parameters:



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/barista/rake_task.rb', line 11

def initialize
  yield self if block_given?
  @namespace ||= :barista
  @task_name ||= :brew
  @task_name = @task_name.to_sym
  @rails     = defined?(Rails) if @rails.nil?

  task_declaration = (@rails ? {@task_name => :environment} : @task_name)

  namespace @namespace do
    desc "Compiles all CoffeeScript sources to JavaScript"
    task task_declaration do
      setup_barista
      check_availability
      puts "Compiling all CoffeeScripts to their JavaScript equivalent."
      Barista.compile_all! true, false
    end
  end
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &blk) ⇒ Object



37
38
39
40
41
42
43
# File 'lib/barista/rake_task.rb', line 37

def method_missing(method, *args, &blk)
  if Barista.respond_to?(method)
    Barista.send method, *args, &blk
  else
    super
  end
end

Instance Attribute Details

#environment=(value) ⇒ Object (writeonly)

Sets the attribute environment

Parameters:

  • value

    the value to set the attribute environment to.



9
10
11
# File 'lib/barista/rake_task.rb', line 9

def environment=(value)
  @environment = value
end

#input_directory=(value) ⇒ Object (writeonly)

Sets the attribute input_directory

Parameters:

  • value

    the value to set the attribute input_directory to.



9
10
11
# File 'lib/barista/rake_task.rb', line 9

def input_directory=(value)
  @input_directory = value
end

#namespace=(value) ⇒ Object (writeonly)

Sets the attribute namespace

Parameters:

  • value

    the value to set the attribute namespace to.



8
9
10
# File 'lib/barista/rake_task.rb', line 8

def namespace=(value)
  @namespace = value
end

#output_directory=(value) ⇒ Object (writeonly)

Sets the attribute output_directory

Parameters:

  • value

    the value to set the attribute output_directory to.



9
10
11
# File 'lib/barista/rake_task.rb', line 9

def output_directory=(value)
  @output_directory = value
end

#rails=(value) ⇒ Object (writeonly)

Sets the attribute rails

Parameters:

  • value

    the value to set the attribute rails to.



9
10
11
# File 'lib/barista/rake_task.rb', line 9

def rails=(value)
  @rails = value
end

#task_name=(value) ⇒ Object (writeonly)

Sets the attribute task_name

Parameters:

  • value

    the value to set the attribute task_name to.



8
9
10
# File 'lib/barista/rake_task.rb', line 8

def task_name=(value)
  @task_name = value
end

Instance Method Details

#respond_to?(method, include_private = false) ⇒ Boolean

Proxy methods for rake tasks

Returns:

  • (Boolean)


33
34
35
# File 'lib/barista/rake_task.rb', line 33

def respond_to?(method, include_private = false)
  super || Barista.respond_to?(method, include_private)
end