Class: Mantra::Commands::Transform

Inherits:
Mantra::Command show all
Defined in:
lib/mantra/commands/transform.rb

Instance Attribute Summary collapse

Attributes inherited from Mantra::Command

#options

Instance Method Summary collapse

Methods inherited from Mantra::Command

#initialize, option, option_descriptors, #parse_options, #run, usage

Methods included from Helpers::ObjectWithType

included

Constructor Details

This class inherits a constructor from Mantra::Command

Instance Attribute Details

#manifestObject

Returns the value of attribute manifest.



8
9
10
# File 'lib/mantra/commands/transform.rb', line 8

def manifest
  @manifest
end

Instance Method Details

#performObject



29
30
31
32
33
34
# File 'lib/mantra/commands/transform.rb', line 29

def perform
  transforms.each do |t|
    t.run
  end
  puts manifest.to_ruby_object.to_yaml
end

#transform_configObject



13
14
15
# File 'lib/mantra/commands/transform.rb', line 13

def transform_config
  @transform_config ||= YAML.load_file(transform_config_path)
end

#transformsObject



17
18
19
20
21
22
23
# File 'lib/mantra/commands/transform.rb', line 17

def transforms
  previous_transform = self
  transform_config["transforms"].map do |t|
    t.merge!(previous_transform: previous_transform)
    previous_transform = Mantra::Transform.create(t)
  end
end