canzea 0.1.136 → 0.1.137

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a87f5f12079168ee940aac006305f0f237af35be
4
- data.tar.gz: 44c94686f6043ac1dcfb9a5cbdd247b9d97f7303
3
+ metadata.gz: c0ef42df3dd357dcded825cd4344b69d12c3ba3c
4
+ data.tar.gz: 316dbd380aa93d64a3e7020ca8763437c5f52f24
5
5
  SHA512:
6
- metadata.gz: 73abb530fee2f01a4180036f1a6655d5d63c38539623d2ed32a4f4c755cfe5078df389c50b85f6adfabbfb4eecfa876fe72f83019ccb8e802a487bb21f4fa074
7
- data.tar.gz: 004d951f709d384d4a8bb7fa7d830df19245c6a500070bd4a8f333f787a83d2423ca40784613f39cae315e2a56a5ee42b963f6986adaec59948a69e742384adb
6
+ metadata.gz: 4ebe898121792821b229ddafe2616ab2fd528e4b07fe708f0af01f287dcb36be5f3a02c1e2b43211494f208a2652fd1ba5cd021141044b309252ae3ac14fdd48
7
+ data.tar.gz: cfeeec5b9dc4748108b5005252b37ee3fb735a4385c2f2c14576a4908502426bd91ef97bb8fa74f308dbaed03ab90d9d074c948efb713c6c2c0e2b32e380e460
@@ -1,3 +1,3 @@
1
1
  module Canzea
2
- VERSION = "0.1.136"
2
+ VERSION = "0.1.137"
3
3
  end
data/lib/canzea.rb CHANGED
@@ -19,6 +19,7 @@ require "commands/apply-config"
19
19
  require "commands/add-env"
20
20
  require "commands/prepare-plan"
21
21
  require "commands/register-metadata"
22
+ require "commands/push-config"
22
23
 
23
24
  module Canzea
24
25
  command = Cri::Command.define do
@@ -160,6 +161,9 @@ module Canzea
160
161
  ac = ApplyConfig.new
161
162
  ac.do gitRoot, test, opts[:step], opts[:task]
162
163
  end
164
+ if (util == "push-config")
165
+ PushConfig.new.do(args[0], args[1], JSON.parse(opts.fetch(:args, '{}')))
166
+ end
163
167
  end
164
168
 
165
169
  if (opts[:get] || opts[:put])
@@ -0,0 +1,71 @@
1
+
2
+ require 'git'
3
+ require 'json'
4
+ require 'fileutils'
5
+
6
+ # canzea --lifecycle=wire --solution=gogs --action=push-content --args='{"file":"metadata.json","path":"test/a/metadata.json", "comment":"V1.0"}'
7
+ # canzea --util=push-config git@165.227.87.135:root/ecosystem.git "Latest Input" --args='{"files":[{"file":"metadata.json","path":"test/a/metadata.json"}]}''
8
+
9
+ class PushConfig
10
+ def initialize ()
11
+ @log = Logger.new(Canzea::config[:logging_root] + '/plans.log')
12
+ end
13
+
14
+ def do(url, comment, params)
15
+ begin
16
+
17
+ # "git@#{ENV["GOGS_ADDRESS"]}:root/ecosystem.git"
18
+
19
+ folder = "_working"
20
+
21
+ FileUtils.rm_rf(folder)
22
+
23
+ g = Git.clone(url, folder, :path => '.')
24
+
25
+ params['files'].each { | f |
26
+ file = f['file']
27
+
28
+ path = f['path']
29
+
30
+ FileUtils.mkdir_p File.dirname("#{folder}/#{path}")
31
+
32
+ open("#{folder}/#{path}", 'w') { |f|
33
+ f.puts File.read(file)
34
+ }
35
+ g.add("#{path}")
36
+ }
37
+
38
+
39
+ count = 0
40
+ g.chdir do
41
+ g.status.changed.each do |file|
42
+ count = count +1
43
+ end
44
+ g.status.added.each do |file|
45
+ count = count +1
46
+ end
47
+ g.status.deleted.each do |file|
48
+ count = count +1
49
+ end
50
+ end
51
+
52
+ if count == 0
53
+ puts "No changes"
54
+ else
55
+ g.commit(comment)
56
+
57
+ g.push
58
+ end
59
+ rescue => exception
60
+ @log.error("PushConfig Failed")
61
+ @log.error(exception.to_s)
62
+ @log.error(exception.backtrace)
63
+ abort()
64
+ end
65
+ end
66
+
67
+ def log (msg)
68
+ puts msg
69
+ @log.info(msg)
70
+ end
71
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: canzea
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.136
4
+ version: 0.1.137
5
5
  platform: ruby
6
6
  authors:
7
7
  - Canzea Technologies
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-17 00:00:00.000000000 Z
11
+ date: 2017-10-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -172,6 +172,7 @@ files:
172
172
  - lib/commands/gen-user.rb
173
173
  - lib/commands/get-catalog.rb
174
174
  - lib/commands/prepare-plan.rb
175
+ - lib/commands/push-config.rb
175
176
  - lib/commands/register-metadata.rb
176
177
  - lib/commands/remote-bootstrap.rb
177
178
  - lib/commands/remote-run.rb