kondate 0.4.8 → 0.4.9

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: b54a2f96280eb909e0e542d324820de43b6ade6b
4
- data.tar.gz: 424d90982dbb240817604b84dd42c25eb17e49cb
3
+ metadata.gz: bf4004d5d01890e7fed5e1d00f7510368849b712
4
+ data.tar.gz: 16d2d4481549467e5888cfa8c97970ab28d71aae
5
5
  SHA512:
6
- metadata.gz: fafee50e2a6a054acf7251c97757274bb8579a0ef53e41cc288fc1fc1a220f5cf55a1c8d722e5fcb2a0c4e2bdda7f27334777132cfce86379ff6f02765f45c59
7
- data.tar.gz: 6de4e87c5b2df2cf9d3c8bc4ad39aa0ce15a14f231b255df825b66a2202295f768f6ab733d00e53d87f4cbc5acd8313385e6b7bec03a1b4223e5cd25f8cf6233
6
+ metadata.gz: 4b4e0ac8cd360f975f444aeaa0ec2fd7891eab7394e1f1377468be09e61aea7f727d528951cd5d04ef80a9f552ebec2f0fc9bd342ece2636d730233bc742802e
7
+ data.tar.gz: 65d5fb9e91a7ed2cde4a6af032a58795cd00d2e8630088f5e9bdeca1b6348b46c7f86456a34346e404e29e4671317c72c4a37b8348f0eb07bbcfaab0bec2d22f
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ # 0.4.9 (2017-02-02)
2
+
3
+ Enhancements:
4
+
5
+ * Add hostname to itamae log prefix without using IO.pipe so that we can use debuggers such as pry
6
+
1
7
  # 0.4.8 (2017-01-27)
2
8
 
3
9
  Enhancements:
data/Gemfile CHANGED
@@ -3,3 +3,4 @@ source 'https://rubygems.org'
3
3
  gemspec
4
4
  gem 'pry'
5
5
  gem 'pry-nav'
6
+ gem 'byebug'
data/kondate.gemspec CHANGED
@@ -25,7 +25,6 @@ Gem::Specification.new do |spec|
25
25
  spec.add_dependency 'highline'
26
26
  spec.add_dependency 'facter'
27
27
  spec.add_dependency 'parallel'
28
- spec.add_dependency 'frontkick'
29
28
 
30
29
  spec.add_development_dependency "bundler"
31
30
  spec.add_development_dependency "test-unit"
data/lib/kondate/cli.rb CHANGED
@@ -8,7 +8,6 @@ require 'shellwords'
8
8
  require 'find'
9
9
  require 'facter'
10
10
  require 'parallel'
11
- require 'frontkick'
12
11
 
13
12
  module Kondate
14
13
  class CLI < Thor
@@ -158,10 +157,7 @@ module Kondate
158
157
  command << " bootstrap.rb"
159
158
  $stdout.puts "env #{env.map {|k, v| "#{k}=#{v.shellescape}" }.join(' ')} #{command}"
160
159
 
161
- output_with_hostname(host) do |out, err|
162
- result = Frontkick.exec(env, command, out: out, err: err)
163
- return false unless result.successful?
164
- end
160
+ return false unless system(env, command)
165
161
  end
166
162
  true
167
163
  end
@@ -187,45 +183,11 @@ module Kondate
187
183
  command = "bundle exec rspec #{spec_files.map{|f| f.shellescape }.join(' ')}"
188
184
  $stdout.puts "env #{env.map {|k, v| "#{k}=#{v.shellescape}" }.join(' ')} #{command}"
189
185
 
190
- output_with_hostname(host) do |out, err|
191
- result = Frontkick.exec(env, command, out: out, err: err)
192
- return false unless result.successful?
193
- end
186
+ return false unless system(env, command)
194
187
  end
195
188
  true
196
189
  end
197
190
 
198
- def output_with_hostname(host, &block)
199
- out_r, out_w = IO.pipe
200
- out_w.sync = true
201
- err_r, err_w = IO.pipe
202
- err_w.sync = true
203
-
204
- $stdout.sync = true
205
- $stderr.sync = true
206
-
207
- out_thr = Thread.new do
208
- while r = out_r.gets
209
- $stdout.write "#{host} | #{r}"
210
- end
211
- end
212
-
213
- err_thr = Thread.new do
214
- while r = err_r.gets
215
- $stderr.write "#{host} | #{r}"
216
- end
217
- end
218
-
219
- yield(out_w, err_w)
220
- ensure
221
- out_r.close rescue nil
222
- out_w.close rescue nil
223
- err_r.close rescue nil
224
- err_w.close rescue nil
225
- out_thr.exit rescue nil
226
- err_thr.exit rescue nil
227
- end
228
-
229
191
  def proceed?(property_files)
230
192
  if property_files.values.compact.reject(&:empty?).empty?
231
193
  $stderr.puts "Nothing to run"
@@ -13,6 +13,7 @@ module Kondate
13
13
  def bootstrap
14
14
  $stdout.sync = true
15
15
  $stderr.sync = true
16
+ tweak_logger
16
17
  bootstrap_middleware_recipes
17
18
  bootstrap_role_recipes
18
19
  end
@@ -27,6 +28,17 @@ module Kondate
27
28
  @context.include_recipe(recipe)
28
29
  end
29
30
 
31
+ def tweak_logger
32
+ hostname = node[:hostname]
33
+ ::Itamae::Logger::Formatter.class_eval do
34
+ define_method(:call) do |severity, datetime, progname, msg|
35
+ log = "%s | %s : %s" % [hostname, "%5s" % severity, msg2str(msg)]
36
+
37
+ (colored ? colorize(log, severity) : log) + "\n"
38
+ end
39
+ end
40
+ end
41
+
30
42
  def bootstrap_middleware_recipes
31
43
  recipes = node['attributes'].keys
32
44
  recipes.each do |recipe|
@@ -1,3 +1,3 @@
1
1
  module Kondate
2
- VERSION = "0.4.8"
2
+ VERSION = "0.4.9"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kondate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.8
4
+ version: 0.4.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - sonots
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-01-27 00:00:00.000000000 Z
11
+ date: 2017-02-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: itamae
@@ -94,20 +94,6 @@ dependencies:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
- - !ruby/object:Gem::Dependency
98
- name: frontkick
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - ">="
102
- - !ruby/object:Gem::Version
103
- version: '0'
104
- type: :runtime
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - ">="
109
- - !ruby/object:Gem::Version
110
- version: '0'
111
97
  - !ruby/object:Gem::Dependency
112
98
  name: bundler
113
99
  requirement: !ruby/object:Gem::Requirement