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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c5222cb608fedc123c84ca945f2885f4e5609f9f
4
- data.tar.gz: 0ee85f347f7e47b8b149ae7db5ba0a8e0e3405c9
3
+ metadata.gz: 852851abed566f2f3d0bdf877dc11565867b67ce
4
+ data.tar.gz: 7d6ca14938c7a1a79cd6cc66aabbd5c31cdffef9
5
5
  SHA512:
6
- metadata.gz: 0631c79f3a2fd563f65f10b7f5eef51fd90a25b885e5044547e767a5e617c2915e84203f2eb53e48ec1c3be35074d5c29cb3de303c9c1d7f857f0fe05a4ac6b6
7
- data.tar.gz: 7d54800377105f0d8112195e279192a8b5d5aa6d1ce585922136e1d2e0ec04fe40ab3ca0d0e189705c138e935bb72816db5c090b282f90d6ca6be7a2f0de9689
6
+ metadata.gz: f88efb1d2cf11bf121bb9cbdcdef98f4aa549d171570c9edbe70f4e7015542ea5dfa39c848e7d7e3176a83b09eba663b44bc5c30787a3f35e426d6461343b2ed
7
+ data.tar.gz: f8bde2a4df146b97182dc37b9312aef9e816e1306ec334cccbdfd7f44cb8f28f158aa4ebd8dfecd4ec3e375d7e05f5f22d1e3413410bfcd05e2fccbfe7794458
@@ -1,10 +1,22 @@
1
1
  module Cupper
2
2
  class CookbookFile
3
3
  include Entity
4
- def initialize(dest_path, source, content, erb_file = nil, type = nil)
5
- @source = source
6
- @content = content
7
- super(@source, dest_path, erb_file, type)
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
@@ -30,7 +30,7 @@ module Cupper
30
30
  end
31
31
 
32
32
  def save
33
- File.open(@full_path,"a+") { |f| f.write(self.render_template) } if self.file?
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
 
@@ -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 (convert_mode(attr[1]['mode']) != 'Unknown') and text_type?(attr)
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
- CookbookFile.new(@files_path, source, content, 'cookbook_file').create
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
@@ -2,6 +2,7 @@
2
2
 
3
3
  <% for @cbf in @files %>
4
4
  cookbook_file '<%= @cbf.path %>' do
5
+ source '<%= @cbf.source %>'
5
6
  owner '<%= @cbf.owner %>'
6
7
  group '<%= @cbf.group %>'
7
8
  mode '<%= @cbf.mode %>'
@@ -1,3 +1,3 @@
1
1
  module Cupper
2
- VERSION = '0.1.1'.freeze
2
+ VERSION = '0.1.2'.freeze
3
3
  end
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.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-05 00:00:00.000000000 Z
12
+ date: 2016-12-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler