log_view 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/Gemfile.lock +1 -1
- data/README.md +24 -4
- data/lib/log_view/option_parser.rb +21 -1
- data/lib/log_view/version.rb +1 -1
- data/log_view.gemspec +2 -4
- data/spec/option_parser_spec.rb +33 -2
- metadata +4 -6
- data/spec/.DS_Store +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 74734a1e589e30aa0b991b04cb61aa27a292a233
|
4
|
+
data.tar.gz: 467cd4cc47121820b72fa646dae714c8fccc1821
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94367a992392022ed428699d5557ef69c6d700a927f4de13096e66207e1d99fba6fc9d39be749bcd5ac8a409a7513f72ebd31781bd20c49b5279aa200b4f1d16
|
7
|
+
data.tar.gz: 7bd2e7fe42cfb55d3c8c421ad48fff9c949ae320c2b1807015e3ed7078f0cd887b924f78a9f79acddd0560120831d65ec020107ad301ac701b0f89ef7aae6f35
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -32,11 +32,13 @@ $ log_view <project-name> <options>
|
|
32
32
|
```
|
33
33
|
## Help
|
34
34
|
|
35
|
+
|
35
36
|
Execute command line without parameters
|
36
37
|
|
37
38
|
```sh
|
38
39
|
$ log_view
|
39
40
|
```
|
41
|
+
|
40
42
|
## Basic Commands
|
41
43
|
|
42
44
|
log_view gem offers four commands
|
@@ -61,7 +63,18 @@ log_view gem offers four commands
|
|
61
63
|
```sh
|
62
64
|
$ log_view <project_name> --grep <grep_string>
|
63
65
|
```
|
64
|
-
|
66
|
+
|
67
|
+
3. **--grep-v**
|
68
|
+
|
69
|
+
Selected lines are those not matching any of the specified patterns. (grep -v description)
|
70
|
+
|
71
|
+
You should write like:
|
72
|
+
|
73
|
+
```sh
|
74
|
+
$ log_view <project_name> --grep-v <string_to_not_match>
|
75
|
+
```
|
76
|
+
|
77
|
+
4. **-s**
|
65
78
|
|
66
79
|
The choose server option
|
67
80
|
|
@@ -88,7 +101,7 @@ log_view gem offers four commands
|
|
88
101
|
$ log_view project_name1 -s server1
|
89
102
|
```
|
90
103
|
|
91
|
-
|
104
|
+
5. **-f**
|
92
105
|
|
93
106
|
The choose file option
|
94
107
|
|
@@ -114,12 +127,19 @@ log_view gem offers four commands
|
|
114
127
|
```sh
|
115
128
|
$ log_view project_name1 -f file1
|
116
129
|
```
|
130
|
+
6. **-n**
|
117
131
|
|
132
|
+
The -n argument display the latest 'n' input lines
|
133
|
+
|
134
|
+
You should write like this:
|
135
|
+
|
136
|
+
```sh
|
137
|
+
$ log_view project_name1 -n <number_of_lines>
|
138
|
+
```
|
118
139
|
|
119
|
-
|
120
140
|
|
121
141
|
|
122
142
|
=======
|
123
143
|
log_view
|
124
144
|
========
|
125
|
-
|
145
|
+
|
@@ -20,6 +20,8 @@ module LogView
|
|
20
20
|
@options.if_files = false
|
21
21
|
@options.if_server = false
|
22
22
|
@options.if_help = false
|
23
|
+
@options.if_grepv = false
|
24
|
+
@options.if_n = false
|
23
25
|
end
|
24
26
|
|
25
27
|
def new_opt_parser options
|
@@ -28,6 +30,10 @@ module LogView
|
|
28
30
|
options.grep = true
|
29
31
|
options.grep_string = grep
|
30
32
|
}
|
33
|
+
opts.on("--grep-v", "--grep-v string", String){ |grep|
|
34
|
+
options.grep_v = true
|
35
|
+
options.grep_v_string = grep
|
36
|
+
}
|
31
37
|
|
32
38
|
opts.on("--split-log") {
|
33
39
|
options.split_log = true
|
@@ -48,13 +54,19 @@ module LogView
|
|
48
54
|
opts.on("-h"){
|
49
55
|
options.if_help = true
|
50
56
|
}
|
57
|
+
opts.on("-n","--n string", String){ |line_number|
|
58
|
+
options.if_n = true
|
59
|
+
options.line_numbers = line_number
|
60
|
+
}
|
51
61
|
end
|
52
62
|
end
|
53
63
|
|
54
64
|
def generate_config config
|
55
65
|
config.tap do |conf|
|
56
66
|
conf.options = @options
|
67
|
+
create_n_lines conf
|
57
68
|
create_grep conf
|
69
|
+
create_grepv conf
|
58
70
|
create_files conf
|
59
71
|
create_servers conf
|
60
72
|
puts_help conf if conf.options.if_help == true
|
@@ -88,8 +100,16 @@ module LogView
|
|
88
100
|
array.join("\n")
|
89
101
|
end
|
90
102
|
|
91
|
-
def
|
103
|
+
def create_n_lines config
|
92
104
|
config.grep_string = ""
|
105
|
+
config.grep_string << " -n #{config.options.line_numbers}" if config.options.if_n
|
106
|
+
end
|
107
|
+
|
108
|
+
def create_grepv config
|
109
|
+
config.grep_string << " | grep -v #{config.options.grep_v_string}" if config.options.grep_v
|
110
|
+
end
|
111
|
+
|
112
|
+
def create_grep config
|
93
113
|
config.grep_string << " | grep --color=always #{config.options.grep_string}" if config.options.grep
|
94
114
|
end
|
95
115
|
|
data/lib/log_view/version.rb
CHANGED
data/log_view.gemspec
CHANGED
@@ -3,15 +3,13 @@ lib = File.expand_path('../lib', __FILE__)
|
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
4
|
require 'log_view/version'
|
5
5
|
|
6
|
-
Gem::Specification.new do |spec|
|
6
|
+
Gem::Specification.new 'log_view' do |spec|
|
7
7
|
spec.name = "log_view"
|
8
8
|
spec.version = LogView::VERSION
|
9
9
|
spec.authors = ["marcos.ocf01"]
|
10
10
|
spec.email = ["marcos.ocf01@gmail.com"]
|
11
11
|
spec.summary = %q{log_view is a parallel monitoring logs gem}
|
12
|
-
spec.description = %q{log_view is a parallel monitoring logs gem who uses ssh connection to make tail on described files in multiple servers
|
13
|
-
|
14
|
-
}
|
12
|
+
spec.description = %q{log_view is a parallel monitoring logs gem who uses ssh connection to make tail on described files in multiple servers}
|
15
13
|
spec.homepage = "https://github.com/MarcosOcf/log_view"
|
16
14
|
spec.license = "MIT"
|
17
15
|
|
data/spec/option_parser_spec.rb
CHANGED
@@ -22,11 +22,34 @@ describe LogView::OptParser do
|
|
22
22
|
end
|
23
23
|
|
24
24
|
describe "#parse" do
|
25
|
+
describe "with -n test" do
|
26
|
+
let :args do
|
27
|
+
[project_name, '-n', '100']
|
28
|
+
end
|
29
|
+
|
30
|
+
subject do
|
31
|
+
LogView::OptParser.new.parse(args, config.load_project(project_name))
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should create a string with -n args" do
|
35
|
+
subject.grep_string.should eql " -n 100"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
25
39
|
|
26
40
|
it "grep test" do
|
27
41
|
subject.grep_string.should eql " | grep --color=always string"
|
28
42
|
end
|
43
|
+
describe "with --grep-v option" do
|
44
|
+
|
45
|
+
let :args do
|
46
|
+
[project_name, '--grep', 'string', '--grep-v', 'string', '--split-log', '-s', 'test-server1', '-f', 'test-file1']
|
47
|
+
end
|
29
48
|
|
49
|
+
it "grep-v test" do
|
50
|
+
subject.grep_string.should eql " | grep --color=always string | grep -v string"
|
51
|
+
end
|
52
|
+
end
|
30
53
|
it "split-log test" do
|
31
54
|
subject.options.split_log.should eql true
|
32
55
|
end
|
@@ -45,8 +68,8 @@ describe LogView::OptParser do
|
|
45
68
|
|
46
69
|
describe 'choosing inexistent' do
|
47
70
|
let :args do
|
48
|
-
[project_name, '--grep', 'string', '--split-log', '-s', 'test-server10', '-f', 'test-file10']
|
49
|
-
end
|
71
|
+
[project_name, '--grep', 'string', '--split-log', '-s', 'test-server10', '-f', 'test-file10']
|
72
|
+
end
|
50
73
|
|
51
74
|
it 'file test' do
|
52
75
|
subject.options.if_files.should eql true
|
@@ -58,5 +81,13 @@ describe LogView::OptParser do
|
|
58
81
|
subject.options.server.should eql 'test-server10'
|
59
82
|
end
|
60
83
|
end
|
84
|
+
describe 'using all options' do
|
85
|
+
let :args do
|
86
|
+
[project_name, '-n', '100', '--grep', 'string', '--grep-v', 'string', '--split-log', '-s', 'test-server1', '-f', 'test-file1']
|
87
|
+
end
|
88
|
+
it "should start with all choosen options" do
|
89
|
+
subject.grep_string.should eql " -n 100 | grep --color=always string | grep -v string"
|
90
|
+
end
|
91
|
+
end
|
61
92
|
end
|
62
93
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: log_view
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- marcos.ocf01
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: net-ssh
|
@@ -80,8 +80,8 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 3.1.2
|
83
|
-
description:
|
84
|
-
make tail on described files in multiple servers
|
83
|
+
description: log_view is a parallel monitoring logs gem who uses ssh connection to
|
84
|
+
make tail on described files in multiple servers
|
85
85
|
email:
|
86
86
|
- marcos.ocf01@gmail.com
|
87
87
|
executables:
|
@@ -106,7 +106,6 @@ files:
|
|
106
106
|
- lib/log_view/option_parser.rb
|
107
107
|
- lib/log_view/version.rb
|
108
108
|
- log_view.gemspec
|
109
|
-
- spec/.DS_Store
|
110
109
|
- spec/command_spec.rb
|
111
110
|
- spec/config_spec.rb
|
112
111
|
- spec/do_ssh_spec.rb
|
@@ -139,7 +138,6 @@ signing_key:
|
|
139
138
|
specification_version: 4
|
140
139
|
summary: log_view is a parallel monitoring logs gem
|
141
140
|
test_files:
|
142
|
-
- spec/.DS_Store
|
143
141
|
- spec/command_spec.rb
|
144
142
|
- spec/config_spec.rb
|
145
143
|
- spec/do_ssh_spec.rb
|
data/spec/.DS_Store
DELETED
Binary file
|