shell_helpers 0.7.0 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +25 -0
- data/ChangeLog.md +11 -1
- data/Gemfile +5 -2
- data/README.md +6 -3
- data/Rakefile +8 -0
- data/gemspec.yml +3 -5
- data/lib/shell_helpers/logger.rb +9 -7
- data/lib/shell_helpers/pathname.rb +2 -2
- data/lib/shell_helpers/utils.rb +3 -3
- data/lib/shell_helpers/version.rb +1 -1
- data/shell_helpers.gemspec +2 -2
- data/test/helper.rb +10 -0
- data/test/test_export.rb +35 -35
- data/test/test_logger.rb +9 -9
- metadata +13 -38
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1c07c9cffa18a8a3b4df10fe40f8315b09614bd8ac3504d7a80874c4611c017f
|
4
|
+
data.tar.gz: a5fcd72a5f118f02197513ef12a52a59a4d2320a644e4be0c75c2e16906295e3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ce2e71d5b9d39b941a50c08aa5c7b0bae0b1bfa9ea33918a7e26ada325123a434b901611371f33e2307674dab8e65d393d86e64dfffb3954700d127983e2a1f
|
7
|
+
data.tar.gz: 44ed75d1978852eb567b1ad86caaef91b7fdf290d2fdebe4cee4855d863fbd2ce88e8844636a464a9ecd9583de473eafa474f67fc58cf0ceacf06eb61b154acc
|
@@ -0,0 +1,25 @@
|
|
1
|
+
name: Ruby
|
2
|
+
|
3
|
+
on: [push]
|
4
|
+
jobs:
|
5
|
+
test:
|
6
|
+
strategy:
|
7
|
+
fail-fast: false
|
8
|
+
matrix:
|
9
|
+
os: [ ubuntu-latest, macos-latest ]
|
10
|
+
ruby: [ 2.3, 2.4, 2.5, 2.6, 2.7, jruby, truffleruby ]
|
11
|
+
runs-on: ${{ matrix.os }}
|
12
|
+
steps:
|
13
|
+
- name: 'Git checkout'
|
14
|
+
uses: actions/checkout@v2
|
15
|
+
- name: 'Setup ruby'
|
16
|
+
uses: ruby/setup-ruby@v1
|
17
|
+
with:
|
18
|
+
ruby-version: ${{ matrix.ruby }}
|
19
|
+
- name: 'Install bundler and gems'
|
20
|
+
run: |
|
21
|
+
gem install bundler
|
22
|
+
bundle install --jobs 4 --retry 3
|
23
|
+
- name: "Run tests"
|
24
|
+
run: |
|
25
|
+
bundle exec rake test
|
data/ChangeLog.md
CHANGED
@@ -1,5 +1,15 @@
|
|
1
|
-
== Release v0.7.
|
1
|
+
== Release v0.7.1 (2020-02-26) ==
|
2
2
|
|
3
|
+
* logger.rb: use class_eval
|
4
|
+
* Add .bundle/config
|
5
|
+
* Bump require gem versions
|
6
|
+
* Add github action for tests
|
7
|
+
* Fix minitest warning
|
8
|
+
* Fix warnings
|
9
|
+
|
10
|
+
== Release v0.7.0 (2020-02-19) ==
|
11
|
+
|
12
|
+
* Bump version and update ChangeLog.md
|
3
13
|
* Copyright
|
4
14
|
* rsync: Use -zz instead of -z (--new-compress)
|
5
15
|
* Fixes for ruby 2.7
|
data/Gemfile
CHANGED
@@ -1,8 +1,11 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
|
3
3
|
gemspec
|
4
|
-
gem 'drain', :github => 'DamienRobert/drain'
|
4
|
+
# gem 'drain', :github => 'DamienRobert/drain'
|
5
5
|
|
6
|
-
group :
|
6
|
+
group :extra_devel do
|
7
|
+
gem 'minitest-reporters', '~> 1.4'
|
8
|
+
gem 'yard', '~> 0.9'
|
7
9
|
gem 'kramdown'
|
10
|
+
gem 'rubygems-tasks', '~> 0.2'
|
8
11
|
end
|
data/README.md
CHANGED
@@ -3,9 +3,10 @@
|
|
3
3
|
* [Homepage](https://github.com/DamienRobert/shell_helpers#readme)
|
4
4
|
* [Issues](https://github.com/DamienRobert/shell_helpers/issues)
|
5
5
|
* [Documentation](http://rubydoc.info/gems/shell_helpers)
|
6
|
-
* [Email](mailto:Damien.Olivier.Robert+gems
|
6
|
+
* [Email](mailto:Damien.Olivier.Robert+gems@gmail.com)
|
7
7
|
|
8
8
|
[![Gem Version](https://img.shields.io/gem/v/shell_helpers.svg)](https://rubygems.org/gems/shell_helpers)
|
9
|
+
[![Ruby test result](https://github.com/DamienRobert/shell_helpers/workflows/Ruby/badge.svg)](https://github.com/DamienRobert/shell_helpers/actions?query=workflow%3ARuby)
|
9
10
|
[![Build Status](https://travis-ci.org/DamienRobert/shell_helpers.svg?branch=master)](https://travis-ci.org/DamienRobert/shell_helpers)
|
10
11
|
|
11
12
|
## Description
|
@@ -32,6 +33,7 @@
|
|
32
33
|
|
33
34
|
## Examples
|
34
35
|
|
36
|
+
~~~ ruby
|
35
37
|
require 'shell_helpers'
|
36
38
|
SH::Pathname.new("foo").cp("bar") #calls FileUtils.cp("foo","bar")
|
37
39
|
SH::Pathname.new("foo/").on_cp("bar","baz") #copy 'bar' and 'baz' to 'foo/'
|
@@ -42,6 +44,7 @@
|
|
42
44
|
SH::Pathname.new("foo").squel_dir("bar',action: :on_ln_s)
|
43
45
|
#Remove these symlinks
|
44
46
|
SH::Pathname.new("foo").squel_dir("bar") {|o,t| o.on_rm(mode: :symlink)}
|
47
|
+
~~~
|
45
48
|
|
46
49
|
## Warning
|
47
50
|
|
@@ -53,9 +56,9 @@
|
|
53
56
|
|
54
57
|
## Copyright
|
55
58
|
|
56
|
-
Copyright © 2015–
|
59
|
+
Copyright © 2015–2020 Damien Robert
|
57
60
|
|
58
|
-
MIT License. See
|
61
|
+
MIT License. See [`LICENSE.txt`](LICENSE.txt) for details.
|
59
62
|
|
60
63
|
See above for the copyright: for the files `logger.rb` and `sh.rb` the
|
61
64
|
copyright applies only to the diff from the original import from methadone.
|
data/Rakefile
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
## Uncomment to use `rake` directly rather than `bundle exec rake`
|
2
|
+
#begin
|
3
|
+
# require 'bundler/setup'
|
4
|
+
#rescue LoadError => e
|
5
|
+
# warn "Could not setup bundler: #{e.message}"
|
6
|
+
#end
|
1
7
|
require 'rake'
|
2
8
|
|
3
9
|
require 'rake/testtask'
|
@@ -15,6 +21,7 @@ rescue LoadError => e
|
|
15
21
|
warn e.message
|
16
22
|
end
|
17
23
|
end
|
24
|
+
desc 'Generate docs'
|
18
25
|
task :doc => :yard
|
19
26
|
|
20
27
|
begin
|
@@ -24,3 +31,4 @@ rescue LoadError => e
|
|
24
31
|
warn e.message
|
25
32
|
end
|
26
33
|
|
34
|
+
task :default => :test
|
data/gemspec.yml
CHANGED
@@ -8,10 +8,8 @@ email: Damien.Olivier.Robert+gems@gmail.com
|
|
8
8
|
homepage: https://github.com/DamienRobert/shell_helpers#readme
|
9
9
|
|
10
10
|
dependencies:
|
11
|
-
drain: ~> 0.
|
12
|
-
simplecolor: ~> 0.
|
11
|
+
drain: ~> 0.6
|
12
|
+
simplecolor: ~> 0.4
|
13
13
|
development_dependencies:
|
14
14
|
minitest: "~> 5.0"
|
15
|
-
rake: "
|
16
|
-
rubygems-tasks: "~> 0.2"
|
17
|
-
yard: "~> 0.8"
|
15
|
+
rake: ">= 10.0"
|
data/lib/shell_helpers/logger.rb
CHANGED
@@ -159,11 +159,13 @@ module ShellHelpers
|
|
159
159
|
klass=self.singleton_class
|
160
160
|
levels=log_levels.merge!(levels)
|
161
161
|
levels.keys.each do |lvl|
|
162
|
-
klass.
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
162
|
+
klass.class_eval do
|
163
|
+
define_method(lvl.to_sym) do |msg=nil, **opts, &block|
|
164
|
+
add(lvl.to_sym, msg, **opts, &block)
|
165
|
+
end
|
166
|
+
define_method("#{lvl}?".to_sym) do
|
167
|
+
@level <= severity_lvl(lvl)
|
168
|
+
end
|
167
169
|
end
|
168
170
|
end
|
169
171
|
yield self, @default_formatter if block_given?
|
@@ -312,13 +314,13 @@ module ShellHelpers
|
|
312
314
|
split_log: :auto, default_error_lvl: DEFAULT_ERROR_LEVEL, **kwds)
|
313
315
|
@stderr_logger = ColorLogger.new(error_device, default_lvl: default_error_lvl, **kwds)
|
314
316
|
|
315
|
-
super(log_device, **kwds)
|
316
|
-
|
317
317
|
log_device_tty = tty?(log_device)
|
318
318
|
error_device_tty = tty?(error_device)
|
319
319
|
|
320
320
|
@split_logs = log_device_tty && error_device_tty if split_log==:auto
|
321
321
|
|
322
|
+
super(log_device, **kwds)
|
323
|
+
|
322
324
|
self.default_formatter = ColorFormatter.create(:color) if log_device_tty
|
323
325
|
@stderr_logger.default_formatter = ColorFormatter.create(:color) if error_device_tty
|
324
326
|
|
@@ -389,7 +389,7 @@ module ShellHelpers
|
|
389
389
|
extend FUClass
|
390
390
|
#wrapper around FileUtils
|
391
391
|
#For instance Pathname#rmdir uses Dir.rmdir, but the rmdir from FileUtils is a wrapper around Dir.rmdir that accepts extra options
|
392
|
-
[:
|
392
|
+
[:rmdir, :mkdir, :cmp, :touch, :rm, :rm_r, :uptodate?, :cp,:cp_r,:mv,:ln,:ln_s,:ln_sf].each do |method|
|
393
393
|
define_method method do |*args,&b|
|
394
394
|
self.class.fu_class.public_send(method,self,*args,&b)
|
395
395
|
end
|
@@ -590,7 +590,7 @@ module ShellHelpers
|
|
590
590
|
|
591
591
|
class VirtualFile
|
592
592
|
extend Forwardable
|
593
|
-
def_delegators :@tmpfile, :open, :close, :close!, :unlink
|
593
|
+
def_delegators :@tmpfile, :open, :close, :close!, :unlink
|
594
594
|
attr_accessor :content, :name, :tmpfile
|
595
595
|
|
596
596
|
def initialize(name, content)
|
data/lib/shell_helpers/utils.rb
CHANGED
@@ -72,10 +72,10 @@ module ShellHelpers
|
|
72
72
|
files.map! {|f| f.dup.taint}
|
73
73
|
if chdir
|
74
74
|
Dir.chdir(base) do
|
75
|
-
yield
|
75
|
+
yield(*files, base)
|
76
76
|
end
|
77
77
|
else
|
78
|
-
yield
|
78
|
+
yield(*files, base)
|
79
79
|
end
|
80
80
|
end
|
81
81
|
end
|
@@ -130,7 +130,7 @@ module ShellHelpers
|
|
130
130
|
Kernel.select [$stdin] # Wait until we have input before we start the pager
|
131
131
|
pager = ENV['PAGER'] || 'less'
|
132
132
|
run=args.unshift(pager)
|
133
|
-
exec
|
133
|
+
exec(*run) rescue exec "/bin/sh", "-c", *run
|
134
134
|
end
|
135
135
|
|
136
136
|
#inside run_pager, escape from the pager
|
data/shell_helpers.gemspec
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
1
|
require 'yaml'
|
4
2
|
|
5
3
|
Gem::Specification.new do |gem|
|
@@ -35,6 +33,7 @@ Gem::Specification.new do |gem|
|
|
35
33
|
end
|
36
34
|
end
|
37
35
|
gem.files = glob[gemspec['files']] if gemspec['files']
|
36
|
+
gem.files = gem.files + gemspec['extra_files'] if gemspec['extra_files']
|
38
37
|
|
39
38
|
gem.executables = gemspec.fetch('executables') do
|
40
39
|
glob['bin/*'].map { |path| File.basename(path) }
|
@@ -68,4 +67,5 @@ Gem::Specification.new do |gem|
|
|
68
67
|
end
|
69
68
|
|
70
69
|
gem.metadata['yard.run']='yri'
|
70
|
+
gem.metadata['project_name']="ShellHelpers"
|
71
71
|
end
|
data/test/helper.rb
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
## Uncomment if you want to run a test directly without running
|
2
|
+
## `bundle exec ruby -I test test/test_...rb`
|
3
|
+
## (another solution if 'bundler/setup' is called on the Rakefile is to use
|
4
|
+
## `rake test TEST=test/test_...rb`)
|
5
|
+
# begin
|
6
|
+
# require 'bundler/setup'
|
7
|
+
# rescue LoadError => error
|
8
|
+
# warn "Could not setup bundler: #{error.message}"
|
9
|
+
# end
|
10
|
+
|
1
11
|
require 'minitest/autorun'
|
2
12
|
|
3
13
|
## Uncomment to launch pry on a failure
|
data/test/test_export.rb
CHANGED
@@ -3,75 +3,75 @@ require 'shell_helpers'
|
|
3
3
|
|
4
4
|
describe SH::Export do
|
5
5
|
it "can export a value" do
|
6
|
-
SH.export_value("foo").must_equal "foo"
|
7
|
-
SH.export_value(["foo","bar"]).must_equal "(foo bar)"
|
8
|
-
SH.export_value(["foo","bar"]).must_equal "(foo bar)"
|
9
|
-
SH.export_value(Set.new(["foo","bar"])).must_equal "(foo bar)"
|
10
|
-
SH.export_value({foo:"bar"}).must_equal "(foo bar)"
|
6
|
+
_(SH.export_value("foo")).must_equal "foo"
|
7
|
+
_(SH.export_value(["foo","bar"])).must_equal "(foo bar)"
|
8
|
+
_(SH.export_value(["foo","bar"])).must_equal "(foo bar)"
|
9
|
+
_(SH.export_value(Set.new(["foo","bar"]))).must_equal "(foo bar)"
|
10
|
+
_(SH.export_value({foo:"bar"})).must_equal "(foo bar)"
|
11
11
|
end
|
12
12
|
|
13
13
|
it "can escape a shell name" do
|
14
14
|
#foo/bar get interpreted as FOO_BAR
|
15
|
-
SH.escape_name("foo/bar").must_equal("FOO_BAR")
|
16
|
-
SH.escape_name("foo",prefix:"ploum",upcase:false).must_equal("ploumfoo")
|
15
|
+
_(SH.escape_name("foo/bar")).must_equal("FOO_BAR")
|
16
|
+
_(SH.escape_name("foo",prefix:"ploum",upcase:false)).must_equal("ploumfoo")
|
17
17
|
end
|
18
18
|
|
19
19
|
it "can export a variable" do
|
20
|
-
SH.export_variable("foo","baz").must_equal "FOO=baz\n"
|
21
|
-
SH.export_variable("foo","baz",local:true,export:true).must_equal "local FOO\nFOO=baz\nexport FOO\n"
|
22
|
-
SH.export_variable("foo",{bar:"baz"}).must_equal "typeset -A FOO\nFOO=(bar baz)\n"
|
20
|
+
_(SH.export_variable("foo","baz")).must_equal "FOO=baz\n"
|
21
|
+
_(SH.export_variable("foo","baz",local:true,export:true)).must_equal "local FOO\nFOO=baz\nexport FOO\n"
|
22
|
+
_(SH.export_variable("foo",{bar:"baz"})).must_equal "typeset -A FOO\nFOO=(bar baz)\n"
|
23
23
|
end
|
24
24
|
|
25
25
|
it "can export a hash" do
|
26
|
-
SH.export_variables({foo:"bar",ploum:"plam"}).must_equal "FOO=bar\nPLOUM=plam\n"
|
26
|
+
_(SH.export_variables({foo:"bar",ploum:"plam"})).must_equal "FOO=bar\nPLOUM=plam\n"
|
27
27
|
end
|
28
28
|
|
29
29
|
it "can select which keys to export" do
|
30
30
|
h={ploum: "plam", foo: {a: 1, b:2}}
|
31
|
-
SH.export_parse(h,"ploum").must_equal "PLOUM=plam\n"
|
32
|
-
SH.export_parse(h,:ploum).must_equal "PLOUM=plam\n"
|
31
|
+
_(SH.export_parse(h,"ploum")).must_equal "PLOUM=plam\n"
|
32
|
+
_(SH.export_parse(h,:ploum)).must_equal "PLOUM=plam\n"
|
33
33
|
#can select a hash in a hash
|
34
|
-
SH.export_parse(h,"foo/a").must_equal "FOO_A=1\n"
|
34
|
+
_(SH.export_parse(h,"foo/a")).must_equal "FOO_A=1\n"
|
35
35
|
#can export severable variables
|
36
|
-
SH.export_parse(h,"ploum,foo/a").must_equal "PLOUM=plam\nFOO_A=1\n"
|
36
|
+
_(SH.export_parse(h,"ploum,foo/a")).must_equal "PLOUM=plam\nFOO_A=1\n"
|
37
37
|
#can name the variables
|
38
|
-
SH.export_parse(h,"var:ploum").must_equal "VAR=plam\n"
|
39
|
-
SH.export_parse(h,"var2:foo/a").must_equal "VAR2=1\n"
|
40
|
-
SH.export_parse(h,"var:ploum,foo/a").must_equal "VAR=plam\nFOO_A=1\n"
|
38
|
+
_(SH.export_parse(h,"var:ploum")).must_equal "VAR=plam\n"
|
39
|
+
_(SH.export_parse(h,"var2:foo/a")).must_equal "VAR2=1\n"
|
40
|
+
_(SH.export_parse(h,"var:ploum,foo/a")).must_equal "VAR=plam\nFOO_A=1\n"
|
41
41
|
#can export values by ending with /
|
42
|
-
SH.export_parse(h,"foo/").must_equal "A=1\nB=2\n"
|
42
|
+
_(SH.export_parse(h,"foo/")).must_equal "A=1\nB=2\n"
|
43
43
|
#can select a prefix for the values
|
44
|
-
SH.export_parse(h,"prefix_:foo/").must_equal "prefix_A=1\nprefix_B=2\n"
|
44
|
+
_(SH.export_parse(h,"prefix_:foo/")).must_equal "prefix_A=1\nprefix_B=2\n"
|
45
45
|
#use '/' to select the whole hash
|
46
|
-
SH.export_parse(h,"/").must_equal "typeset -A ALL\nALL=(ploum plam foo \\{:a\\=\\>1,\\ :b\\=\\>2\\})\n"
|
46
|
+
_(SH.export_parse(h,"/")).must_equal "typeset -A ALL\nALL=(ploum plam foo \\{:a\\=\\>1,\\ :b\\=\\>2\\})\n"
|
47
47
|
#use '//' to export values in the whole hash
|
48
|
-
SH.export_parse(h,"//").must_equal "PLOUM=plam\ntypeset -A FOO\nFOO=(a 1 b 2)\n"
|
49
|
-
SH.export_parse(h,"prefix_://").must_equal "prefix_PLOUM=plam\ntypeset -A prefix_FOO\nprefix_FOO=(a 1 b 2)\n"
|
48
|
+
_(SH.export_parse(h,"//")).must_equal "PLOUM=plam\ntypeset -A FOO\nFOO=(a 1 b 2)\n"
|
49
|
+
_(SH.export_parse(h,"prefix_://")).must_equal "prefix_PLOUM=plam\ntypeset -A prefix_FOO\nprefix_FOO=(a 1 b 2)\n"
|
50
50
|
#can have options
|
51
|
-
SH.export_parse(h,"ploum!local!export").must_equal "local PLOUM\nPLOUM=plam\nexport PLOUM\n"
|
51
|
+
_(SH.export_parse(h,"ploum!local!export")).must_equal "local PLOUM\nPLOUM=plam\nexport PLOUM\n"
|
52
52
|
#use !! for global options
|
53
|
-
SH.export_parse(h,"ploum!local,var:foo/a!!export").must_equal "local PLOUM\nPLOUM=plam\nexport PLOUM\nVAR=1\nexport VAR\n"
|
53
|
+
_(SH.export_parse(h,"ploum!local,var:foo/a!!export")).must_equal "local PLOUM\nPLOUM=plam\nexport PLOUM\nVAR=1\nexport VAR\n"
|
54
54
|
end
|
55
55
|
|
56
56
|
it "can import a value" do
|
57
|
-
SH.import_value("foo").must_equal "foo"
|
58
|
-
SH.import_value("foo", type: Symbol).must_equal :foo
|
59
|
-
SH.import_value("(foo bar)", type: Array).must_equal %w(foo bar)
|
60
|
-
SH.import_value("(foo bar)", type: Hash).must_equal({"foo"=>"bar"})
|
57
|
+
_(SH.import_value("foo")).must_equal "foo"
|
58
|
+
_(SH.import_value("foo", type: Symbol)).must_equal :foo
|
59
|
+
_(SH.import_value("(foo bar)", type: Array)).must_equal %w(foo bar)
|
60
|
+
_(SH.import_value("(foo bar)", type: Hash)).must_equal({"foo"=>"bar"})
|
61
61
|
end
|
62
62
|
|
63
63
|
it "can import a variable" do
|
64
|
-
SH.import_variable("foo=bar").must_equal ["foo","bar"]
|
65
|
-
SH.import_variable("foo='bar'").must_equal ["foo","bar"]
|
66
|
-
SH.import_variable("foo=(bar baz)").must_equal ["foo",%w(bar baz)]
|
64
|
+
_(SH.import_variable("foo=bar")).must_equal ["foo","bar"]
|
65
|
+
_(SH.import_variable("foo='bar'")).must_equal ["foo","bar"]
|
66
|
+
_(SH.import_variable("foo=(bar baz)")).must_equal ["foo",%w(bar baz)]
|
67
67
|
end
|
68
68
|
|
69
69
|
it "can import instructions" do
|
70
|
-
SH.import_parse("foo=bar,ploum=plim").must_equal({foo: "bar", ploum: "plim"})
|
71
|
-
SH.import_parse(<<EOS).must_equal({foo: "bar", ploum: %w(plim plam)})
|
70
|
+
_(SH.import_parse("foo=bar,ploum=plim")).must_equal({foo: "bar", ploum: "plim"})
|
71
|
+
_(SH.import_parse(<<EOS)).must_equal({foo: "bar", ploum: %w(plim plam)})
|
72
72
|
foo=bar
|
73
73
|
ploum=(plim plam)
|
74
74
|
EOS
|
75
|
-
SH.import_parse("foo/bar=baz,ploum=plim").must_equal({foo: {bar: "baz"}, ploum: "plim"})
|
75
|
+
_(SH.import_parse("foo/bar=baz,ploum=plim")).must_equal({foo: {bar: "baz"}, ploum: "plim"})
|
76
76
|
end
|
77
77
|
end
|
data/test/test_logger.rb
CHANGED
@@ -8,41 +8,41 @@ describe ShellHelpers::ColorLogger do
|
|
8
8
|
end
|
9
9
|
it "Has a info mode" do
|
10
10
|
@logger.info "foo"
|
11
|
-
@buffer.string.must_equal "foo\n"
|
11
|
+
_(@buffer.string).must_equal "foo\n"
|
12
12
|
end
|
13
13
|
it "Has a color mark mode" do
|
14
14
|
@logger.mark "foo"
|
15
|
-
@buffer.string.must_equal "\e[1mfoo\e[0m\n"
|
15
|
+
_(@buffer.string).must_equal "\e[1mfoo\e[0m\n"
|
16
16
|
end
|
17
17
|
it "Has a colored important mode" do
|
18
18
|
@logger.important "foo"
|
19
|
-
@buffer.string.must_equal "\e[34;1mfoo\e[0m\n"
|
19
|
+
_(@buffer.string).must_equal "\e[34;1mfoo\e[0m\n"
|
20
20
|
end
|
21
21
|
it "The colored mode can add colors" do
|
22
22
|
@logger.important "foo", color: [:red]
|
23
|
-
@buffer.string.must_equal "\e[34;1;31mfoo\e[0m\n"
|
23
|
+
_(@buffer.string).must_equal "\e[34;1;31mfoo\e[0m\n"
|
24
24
|
end
|
25
25
|
it "Has a raw important mode" do
|
26
26
|
@logger.important "foo", format: :blank
|
27
|
-
@buffer.string.must_equal "foo\n"
|
27
|
+
_(@buffer.string).must_equal "foo\n"
|
28
28
|
end
|
29
29
|
it "Can give a numeric level" do
|
30
30
|
@logger.add(@logger.severity_lvl(:important), "foo")
|
31
|
-
@buffer.string.must_equal "foo\n"
|
31
|
+
_(@buffer.string).must_equal "foo\n"
|
32
32
|
end
|
33
33
|
it "Default to info level" do
|
34
34
|
@logger.debug("foo")
|
35
|
-
@buffer.string.must_equal ""
|
35
|
+
_(@buffer.string).must_equal ""
|
36
36
|
end
|
37
37
|
it "Don't show below debug level" do
|
38
38
|
@logger.debug3("foo")
|
39
|
-
@buffer.string.must_equal ""
|
39
|
+
_(@buffer.string).must_equal ""
|
40
40
|
end
|
41
41
|
it "Can change level" do
|
42
42
|
old_level=@logger.level
|
43
43
|
@logger.level=:debug3
|
44
44
|
@logger.debug3("foo")
|
45
45
|
@logger.level=old_level
|
46
|
-
@buffer.string.must_equal "foo\n"
|
46
|
+
_(@buffer.string).must_equal "foo\n"
|
47
47
|
end
|
48
48
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shell_helpers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Damien Robert
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-02-
|
11
|
+
date: 2020-02-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: drain
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
19
|
+
version: '0.6'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0.
|
26
|
+
version: '0.6'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: simplecolor
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0.
|
33
|
+
version: '0.4'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '0.
|
40
|
+
version: '0.4'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: minitest
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -56,44 +56,16 @@ dependencies:
|
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '10'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '10'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: rubygems-tasks
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "~>"
|
59
|
+
- - ">="
|
74
60
|
- !ruby/object:Gem::Version
|
75
|
-
version: '0
|
61
|
+
version: '10.0'
|
76
62
|
type: :development
|
77
63
|
prerelease: false
|
78
64
|
version_requirements: !ruby/object:Gem::Requirement
|
79
65
|
requirements:
|
80
|
-
- - "
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '0.2'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: yard
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - "~>"
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0.8'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - "~>"
|
66
|
+
- - ">="
|
95
67
|
- !ruby/object:Gem::Version
|
96
|
-
version: '0
|
68
|
+
version: '10.0'
|
97
69
|
description: 'Collection of script to ease working with the shell with ruby.
|
98
70
|
|
99
71
|
'
|
@@ -107,6 +79,8 @@ extra_rdoc_files:
|
|
107
79
|
- LICENSE.txt
|
108
80
|
- README.md
|
109
81
|
files:
|
82
|
+
- ".bundle/config"
|
83
|
+
- ".github/workflows/ruby.yml"
|
110
84
|
- ".gitignore"
|
111
85
|
- ".travis.yml"
|
112
86
|
- ".yardopts"
|
@@ -140,6 +114,7 @@ licenses:
|
|
140
114
|
- MIT
|
141
115
|
metadata:
|
142
116
|
yard.run: yri
|
117
|
+
project_name: ShellHelpers
|
143
118
|
post_install_message:
|
144
119
|
rdoc_options: []
|
145
120
|
require_paths:
|