Class: FPM::Fry::Plugin::Config::DSL

Inherits:
Struct
  • Object
show all
Defined in:
lib/fpm/fry/plugin/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(builder, options) ⇒ DSL

Returns a new instance of DSL.



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/fpm/fry/plugin/config.rb', line 69

def initialize( builder, options )
  callback = builder.output_hooks.find{|h| h.kind_of? Callback }
  if !callback
    callback = Callback.new({'etc' => true})
    builder.output_hooks << callback
  end
  # This looks kind of dirty. The callback tells the cook comamnd that the 
  # user has explictly used the config plugin. This way the cook command 
  # can hint the user to use this plugin if config files were automatically 
  # added.
  if !options[IMPLICIT]
    builder.output_hooks << MARK_EXPLICIT
  end
  super( builder, options, callback )
end

Instance Attribute Details

#builderObject

Returns the value of attribute builder

Returns:

  • (Object)

    the current value of builder



67
68
69
# File 'lib/fpm/fry/plugin/config.rb', line 67

def builder
  @builder
end

#callbackObject

Returns the value of attribute callback

Returns:

  • (Object)

    the current value of callback



67
68
69
# File 'lib/fpm/fry/plugin/config.rb', line 67

def callback
  @callback
end

#optionsObject

Returns the value of attribute options

Returns:

  • (Object)

    the current value of options



67
68
69
# File 'lib/fpm/fry/plugin/config.rb', line 67

def options
  @options
end

Instance Method Details

#exclude(path) ⇒ Object



92
93
94
95
96
97
# File 'lib/fpm/fry/plugin/config.rb', line 92

def exclude( path )
  if path[0] == "/"
    path = path[1..-1]
  end
  callback.files[path] = false
end

#include(path) ⇒ Object



85
86
87
88
89
90
# File 'lib/fpm/fry/plugin/config.rb', line 85

def include( path )
  if path[0] == "/"
    path = path[1..-1]
  end
  callback.files[path] = true
end