autowow 0.9.1 → 0.9.2

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: c8c42c86b4414e4942f06b88a2af8bb3f5ec0d4e
4
- data.tar.gz: 9c120e8ad48070549369d59300603830433ad080
3
+ metadata.gz: 48291b2d9a0df006bf706b4b1e78e68d738b2e95
4
+ data.tar.gz: a77484bd198269c68dd5c43afec2055b0368f536
5
5
  SHA512:
6
- metadata.gz: c6b51113b900820696854893a46e994008787ca0b117cad6308589441980887b69ad2af669fe910bddff5b098c8961709ff576fa2c96ee938f57183a7f650bb5
7
- data.tar.gz: 7d75cd525f8e4ce7e82f801045b6f86f9b5766343be582830e572d992c63ccf4a69be8062e214ea3cdf90c62bac06a245ec7627f90fc38f8e71d0a7f4d3ac149
6
+ metadata.gz: 917b983e4fb8cd58ea0c6ff2b2c06b5b496b86f5fd28cbb06fce4f6b43d53ca915929be98b12d7be276d4cd0bfe43d954582af576992eb83e5b60a25d1b49da8
7
+ data.tar.gz: 769549c409634fe76c2e286d97be3d7fa7bca9204c4582834306e815caef882d024c1e1dde9706469413dd52414b248c091322f5ac20c2dbe1aadc00ae018bda
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  #### Set of commands to [auto]mate [w]ay [o]f [w]orking
4
4
 
5
- *You are viewing the README of version [v0.9.1](https://github.com/thisismydesign/autowow/releases/tag/v0.9.1). You can find other releases [here](https://github.com/thisismydesign/autowow/releases).*
5
+ *You are viewing the README of version [v0.9.2](https://github.com/thisismydesign/autowow/releases/tag/v0.9.2). You can find other releases [here](https://github.com/thisismydesign/autowow/releases).*
6
6
 
7
7
  | Branch | Status |
8
8
  | ------ | ------ |
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
26
26
  spec.add_dependency "pastel" # Colorize output of own logger
27
27
  spec.add_dependency "time_difference", "= 0.5.0" # Calculate project age. Fixed version because of refinements :(
28
28
  spec.add_dependency "launchy" # Open project in browser
29
- spec.add_dependency "tty-command", "<= 0.8.0" # Execute system commands nicely, upper limit because `Autowow::Executor` hijacks Printer classes (new releases should be tested)
29
+ spec.add_dependency "tty-command", "~> 0.8" # Execute system commands nicely
30
30
  spec.add_dependency "reflection_utils", ">= 0.3.0" # Invoke module methods without including the module
31
31
  spec.add_dependency "rubocop" # Style check
32
32
  spec.add_dependency "rubocop-rspec" # Style check
@@ -8,24 +8,53 @@ module Autowow
8
8
 
9
9
  def print_command_exit(cmd, status, runtime, *args)
10
10
  super
11
- tty_version = Gem::Version.new(TTY::Command::VERSION)
12
- if tty_version < Gem::Version.new("0.8.0")
13
- write("")
14
- else
15
- write(TTY::Command::Cmd.new("dummy"), "")
16
- end
11
+ write(TTY::Command::Cmd.new("dummy"), "")
17
12
  end
18
13
  end
19
14
 
20
15
  class PrettyWithOutput < TTY::Command::Printers::Pretty
21
16
  def print_command_exit(cmd, status, runtime, *args)
22
17
  super
23
- tty_version = Gem::Version.new(TTY::Command::VERSION)
24
- if tty_version < Gem::Version.new("0.8.0")
25
- write("")
26
- else
27
- write(TTY::Command::Cmd.new("dummy"), "")
28
- end
18
+ write(TTY::Command::Cmd.new("dummy"), "")
19
+ end
20
+ end
21
+
22
+ class BufferingPretty < TTY::Command::Printers::Pretty
23
+ def initialize(*)
24
+ super
25
+ @out = ""
26
+ end
27
+
28
+ def print_command_out_data(cmd, *args)
29
+ @out << args.join(" ")
30
+ return unless multiple_lines?(@out)
31
+ finished_lines(@out).each { |line| write(cmd, line) }
32
+ @out = unfinished_line(@out)
33
+ end
34
+ alias_method :print_command_err_data, :print_command_out_data
35
+
36
+ def print_command_exit(cmd, status, runtime, *args)
37
+ @out.each_line.map(&:chomp).each { |line| write(cmd, line) }
38
+ super
39
+ end
40
+
41
+ def write(cmd, message, data = nil)
42
+ out = []
43
+ out << "[#{decorate(cmd.uuid, :green)}] " unless cmd.uuid.nil?
44
+ out << "#{message}\n"
45
+ output << out.join
46
+ end
47
+
48
+ def finished_lines(string)
49
+ string.each_line.to_a[0..-2].map(&:chomp)
50
+ end
51
+
52
+ def unfinished_line(string)
53
+ string.each_line.to_a[-1]
54
+ end
55
+
56
+ def multiple_lines?(string)
57
+ string.each_line.count > 1
29
58
  end
30
59
  end
31
60
 
@@ -54,7 +83,7 @@ module Autowow
54
83
  end
55
84
 
56
85
  def pretty_with_output
57
- @pretty_with_output ||= RunWrapper.new(TTY::Command.new(tty_params.merge(printer: PrettyWithOutput)), fail_silently: true)
86
+ @pretty_with_output ||= RunWrapper.new(TTY::Command.new(tty_params.merge(printer: BufferingPretty)), fail_silently: true)
58
87
  end
59
88
 
60
89
  def quiet
@@ -62,14 +91,7 @@ module Autowow
62
91
  end
63
92
 
64
93
  def tty_params
65
- tty_version = Gem::Version.new(TTY::Command::VERSION)
66
- if tty_version < Gem::Version.new("0.7.0")
67
- {}
68
- elsif tty_version < Gem::Version.new("0.8.0")
69
- { pty: true }
70
- else
71
- { pty: true, verbose: false }
72
- end
94
+ { pty: true, verbose: false }
73
95
  end
74
96
 
75
97
  include ReflectionUtils::CreateModuleFunctions
@@ -1,3 +1,3 @@
1
1
  module Autowow
2
- VERSION = "0.9.1"
2
+ VERSION = "0.9.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autowow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - thisismydesign
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-24 00:00:00.000000000 Z
11
+ date: 2018-06-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: easy_logging
@@ -84,16 +84,16 @@ dependencies:
84
84
  name: tty-command
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "<="
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: 0.8.0
89
+ version: '0.8'
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - "<="
94
+ - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: 0.8.0
96
+ version: '0.8'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: reflection_utils
99
99
  requirement: !ruby/object:Gem::Requirement