Class: Awestruct::Commands::Manifest

Inherits:
Object
  • Object
show all
Defined in:
lib/awestruct/commands/manifest.rb

Defined Under Namespace

Classes: CopyFile, InstallCompass, MkDir, TouchFile

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parent = nil, &block) ⇒ Manifest

Returns a new instance of Manifest.



39
40
41
42
43
# File 'lib/awestruct/commands/manifest.rb', line 39

def initialize(parent=nil,&block)
  @parent = parent
  @steps = []
  instance_eval &block if block
end

Instance Attribute Details

#parentObject (readonly)

Returns the value of attribute parent.



36
37
38
# File 'lib/awestruct/commands/manifest.rb', line 36

def parent
  @parent
end

#stepsObject (readonly)

Returns the value of attribute steps.



37
38
39
# File 'lib/awestruct/commands/manifest.rb', line 37

def steps
  @steps
end

Instance Method Details

#copy_file(path, input_path) ⇒ Object



49
50
51
# File 'lib/awestruct/commands/manifest.rb', line 49

def copy_file(path, input_path)
  steps << CopyFile.new( path, input_path )
end

#install_compass(framework) ⇒ Object



57
58
59
# File 'lib/awestruct/commands/manifest.rb', line 57

def install_compass(framework)
  steps << InstallCompass.new(framework)
end

#mkdir(path) ⇒ Object



45
46
47
# File 'lib/awestruct/commands/manifest.rb', line 45

def mkdir(path)
  steps << MkDir.new( path )
end

#perform(dir) ⇒ Object



61
62
63
64
65
66
67
68
69
70
71
# File 'lib/awestruct/commands/manifest.rb', line 61

def perform(dir)
  parent.perform(dir) if parent
  steps.each do |step|
    begin
      step.perform( dir )
    rescue => e
      puts e
      puts e.backtrace
    end
  end
end

#touch_file(path) ⇒ Object



53
54
55
# File 'lib/awestruct/commands/manifest.rb', line 53

def touch_file(path)
  steps << TouchFile.new(path)
end

#unperform(dir) ⇒ Object



73
74
75
76
77
78
79
80
81
82
# File 'lib/awestruct/commands/manifest.rb', line 73

def unperform(dir)
  steps.each do |step|
    begin
      step.unperform( dir )
    rescue => e
      puts e
      puts e.backtrace
    end
  end
end