tailstrom 0.0.8 → 0.0.9

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
  SHA1:
3
- metadata.gz: a900ba214e37a066dfc4407d2e4dc2419dd856e0
4
- data.tar.gz: c52fc0febe3102354115b46c3c691d0fe55be08e
3
+ metadata.gz: f024c5b10c7a71e02ca1c1555ab122af54b7b5c3
4
+ data.tar.gz: 0cfe7ba4da0855fa6bffe474c26d7fd37084da0b
5
5
  SHA512:
6
- metadata.gz: 809722b51d215de0861f9745d0e494c93846621205af3d53285d012504c88d8fe2030505b2b0eb812967b25e9aaa571c585ffd9a7bc5a736b19f8e54ef51b9c4
7
- data.tar.gz: d46b7ff7ec44ba051895e04f56d1626ec6688490b7f1c9eaa8484af097924ddf88c04400c9ac1cd6b6b461d41c69ab6d55b7bb45f3e4d163e343f6c8c8649334
6
+ metadata.gz: 2e6c8d72a007efb913f5202331eb0550970ae96ae227a053cd67853b4b4f5bccbd2164b007f82ab95442029397f87c2a311bd2846aeed4ba20ba7f4ab2b46e15
7
+ data.tar.gz: 7e29a3cd6d1de6c322394043d033f9616cde73f292e8e2ccab756febb556f6b7036773e40ea0173e5eaee2bc26ca3eff7e23fb5ebf0b65cb7d81546c7d960a10
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format progress
@@ -30,19 +30,30 @@ module Tailstrom
30
30
  end
31
31
 
32
32
  height = terminal_height
33
- i = 0
33
+ printed_lines_sum = printed_lines = 0
34
34
  begin
35
35
  sleep @options[:interval]
36
36
 
37
- if i % height == 0
37
+ # TODO refactoring
38
+ if printed_lines > 0 && (@counters.size > 1 || @counters.keys != [:nil] && !@counters.empty?)
39
+ @table.puts
40
+ printed_lines += 1
41
+ end
42
+ printed_lines = 0
43
+
44
+ if (printed_lines_sum %= height) == 0
38
45
  @table.print_header
39
46
  end
40
47
 
41
- print_counters
48
+ if @counters.size == 0
49
+ @counters[:nil].count
50
+ end
51
+
52
+ printed_lines = print_counters
53
+ printed_lines_sum += printed_lines
42
54
 
43
55
  @counters.clear
44
- i = i + 1
45
- end while !reader.eof?
56
+ end until reader.eof?
46
57
  rescue Interrupt
47
58
  exit 0
48
59
  end
@@ -70,7 +81,7 @@ module Tailstrom
70
81
  end
71
82
  printed_lines += 1
72
83
  end
73
- @table.puts if printed_lines > 1
84
+ printed_lines
74
85
  end
75
86
 
76
87
  def sorted_counters
@@ -29,5 +29,9 @@ module Tailstrom
29
29
  def size
30
30
  @counters.size
31
31
  end
32
+
33
+ def keys
34
+ @counters.keys
35
+ end
32
36
  end
33
37
  end
@@ -14,16 +14,18 @@ module Tailstrom
14
14
  end
15
15
 
16
16
  def _each_line
17
+ @eof = false
17
18
  @infile.each_line do |line|
18
19
  line.chomp!
19
20
  result = parse_line(line)
20
21
  yield result if result
21
22
  end
23
+ @eof = true
22
24
  end
23
25
  private :_each_line
24
26
 
25
27
  def eof?
26
- @infile.eof?
28
+ @eof
27
29
  end
28
30
 
29
31
  def parse_line(line)
