log_view 0.2.0 → 0.2.1
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/lib/log_view/command.rb +4 -0
- data/lib/log_view/option_parser.rb +2 -2
- data/lib/log_view/version.rb +1 -1
- data/spec/option_parser_spec.rb +33 -8
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f658d657fa8c230414c22865bdc1df3bbf2a1ee
|
4
|
+
data.tar.gz: bd2ddea229726027b75c7ca0c04b8d10302d9361
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4d6f93a04e68411f0e78030ef365cad144bf2766083cf4cba5a02e18a8130adea2b87004c9a5cd0ee82216035e0d3b86ce8c8cc050936a35fb370c04cf07b35
|
7
|
+
data.tar.gz: 8116240d7f238c18de9637e884a4e0291c5a1b4ffae5f80059d1e100a32cbb99866476a9a3299d119da3c7a7dcc8352121345331e514eba73b30bff681a9a376
|
data/Gemfile.lock
CHANGED
data/lib/log_view/command.rb
CHANGED
@@ -48,6 +48,10 @@ module LogView
|
|
48
48
|
array << "\n"
|
49
49
|
array << " $ log_view <project_name> --grep <string-name>"
|
50
50
|
array << "\n"
|
51
|
+
array << " $ log_view <project_name> --grep-v <string-name>"
|
52
|
+
array << "\n"
|
53
|
+
array << " $ log_view <project_name> -n <line_numbers>"
|
54
|
+
array << "\n"
|
51
55
|
array << " $ log_view <project_name> --split-log"
|
52
56
|
array << "\n"
|
53
57
|
array << " $ log_view <project_name> -s <server-name>"
|
@@ -106,11 +106,11 @@ module LogView
|
|
106
106
|
end
|
107
107
|
|
108
108
|
def create_grepv config
|
109
|
-
config.grep_string << " | grep -v #{config.options.grep_v_string}" if config.options.grep_v
|
109
|
+
config.grep_string << " | grep -v '#{config.options.grep_v_string}'" if config.options.grep_v
|
110
110
|
end
|
111
111
|
|
112
112
|
def create_grep config
|
113
|
-
config.grep_string << " | grep --color=always #{config.options.grep_string}" if config.options.grep
|
113
|
+
config.grep_string << " | grep --color=always '#{config.options.grep_string}'" if config.options.grep
|
114
114
|
end
|
115
115
|
|
116
116
|
def create_files config
|
data/lib/log_view/version.rb
CHANGED
data/spec/option_parser_spec.rb
CHANGED
@@ -36,20 +36,45 @@ describe LogView::OptParser do
|
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
|
-
|
40
|
-
|
41
|
-
|
39
|
+
describe "in grep test" do
|
40
|
+
it "with a single word" do
|
41
|
+
subject.grep_string.should eql " | grep --color=always 'string'"
|
42
|
+
end
|
43
|
+
|
44
|
+
describe "with a sentence separeted by spaces" do
|
45
|
+
let :args do
|
46
|
+
[project_name, '--grep', 'string to not match']
|
47
|
+
end
|
48
|
+
subject do
|
49
|
+
LogView::OptParser.new.parse(args, config.load_project(project_name))
|
50
|
+
end
|
51
|
+
it "shoud return a string result" do
|
52
|
+
subject.grep_string.should eql " | grep --color=always 'string to not match'"
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
42
56
|
end
|
57
|
+
|
43
58
|
describe "with --grep-v option" do
|
44
59
|
|
45
60
|
let :args do
|
46
|
-
[project_name, '--grep', 'string', '--grep-v', 'string'
|
61
|
+
[project_name, '--grep', 'string', '--grep-v', 'string']
|
47
62
|
end
|
48
|
-
|
49
|
-
|
50
|
-
|
63
|
+
describe "with a single word given" do
|
64
|
+
it "grep-v test" do
|
65
|
+
subject.grep_string.should eql " | grep --color=always 'string' | grep -v 'string'"
|
66
|
+
end
|
67
|
+
end
|
68
|
+
describe "with a given sentence" do
|
69
|
+
let :args do
|
70
|
+
[project_name, '--grep', 'string to match', '--grep-v', 'string to not match']
|
71
|
+
end
|
72
|
+
it "grep-v test" do
|
73
|
+
subject.grep_string.should eql " | grep --color=always 'string to match' | grep -v 'string to not match'"
|
74
|
+
end
|
51
75
|
end
|
52
76
|
end
|
77
|
+
|
53
78
|
it "split-log test" do
|
54
79
|
subject.options.split_log.should eql true
|
55
80
|
end
|
@@ -86,7 +111,7 @@ describe LogView::OptParser do
|
|
86
111
|
[project_name, '-n', '100', '--grep', 'string', '--grep-v', 'string', '--split-log', '-s', 'test-server1', '-f', 'test-file1']
|
87
112
|
end
|
88
113
|
it "should start with all choosen options" do
|
89
|
-
subject.grep_string.should eql " -n 100 | grep --color=always string | grep -v string"
|
114
|
+
subject.grep_string.should eql " -n 100 | grep --color=always 'string' | grep -v 'string"
|
90
115
|
end
|
91
116
|
end
|
92
117
|
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.2.
|
4
|
+
version: 0.2.1
|
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-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: net-ssh
|