class Detroit::Mast

Mast Tool

Constants

DEFAULT_EXCLUDE

Default files/dirs to exclude.

DEFAULT_FILENAME

Default MANIFEST filename.

DEFAULT_IGNORE

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

DEFAULT_INCLUDE

Default files/dirs to include.

Attributes

exclude[RW]
ignore[RW]
include[RW]
output[RW]

Public Instance Methods

assemble(station, options={}) click to toggle source

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

# File lib/detroit-mast.rb, line 59
def assemble(station, options={})
  case station
  when :pre_generate then generate
  end
end
assemble?(station, options={}) click to toggle source

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

# File lib/detroit-mast.rb, line 51
def assemble?(station, options={})
  case station
  when :pre_generate then true
  end
end
generate() click to toggle source

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

# 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
manifest() click to toggle source
# File lib/detroit-mast.rb, line 66
def manifest
  @manifest ||= ::Mast::Manifest.new(options)
end

Private Instance Methods

file() click to toggle source
# File lib/detroit-mast.rb, line 111
def file
  project.root.glob("MANIFEST{,.txt}", File::FNM_CASEFOLD).first
end
initialize_defaults() click to toggle source
# File lib/detroit-mast.rb, line 103
def initialize_defaults
  @include = DEFAULT_INCLUDE
  @exclude = DEFAULT_EXCLUDE
  @ignore  = DEFAULT_IGNORE
  @output  = (file || project.root + DEFAULT_FILENAME).to_s
end
initialize_requires() click to toggle source
# File lib/detroit-mast.rb, line 98
def initialize_requires
  require 'mast'
end
options() click to toggle source
# File lib/detroit-mast.rb, line 116
def options
  { :include => include,
    :exclude => exclude,
    :ignore  => ignore,
    :file    => output
  }
end