@@ -1,3 +1,3 @@
1
1
  module Tailstrom
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
@@ -0,0 +1,300 @@
1
+ 200 2013-10-08T23:47:47+09:00 367965 /users/884
2
+ 200 2013-10-08T23:47:47+09:00 145514 /products/568
3
+ 302 2013-10-08T23:47:47+09:00 922567 /photos/533
4
+ 302 2013-10-08T23:47:47+09:00 109578 /users/619
5
+ 200 2013-10-08T23:47:47+09:00 775727 /users/135
6
+ 200 2013-10-08T23:47:47+09:00 105368 /photos/345
7
+ 302 2013-10-08T23:47:47+09:00 371481 /photos/634
8
+ 200 2013-10-08T23:47:47+09:00 849342 /users/475
9
+ 302 2013-10-08T23:47:47+09:00 814541 /users/817
10
+ 200 2013-10-08T23:47:47+09:00 651148 /products/967
11
+ 302 2013-10-08T23:47:48+09:00 971226 /users/282
12
+ 302 2013-10-08T23:47:48+09:00 142822 /users/353
13
+ 200 2013-10-08T23:47:48+09:00 473557 /photos/918
14
+ 200 2013-10-08T23:47:48+09:00 170779 /users/241
15
+ 200 2013-10-08T23:47:48+09:00 687576 /users/479
16
+ 302 2013-10-08T23:47:48+09:00 87590 /photos/22
17
+ 200 2013-10-08T23:47:48+09:00 23315 /photos/17
18
+ 302 2013-10-08T23:47:48+09:00 246019 /photos/253
19
+ 302 2013-10-08T23:47:48+09:00 408725 /products/2
20
+ 302 2013-10-08T23:47:48+09:00 568982 /photos/4
21
+ 200 2013-10-08T23:47:48+09:00 31984 /photos/954
22
+ 302 2013-10-08T23:47:48+09:00 800767 /photos/279
23
+ 200 2013-10-08T23:47:48+09:00 572925 /products/880
24
+ 200 2013-10-08T23:47:48+09:00 114661 /photos/368
25
+ 302 2013-10-08T23:47:48+09:00 677477 /products/93
26
+ 302 2013-10-08T23:47:48+09:00 668407 /users/65
27
+ 200 2013-10-08T23:47:48+09:00 234679 /products/524
28
+ 200 2013-10-08T23:47:48+09:00 185193 /products/829
29
+ 302 2013-10-08T23:47:48+09:00 44334 /users/917
30
+ 302 2013-10-08T23:47:48+09:00 373057 /users/714
31
+ 302 2013-10-08T23:47:48+09:00 252605 /photos/514
32
+ 302 2013-10-08T23:47:49+09:00 27667 /photos/901
33
+ 302 2013-10-08T23:47:49+09:00 745515 /users/197
34
+ 302 2013-10-08T23:47:49+09:00 248377 /products/759
35
+ 302 2013-10-08T23:47:49+09:00 596064 /products/72
36
+ 302 2013-10-08T23:47:49+09:00 302140 /products/125
37
+ 302 2013-10-08T23:47:49+09:00 520667 /users/566
38
+ 200 2013-10-08T23:47:49+09:00 595704 /products/763
39
+ 302 2013-10-08T23:47:49+09:00 120805 /products/997
40
+ 200 2013-10-08T23:47:49+09:00 8895 /products/948
41
+ 302 2013-10-08T23:47:49+09:00 696948 /products/768
42
+ 302 2013-10-08T23:47:49+09:00 49074 /photos/433
43
+ 200 2013-10-08T23:47:49+09:00 458330 /users/517
44
+ 200 2013-10-08T23:47:49+09:00 722002 /photos/630
45
+ 302 2013-10-08T23:47:49+09:00 644297 /photos/16
46
+ 302 2013-10-08T23:47:49+09:00 201362 /photos/1
47
+ 302 2013-10-08T23:47:49+09:00 907402 /users/836
48
+ 200 2013-10-08T23:47:49+09:00 846845 /photos/267
49
+ 200 2013-10-08T23:47:49+09:00 13281 /users/107
50
+ 302 2013-10-08T23:47:50+09:00 929340 /users/644
51
+ 302 2013-10-08T23:47:50+09:00 109123 /users/829
52
+ 302 2013-10-08T23:47:50+09:00 54655 /photos/993
53
+ 302 2013-10-08T23:47:50+09:00 377426 /users/909
54
+ 200 2013-10-08T23:47:50+09:00 479605 /products/967
55
+ 302 2013-10-08T23:47:50+09:00 279364 /products/615
56
+ 200 2013-10-08T23:47:50+09:00 184794 /users/294
57
+ 200 2013-10-08T23:47:50+09:00 765083 /photos/284
58
+ 200 2013-10-08T23:47:50+09:00 39573 /products/764
59
+ 200 2013-10-08T23:47:50+09:00 687502 /users/222
60
+ 302 2013-10-08T23:47:50+09:00 507056 /photos/606
61
+ 302 2013-10-08T23:47:50+09:00 239180 /photos/526
62
+ 200 2013-10-08T23:47:50+09:00 21709 /products/532
63
+ 200 2013-10-08T23:47:50+09:00 847956 /products/818
64
+ 302 2013-10-08T23:47:50+09:00 989278 /photos/32
65
+ 200 2013-10-08T23:47:50+09:00 386431 /users/705
66
+ 302 2013-10-08T23:47:50+09:00 916618 /users/502
67
+ 200 2013-10-08T23:47:50+09:00 444928 /photos/804
68
+ 302 2013-10-08T23:47:51+09:00 172894 /photos/755
69
+ 200 2013-10-08T23:47:51+09:00 941253 /users/839
70
+ 200 2013-10-08T23:47:51+09:00 466532 /photos/818
71
+ 302 2013-10-08T23:47:51+09:00 408522 /photos/306
72
+ 200 2013-10-08T23:47:51+09:00 171342 /users/858
73
+ 200 2013-10-08T23:47:51+09:00 712925 /photos/274
74
+ 200 2013-10-08T23:47:51+09:00 450530 /products/133
75
+ 302 2013-10-08T23:47:51+09:00 961551 /products/408
76
+ 200 2013-10-08T23:47:51+09:00 536973 /photos/1
77
+ 302 2013-10-08T23:47:51+09:00 782408 /products/66
78
+ 302 2013-10-08T23:47:51+09:00 154003 /users/194
79
+ 200 2013-10-08T23:47:51+09:00 531490 /products/90
80
+ 200 2013-10-08T23:47:51+09:00 834083 /users/754
81
+ 302 2013-10-08T23:47:51+09:00 145754 /users/832
82
+ 302 2013-10-08T23:47:51+09:00 544932 /users/519
83
+ 302 2013-10-08T23:47:51+09:00 536619 /users/585
84
+ 200 2013-10-08T23:47:51+09:00 533501 /products/629
85
+ 302 2013-10-08T23:47:51+09:00 637705 /photos/982
86
+ 302 2013-10-08T23:47:51+09:00 915486 /products/274
87
+ 302 2013-10-08T23:47:52+09:00 547782 /products/350
88
+ 302 2013-10-08T23:47:52+09:00 195191 /users/467
89
+ 302 2013-10-08T23:47:52+09:00 5584 /users/435
90
+ 200 2013-10-08T23:47:52+09:00 729121 /products/446
91
+ 302 2013-10-08T23:47:52+09:00 369061 /photos/407
92
+ 302 2013-10-08T23:47:52+09:00 871881 /products/363
93
+ 200 2013-10-08T23:47:52+09:00 314768 /products/180
94
+ 302 2013-10-08T23:47:52+09:00 698247 /products/138
95
+ 302 2013-10-08T23:47:52+09:00 989277 /photos/865
96
+ 200 2013-10-08T23:47:52+09:00 858482 /products/508
97
+ 200 2013-10-08T23:47:52+09:00 122179 /products/61
98
+ 302 2013-10-08T23:47:52+09:00 747057 /photos/398
99
+ 200 2013-10-08T23:47:52+09:00 171678 /products/701
100
+ 200 2013-10-08T23:47:52+09:00 310409 /users/580
101
+ 302 2013-10-08T23:47:52+09:00 935101 /photos/793
102
+ 200 2013-10-08T23:47:52+09:00 113624 /users/594
103
+ 200 2013-10-08T23:47:52+09:00 887122 /products/389
104
+ 302 2013-10-08T23:47:52+09:00 372208 /photos/123
105
+ 302 2013-10-08T23:47:52+09:00 198323 /photos/944
106
+ 302 2013-10-08T23:47:52+09:00 344514 /users/232
107
+ 200 2013-10-08T23:47:52+09:00 23278 /photos/919
108
+ 200 2013-10-08T23:47:52+09:00 905270 /users/509
109
+ 302 2013-10-08T23:47:53+09:00 695389 /products/885
110
+ 302 2013-10-08T23:47:53+09:00 471294 /users/758
111
+ 200 2013-10-08T23:47:53+09:00 774444 /users/329
112
+ 200 2013-10-08T23:47:53+09:00 472161 /products/379
113
+ 200 2013-10-08T23:47:53+09:00 923709 /photos/870
114
+ 200 2013-10-08T23:47:53+09:00 486107 /users/130
115
+ 200 2013-10-08T23:47:53+09:00 102953 /products/417
116
+ 200 2013-10-08T23:47:53+09:00 380058 /users/914
117
+ 200 2013-10-08T23:47:53+09:00 115048 /photos/744
118
+ 200 2013-10-08T23:47:53+09:00 488691 /users/378
119
+ 302 2013-10-08T23:47:53+09:00 675705 /products/359
120
+ 200 2013-10-08T23:47:53+09:00 54007 /products/957
121
+ 302 2013-10-08T23:47:53+09:00 106162 /users/692
122
+ 200 2013-10-08T23:47:53+09:00 117931 /products/687
123
+ 302 2013-10-08T23:47:53+09:00 21940 /photos/258
124
+ 200 2013-10-08T23:47:53+09:00 160661 /photos/857
125
+ 200 2013-10-08T23:47:53+09:00 399325 /products/343
126
+ 302 2013-10-08T23:47:53+09:00 139548 /products/641
127
+ 200 2013-10-08T23:47:53+09:00 513296 /users/910
128
+ 302 2013-10-08T23:47:53+09:00 723173 /photos/166
129
+ 200 2013-10-08T23:47:53+09:00 163780 /users/174
130
+ 200 2013-10-08T23:47:53+09:00 133739 /users/628
131
+ 302 2013-10-08T23:47:53+09:00 849971 /photos/951
132
+ 302 2013-10-08T23:47:54+09:00 422353 /products/531
133
+ 200 2013-10-08T23:47:54+09:00 892732 /products/265
134
+ 200 2013-10-08T23:47:54+09:00 491973 /users/690
135
+ 200 2013-10-08T23:47:54+09:00 1521 /photos/422
136
+ 200 2013-10-08T23:47:54+09:00 838679 /users/926
137
+ 302 2013-10-08T23:47:54+09:00 505926 /photos/690
138
+ 200 2013-10-08T23:47:54+09:00 143386 /photos/52
139
+ 200 2013-10-08T23:47:54+09:00 540623 /products/187
140
+ 302 2013-10-08T23:47:54+09:00 640534 /users/651
141
+ 302 2013-10-08T23:47:54+09:00 512786 /products/634
142
+ 302 2013-10-08T23:47:54+09:00 69525 /photos/790
143
+ 302 2013-10-08T23:47:54+09:00 497028 /photos/907
144
+ 200 2013-10-08T23:47:54+09:00 344782 /products/2
145
+ 200 2013-10-08T23:47:54+09:00 531112 /products/416
146
+ 302 2013-10-08T23:47:54+09:00 801842 /users/164
147
+ 302 2013-10-08T23:47:54+09:00 403019 /products/454
148
+ 200 2013-10-08T23:47:54+09:00 517548 /products/746
149
+ 302 2013-10-08T23:47:54+09:00 567503 /photos/299
150
+ 200 2013-10-08T23:47:54+09:00 51700 /users/640
151
+ 302 2013-10-08T23:47:54+09:00 348898 /products/163
152
+ 302 2013-10-08T23:47:54+09:00 659461 /users/26
153
+ 302 2013-10-08T23:47:54+09:00 522102 /photos/475
154
+ 200 2013-10-08T23:47:55+09:00 158444 /photos/749
155
+ 200 2013-10-08T23:47:55+09:00 881425 /products/22
156
+ 302 2013-10-08T23:47:55+09:00 729954 /products/584
157
+ 200 2013-10-08T23:47:55+09:00 282045 /products/613
158
+ 200 2013-10-08T23:47:55+09:00 604750 /products/703
159
+ 200 2013-10-08T23:47:55+09:00 240106 /products/258
160
+ 200 2013-10-08T23:47:55+09:00 509673 /users/116
161
+ 302 2013-10-08T23:47:55+09:00 995595 /products/894
162
+ 200 2013-10-08T23:47:55+09:00 793247 /users/45
163
+ 200 2013-10-08T23:47:55+09:00 169298 /products/500
164
+ 302 2013-10-08T23:47:55+09:00 501141 /photos/604
165
+ 200 2013-10-08T23:47:55+09:00 794169 /photos/344
166
+ 302 2013-10-08T23:47:55+09:00 140207 /photos/657
167
+ 302 2013-10-08T23:47:55+09:00 67060 /photos/896
168
+ 302 2013-10-08T23:47:55+09:00 759797 /products/950
169
+ 200 2013-10-08T23:47:55+09:00 158753 /users/62
170
+ 200 2013-10-08T23:47:55+09:00 209524 /users/849
171
+ 302 2013-10-08T23:47:55+09:00 354059 /users/334
172
+ 302 2013-10-08T23:47:55+09:00 93982 /photos/138
173
+ 302 2013-10-08T23:47:55+09:00 640449 /products/688
174
+ 302 2013-10-08T23:47:55+09:00 539761 /photos/338
175
+ 302 2013-10-08T23:47:55+09:00 139960 /photos/930
176
+ 302 2013-10-08T23:47:56+09:00 634116 /photos/555
177
+ 302 2013-10-08T23:47:56+09:00 335772 /photos/29
178
+ 302 2013-10-08T23:47:56+09:00 528427 /users/182
179
+ 302 2013-10-08T23:47:56+09:00 444395 /products/61
180
+ 302 2013-10-08T23:47:56+09:00 778869 /products/871
181
+ 200 2013-10-08T23:47:56+09:00 888564 /products/497
182
+ 200 2013-10-08T23:47:56+09:00 902631 /users/971
183
+ 302 2013-10-08T23:47:56+09:00 388330 /products/120
184
+ 302 2013-10-08T23:47:56+09:00 484587 /photos/921
185
+ 302 2013-10-08T23:47:56+09:00 540335 /photos/124
186
+ 302 2013-10-08T23:47:56+09:00 812264 /products/810
187
+ 302 2013-10-08T23:47:56+09:00 108142 /users/24
188
+ 200 2013-10-08T23:47:56+09:00 958131 /products/779
189
+ 302 2013-10-08T23:47:56+09:00 427081 /users/235
190
+ 200 2013-10-08T23:47:56+09:00 393762 /products/553
191
+ 200 2013-10-08T23:47:56+09:00 287979 /products/429
192
+ 200 2013-10-08T23:47:56+09:00 658855 /photos/450
193
+ 200 2013-10-08T23:47:56+09:00 766949 /users/209
194
+ 302 2013-10-08T23:47:56+09:00 918697 /products/242
195
+ 200 2013-10-08T23:47:56+09:00 619620 /products/478
196
+ 200 2013-10-08T23:47:57+09:00 891609 /products/885
197
+ 302 2013-10-08T23:47:57+09:00 814297 /users/131
198
+ 302 2013-10-08T23:47:57+09:00 386535 /photos/960
199
+ 302 2013-10-08T23:47:57+09:00 429773 /users/409
200
+ 200 2013-10-08T23:47:57+09:00 231723 /products/65
201
+ 200 2013-10-08T23:47:57+09:00 757016 /users/415
202
+ 302 2013-10-08T23:47:57+09:00 786988 /photos/208
203
+ 200 2013-10-08T23:47:57+09:00 642106 /users/525
204
+ 200 2013-10-08T23:47:57+09:00 447364 /photos/708
205
+ 302 2013-10-08T23:47:57+09:00 98258 /users/397
206
+ 302 2013-10-08T23:47:57+09:00 2524 /products/501
207
+ 302 2013-10-08T23:47:57+09:00 531634 /users/798
208
+ 200 2013-10-08T23:47:57+09:00 927668 /products/54
209
+ 200 2013-10-08T23:47:57+09:00 600614 /users/891
210
+ 302 2013-10-08T23:47:57+09:00 322459 /products/114
211
+ 302 2013-10-08T23:47:57+09:00 744892 /products/683
212
+ 302 2013-10-08T23:47:57+09:00 142443 /products/17
213
+ 302 2013-10-08T23:47:57+09:00 954268 /photos/65
214
+ 302 2013-10-08T23:47:57+09:00 66996 /photos/243
215
+ 200 2013-10-08T23:47:57+09:00 547941 /photos/873
216
+ 302 2013-10-08T23:47:57+09:00 96702 /products/441
217
+ 302 2013-10-08T23:47:57+09:00 776566 /products/191
218
+ 200 2013-10-08T23:47:57+09:00 770681 /products/526
219
+ 302 2013-10-08T23:47:58+09:00 645689 /products/642
220
+ 200 2013-10-08T23:47:58+09:00 552888 /products/612
221
+ 302 2013-10-08T23:47:58+09:00 410965 /products/67
222
+ 302 2013-10-08T23:47:58+09:00 175747 /products/875
223
+ 200 2013-10-08T23:47:58+09:00 32266 /products/349
224
+ 302 2013-10-08T23:47:58+09:00 841370 /users/805
225
+ 302 2013-10-08T23:47:58+09:00 165884 /products/69
226
+ 200 2013-10-08T23:47:58+09:00 698479 /products/842
227
+ 200 2013-10-08T23:47:58+09:00 767333 /products/482
228
+ 302 2013-10-08T23:47:58+09:00 67037 /photos/178
229
+ 200 2013-10-08T23:47:58+09:00 675087 /users/513
230
+ 302 2013-10-08T23:47:58+09:00 422981 /users/230
231
+ 302 2013-10-08T23:47:58+09:00 359058 /users/687
232
+ 200 2013-10-08T23:47:58+09:00 910472 /users/53
233
+ 302 2013-10-08T23:47:58+09:00 204312 /products/826
234
+ 200 2013-10-08T23:47:58+09:00 921677 /products/266
235
+ 302 2013-10-08T23:47:58+09:00 716206 /photos/639
236
+ 200 2013-10-08T23:47:58+09:00 595879 /users/720
237
+ 302 2013-10-08T23:47:58+09:00 97610 /users/595
238
+ 302 2013-10-08T23:47:58+09:00 483691 /products/608
239
+ 302 2013-10-08T23:47:58+09:00 51706 /photos/86
240
+ 200 2013-10-08T23:47:58+09:00 937835 /users/510
241
+ 302 2013-10-08T23:47:59+09:00 615969 /photos/783
242
+ 200 2013-10-08T23:47:59+09:00 213364 /users/285
243
+ 200 2013-10-08T23:47:59+09:00 19813 /photos/30
244
+ 200 2013-10-08T23:47:59+09:00 224856 /products/406
245
+ 200 2013-10-08T23:47:59+09:00 539478 /photos/950
246
+ 302 2013-10-08T23:47:59+09:00 799167 /products/479
247
+ 302 2013-10-08T23:47:59+09:00 299662 /photos/788
248
+ 302 2013-10-08T23:47:59+09:00 905674 /products/284
249
+ 302 2013-10-08T23:47:59+09:00 75398 /products/907
250
+ 200 2013-10-08T23:47:59+09:00 12371 /photos/907
251
+ 200 2013-10-08T23:47:59+09:00 784379 /photos/842
252
+ 200 2013-10-08T23:47:59+09:00 677654 /products/209
253
+ 302 2013-10-08T23:47:59+09:00 587495 /photos/10
254
+ 302 2013-10-08T23:47:59+09:00 683331 /photos/874
255
+ 302 2013-10-08T23:47:59+09:00 734775 /users/438
256
+ 302 2013-10-08T23:47:59+09:00 152981 /photos/748
257
+ 200 2013-10-08T23:47:59+09:00 264507 /photos/51
258
+ 302 2013-10-08T23:47:59+09:00 260608 /users/491
259
+ 200 2013-10-08T23:47:59+09:00 452379 /users/886
260
+ 302 2013-10-08T23:47:59+09:00 195431 /products/570
261
+ 302 2013-10-08T23:47:59+09:00 38139 /users/899
262
+ 302 2013-10-08T23:47:59+09:00 467231 /photos/953
263
+ 302 2013-10-08T23:47:59+09:00 413143 /photos/583
264
+ 302 2013-10-08T23:47:59+09:00 414625 /users/265
265
+ 200 2013-10-08T23:47:59+09:00 897162 /products/249
266
+ 302 2013-10-08T23:47:59+09:00 497282 /products/99
267
+ 200 2013-10-08T23:47:59+09:00 214617 /photos/219
268
+ 200 2013-10-08T23:48:00+09:00 28563 /users/298
269
+ 302 2013-10-08T23:48:00+09:00 578771 /products/501
270
+ 200 2013-10-08T23:48:00+09:00 231471 /photos/200
271
+ 200 2013-10-08T23:48:00+09:00 332243 /users/467
272
+ 302 2013-10-08T23:48:00+09:00 57673 /photos/732
273
+ 200 2013-10-08T23:48:00+09:00 491276 /photos/552
274
+ 302 2013-10-08T23:48:00+09:00 175372 /photos/89
275
+ 200 2013-10-08T23:48:00+09:00 648595 /users/554
276
+ 302 2013-10-08T23:48:00+09:00 200284 /photos/462
277
+ 302 2013-10-08T23:48:00+09:00 542167 /photos/489
278
+ 302 2013-10-08T23:48:00+09:00 184510 /products/863
279
+ 302 2013-10-08T23:48:00+09:00 883594 /users/868
280
+ 200 2013-10-08T23:48:00+09:00 446742 /photos/861
281
+ 200 2013-10-08T23:48:00+09:00 867804 /photos/305
282
+ 200 2013-10-08T23:48:00+09:00 102010 /photos/624
283
+ 302 2013-10-08T23:48:00+09:00 918130 /photos/560
284
+ 200 2013-10-08T23:48:00+09:00 632170 /users/485
285
+ 302 2013-10-08T23:48:00+09:00 724024 /users/285
286
+ 200 2013-10-08T23:48:00+09:00 684498 /photos/571
287
+ 302 2013-10-08T23:48:00+09:00 62036 /photos/396
288
+ 200 2013-10-08T23:48:00+09:00 957177 /users/9
289
+ 302 2013-10-08T23:48:00+09:00 539157 /photos/725
290
+ 200 2013-10-08T23:48:01+09:00 821039 /products/493
291
+ 302 2013-10-08T23:48:01+09:00 50567 /photos/661
292
+ 302 2013-10-08T23:48:01+09:00 441058 /products/94
293
+ 200 2013-10-08T23:48:01+09:00 47379 /users/792
294
+ 302 2013-10-08T23:48:01+09:00 382028 /photos/116
295
+ 200 2013-10-08T23:48:01+09:00 185526 /photos/591
296
+ 200 2013-10-08T23:48:01+09:00 655455 /photos/64
297
+ 200 2013-10-08T23:48:01+09:00 702888 /users/435
298
+ 302 2013-10-08T23:48:01+09:00 888430 /products/217
299
+ 200 2013-10-08T23:48:01+09:00 764924 /photos/963
300
+ 302 2013-10-08T23:48:01+09:00 196476 /users/966
@@ -0,0 +1,17 @@
1
+ # This file was generated by the `rspec --init` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # Require this file using `require "spec_helper"` to ensure that it is only
4
+ # loaded once.
5
+ #
6
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
7
+ RSpec.configure do |config|
8
+ config.treat_symbols_as_metadata_keys_with_true_values = true
9
+ config.run_all_when_everything_filtered = true
10
+ config.filter_run :focus
11
+
12
+ # Run specs in random order to surface order dependencies. If you find an
13
+ # order dependency and want to debug it, you can fix the order by providing
14
+ # the seed, which is printed after each run.
15
+ # --seed 1234
16
+ config.order = 'random'
17
+ end
@@ -0,0 +1,65 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'stat' do
4
+ def run(options)
5
+ `bin/tailstrom #{options} spec/fixtures/log-01.txt`
6
+ end
7
+
8
+ it { expect(run '-f2').to eq <<-END }
9
+ ---------------------------------------------------
10
+ count min max avg key
11
+ ---------------------------------------------------
12
+ 300 1,521 995,595 468,164 -
13
+ END
14
+
15
+ it { expect(run '-f2 -k0').to eq <<-END }
16
+ ---------------------------------------------------
17
+ count min max avg key
18
+ ---------------------------------------------------
19
+ 161 2,524 995,595 460,966 302
20
+ 139 1,521 958,131 476,502 200
21
+ END
22
+
23
+ it { expect(run '-f2 -k3 --map key=key[/[a-z]+/]').to eq <<-END }
24
+ ---------------------------------------------------
25
+ count min max avg key
26
+ ---------------------------------------------------
27
+ 104 2,524 995,595 505,832 products
28
+ 93 5,584 971,226 485,544 users
29
+ 103 1,521 989,278 414,438 photos
30
+ END
31
+
32
+ it { expect(run '-f2 -k3 --map key=key[/[a-z]+/] --in-filter key=~/products/').to eq <<-END }
33
+ ---------------------------------------------------
34
+ count min max avg key
35
+ ---------------------------------------------------
36
+ 104 2,524 995,595 505,832 products
37
+ END
38
+
39
+ it { expect(run '-f2 -k3 --map key=key[/[a-z]+/] --sort count').to eq <<-END }
40
+ ---------------------------------------------------
41
+ count min max avg key
42
+ ---------------------------------------------------
43
+ 104 2,524 995,595 505,832 products
44
+ 103 1,521 989,278 414,438 photos
45
+ 93 5,584 971,226 485,544 users
46
+ END
47
+
48
+ it { expect(run '-f2 -k3 --map key=key[/[a-z]+/] --sort count --order asc').to eq <<-END }
49
+ ---------------------------------------------------
50
+ count min max avg key
51
+ ---------------------------------------------------
52
+ 93 5,584 971,226 485,544 users
53
+ 103 1,521 989,278 414,438 photos
54
+ 104 2,524 995,595 505,832 products
55
+ END
56
+
57
+ it { expect(run '-f2 -k3 --map key=key[/[a-z]+/] --out-filter "min>2000"').to eq <<-END }
58
+ ---------------------------------------------------
59
+ count min max avg key
60
+ ---------------------------------------------------
61
+ 104 2,524 995,595 505,832 products
62
+ 93 5,584 971,226 485,544 users
63
+ END
64
+
65
+ end
data/tailstrom.gemspec CHANGED
@@ -17,4 +17,6 @@ Gem::Specification.new do |spec|
17
17
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency 'rspec', '~> 2.0'
20
22
  end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tailstrom
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Issei Naruta
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-06 00:00:00.000000000 Z
12
- dependencies: []
11
+ date: 2013-10-08 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rspec
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '2.0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '2.0'
13
27
  description: tailstrom is an utility for "tail -f"
14
28
  email:
15
29
  - naruta@cookpad.com
@@ -19,6 +33,7 @@ extensions: []
19
33
  extra_rdoc_files: []
20
34
  files:
21
35
  - .gitignore
36
+ - .rspec
22
37
  - Gemfile
23
38
  - LICENSE.txt
24
39
  - README.md
@@ -35,6 +50,9 @@ files:
35
50
  - lib/tailstrom/table.rb
36
51
  - lib/tailstrom/tail_reader.rb
37
52
  - lib/tailstrom/version.rb
53
+ - spec/fixtures/log-01.txt
54
+ - spec/spec_helper.rb
55
+ - spec/stat_command_spec.rb
38
56
  - tailstrom.gemspec
39
57
  homepage: ''
40
58
  licenses:
@@ -60,4 +78,7 @@ rubygems_version: 2.0.3
60
78
  signing_key:
61
79
  specification_version: 4
62
80
  summary: A utility for "tail -f"
63
- test_files: []
81
+ test_files:
82
+ - spec/fixtures/log-01.txt
83
+ - spec/spec_helper.rb
84
+ - spec/stat_command_spec.rb