glark 1.10.0 → 1.10.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,65 @@
1
+ #!/usr/bin/ruby -w
2
+ # -*- ruby -*-
3
+
4
+ require 'glark/app/tc'
5
+
6
+ module Glark
7
+ class StdInTestCase < AppTestCase
8
+ def run_stdin_test expected, args
9
+ file = '/proj/org/incava/glark/test/resources/textfile.txt'
10
+
11
+ origstdin = $stdin
12
+
13
+ inio = StringIO.new(::IO.readlines(file).join(''))
14
+
15
+ gopt = AppOptions.new
16
+ $stdin = inio
17
+
18
+ outio = StringIO.new
19
+ gopt.run(args)
20
+ gopt.output_options.out = outio
21
+
22
+ Runner.new gopt, gopt.fileset
23
+
24
+ # inio.close
25
+ outio.close
26
+
27
+ $stdin = origstdin
28
+
29
+ if false
30
+ puts ",,,,,"
31
+ puts outio.string
32
+ puts ",,,,,"
33
+ end
34
+
35
+ result = outio.string
36
+
37
+ actual = result.split "\n"
38
+ ( 0 ... [ expected.length, actual.length ].max ).each do |idx|
39
+ assert_equal expected[idx], actual[idx], "idx: #{idx}"
40
+ end
41
+ end
42
+
43
+ def test_like_grep
44
+ expected = [
45
+ " -rw-r--r-- 1 jpace jpace 45450 2010-12-04 15:24 02-TheMillersTale.txt",
46
+ " -rw-r--r-- 1 jpace jpace 63290 2010-12-04 15:24 05-TheManOfLawsTale.txt",
47
+ " -rw-r--r-- 1 jpace jpace 65852 2010-12-04 15:24 10-TheMerchantsTale.txt",
48
+ " -rw-r--r-- 1 jpace jpace 49747 2010-12-04 15:24 19-TheMonksTale.txt",
49
+ " -rw-r--r-- 1 jpace jpace 21141 2010-12-04 15:24 23-TheManciplesTale.txt",
50
+ ]
51
+ run_stdin_test expected, [ '-g', 'M.*Tale' ]
52
+ end
53
+
54
+ def test_like_glark
55
+ expected = [
56
+ " 3 -rw-r--r-- 1 jpace jpace 45450 2010-12-04 15:24 02-TheMillersTale.txt",
57
+ " 6 -rw-r--r-- 1 jpace jpace 63290 2010-12-04 15:24 05-TheManOfLawsTale.txt",
58
+ " 11 -rw-r--r-- 1 jpace jpace 65852 2010-12-04 15:24 10-TheMerchantsTale.txt",
59
+ " 20 -rw-r--r-- 1 jpace jpace 49747 2010-12-04 15:24 19-TheMonksTale.txt",
60
+ " 24 -rw-r--r-- 1 jpace jpace 21141 2010-12-04 15:24 23-TheManciplesTale.txt",
61
+ ]
62
+ run_stdin_test expected, [ 'M.*Tale' ]
63
+ end
64
+ end
65
+ end
@@ -28,13 +28,11 @@ module Glark
28
28
  gopt.run(args + files)
29
29
  gopt.output_options.out = sio
30
30
 
31
- Log.verbose = true
32
-
33
- glark = Runner.new gopt, gopt.fileset
31
+ Runner.new gopt, gopt.fileset
34
32
 
35
33
  sio.close
36
34
 
37
- if true
35
+ if false
38
36
  puts "....."
39
37
  puts sio.string
40
38
  puts "....."
@@ -129,8 +129,6 @@ module Glark
129
129
  end
130
130
 
131
131
  def test_and_expression_2_lines_apart
132
- Log.level = Log::DEBUG
133
-
134
132
  # 'ea', 'ec' within 2 lines of each other:
