Class: Awestruct::CLI::Manifest

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

Defined Under Namespace

Classes: AddRequires, CopyFile, InstallCompass, MkDir, RemoveFile, TouchFile

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Manifest.



43
44
45
46
47
# File 'lib/awestruct/cli/manifest.rb', line 43

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.



40
41
42
# File 'lib/awestruct/cli/manifest.rb', line 40

def parent
  @parent
end

#stepsObject (readonly)

Returns the value of attribute steps.



41
42
43
# File 'lib/awestruct/cli/manifest.rb', line 41

def steps
  @steps
end

Instance Method Details

#add_requires(path, libs = []) ⇒ Object



65
66
67
# File 'lib/awestruct/cli/manifest.rb', line 65

def add_requires(path, libs = [])
  steps << AddRequires.new(path, libs)
end

#copy_file(path, input_path, opts = {}) ⇒ Object



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

def copy_file(path, input_path, opts = {})
  steps << CopyFile.new( path, input_path, opts )
end

#install_compass(framework) ⇒ Object



69
70
71
# File 'lib/awestruct/cli/manifest.rb', line 69

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

#mkdir(path) ⇒ Object



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

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

#perform(dir) ⇒ Object



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

def perform(dir)
  parent.perform(dir) if parent
  steps.each do |step|
    begin
      step.perform( dir )
    rescue => e
      $LOG.error e if $LOG.error?
      $LOG.error e.backtrace.join("\n") if $LOG.error?
    end
  end
end

#remove_file(path) ⇒ Object



61
62
63
# File 'lib/awestruct/cli/manifest.rb', line 61

def remove_file(path)
  steps << RemoveFile.new(path)
end

#touch_file(path) ⇒ Object



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

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

#unperform(dir) ⇒ Object



85
86
87
88
89
90
91
92
93
94
# File 'lib/awestruct/cli/manifest.rb', line 85

def unperform(dir)
  steps.each do |step|
    begin
      step.unperform( dir )
    rescue => e
      $LOG.error e if $LOG.error?
      $LOG.error e.backtrace.join("\n") if $LOG.error?
    end
  end
end