fiedl-log 0.1.0 → 0.2.0
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 +4 -4
- data/README.md +31 -18
- data/fiedl-log.gemspec +1 -1
- data/lib/fiedl/log/log.rb +18 -0
- data/lib/fiedl/log/version.rb +1 -1
- data/lib/fiedl/log.rb +11 -1
- data/screenshots/Bildschirmfoto 2016-11-24 um 18.14.49.png +0 -0
- data/screenshots/Bildschirmfoto 2016-11-24 um 18.15.47.png +0 -0
- metadata +4 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c5a56e0c4fc76b55797ff6d1cafaa5d013689ef
|
4
|
+
data.tar.gz: e66f0a11e239932fbc3200df64f6685f6532fb01
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 38fcd880973d29deabcc6c16722287ba2d34cbee74636ad7cc696d818b0e76314b701a1296d8fcae6d0674854005023c0e49c86ea321e9ce65dd592be250fd7a
|
7
|
+
data.tar.gz: 362f6ac6c8308408d95b262d4d5a18bba480c1b295ad090cd20c916ab5bcdb539c24bbb4d461134547bf74df33f0237c9158afaf79b277736d8963cb79618813
|
data/README.md
CHANGED
@@ -2,23 +2,6 @@
|
|
2
2
|
|
3
3
|
Simple colored output helper for ruby scripts.
|
4
4
|
|
5
|
-
|
6
|
-
## Installation
|
7
|
-
|
8
|
-
Add this line to your application's Gemfile:
|
9
|
-
|
10
|
-
```ruby
|
11
|
-
gem 'fiedl-log'
|
12
|
-
```
|
13
|
-
|
14
|
-
And then execute:
|
15
|
-
|
16
|
-
$ bundle
|
17
|
-
|
18
|
-
Or install it yourself as:
|
19
|
-
|
20
|
-
$ gem install fiedl-log
|
21
|
-
|
22
5
|
## Usage
|
23
6
|
|
24
7
|
```ruby
|
@@ -38,6 +21,8 @@ log.error "This script does nothing, yet."
|
|
38
21
|
raise "This script does nothing, yet, sorry!"
|
39
22
|
```
|
40
23
|
|
24
|
+

|
25
|
+
|
41
26
|
### Manually defining a log instance
|
42
27
|
|
43
28
|
This gem defines `log` unless `log` is already defined. But, of course, you may manually instantiate it:
|
@@ -60,6 +45,34 @@ log.filter_out("my_secret_password")
|
|
60
45
|
|
61
46
|
This will filter out any occurance of "my_secret_password" and replace it by "[...]" in the output.
|
62
47
|
|
48
|
+
### Shell commands
|
49
|
+
|
50
|
+
Print a shell command, execute it and display the result:
|
51
|
+
|
52
|
+
```ruby
|
53
|
+
# ~/some_ruby_script.rb
|
54
|
+
require 'fiedl/log'
|
55
|
+
|
56
|
+
shell "whoami"
|
57
|
+
```
|
58
|
+
|
59
|
+

|
60
|
+
|
61
|
+
## Installation
|
62
|
+
|
63
|
+
Add this line to your application's Gemfile:
|
64
|
+
|
65
|
+
```ruby
|
66
|
+
gem 'fiedl-log'
|
67
|
+
```
|
68
|
+
|
69
|
+
And then execute:
|
70
|
+
|
71
|
+
$ bundle
|
72
|
+
|
73
|
+
Or install it yourself as:
|
74
|
+
|
75
|
+
$ gem install fiedl-log
|
63
76
|
|
64
77
|
## Development
|
65
78
|
|
@@ -69,7 +82,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
69
82
|
|
70
83
|
## Contributing
|
71
84
|
|
72
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
85
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/fiedl/fiedl-log.
|
73
86
|
|
74
87
|
|
75
88
|
## License
|
data/fiedl-log.gemspec
CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
18
18
|
f.match(%r{^(test|spec|features)/})
|
19
19
|
end
|
20
|
-
spec.require_paths = ["lib"]
|
20
|
+
spec.require_paths = ["lib", "lib/fiedl/log"]
|
21
21
|
|
22
22
|
spec.add_development_dependency "bundler", "~> 1.13"
|
23
23
|
spec.add_development_dependency "rake", "~> 10.0"
|
data/lib/fiedl/log/log.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
class Fiedl::Log::Log
|
2
|
+
|
2
3
|
def head(text)
|
3
4
|
info ""
|
4
5
|
info "==========================================================".blue
|
@@ -40,4 +41,21 @@ class Fiedl::Log::Log
|
|
40
41
|
filter_out expression
|
41
42
|
end
|
42
43
|
|
44
|
+
# Print commant, execute it and display result.
|
45
|
+
# See also: http://stackoverflow.com/a/10224650/2066546
|
46
|
+
#
|
47
|
+
def shell(command)
|
48
|
+
prompt command
|
49
|
+
|
50
|
+
output = ""
|
51
|
+
r, io = IO.pipe
|
52
|
+
fork do
|
53
|
+
system(command, out: io, err: :out)
|
54
|
+
end
|
55
|
+
io.close
|
56
|
+
r.each_char{|c| print c; output += c}
|
57
|
+
|
58
|
+
return output
|
59
|
+
end
|
60
|
+
|
43
61
|
end
|
data/lib/fiedl/log/version.rb
CHANGED
data/lib/fiedl/log.rb
CHANGED
Binary file
|
Binary file
|
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
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sebastian Fiedlschuster
|
@@ -86,6 +86,8 @@ files:
|
|
86
86
|
- lib/fiedl/log.rb
|
87
87
|
- lib/fiedl/log/log.rb
|
88
88
|
- lib/fiedl/log/version.rb
|
89
|
+
- screenshots/Bildschirmfoto 2016-11-24 um 18.14.49.png
|
90
|
+
- screenshots/Bildschirmfoto 2016-11-24 um 18.15.47.png
|
89
91
|
homepage: https://github.com/fiedl/fiedl-log
|
90
92
|
licenses:
|
91
93
|
- MIT
|
@@ -94,6 +96,7 @@ post_install_message:
|
|
94
96
|
rdoc_options: []
|
95
97
|
require_paths:
|
96
98
|
- lib
|
99
|
+
- lib/fiedl/log
|
97
100
|
required_ruby_version: !ruby/object:Gem::Requirement
|
98
101
|
requirements:
|
99
102
|
- - ">="
|