lib/cupper/recipe.rb in cupper-0.1.2 vs lib/cupper/recipe.rb in cupper-0.1.3
- old
+ new
@@ -63,14 +63,15 @@
att = Array.new
files.each do |attr|
# TODO: Doesn't works for arch, this should be a plugin responsability
if attr[0].include?("/etc/apt/sources.list") and text_type?(attr)
path = attr[0]
+ source = attr[0]
group = attr[1]['group']
mode = attr[1]['mode']
owner = attr[1]['owner']
- att.push(new_file(group, mode, owner, path))
+ att.push(new_file(group, mode, owner, path,source))
end
end
att
end
@@ -87,13 +88,14 @@
def expand_services(services)
att = Array.new
services.each do |attr|
srv = attr[0]
+ provider = attr[1]['provider']
action = attr[1]['action']
- att.push(new_service(srv,action))
+ att.push(new_service(srv,action,provider))
end
att
end
def expand_links(links)
@@ -118,12 +120,13 @@
usr = attr[0]
uid = attr[1]['uid']
gid = attr[1]['gid']
dir = attr[1]['dir']
shell = attr[1]['shell']
+ manage_home = if dir.include?("home") then "true" else "false" end
- att.push(new_user(usr, uid, gid, dir, shell))
+ att.push(new_user(usr, uid, gid, dir, shell, manage_home))
end
att
end
def expand_groups(groups)
@@ -169,18 +172,20 @@
package.name = name
package.version = version
package
end
- def new_service(name, action)
+ def new_service(name, action, provider)
service = Attribute.new
class << service
attr_accessor :name
attr_accessor :action
+ attr_accessor :provider
end
service.name = name
service.action = action
+ service.provider = provider
service
end
def new_link(group, mode, owner, target_file, to)
link = Attribute.new
@@ -197,24 +202,26 @@
link.target_file = target_file
link.to = to
link
end
- def new_user(name, uid, gid, dir, shell)
+ def new_user(name, uid, gid, dir, shell, manage_home)
user = Attribute.new
class << user
attr_accessor :name
attr_accessor :uid
attr_accessor :gid
attr_accessor :dir
attr_accessor :shell
+ attr_accessor :manage_home
end
user.name = name
- user.uid = uid
+ user.uid = uid
user.gid = gid
user.dir = dir
- user.shell = shell
+ user.shell = shell
+ user.manage_home = manage_home
user
end
def new_group(name, gid, members)
group = Attribute.new
@@ -226,10 +233,10 @@
group.name = name
group.gid = gid
group.members = members
group
end
-
+
def new_file(group, mode, owner, path, source='')
file = Attribute.new
class << file
attr_accessor :path
attr_accessor :source