cupper 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cupper/cookbook_file.rb +16 -4
- data/lib/cupper/entity.rb +1 -1
- data/lib/cupper/recipe.rb +6 -3
- data/lib/cupper/templates/_cookbook_file.erb +1 -0
- data/lib/cupper/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 852851abed566f2f3d0bdf877dc11565867b67ce
|
4
|
+
data.tar.gz: 7d6ca14938c7a1a79cd6cc66aabbd5c31cdffef9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f88efb1d2cf11bf121bb9cbdcdef98f4aa549d171570c9edbe70f4e7015542ea5dfa39c848e7d7e3176a83b09eba663b44bc5c30787a3f35e426d6461343b2ed
|
7
|
+
data.tar.gz: f8bde2a4df146b97182dc37b9312aef9e816e1306ec334cccbdfd7f44cb8f28f158aa4ebd8dfecd4ec3e375d7e05f5f22d1e3413410bfcd05e2fccbfe7794458
|
data/lib/cupper/cookbook_file.rb
CHANGED
@@ -1,10 +1,22 @@
|
|
1
1
|
module Cupper
|
2
2
|
class CookbookFile
|
3
3
|
include Entity
|
4
|
-
|
5
|
-
|
6
|
-
@
|
7
|
-
|
4
|
+
|
5
|
+
def initialize(dest_path, source, content, erb_file, full_path, type = nil)
|
6
|
+
@source = source
|
7
|
+
@content = content
|
8
|
+
puts content if full_path.include? "sources.list"
|
9
|
+
@file_path = dest_path
|
10
|
+
subdir = full_path.split('/')
|
11
|
+
subdir.pop
|
12
|
+
@subdir_path = subdir.join('/')
|
13
|
+
self.setup_path
|
14
|
+
super(@source, @file_path+@subdir_path, erb_file, type)
|
15
|
+
end
|
16
|
+
|
17
|
+
def setup_path
|
18
|
+
require 'fileutils'
|
19
|
+
FileUtils.mkdir_p @file_path+@subdir_path
|
8
20
|
end
|
9
21
|
end
|
10
22
|
end
|
data/lib/cupper/entity.rb
CHANGED
@@ -30,7 +30,7 @@ module Cupper
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def save
|
33
|
-
File.open(@full_path,"
|
33
|
+
File.open(@full_path,"w+") { |f| f.write(self.render_template) } if self.file?
|
34
34
|
Dir.mkdir(@full_path) if self.dir? && !(self.exist?)
|
35
35
|
end
|
36
36
|
|
data/lib/cupper/recipe.rb
CHANGED
@@ -52,6 +52,7 @@ module Cupper
|
|
52
52
|
when 'rw-rw-rw-' then '666'
|
53
53
|
when 'rw-r--r--' then '644'
|
54
54
|
when 'rw-------' then '600'
|
55
|
+
when 'r--r-----' then '440'
|
55
56
|
else 'Unknown'
|
56
57
|
end
|
57
58
|
result
|
@@ -62,7 +63,7 @@ module Cupper
|
|
62
63
|
att = Array.new
|
63
64
|
files.each do |attr|
|
64
65
|
# TODO: Doesn't works for arch, this should be a plugin responsability
|
65
|
-
if attr[0].include?("/etc/apt/sources.list") and
|
66
|
+
if attr[0].include?("/etc/apt/sources.list") and text_type?(attr)
|
66
67
|
path = attr[0]
|
67
68
|
group = attr[1]['group']
|
68
69
|
mode = attr[1]['mode']
|
@@ -142,15 +143,17 @@ module Cupper
|
|
142
143
|
files.each do |attr|
|
143
144
|
if text_type?(attr) and (!(attr[1]['related'].nil?) or attr[0].include? "/etc/apt/sources.list")
|
144
145
|
path = attr[0]
|
146
|
+
source = attr[0]
|
145
147
|
group = attr[1]['group']
|
146
148
|
mode = attr[1]['mode']
|
147
149
|
owner = attr[1]['owner']
|
148
|
-
att.push(new_file(group, mode, owner, path))
|
150
|
+
att.push(new_file(group, mode, owner, path,source))
|
149
151
|
|
150
152
|
# Related file
|
151
153
|
source = attr[0].split('/').last
|
152
154
|
content = attr[1]['content']
|
153
|
-
|
155
|
+
full_path = attr[0]
|
156
|
+
CookbookFile.new(@files_path, source, content, 'cookbook_file', full_path).create
|
154
157
|
end
|
155
158
|
end
|
156
159
|
att
|
data/lib/cupper/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cupper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paulo Tada
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-12-
|
12
|
+
date: 2016-12-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|