Class: Charleston::Transform

Inherits:
Object
  • Object
show all
Defined in:
lib/charleston/transform.rb

Instance Method Summary collapse

Constructor Details

#initialize(source_directory, source_pattern, destination_directory, destination_pattern, &transformation) ⇒ Transform

Returns a new instance of Transform.



3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/charleston/transform.rb', line 3

def initialize(source_directory, source_pattern,
               destination_directory, destination_pattern,
               &transformation)
  @source_dir = source_directory
  @source_pat = source_pattern
  @dest_dir = destination_directory
  @dest_pat = destination_pattern
  @transformation = transformation

  find_sources
  target_destinations
  write_rules
end

Instance Method Details

#generates(rule_name) ⇒ Object



17
18
19
20
21
# File 'lib/charleston/transform.rb', line 17

def generates(rule_name)
  desc "Transform #{@source_dir}/#{@source_pat} into output/#{@dest_dir}/#{@dest_pat}"
  task "generate:#{rule_name}" => @destinations
  task 'generate:all' => "generate:#{rule_name}"
end