class Awestruct::CLI::Manifest

noinspection RubyResolve

Attributes

parent[R]
steps[R]

Public Class Methods

new(parent=nil, &block) click to toggle source
# File lib/awestruct/cli/manifest.rb, line 15
def initialize(parent=nil, &block)
  @parent = parent
  @steps = []
  instance_eval &block if block
end

Public Instance Methods

add_requires(path, libs = []) click to toggle source
# File lib/awestruct/cli/manifest.rb, line 42
def add_requires(path, libs = [])
  steps << AddRequires.new(path, libs)
end
copy_file(path, input_path, opts = {}) click to toggle source
# File lib/awestruct/cli/manifest.rb, line 30
def copy_file(path, input_path, opts = {})
  steps << CopyFile.new(path, input_path, opts)
end
install_compass(framework, lib) click to toggle source
# File lib/awestruct/cli/manifest.rb, line 46
def install_compass(framework, lib)
  steps << InstallCompass.new(framework, lib)
end
mkdir(path) click to toggle source
# File lib/awestruct/cli/manifest.rb, line 21
def mkdir(path)
  steps << MkDir.new(path)
end
perform(dir) click to toggle source
# File lib/awestruct/cli/manifest.rb, line 50
def perform(dir)
  parent.perform(dir) if parent
  begin
    steps.each do |step|
      step.perform(dir)
    end
    true
  rescue => e
    ExceptionHelper.log_error e
    ExceptionHelper.log_backtrace e
    false
  end
end
remove_file(path) click to toggle source
# File lib/awestruct/cli/manifest.rb, line 38
def remove_file(path)
  steps << RemoveFile.new(path)
end
template_file(path, input_path, state = {}) click to toggle source
# File lib/awestruct/cli/manifest.rb, line 25
def template_file(path, input_path, state = {})
  new_state = state.merge(load_gem(true))
  steps << TemplateFile.new(path, input_path, new_state)
end
touch_file(path) click to toggle source
# File lib/awestruct/cli/manifest.rb, line 34
def touch_file(path)
  steps << TouchFile.new(path)
end
unperform(dir) click to toggle source
# File lib/awestruct/cli/manifest.rb, line 64
def unperform(dir)
  steps.each do |step|
    begin
      step.unperform(dir)
      true
    rescue => e
      ExceptionHelper.log_error e
      ExceptionHelper.log_backtrace e
    end
  end
end

Private Instance Methods

load_gem(add_compass = false) click to toggle source
# File lib/awestruct/cli/manifest.rb, line 78
def load_gem(add_compass = false)
  spec = {:dependencies => {}}
  gem_spec = Gem::Specification.find_all_by_name('awestruct').last # Make sure we have the latest version

  if add_compass
    gem_spec.add_dependency('compass', '>= 1.0.1')
  end

  gem_spec.dependencies.each { |d| spec[:dependencies][d.name] = d}
  spec[:awestruct_version] = gem_spec.version
  spec
end