Module: Bakery

Defined in:
lib/bakery/cake.rb,
lib/bakery.rb,
lib/bakery/version.rb,
lib/bakery/detail/log.rb,
lib/bakery/detail/icing.rb,
lib/bakery/detail/marker.rb

Overview

Copyright © 2013 Nathan Currier

Use, modification, and distribution are all subject to the Boost Software License, Version 1.0. (See the accompanying file LICENSE.md or at rideliner.tk/LICENSE.html).

<description>

Defined Under Namespace

Modules: Log Classes: Cake

Constant Summary collapse

ROOT_DIR =
Dir.pwd
LIB_DIR =
File.dirname __FILE__
INGREDIENTS_DIR =
File.join LIB_DIR, 'bakery', 'ingredients'
INGREDIENTS_DETAIL_DIR =
File.join INGREDIENTS_DIR, 'detail'
ICING_SEARCH =
PathSearch.new [ Dir.home, File.join(Dir.home, '.bakery'), File.join('/', 'etc', 'bakery') ]
VERSION =
'0.5.3'

Class Method Summary collapse

Class Method Details

.[](symbol) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/bakery/detail/icing.rb', line 20

def [] symbol
  if icing = getCake.icing[symbol]
    icing
  else
    @globalIcing[symbol]
  end
end

.addCakeObject



36
37
38
39
40
41
42
# File 'lib/bakery/cake.rb', line 36

def addCake
  cake = Cake.new @currentCake

  Bakery::Log.debug "entering project: #{cake.root}"

  @currentCake = cake
end

.getCakeObject



50
51
52
# File 'lib/bakery/cake.rb', line 50

def getCake
  @currentCake
end

.getLatestMarkerOfType(type) ⇒ Object



29
30
31
32
33
34
35
36
37
# File 'lib/bakery/detail/marker.rb', line 29

def getLatestMarkerOfType type
  @markers.reverse_each { |marker|
    if marker.is_a? type
      return marker
    end
  }

  nil
end

.icingObject



16
17
18
# File 'lib/bakery/detail/icing.rb', line 16

def icing
  @globalIcing
end

.markersObject



39
40
41
# File 'lib/bakery/detail/marker.rb', line 39

def markers
  @markers
end

.removeCakeObject



44
45
46
47
48
# File 'lib/bakery/cake.rb', line 44

def removeCake
  Bakery::Log.debug "leaving project: #{@currentCake.root}"

  @currentCake = @currentCake.parent
end

.removeMarkerLayerFromStack(path) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/bakery/detail/marker.rb', line 16

def removeMarkerLayerFromStack path
  # remove all markers that are in the current directory
  @markers.select! { |marker|
    removed = !marker.getPath.start_with?(path)

    if removed
      Bakery::Log.debug "unset #{marker.class}: #{marker.getPath}"
    end

    removed
  }
end