Class: Detroit::Mast

Inherits:
Tool
  • Object
show all
Defined in:
lib/detroit-mast.rb

Overview

Mast Tool

Constant Summary collapse

DEFAULT_FILENAME =

Default MANIFEST filename.

'MANIFEST'
DEFAULT_INCLUDE =

Default files/dirs to include.

%w{ bin data etc features lib man meta qed script spec test [A-Z]* }
DEFAULT_EXCLUDE =

Default files/dirs to exclude.

nil
DEFAULT_IGNORE =

Default files/dirs to ignore. Unlike exclude, this work on path basenames, and not full pathnames.

nil

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#excludeObject

Returns the value of attribute exclude.



36
37
38
# File 'lib/detroit-mast.rb', line 36

def exclude
  @exclude
end

#ignoreObject

Returns the value of attribute ignore.



39
40
41
# File 'lib/detroit-mast.rb', line 39

def ignore
  @ignore
end

#includeObject

Returns the value of attribute include.



33
34
35
# File 'lib/detroit-mast.rb', line 33

def include
  @include
end

#outputObject

Returns the value of attribute output.



42
43
44
# File 'lib/detroit-mast.rb', line 42

def output
  @output
end

Instance Method Details

#assemble(station, options = {}) ⇒ Object

It’s important to update the manifest before other generators, so this plugs into the :pre_generate phase.



59
60
61
62
63
# File 'lib/detroit-mast.rb', line 59

def assemble(station, options={})
  case station
  when :pre_generate then generate
  end
end

#assemble?(station, options = {}) ⇒ Boolean

A S S E M B L Y M E T H O D S

Returns:

  • (Boolean)


51
52
53
54
55
# File 'lib/detroit-mast.rb', line 51

def assemble?(station, options={})
  case station
  when :pre_generate then true
  end
end

#generateObject

Generate manifest. TODO: don’t overwrite if it hasn’t changed



72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/detroit-mast.rb', line 72

def generate
  if !file #manifest.exist? (future version of mast)
    file = manifest.save
    report "Created #{file.to_s.sub(Dir.pwd+'/','')}"
  elsif manifest.changed?
    file = manifest.update
    report "Updated #{file.to_s.sub(Dir.pwd+'/','')}"
    #report "Updated #{output.to_s.sub(Dir.pwd+'/','')}"
  else
    report "#{output.to_s.sub(Dir.pwd+'/','')} is current"
  end
end

#manifestObject



66
67
68
# File 'lib/detroit-mast.rb', line 66

def manifest
  @manifest ||= ::Mast::Manifest.new(options)
end