135
133
  expected = [
136
134
  " 9 zooeal",
@@ -11,9 +11,10 @@ STDERR.sync = true
11
11
 
12
12
  require 'glark/app/runner'
13
13
 
14
- Log.verbose = true
14
+ # Log.verbose = true
15
15
  Log.set_widths(-15, 35, -35)
16
- Log.level = Log::DEBUG
16
+ Log.quiet = true
17
+ Log.verbose = false
17
18
 
18
19
  module Glark
19
20
  class TestCase < Test::Unit::TestCase
metadata CHANGED
@@ -1,265 +1,247 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: glark
3
- version: !ruby/object:Gem::Version
4
- hash: 63
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.10.1
5
5
  prerelease:
6
- segments:
7
- - 1
8
- - 10
9
- - 0
10
- version: 1.10.0
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Jeff Pace
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-12-30 00:00:00 -05:00
19
- default_executable: glark
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
12
+ date: 2013-02-28 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
22
15
  name: riel
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
25
17
  none: false
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- hash: 51
30
- segments:
31
- - 1
32
- - 1
33
- - 16
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
34
21
  version: 1.1.16
35
22
  type: :runtime
36
- version_requirements: *id001
37
- - !ruby/object:Gem::Dependency
38
- name: rainbow
39
23
  prerelease: false
40
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: !ruby/object:Gem::Requirement
41
25
  none: false
42
- requirements:
43
- - - ">="
44
- - !ruby/object:Gem::Version
45
- hash: 27
46
- segments:
47
- - 1
48
- - 1
49
- - 4
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 1.1.16
30
+ - !ruby/object:Gem::Dependency
31
+ name: rainbow
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
50
37
  version: 1.1.4
51
38
  type: :runtime
52
- version_requirements: *id002
53
- description: |
54
- Glark searches files for regular expressions, extending grep by matching complex
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: 1.1.4
46
+ description: ! 'Glark searches files for regular expressions, extending grep by matching
47
+ complex
48
+
55
49
  expressions ("and", "or", and "xor"), extracting and searching within compressed
50
+
56
51
  files, and excluding .svn and .git subdirectories by default. Different projects
52
+
57
53
  can have their own Glark configuration.
58
54
 
55
+ '
59
56
  email: jeugenepace@gmail.com
60
- executables:
57
+ executables:
61
58
  - glark
62
59
  extensions: []
63
-
64
60
  extra_rdoc_files: []
65
-
66
- files:
61
+ files:
62
+ - lib/glark.rb
63
+ - lib/glark/app/app.rb
67
64
  - lib/glark/app/help.rb
68
- - lib/glark/app/options.rb
69
- - lib/glark/app/runner.rb
70
65
  - lib/glark/app/info/options.rb
71
- - lib/glark/app/app.rb
66
+ - lib/glark/app/options.rb
72
67
  - lib/glark/app/rcfile.rb
68
+ - lib/glark/app/runner.rb
73
69
  - lib/glark/app/spec.rb
74
- - lib/glark/util/options.rb
75
- - lib/glark/util/option.rb
76
- - lib/glark/util/timestamper.rb
77
- - lib/glark/util/io/fileset.rb
78
- - lib/glark/util/io/filter/filter.rb
79
- - lib/glark/util/io/filter/criteria.rb
80
- - lib/glark/util/io/depth.rb
81
- - lib/glark/util/io/lines.rb
82
- - lib/glark/util/optutil.rb
83
- - lib/glark/util/highlight.rb
84
- - lib/glark/util/colors/options.rb
85
- - lib/glark/util/colors/spec.rb
86
- - lib/glark/input/options.rb
87
- - lib/glark/input/range.rb
88
- - lib/glark/input/filter/options.rb
89
70
  - lib/glark/input/filter/criteria_opts.rb
90
- - lib/glark/input/filter/filter.rb
91
- - lib/glark/input/filter/file_criteria_opts.rb
92
71
  - lib/glark/input/filter/dir_criteria_opts.rb
72
+ - lib/glark/input/filter/file_criteria_opts.rb
73
+ - lib/glark/input/filter/filter.rb
74
+ - lib/glark/input/filter/options.rb
75
+ - lib/glark/input/options.rb
76
+ - lib/glark/input/range.rb
93
77
  - lib/glark/input/spec.rb
78
+ - lib/glark/io/file/archive_file.rb
94
79
  - lib/glark/io/file/binary_file.rb
95
- - lib/glark/io/file/tar_gz_file.rb
96
- - lib/glark/io/file/zip_file.rb
97
- - lib/glark/io/file/tar_file.rb
98
80
  - lib/glark/io/file/file.rb
99
81
  - lib/glark/io/file/gz_file.rb
100
- - lib/glark/io/file/archive_file.rb
101
- - lib/glark/match/options.rb
82
+ - lib/glark/io/file/tar_file.rb
83
+ - lib/glark/io/file/tar_gz_file.rb
84
+ - lib/glark/io/file/zip_file.rb
85
+ - lib/glark/match/and.rb
102
86
  - lib/glark/match/and_distance.rb
103
- - lib/glark/match/re.rb
87
+ - lib/glark/match/compound.rb
104
88
  - lib/glark/match/expression.rb
105
- - lib/glark/match/and.rb
106
89
  - lib/glark/match/factory.rb
107
- - lib/glark/match/compound.rb
108
- - lib/glark/match/xor.rb
109
- - lib/glark/match/or.rb
110
90
  - lib/glark/match/ior.rb
91
+ - lib/glark/match/options.rb
92
+ - lib/glark/match/or.rb
93
+ - lib/glark/match/re.rb
111
94
  - lib/glark/match/re_factory.rb
112
95
  - lib/glark/match/spec.rb
113
- - lib/glark/output/line_status.rb
114
- - lib/glark/output/unfiltered_lines.rb
115
- - lib/glark/output/options.rb
116
- - lib/glark/output/grep_lines.rb
117
- - lib/glark/output/grep_count.rb
118
- - lib/glark/output/glark_lines.rb
96
+ - lib/glark/match/xor.rb
97
+ - lib/glark/output/binary_file_summary.rb
98
+ - lib/glark/output/common.rb
99
+ - lib/glark/output/context.rb
119
100
  - lib/glark/output/count.rb
101
+ - lib/glark/output/file_header.rb
102
+ - lib/glark/output/file_name_only.rb
103
+ - lib/glark/output/formatted.rb
120
104
  - lib/glark/output/glark_count.rb
121
105
  - lib/glark/output/glark_format.rb
122
- - lib/glark/output/binary_file_summary.rb
123
- - lib/glark/output/context.rb
106
+ - lib/glark/output/glark_lines.rb
107
+ - lib/glark/output/grep_count.rb
108
+ - lib/glark/output/grep_lines.rb
109
+ - lib/glark/output/line_status.rb
124
110
  - lib/glark/output/lines.rb
125
- - lib/glark/output/results.rb
126
- - lib/glark/output/common.rb
127
111
  - lib/glark/output/match_list.rb
128
- - lib/glark/output/file_name_only.rb
129
- - lib/glark/output/formatted.rb
130
- - lib/glark/output/file_header.rb
112
+ - lib/glark/output/options.rb
113
+ - lib/glark/output/results.rb
131
114
  - lib/glark/output/spec.rb
132
- - lib/glark.rb
133
- - man/glark.1
115
+ - lib/glark/output/unfiltered_lines.rb
116
+ - lib/glark/util/colors/options.rb
117
+ - lib/glark/util/colors/spec.rb
118
+ - lib/glark/util/highlight.rb
119
+ - lib/glark/util/io/depth.rb
120
+ - lib/glark/util/io/fileset.rb
121
+ - lib/glark/util/io/filter/criteria.rb
122
+ - lib/glark/util/io/filter/filter.rb
123
+ - lib/glark/util/io/lines.rb
124
+ - lib/glark/util/option.rb
125
+ - lib/glark/util/options.rb
126
+ - lib/glark/util/optutil.rb
127
+ - lib/glark/util/timestamper.rb
134
128
  - bin/glark
135
129
  - test/glark/app/and_test.rb
136
- - test/glark/app/invert_test.rb
130
+ - test/glark/app/compound_test.rb
137
131
  - test/glark/app/context_test.rb
132
+ - test/glark/app/count_test.rb
133
+ - test/glark/app/expression_file_test.rb
134
+ - test/glark/app/extended_regexp_test.rb
135
+ - test/glark/app/extract_matches_test.rb
138
136
  - test/glark/app/files_with_match_test.rb
139
- - test/glark/app/xor_test.rb
137
+ - test/glark/app/files_without_match_test.rb
138
+ - test/glark/app/filter_test.rb
139
+ - test/glark/app/highlight_test.rb
140
140
  - test/glark/app/ignore_case_test.rb
141
- - test/glark/app/line_number_color_test.rb
141
+ - test/glark/app/invert_test.rb
142
142
  - test/glark/app/ior_test.rb
143
- - test/glark/app/whole_words_test.rb
144
- - test/glark/app/expression_file_test.rb
145
- - test/glark/app/regexp_test.rb
143
+ - test/glark/app/label_test.rb
144
+ - test/glark/app/line_number_color_test.rb
146
145
  - test/glark/app/line_numbers_test.rb
147
- - test/glark/app/range_test.rb
148
- - test/glark/app/options_test.rb
149
146
  - test/glark/app/match_limit_test.rb
150
- - test/glark/app/text_color_test.rb
151
- - test/glark/app/extract_matches_test.rb
152
- - test/glark/app/highlight_test.rb
153
- - test/glark/app/whole_lines_test.rb
147
+ - test/glark/app/options_test.rb
148
+ - test/glark/app/range_test.rb
149
+ - test/glark/app/rcfile_test.rb
154
150
  - test/glark/app/record_separator_test.rb
155
- - test/glark/app/filter_test.rb
156
- - test/glark/app/label_test.rb
157
- - test/glark/app/extended_regexp_test.rb
158
- - test/glark/app/dump_test.rb
151
+ - test/glark/app/regexp_test.rb
152
+ - test/glark/app/stdin_test.rb
159
153
  - test/glark/app/tc.rb
160
- - test/glark/app/rcfile_test.rb
161
- - test/glark/app/compound_test.rb
162
- - test/glark/app/count_test.rb
163
- - test/glark/app/files_without_match_test.rb
164
- - test/glark/match_test.rb
154
+ - test/glark/app/text_color_test.rb
155
+ - test/glark/app/whole_lines_test.rb
156
+ - test/glark/app/whole_words_test.rb
157
+ - test/glark/app/xor_test.rb
158
+ - test/glark/input/binary_file_test.rb
159
+ - test/glark/input/directory_test.rb
160
+ - test/glark/input/dirname_test.rb
165
161
  - test/glark/input/exclude_matching_test.rb
166
- - test/glark/input/split_as_path_test.rb
167
- - test/glark/input/filter/filter_spec_test.rb
168
- - test/glark/input/filter/filter_test.rb
162
+ - test/glark/input/ext_test.rb
169
163
  - test/glark/input/filter/criteria_test.rb
164
+ - test/glark/input/filter/filter_test.rb
165
+ - test/glark/input/name_test.rb
166
+ - test/glark/input/path_test.rb
170
167
  - test/glark/input/range_test.rb
171
168
  - test/glark/input/size_limit_test.rb
172
- - test/glark/input/path_test.rb
173
- - test/glark/input/ext_test.rb
174
- - test/glark/input/directory_test.rb
175
- - test/glark/input/binary_file_test.rb
176
- - test/glark/input/name_test.rb
177
- - test/glark/input/dirname_test.rb
169
+ - test/glark/input/split_as_path_test.rb
170
+ - test/glark/match_test.rb
178
171
  - test/glark/resources.rb
179
172
  - test/glark/tc.rb
180
- - test/resources/greet.rb
181
173
  - test/resources/add.rb
182
174
  - test/resources/echo.rb
183
- has_rdoc: true
175
+ - test/resources/greet.rb
184
176
  homepage: http://www.incava.org/projects/glark
185
177
  licenses: []
186
-
187
178
  post_install_message:
188
179
  rdoc_options: []
189
-
190
- require_paths:
180
+ require_paths:
191
181
  - lib
192
- required_ruby_version: !ruby/object:Gem::Requirement
182
+ required_ruby_version: !ruby/object:Gem::Requirement
193
183
  none: false
194
- requirements:
195
- - - ">="
196
- - !ruby/object:Gem::Version
197
- hash: 3
198
- segments:
199
- - 0
200
- version: "0"
201
- required_rubygems_version: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - ! '>='
186
+ - !ruby/object:Gem::Version
187
+ version: '0'
188
+ required_rubygems_version: !ruby/object:Gem::Requirement
202
189
  none: false
203
- requirements:
204
- - - ">="
205
- - !ruby/object:Gem::Version
206
- hash: 3
207
- segments:
208
- - 0
209
- version: "0"
190
+ requirements:
191
+ - - ! '>='
192
+ - !ruby/object:Gem::Version
193
+ version: '0'
210
194
  requirements: []
211
-
212
195
  rubyforge_project:
213
- rubygems_version: 1.4.2
196
+ rubygems_version: 1.8.23
214
197
  signing_key:
215
198
  specification_version: 3
216
199
  summary: Extended searching of text files.
217
- test_files:
200
+ test_files:
218
201
  - test/glark/app/and_test.rb
219
- - test/glark/app/invert_test.rb
202
+ - test/glark/app/compound_test.rb
220
203
  - test/glark/app/context_test.rb
204
+ - test/glark/app/count_test.rb
205
+ - test/glark/app/expression_file_test.rb
206
+ - test/glark/app/extended_regexp_test.rb
207
+ - test/glark/app/extract_matches_test.rb
221
208
  - test/glark/app/files_with_match_test.rb
222
- - test/glark/app/xor_test.rb
209
+ - test/glark/app/files_without_match_test.rb
210
+ - test/glark/app/filter_test.rb
211
+ - test/glark/app/highlight_test.rb
223
212
  - test/glark/app/ignore_case_test.rb
224
- - test/glark/app/line_number_color_test.rb
213
+ - test/glark/app/invert_test.rb
225
214
  - test/glark/app/ior_test.rb
226
- - test/glark/app/whole_words_test.rb
227
- - test/glark/app/expression_file_test.rb
228
- - test/glark/app/regexp_test.rb
215
+ - test/glark/app/label_test.rb
216
+ - test/glark/app/line_number_color_test.rb
229
217
  - test/glark/app/line_numbers_test.rb
230
- - test/glark/app/range_test.rb
231
- - test/glark/app/options_test.rb
232
218
  - test/glark/app/match_limit_test.rb
233
- - test/glark/app/text_color_test.rb
234
- - test/glark/app/extract_matches_test.rb
235
- - test/glark/app/highlight_test.rb
236
- - test/glark/app/whole_lines_test.rb
219
+ - test/glark/app/options_test.rb
220
+ - test/glark/app/range_test.rb
221
+ - test/glark/app/rcfile_test.rb
237
222
  - test/glark/app/record_separator_test.rb
238
- - test/glark/app/filter_test.rb
239
- - test/glark/app/label_test.rb
240
- - test/glark/app/extended_regexp_test.rb
241
- - test/glark/app/dump_test.rb
223
+ - test/glark/app/regexp_test.rb
224
+ - test/glark/app/stdin_test.rb
242
225
  - test/glark/app/tc.rb
243
- - test/glark/app/rcfile_test.rb
244
- - test/glark/app/compound_test.rb
245
- - test/glark/app/count_test.rb
246
- - test/glark/app/files_without_match_test.rb
247
- - test/glark/match_test.rb
226
+ - test/glark/app/text_color_test.rb
227
+ - test/glark/app/whole_lines_test.rb
228
+ - test/glark/app/whole_words_test.rb
229
+ - test/glark/app/xor_test.rb
230
+ - test/glark/input/binary_file_test.rb
231
+ - test/glark/input/directory_test.rb
232
+ - test/glark/input/dirname_test.rb
248
233
  - test/glark/input/exclude_matching_test.rb
249
- - test/glark/input/split_as_path_test.rb
250
- - test/glark/input/filter/filter_spec_test.rb
251
- - test/glark/input/filter/filter_test.rb
234
+ - test/glark/input/ext_test.rb
252
235
  - test/glark/input/filter/criteria_test.rb
236
+ - test/glark/input/filter/filter_test.rb
237
+ - test/glark/input/name_test.rb
238
+ - test/glark/input/path_test.rb
253
239
  - test/glark/input/range_test.rb
254
240
  - test/glark/input/size_limit_test.rb
255
- - test/glark/input/path_test.rb
256
- - test/glark/input/ext_test.rb
257
- - test/glark/input/directory_test.rb
258
- - test/glark/input/binary_file_test.rb
259
- - test/glark/input/name_test.rb
260
- - test/glark/input/dirname_test.rb
241
+ - test/glark/input/split_as_path_test.rb
242
+ - test/glark/match_test.rb
261
243
  - test/glark/resources.rb
262
244
  - test/glark/tc.rb
263
- - test/resources/greet.rb
264
245
  - test/resources/add.rb
265
246
  - test/resources/echo.rb
247
+ - test/resources/greet.rb