canzea 0.1.108 → 0.1.109
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/canzea/version.rb +1 -1
- data/lib/commands/config-git-commit.rb +15 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ff9a513705220c4c00ad9e961317295b7bed833
|
4
|
+
data.tar.gz: 66c21e800e7ecaa2bb3191599776c1a506bc434f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3b5e33c9b1bc8879e1b7895c43621bae83f437a007a1a2f556fc2b92361e678468a6e117a89fd59fc983dadd3c47ae111b01bab79c5ee854037ae1ad7a1e6bbb
|
7
|
+
data.tar.gz: 5e724a8e6aca2804986c07f40a8dcd67f33010543f74b42db694f3083a523cfc2730b9a7deb78f2138bc21adba689d1a66be81f8a7860150e05c3219e59f9e74
|
data/lib/canzea/version.rb
CHANGED
@@ -3,6 +3,10 @@ require "fileutils"
|
|
3
3
|
require "pathname"
|
4
4
|
|
5
5
|
class ConfigGitCommit
|
6
|
+
def initialize ()
|
7
|
+
@log = Logger.new(Canzea::config[:logging_root] + '/plans.log')
|
8
|
+
end
|
9
|
+
|
6
10
|
def do(gitRoot, sourcePath, template, parameters)
|
7
11
|
begin
|
8
12
|
# if file exists on file system and does not exist in gitRoot, then commit the "oem" file
|
@@ -12,13 +16,13 @@ class ConfigGitCommit
|
|
12
16
|
else
|
13
17
|
dest = "#{gitRoot}/config#{sourcePath}"
|
14
18
|
end
|
15
|
-
|
19
|
+
log "Writing to #{dest}"
|
16
20
|
|
17
21
|
if (File.exist?(dest) == false and File.exist?(sourcePath))
|
18
22
|
FileUtils.mkdir_p Pathname.new(dest).dirname
|
19
23
|
FileUtils.cp sourcePath, dest
|
20
24
|
|
21
|
-
|
25
|
+
log "Recording in repo the default file first: #{sourcePath}"
|
22
26
|
if (Canzea::config[:track_changes_in_git])
|
23
27
|
g = Git.init(gitRoot)
|
24
28
|
g.add(:all=>true)
|
@@ -27,18 +31,18 @@ class ConfigGitCommit
|
|
27
31
|
end
|
28
32
|
|
29
33
|
if template
|
30
|
-
|
34
|
+
log "Processing template #{template}"
|
31
35
|
FileUtils.mkdir_p Pathname.new(sourcePath).dirname
|
32
36
|
t = Template.new
|
33
37
|
t.processAndWriteToFile template, sourcePath, parameters
|
34
38
|
end
|
35
39
|
FileUtils.mkdir_p Pathname.new(dest).dirname
|
36
|
-
FileUtils.cp sourcePath, dest
|
40
|
+
FileUtils.cp sourcePath, dest, :verbose => true
|
37
41
|
|
38
42
|
if (Canzea::config[:track_changes_in_git])
|
39
43
|
g = Git.init(gitRoot)
|
40
44
|
g.add(:all=>true)
|
41
|
-
|
45
|
+
log "#{g.status.changed.size() + g.status.added.size()}"
|
42
46
|
if (g.status.changed.size() > 0 or g.status.added.size() > 0)
|
43
47
|
g.commit("Config update #{sourcePath}")
|
44
48
|
end
|
@@ -50,4 +54,10 @@ class ConfigGitCommit
|
|
50
54
|
abort()
|
51
55
|
end
|
52
56
|
end
|
57
|
+
|
58
|
+
def log (msg)
|
59
|
+
puts msg
|
60
|
+
@log.info(msg)
|
61
|
+
end
|
62
|
+
|
53
63
|
end
|