kafo 6.1.2 → 6.2.0

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
  SHA256:
3
- metadata.gz: d5b062b74a81972dc7e0029799071d8b634ff87d50921e971bea9160ac007179
4
- data.tar.gz: 91d16fcc9ce37cece41968d07ca8f44150016ac58cdc66adaef07ec9efa21d9f
3
+ metadata.gz: 21528e35ca1cc51e734b4251383a69fd840c7f83dc084a9dfe45289360b2bb21
4
+ data.tar.gz: ccc5e320dd763e782670173e9f7f9222c37e0a3ad3da4efe4d81e4ce21a41743
5
5
  SHA512:
6
- metadata.gz: 57abd42df5d5718db2a0ad815fac3c9b7c7e670baa394c9227cedadf3cd0c18f433168d035f23b8aaf4e48d8fe2d2ae17a19371dc8f8756b0857eb31878b5a8c
7
- data.tar.gz: ef4f963505fc2e6315fbe19ed8e71e69faa44bf852491b0eebcb3ac778a8ecd86d03989bb2784735e6502ff539f026bd5ae51a12062c01d467601c03fea5ea3e
6
+ metadata.gz: 01cc33d944f33ac1e14c38b5969c078ff452c5b52a419981206fd3a23e03e17597e8ae6a57f6f50addd6e04e7e890ba398d502128f5d5d5e7fecce9aa01a7c9e
7
+ data.tar.gz: 772011182c7d11ada145164683ff5177fd031f48d2596adc67888c6c0e11ae4e19311dc737fbebb3a053b574be9c52a2c4fd376f6c84908438faa0b544ba11a0
data/Rakefile CHANGED
@@ -4,7 +4,7 @@ load 'tasks/jenkins.rake'
4
4
 
5
5
  Rake::TestTask.new('test:ruby') do |t|
6
6
  t.libs << 'lib' << 'test'
7
- t.test_files = FileList['test/**/*_test.rb']
7
+ t.test_files = FileList['test/**/*_test.rb'] - FileList['test/tmp/**/*_test.rb']
8
8
  t.verbose = true
9
9
  end
10
10
 
@@ -1,4 +1,4 @@
1
- require 'highline/import'
1
+ require 'highline'
2
2
 
3
3
  module Kafo
4
4
  class ColorScheme
@@ -48,11 +48,17 @@ module Kafo
48
48
  def execute(group, log_stage: true)
49
49
  logger = Logger.new(group)
50
50
  logger.notice "Executing hooks in group #{group}" if log_stage
51
- self.hooks[group].keys.sort_by(&:to_s).each do |name|
51
+
52
+ sorted_hooks = self.hooks[group].keys.sort do |a, b|
53
+ File.basename(a.to_s) <=> File.basename(b.to_s)
54
+ end
55
+
56
+ sorted_hooks.each do |name|
52
57
  hook = self.hooks[group][name]
53
58
  result = HookContext.execute(self.kafo, logger, &hook)
54
59
  logger.debug "Hook #{name} returned #{result.inspect}"
55
60
  end
61
+
56
62
  logger.notice "All hooks in group #{group} finished" if log_stage
57
63
  @group = nil
58
64
  end
@@ -1,4 +1,5 @@
1
1
  # encoding: UTF-8
2
+ require 'highline'
2
3
  require 'powerbar'
3
4
  require 'ansi/code'
4
5
  require 'set'
@@ -20,7 +21,7 @@ module Kafo
20
21
  @all_lines = 0
21
22
  @total = :unknown
22
23
  @resources = Set.new
23
- @term_width = HighLine::SystemExtensions.terminal_size[0] || 0
24
+ @term_width = terminal_width
24
25
  @bar = PowerBar.new
25
26
  @bar.settings.tty.infinite.template.main = infinite_template
26
27
  @bar.settings.tty.finite.template.main = finite_template
@@ -85,6 +86,17 @@ module Kafo
85
86
 
86
87
  private
87
88
 
89
+ def terminal_width
90
+ # HighLine 2 has Terminal, 1 has SystemExtensions
91
+ terminal_size = if HighLine.respond_to?(:default_instance)
92
+ HighLine.default_instance.terminal.terminal_size
93
+ else
94
+ HighLine::SystemExtensions.terminal_size
95
+ end
96
+
97
+ terminal_size ? (terminal_size[0] || 0) : 0
98
+ end
99
+
88
100
  def done_message
