fiedl-log 0.4.0 → 0.5.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: 3ca8a558e1474746111a403e6fd436764f5231a55568e083e670c64d719acdaa
4
- data.tar.gz: e43c5793db564bb5cad0c42ddf46aba9eb73f5eb1aa1e079c2d6856c1c89454b
3
+ metadata.gz: 50633d096202849e748b14cc35cf0badcf887040d719239480c5117dda15d454
4
+ data.tar.gz: 83cd6b2bc6aea3834a3ef40a52bd1c19a8f573da7027a64fb8c325aa8ec2e352
5
5
  SHA512:
6
- metadata.gz: 28998b2f0a0f520a5786b66e407cb9138593c1c8c822068eb1e06f88faf496d3399bfbb802b1dc43e1287ae333d31563fd1f14f959a2474f04c92ff12ad144ac
7
- data.tar.gz: e6cc038d50549d14dcb016635b09ccf193e0f889edd83c43c41167077466a1371c9a873ece5d99dcd6c9dab27da35c970876c6dc30bfa464f04f29a8d6de56cb
6
+ metadata.gz: 298c22019b349406edb0569f75c416e1209c78cd7715fdb635e093d9de61f3e36b48db493ac55427a816150756c51cd7159ad4cf65f63aabd0567bc65556bd2a
7
+ data.tar.gz: e36ea52a0268251cebffc7c8b348941e37391f4a884755bb91716e18718ce9bfb0e7bd1d6a39da142e12f91c4463bfc9ecff658cf54edb9114aa4314008c10e6
data/README.md CHANGED
@@ -21,7 +21,7 @@ log.error "This script does nothing, yet."
21
21
  raise "This script does nothing, yet, sorry!"
22
22
  ```
23
23
 
24
- ![screenshot](screenshots/Bildschirmfoto 2016-11-24 um 18.14.49.png)
24
+ ![screenshot](https://github.com/fiedl/fiedl-log/raw/master/screenshots/Bildschirmfoto%202016-11-24%20um%2018.14.49.png)
25
25
 
26
26
  ### Manually defining a log instance
27
27
 
@@ -56,7 +56,15 @@ require 'fiedl/log'
56
56
  shell "whoami"
57
57
  ```
58
58
 
59
- ![screenshot](screenshots/Bildschirmfoto 2016-11-24 um 18.15.47.png)
59
+ ![screenshot](https://github.com/fiedl/fiedl-log/raw/master/screenshots/Bildschirmfoto%202016-11-24%20um%2018.15.47.png)
60
+
61
+ The `shell` command returns both the output of the stdin and the stderr.
62
+
63
+ To prevent the `shell` command from printing anything, use `verbose: false`:
64
+
65
+ ```ruby
66
+ user = shell "whoami", verbose: false
67
+ ```
60
68
 
61
69
  ### Logging variables
62
70
 
data/lib/fiedl/log/log.rb CHANGED
@@ -50,11 +50,16 @@ class Fiedl::Log::Log
50
50
  filter_out expression
51
51
  end
52
52
 
53
+ def raise(text)
54
+ self.error(text.bold)
55
+ super(text)
56
+ end
57
+
53
58
  # Print commant, execute it and display result.
54
59
  # See also: http://stackoverflow.com/a/10224650/2066546
55
60
  #
56
- def shell(command)
57
- prompt command
61
+ def shell(command, verbose: true)
62
+ prompt command if verbose
58
63
 
59
64
  output = ""
60
65
  r, io = IO.pipe
@@ -62,10 +67,10 @@ class Fiedl::Log::Log
62
67
  system(command, out: io, err: io)
63
68
  end
64
69
  io.close
65
- r.each_char{|c| print c; output += c}
70
+ r.each_char{|c| (print c if verbose); output += c}
66
71
 
67
72
  Process.waitpid pid
68
- return output
73
+ return output.strip
69
74
  end
70
75
 
71
76
  # Ensure that a certain file is present.
@@ -1,5 +1,5 @@
1
1
  module Fiedl
2
2
  module Log
3
- VERSION = "0.4.0"
3
+ VERSION = "0.5.0"
4
4
  end
5
5
  end
data/lib/fiedl/log.rb CHANGED
@@ -17,7 +17,7 @@ unless defined? log
17
17
  end
18
18
 
19
19
  unless defined? shell
20
- def shell(command)
21
- log.shell command
20
+ def shell(command, verbose: true)
21
+ log.shell command, verbose: verbose
22
22
  end
23
23
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fiedl-log
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sebastian Fiedlschuster