Module: Bakery

Defined in:
lib/bakery/cake.rb,
lib/bakery.rb,
lib/bakery/bakery.rb,
lib/bakery/version.rb,
lib/bakery/detail/log.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.2'

Class Method Summary collapse

Class Method Details

.[](symbol) ⇒ Object



60
61
62
63
64
65
66
# File 'lib/bakery/bakery.rb', line 60

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

.addCakeObject



68
69
70
71
72
73
74
75
# File 'lib/bakery/bakery.rb', line 68

def addCake
  cake = Cake.new @currentCake

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

  @cakes.push cake
  @currentCake = cake
end

.cakesObject



56
57
58
# File 'lib/bakery/bakery.rb', line 56

def cakes
  @cakes
end

.getCakeObject



77
78
79
# File 'lib/bakery/bakery.rb', line 77

def getCake
  @currentCake
end

.getLatestMarkerOfType(type) ⇒ Object



38
39
40
41
42
43
44
45
46
# File 'lib/bakery/bakery.rb', line 38

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

  nil
end

.icingObject



48
49
50
# File 'lib/bakery/bakery.rb', line 48

def icing
  @defaultIcing
end

.markersObject



52
53
54
# File 'lib/bakery/bakery.rb', line 52

def markers
  @markers
end

.removeMarkerLayerFromStack(path) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/bakery/bakery.rb', line 19

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
  }

  if @currentCake.root == path
    Bakery::Log.debug "leaving project: #{@currentCake.root}"

    @currentCake = @currentCake.parent
  end
end