89
101
  text = 'Done'
90
102
  text + (' ' * (50 - text.length))
@@ -1,4 +1,5 @@
1
1
  # encoding: UTF-8
2
+ require 'highline/import'
2
3
  require 'kafo_wizards'
3
4
  require 'pathname'
4
5
 
@@ -1,5 +1,5 @@
1
1
  # encoding: UTF-8
2
2
  module Kafo
3
3
  PARSER_CACHE_VERSION = 1
4
- VERSION = "6.1.2"
4
+ VERSION = "6.2.0"
5
5
  end
@@ -1,5 +1,6 @@
1
1
  # encoding: UTF-8
2
- require 'highline/import'
2
+ require 'forwardable'
3
+ require 'highline'
3
4
  require 'yaml'
4
5
 
5
6
  module Kafo
@@ -8,14 +9,17 @@ module Kafo
8
9
  Kafo::ENV::LANG =~ /UTF-8\z/
9
10
  end
10
11
 
12
+ extend Forwardable
13
+ def_delegators :@highline, :agree, :ask, :choose, :say
14
+
11
15
  OK = utf_support? ? '✓' : 'y'
12
16
  NO = utf_support? ? '✗' : 'n'
13
17
 
14
- def initialize(kafo)
18
+ def initialize(kafo, input=$stdin, output=$stdout)
15
19
  @kafo = kafo
16
20
  @config = kafo.config
17
21
  @name = @config.app[:name] || 'Kafo'
18
- setup_terminal
22
+ @highline = setup_terminal(input, output)
19
23
  end
20
24
 
21
25
  def run
@@ -178,11 +182,17 @@ END
178
182
  say "\n" + HighLine.color("Value for #{param.name} reset to default", :important)
179
183
  end
180
184
 
181
- def setup_terminal
182
- $terminal = HighLine.new
183
- data = HighLine::SystemExtensions.terminal_size
184
- $terminal.wrap_at = data.first > 80 ? 80 : data.first if data.first
185
- $terminal.page_at = data.last if data.last
185
+ def setup_terminal(input, output)
186
+ highline = HighLine.new(input, output)
187
+ # HighLine 2 vs 1
188
+ data = if highline.respond_to?(:terminal)
189
+ highline.terminal.terminal_size
190
+ else
191
+ HighLine::SystemExtensions.terminal_size
192
+ end
193
+ highline.wrap_at = data.first > 80 ? 80 : data.first if data.first
194
+ highline.page_at = data.last if data.last
195
+ highline
186
196
  end
187
197
  end
188
198
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kafo
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.1.2
4
+ version: 6.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marek Hulan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-10 00:00:00.000000000 Z
11
+ date: 2021-01-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -171,7 +171,7 @@ dependencies:
171
171
  version: 1.6.21
172
172
  - - "<"
173
173
  - !ruby/object:Gem::Version
174
- version: '2.0'
174
+ version: '3.0'
175
175
  type: :runtime
176
176
  prerelease: false
177
177
  version_requirements: !ruby/object:Gem::Requirement
@@ -181,7 +181,7 @@ dependencies:
181
181
  version: 1.6.21
182
182
  - - "<"
183
183
  - !ruby/object:Gem::Version
184
- version: '2.0'
184
+ version: '3.0'
185
185
  - !ruby/object:Gem::Dependency
186
186
  name: powerbar
187
187
  requirement: !ruby/object:Gem::Requirement
@@ -293,7 +293,6 @@ files:
293
293
  - modules/kafo_configure/spec/classes/init_spec.rb
294
294
  - modules/kafo_configure/spec/fixtures/hiera/hiera.yaml
295
295
  - modules/kafo_configure/spec/fixtures/hiera/test.yaml
296
- - modules/kafo_configure/spec/fixtures/manifests/site.pp
297
296
  - modules/kafo_configure/spec/fixtures/modules/dummy/manifests/init.pp
298
297
  - modules/kafo_configure/spec/fixtures/modules/dummy/manifests/params.pp
299
298
  - modules/kafo_configure/spec/functions/dump_lookups_spec.rb