Class: FPM::Cookery::BaseRecipe
- Inherits:
-
Object
- Object
- FPM::Cookery::BaseRecipe
show all
- Includes:
- PathHelper, Utils, FileUtils
- Defined in:
- lib/fpm/cookery/recipe.rb
Instance Attribute Summary collapse
Attributes included from PathHelper
#installing, #omnibus_installing
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from PathHelper
#bin, #doc, #etc, #include, #info, #installing?, #lib, #libexec, #man, #man1, #man2, #man3, #man4, #man5, #man6, #man7, #man8, #omnibus_installing?, #opt, #prefix, #root, #sbin, #share, #var, #with_trueprefix
Constructor Details
#initialize(filename, config) ⇒ BaseRecipe
Returns a new instance of BaseRecipe.
80
81
82
83
84
85
86
87
88
89
90
91
|
# File 'lib/fpm/cookery/recipe.rb', line 80
def initialize(filename, config)
@filename = Path.new(filename).expand_path
@config = config
@workdir = @filename.dirname
@tmp_root = @config.tmp_root ? Path.new(@config.tmp_root) : @workdir
@pkgdir = @config.pkg_dir && Path.new(@config.pkg_dir)
@cachedir = @config.cache_dir && Path.new(@config.cache_dir)
revision || self.class.revision(1)
end
|
Instance Attribute Details
#filename ⇒ Object
Returns the value of attribute filename.
68
69
70
|
# File 'lib/fpm/cookery/recipe.rb', line 68
def filename
@filename
end
|
Class Method Details
.architectures(archs) ⇒ Object
37
38
39
|
# File 'lib/fpm/cookery/recipe.rb', line 37
def self.architectures(archs)
Array(archs).member?(FPM::Cookery::Facts.arch) and block_given? ? yield : false
end
|
.attr_rw(*attrs) ⇒ Object
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/fpm/cookery/recipe.rb', line 19
def self.attr_rw(*attrs)
attrs.each do |attr|
class_eval %Q{
def self.#{attr}(value = nil)
value.nil? ? @#{attr} : @#{attr} = value
end
def #{attr}
self.class.#{attr}
end
}
end
end
|
.attr_rw_list(*attrs) ⇒ Object
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
# File 'lib/fpm/cookery/recipe.rb', line 41
def self.attr_rw_list(*attrs)
attrs.each do |attr|
class_eval %Q{
def self.#{attr}(*list)
@#{attr} ||= []
@#{attr} << list
@#{attr}.flatten!
@#{attr}.uniq!
@#{attr}
end
def #{attr}
self.class.#{attr}
end
}
end
end
|
.depends_all ⇒ Object
75
76
77
|
# File 'lib/fpm/cookery/recipe.rb', line 75
def depends_all
(depends + build_depends).uniq
end
|
33
34
35
|
# File 'lib/fpm/cookery/recipe.rb', line 33
def self.platforms(valid_platforms)
Array(valid_platforms).member?(self.platform) and block_given? ? yield : false
end
|
Instance Method Details
#builddir(path = nil) ⇒ Object
103
|
# File 'lib/fpm/cookery/recipe.rb', line 103
def builddir(path = nil) (@builddir || tmp_root('tmp-build'))/path end
|
#builddir=(value) ⇒ Object
96
|
# File 'lib/fpm/cookery/recipe.rb', line 96
def builddir=(value) @builddir = Path.new(value) end
|
#cachedir(path = nil) ⇒ Object
105
|
# File 'lib/fpm/cookery/recipe.rb', line 105
def cachedir(path = nil) (@cachedir || workdir('cache'))/path end
|
#cachedir=(value) ⇒ Object
98
|
# File 'lib/fpm/cookery/recipe.rb', line 98
def cachedir=(value) @cachedir = Path.new(value) end
|
#depends_all ⇒ Object
Resolve dependencies from omnibus package.
108
109
110
111
112
113
114
115
116
117
118
119
120
121
|
# File 'lib/fpm/cookery/recipe.rb', line 108
def depends_all
pkg_depends = self.class.depends_all
if self.class.omnibus_package
self.class.omnibus_recipes.each { |omni_recipe|
recipe_file = File.expand_path(omni_recipe + '.rb', File.dirname(filename))
Book.instance.load_recipe(recipe_file, config) do |recipe|
pkg_depends << recipe.depends_all
end
}
end
pkg_depends.flatten.uniq
end
|
#destdir(path = nil) ⇒ Object
102
|
# File 'lib/fpm/cookery/recipe.rb', line 102
def destdir(path = nil) (@destdir || tmp_root('tmp-dest'))/path end
|
#destdir=(value) ⇒ Object
95
|
# File 'lib/fpm/cookery/recipe.rb', line 95
def destdir=(value) @destdir = Path.new(value) end
|
#pkgdir(path = nil) ⇒ Object
104
|
# File 'lib/fpm/cookery/recipe.rb', line 104
def pkgdir(path = nil) (@pkgdir || workdir('pkg'))/path end
|
#pkgdir=(value) ⇒ Object
97
|
# File 'lib/fpm/cookery/recipe.rb', line 97
def pkgdir=(value) @pkgdir = Path.new(value) end
|
#tmp_root(path = nil) ⇒ Object
101
|
# File 'lib/fpm/cookery/recipe.rb', line 101
def tmp_root(path = nil) @tmp_root/path end
|
#tmp_root=(value) ⇒ Object
94
|
# File 'lib/fpm/cookery/recipe.rb', line 94
def tmp_root=(value) @tmp_root = Path.new(value) end
|
#workdir(path = nil) ⇒ Object
100
|
# File 'lib/fpm/cookery/recipe.rb', line 100
def workdir(path = nil) @workdir/path end
|
#workdir=(value) ⇒ Object
93
|
# File 'lib/fpm/cookery/recipe.rb', line 93
def workdir=(value) @workdir = Path.new(value) end
|