ltsview 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/README.md +2 -2
- data/Rakefile +1 -5
- data/bin/ltsview +2 -0
- data/lib/ltsview/parse.rb +5 -1
- data/lib/ltsview/version.rb +1 -1
- data/spec/ltsview/parse_spec.rb +8 -8
- data/spec/spec_helper.rb +4 -0
- metadata +19 -21
- data/spec/ltsview187/parse_spec.rb +0 -121
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1411fb9fe19571d4be18dada7ce16874ac14f54f
|
4
|
+
data.tar.gz: 6fb51f73115db437928ddc6a39e14ed0aa68fc32
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f16fc5a3171334626af61fc206ac24c421fae612efbab5d8a6cfaa327d76466fba5b20c36e64fcfb28a95e3df56e5249eaaa17415da14073d82200d66e953a8
|
7
|
+
data.tar.gz: 63dad955eb93ca98a68c55d7d01215643e44487aee6fce4cdf41a8d010ff0726f9015032c952844f0198aa050fb00849397a0513393437224c4b73c0022afafd
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -9,10 +9,10 @@ Ltsview - Labeled Tab Separated Value manipulator Viewer
|
|
9
9
|
[![Coverage Status](https://coveralls.io/repos/naoto/ltsview/badge.png?branch=master)](https://coveralls.io/r/naoto/ltsview)
|
10
10
|
|
11
11
|
|
12
|
-
##
|
12
|
+
## Supported
|
13
13
|
|
14
14
|
* OSX or Ubuntu
|
15
|
-
* Ruby 1.
|
15
|
+
* Ruby 1.9.3 or 2.0.0 or 2.1.0
|
16
16
|
|
17
17
|
## Installation
|
18
18
|
|
data/Rakefile
CHANGED
@@ -4,10 +4,6 @@ require 'bundler/gem_tasks'
|
|
4
4
|
# RSpec
|
5
5
|
require 'rspec/core/rake_task'
|
6
6
|
RSpec::Core::RakeTask.new(:spec) do |spec|
|
7
|
-
|
8
|
-
spec.pattern = 'spec/ltsview187/*_spec.rb'
|
9
|
-
else
|
10
|
-
spec.pattern = 'spec/ltsview/*_spec.rb'
|
11
|
-
end
|
7
|
+
spec.pattern = 'spec/ltsview/*_spec.rb'
|
12
8
|
end
|
13
9
|
task :default => :spec
|
data/bin/ltsview
CHANGED
data/lib/ltsview/parse.rb
CHANGED
@@ -24,7 +24,7 @@ module Ltsview
|
|
24
24
|
|
25
25
|
private
|
26
26
|
def option_parse(options)
|
27
|
-
option = OptionParser.new(
|
27
|
+
option = OptionParser.new()
|
28
28
|
option.on('-f', '--file VAL'){ |v| @options[:file] = v }
|
29
29
|
option.on('-k', '--keys VAL'){ |v| @options[:keys] = v.split(',') }
|
30
30
|
option.on('-i', '--ignore-key VAL'){ |v| @options[:ignore_key] = v.split(',') }
|
@@ -36,6 +36,10 @@ module Ltsview
|
|
36
36
|
option.on('-l', '--ltsv') { |v| @options[:mode] = :ltsv }
|
37
37
|
option.on('-t', '--tag VAL'){ |v| @options[:tag] = v }
|
38
38
|
option.on('--[no-]colors'){ |v| @options[:color] = v }
|
39
|
+
option.on('-v','--version'){ |v|
|
40
|
+
puts "LTSView version: #{Ltsview::VERSION}"
|
41
|
+
exit
|
42
|
+
}
|
39
43
|
option.permute!(options)
|
40
44
|
|
41
45
|
@options[:color] = false if @options[:mode] == :ltsv
|
data/lib/ltsview/version.rb
CHANGED
data/spec/ltsview/parse_spec.rb
CHANGED
@@ -11,7 +11,7 @@ describe Ltsview::Parse do
|
|
11
11
|
$stdin << "hoge:fuga hago\tfoo:barbaz\n"
|
12
12
|
$stdin.rewind
|
13
13
|
parse.print
|
14
|
-
}.should eq("
|
14
|
+
}.should eq(color("---\n:hoge\: fuga hago\n:foo: barbaz\n"))
|
15
15
|
end
|
16
16
|
|
17
17
|
it 'shoild get json' do
|
@@ -21,7 +21,7 @@ describe Ltsview::Parse do
|
|
21
21
|
$stdin << "hoge:fuga hago\tfoo:barbaz\n"
|
22
22
|
$stdin.rewind
|
23
23
|
parse.print
|
24
|
-
}.should eq("{\
|
24
|
+
}.should eq(color("{\"hoge\":\"fuga hago\",\"foo\":\"barbaz\"}\n", :json))
|
25
25
|
end
|
26
26
|
|
27
27
|
it 'should get non-colored ltsv' do
|
@@ -43,7 +43,7 @@ describe Ltsview::Parse do
|
|
43
43
|
$stdin << "hoge:fuga hago\tfoo:barbaz\n"
|
44
44
|
$stdin.rewind
|
45
45
|
parse.print
|
46
|
-
}.should eq("@[test.tag]
|
46
|
+
}.should eq("@[test.tag] #{color("---\n:hoge: fuga hago\n:foo: barbaz\n")}")
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
@@ -52,7 +52,7 @@ describe Ltsview::Parse do
|
|
52
52
|
parse = Ltsview::Parse.new(['-f','spec/test.ltsv'])
|
53
53
|
capture(:stdout){
|
54
54
|
parse.print
|
55
|
-
}.should eq("
|
55
|
+
}.should eq(color("---\n:hoge: fuga hago\n:foo: barbaz\n"))
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
@@ -65,7 +65,7 @@ describe Ltsview::Parse do
|
|
65
65
|
$stdin << "hoge:fuga hago\tfoo:barbaz\n"
|
66
66
|
$stdin.rewind
|
67
67
|
parse.print
|
68
|
-
}.should eq("
|
68
|
+
}.should eq(color("---\n:foo: barbaz\n"))
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
@@ -77,7 +77,7 @@ describe Ltsview::Parse do
|
|
77
77
|
$stdin << "hoge:fuga hago\tfoo:barbaz\n"
|
78
78
|
$stdin.rewind
|
79
79
|
parse.print
|
80
|
-
}.should eq("
|
80
|
+
}.should eq(color("---\n:hoge: fuga hago\n"))
|
81
81
|
end
|
82
82
|
end
|
83
83
|
|
@@ -90,7 +90,7 @@ describe Ltsview::Parse do
|
|
90
90
|
$stdin << "hago:fuga2 hago\tfoo:fugabarbaz\n"
|
91
91
|
$stdin.rewind
|
92
92
|
parse.print
|
93
|
-
}.should eq("
|
93
|
+
}.should eq(color("---\n:hago: fuga2 hago\n:foo: fugabarbaz\n"))
|
94
94
|
end
|
95
95
|
end
|
96
96
|
|
@@ -102,7 +102,7 @@ describe Ltsview::Parse do
|
|
102
102
|
$stdin << "hoge:fuga hago\tfoo:barbaz\n"
|
103
103
|
$stdin.rewind
|
104
104
|
parse.print
|
105
|
-
}.should eq("
|
105
|
+
}.should eq(color("---\n:hoge: fuga hago\n:foo: barbaz\n"))
|
106
106
|
end
|
107
107
|
|
108
108
|
it 'should by color mode off' do
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,97 +1,97 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ltsview
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Naoto SHINGAKI
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-05-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ltsv
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
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
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: coderay
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
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
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '1.3'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '1.3'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: coveralls
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
description: Ltsview - Labeled Tab Separated Value manipulator Viewer
|
@@ -102,8 +102,8 @@ executables:
|
|
102
102
|
extensions: []
|
103
103
|
extra_rdoc_files: []
|
104
104
|
files:
|
105
|
-
- .gitignore
|
106
|
-
- .travis.yml
|
105
|
+
- ".gitignore"
|
106
|
+
- ".travis.yml"
|
107
107
|
- Gemfile
|
108
108
|
- LICENSE.txt
|
109
109
|
- README.md
|
@@ -115,7 +115,6 @@ files:
|
|
115
115
|
- lib/ltsview/version.rb
|
116
116
|
- ltsview.gemspec
|
117
117
|
- spec/ltsview/parse_spec.rb
|
118
|
-
- spec/ltsview187/parse_spec.rb
|
119
118
|
- spec/spec_helper.rb
|
120
119
|
- spec/test.ltsv
|
121
120
|
homepage: https://github.com/naoto/ltsview
|
@@ -127,22 +126,21 @@ require_paths:
|
|
127
126
|
- lib
|
128
127
|
required_ruby_version: !ruby/object:Gem::Requirement
|
129
128
|
requirements:
|
130
|
-
- -
|
129
|
+
- - ">="
|
131
130
|
- !ruby/object:Gem::Version
|
132
131
|
version: '0'
|
133
132
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
134
133
|
requirements:
|
135
|
-
- -
|
134
|
+
- - ">="
|
136
135
|
- !ruby/object:Gem::Version
|
137
136
|
version: '0'
|
138
137
|
requirements: []
|
139
138
|
rubyforge_project:
|
140
|
-
rubygems_version: 2.
|
139
|
+
rubygems_version: 2.2.0
|
141
140
|
signing_key:
|
142
141
|
specification_version: 4
|
143
142
|
summary: Ltsview - Labeled Tab Separated Value manipulator Viewer
|
144
143
|
test_files:
|
145
144
|
- spec/ltsview/parse_spec.rb
|
146
|
-
- spec/ltsview187/parse_spec.rb
|
147
145
|
- spec/spec_helper.rb
|
148
146
|
- spec/test.ltsv
|
@@ -1,121 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'ltsview/parse'
|
3
|
-
|
4
|
-
describe Ltsview::Parse do
|
5
|
-
|
6
|
-
describe 'when encode stdin text line' do
|
7
|
-
it 'should get yaml' do
|
8
|
-
parse = Ltsview::Parse.new(ARGV)
|
9
|
-
capture(:stdout) {
|
10
|
-
$stdin = StringIO.new
|
11
|
-
$stdin << "hoge:fuga hago\tfoo:barbaz\n"
|
12
|
-
$stdin.rewind
|
13
|
-
parse.print
|
14
|
-
}.match(/\e\[45m---\e\[0m\s?\n\e\[1;32m:(hoge|foo)\e\[0m: \e\[1;33m\e\[41m(fuga hago|barbaz)\e\[0m\n\e\[1;32m:(foo|hoge)\e\[0m: \e\[1;33m\e\[41m(barbaz|fuga hago)\e\[0m\n/)
|
15
|
-
end
|
16
|
-
|
17
|
-
it 'shoild get json' do
|
18
|
-
parse = Ltsview::Parse.new(['-j'])
|
19
|
-
capture(:stdout) {
|
20
|
-
$stdin = StringIO.new
|
21
|
-
$stdin << "hoge:fuga hago\tfoo:barbaz\n"
|
22
|
-
$stdin.rewind
|
23
|
-
parse.print
|
24
|
-
}.should match(/\{\e\[35m"(hoge|foo)"\e\[0m:\e\[32m\e\[1;32m"\e\[0m\e\[32m(fuga hago|barbaz)\e\[1;32m"\e\[0m\e\[32m\e\[0m,\e\[35m"(foo|hoge)"\e\[0m:\e\[32m\e\[1;32m"\e\[0m\e\[32m(barbaz|fuga hago)\e\[1;32m"\e\[0m\e\[32m\e\[0m\}\n/)
|
25
|
-
end
|
26
|
-
|
27
|
-
it 'should get non-colored ltsv' do
|
28
|
-
parse = Ltsview::Parse.new(['-l'])
|
29
|
-
capture(:stdout) {
|
30
|
-
$stdin = StringIO.new
|
31
|
-
$stdin << "hoge:fuga hago\tfoo:barbaz\n"
|
32
|
-
$stdin.rewind
|
33
|
-
parse.print
|
34
|
-
}.should match(/(hoge:fuga hago|foo:barbaz)\t(foo:barbaz|hoge:fuga hago)\n/)
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
describe 'when appended tag' do
|
39
|
-
it 'should apeended tag' do
|
40
|
-
parse = Ltsview::Parse.new(['-t', 'test.tag'])
|
41
|
-
capture(:stdout) {
|
42
|
-
$stdin = StringIO.new
|
43
|
-
$stdin << "hoge:fuga hago\tfoo:barbaz\n"
|
44
|
-
$stdin.rewind
|
45
|
-
parse.print
|
46
|
-
}.should match(/@\[test\.tag\] \e\[45m---\e\[0m\s?\n\e\[1;32m:(hoge|foo)\e\[0m: \e\[1;33m\e\[41m(fuga hago|barbaz)\e\[0m\n\e\[1;32m:(foo|hoge)\e\[0m: \e\[1;33m\e\[41m(barbaz|fuga hago)\e\[0m\n/)
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
describe 'when encode ltsv format file' do
|
51
|
-
it 'should load ltsv' do
|
52
|
-
parse = Ltsview::Parse.new(['-f','spec/test.ltsv'])
|
53
|
-
capture(:stdout){
|
54
|
-
parse.print
|
55
|
-
}.should match(/\e\[45m---\e\[0m\s?\n\e\[1;32m:(hoge|foo)\e\[0m: \e\[1;33m\e\[41m(fuga hago|barbaz)\e\[0m\n\e\[1;32m:(foo|hoge)\e\[0m: \e\[1;33m\e\[41m(barbaz|fuga hago)\e\[0m\n/)
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
|
60
|
-
describe 'when key select' do
|
61
|
-
it 'should by key select' do
|
62
|
-
parse = Ltsview::Parse.new(['-k','foo'])
|
63
|
-
capture(:stdout){
|
64
|
-
$stdin = StringIO.new
|
65
|
-
$stdin << "hoge:fuga hago\tfoo:barbaz\n"
|
66
|
-
$stdin.rewind
|
67
|
-
parse.print
|
68
|
-
}.should match(/\e\[45m---\e\[0m\s?\n\e\[1;32m:foo\e\[0m: \e\[1;33m\e\[41mbarbaz\e\[0m\n/)
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
describe 'when ignore key select' do
|
73
|
-
it 'should by igonore key select' do
|
74
|
-
parse = Ltsview::Parse.new(['-i','foo'])
|
75
|
-
capture(:stdout){
|
76
|
-
$stdin = StringIO.new
|
77
|
-
$stdin << "hoge:fuga hago\tfoo:barbaz\n"
|
78
|
-
$stdin.rewind
|
79
|
-
parse.print
|
80
|
-
}.should match(/\e\[45m---\e\[0m\s?\n\e\[1;32m:hoge\e\[0m: \e\[1;33m\e\[41mfuga hago\e\[0m\n/)
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
describe 'when regex matche' do
|
85
|
-
it 'should by regex matcher' do
|
86
|
-
parse = Ltsview::Parse.new(['-r', 'foo:^fuga'])
|
87
|
-
capture(:stdout){
|
88
|
-
$stdin = StringIO.new
|
89
|
-
$stdin << "hago:fuga hago\tfoo:barbaz\n"
|
90
|
-
$stdin << "hago:fuga2 hago\tfoo:fugabarbaz\n"
|
91
|
-
$stdin.rewind
|
92
|
-
parse.print
|
93
|
-
}.should match(/\e\[45m---\e\[0m \n\e\[1;32m:(foo|hago)\e\[0m: \e\[1;33m\e\[41m(fugabarbaz|fuga2 hago)\e\[0m\n\e\[1;32m:(hago|foo)\e\[0m: \e\[1;33m\e\[41m(fuga2 hago|fugabarbaz)\e\[0m\n/)
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
describe 'when color mode' do
|
98
|
-
it 'should by default color mode on' do
|
99
|
-
parse = Ltsview::Parse.new(ARGV)
|
100
|
-
capture(:stdout){
|
101
|
-
$stdin = StringIO.new
|
102
|
-
$stdin << "hoge:fuga hago\tfoo:barbaz\n"
|
103
|
-
$stdin.rewind
|
104
|
-
parse.print
|
105
|
-
}.should match(/\e\[45m---\e\[0m\s?\n\e\[1;32m:(hoge|foo)\e\[0m: \e\[1;33m\e\[41m(fuga hago|barbaz)\e\[0m\n\e\[1;32m:(foo|hoge)\e\[0m: \e\[1;33m\e\[41m(barbaz|fuga hago)\e\[0m\n/)
|
106
|
-
end
|
107
|
-
|
108
|
-
it 'should by color mode off' do
|
109
|
-
parse = Ltsview::Parse.new(['--no-colors'])
|
110
|
-
capture(:stdout){
|
111
|
-
$stdin = StringIO.new
|
112
|
-
$stdin << "hoge:fuga hago\tfoo:barbaz\n"
|
113
|
-
$stdin.rewind
|
114
|
-
parse.print
|
115
|
-
}.should match(/---\s?\n:(hoge|foo): (fuga hago|barbaz)\n:(foo|hoge): (barbaz|fuga hago)\n/)
|
116
|
-
end
|
117
|
-
|
118
|
-
end
|
119
|
-
|
120
|
-
end
|
121
|
-
|