samovar 1.9.2 → 1.10.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: 9c0bd9487cfc9b45d64ca2f1e807ce0e89b6b4408ef9ed812eb6fd3f04b376c6
4
- data.tar.gz: 7145b36d633509be0f83db27f2f875109ac0623f9d46fac397933e3ac0196a6d
3
+ metadata.gz: c1e5553e013cfe19724bdbdb1cb1c989025216e737e6b7591068f97fc4059fb3
4
+ data.tar.gz: 7430857e0d0d389b041056d2cac1f532d6215014ed06b4f60fc2a8e0fdc4161f
5
5
  SHA512:
6
- metadata.gz: fcf6d2a20f71d11d82855526be7f9e888ec332cdf80bb8999fa4467f5030e4ba8ee18cd9fa710f0e3c2083be4222ea4dd2db44b3b7a435bb41cd8e10692371a9
7
- data.tar.gz: f75f223d7e5db75dc352f18f384b53e4935937353ef213b77949b963305ba717c7054d38c036e1f6c43a6bea448093154d7a90a8926670fd0c5109387bd66fc8
6
+ metadata.gz: 9a47b68e6b5c28c2539d9089d51752320a289056f762693edef1b7ec84dff3f8befc3f5196700f95243ca3bb1461413e1fc74c3d6d6619c816eeb873f5491800
7
+ data.tar.gz: b083e569e8f23de9da31c302dbd1526b32cbfbb9d6087430f0103ff68d3ca3de204d87bf4f541179f3c2b56f3f71c10b4ac0c32331a1261d740f5f3d7a88445e
@@ -20,7 +20,8 @@
20
20
 
21
21
  require_relative '../failure'
22
22
 
23
- require 'time'
23
+ require_relative 'terminal'
24
+
24
25
  require 'shellwords'
25
26
 
26
27
  module Samovar
@@ -49,7 +50,7 @@ module Samovar
49
50
  def log_system(args, options)
50
51
  # Print out something half-decent:
51
52
  command_line = Shellwords.join(args)
52
- puts Rainbow(command_line).color(:blue)
53
+ terminal.puts command_line, style: :command
53
54
  end
54
55
  end
55
56
  end
@@ -0,0 +1,32 @@
1
+ # Copyright, 2019, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the "Software"), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in
11
+ # all copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ # THE SOFTWARE.
20
+
21
+ require 'time'
22
+
23
+ module Samovar
24
+ class Command
25
+ def terminal(output = $stderr)
26
+ Event::Terminal.for(output).tap do |terminal|
27
+ terminal[:command] = terminal.style(:blue)
28
+ terminal[:summary] = terminal.style(:magenta)
29
+ end
30
+ end
31
+ end
32
+ end
@@ -20,6 +20,8 @@
20
20
 
21
21
  require 'time'
22
22
 
23
+ require_relative 'terminal'
24
+
23
25
  module Samovar
24
26
  class Command
25
27
  def track_time
@@ -31,7 +33,7 @@ module Samovar
31
33
  elapsed_time = end_time - start_time
32
34
 
33
35
  $stdout.flush
34
- $stderr.puts Rainbow("Elapsed Time: %0.3fs" % elapsed_time).magenta
36
+ terminal.puts("Elapsed Time: %0.3fs" % elapsed_time, style: :summary)
35
37
  end
36
38
  end
37
39
  end
@@ -19,7 +19,8 @@
19
19
  # THE SOFTWARE.
20
20
 
21
21
  require 'mapping/model'
22
- require 'rainbow'
22
+
23
+ require 'event/terminal'
23
24
 
24
25
  module Samovar
25
26
  module Output
@@ -141,17 +142,21 @@ module Samovar
141
142
  @rows = rows
142
143
  @output = output
143
144
  @width = 80
145
+
146
+ @terminal = Event::Terminal.for(@output)
147
+ @terminal[:header] = @terminal.style(:blue, nil, :bright)
148
+ @terminal[:description] = @terminal.style(:blue)
144
149
  end
145
150
 
146
151
  map(Header) do |header, rows|
147
- @output.puts unless header == @rows.first
148
- @output.puts "#{rows.indentation}#{Rainbow(header.object.command_line(header.name)).bright}"
149
- @output.puts "#{rows.indentation}\t#{Rainbow(header.object.description).blue}"
150
- @output.puts
152
+ @terminal.puts unless header == @rows.first
153
+ @terminal.puts "#{rows.indentation}#{header.object.command_line(header.name)}", style: :header
154
+ @terminal.puts "#{rows.indentation}\t#{header.object.description}", style: :description
155
+ @terminal.puts
151
156
  end
152
157
 
153
158
  map(Row) do |row, rows|
154
- @output.puts "#{rows.indentation}#{row.align(rows.columns)}"
159
+ @terminal.puts "#{rows.indentation}#{row.align(rows.columns)}"
155
160
  end
156
161
 
157
162
  map(Rows) do |items|
@@ -19,5 +19,5 @@
19
19
  # THE SOFTWARE.
20
20
 
21
21
  module Samovar
22
- VERSION = "1.9.2"
22
+ VERSION = "1.10.0"
23
23
  end
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ["lib"]
20
20
 
21
21
  spec.add_dependency "mapping", "~> 1.0"
22
- spec.add_dependency "rainbow", ">= 2.0", "< 4.0"
22
+ spec.add_dependency "event"
23
23
 
24
24
  spec.add_development_dependency "covered"
25
25
  spec.add_development_dependency "bundler"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: samovar
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.2
4
+ version: 1.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-02-08 00:00:00.000000000 Z
11
+ date: 2019-03-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mapping
@@ -25,25 +25,19 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: rainbow
28
+ name: event
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '2.0'
34
- - - "<"
35
- - !ruby/object:Gem::Version
36
- version: '4.0'
33
+ version: '0'
37
34
  type: :runtime
38
35
  prerelease: false
39
36
  version_requirements: !ruby/object:Gem::Requirement
40
37
  requirements:
41
38
  - - ">="
42
39
  - !ruby/object:Gem::Version
43
- version: '2.0'
44
- - - "<"
45
- - !ruby/object:Gem::Version
46
- version: '4.0'
40
+ version: '0'
47
41
  - !ruby/object:Gem::Dependency
48
42
  name: covered
49
43
  requirement: !ruby/object:Gem::Requirement
@@ -116,6 +110,7 @@ files:
116
110
  - lib/samovar.rb
117
111
  - lib/samovar/command.rb
118
112
  - lib/samovar/command/system.rb
113
+ - lib/samovar/command/terminal.rb
119
114
  - lib/samovar/command/track_time.rb
120
115
  - lib/samovar/failure.rb
121
116
  - lib/samovar/flags.rb
@@ -154,7 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
154
149
  - !ruby/object:Gem::Version
155
150
  version: '0'
156
151
  requirements: []
157
- rubygems_version: 3.0.2
152
+ rubygems_version: 3.0.3
158
153
  signing_key:
159
154
  specification_version: 4
160
155
  summary: Samovar is a flexible option parser excellent support for sub-commands and