rubygrep 0.0.4 → 0.0.5

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: 8ac2a3d55254f307dc0b56908c0bcd0bc54ade54
4
- data.tar.gz: e2e6fa9f6846737e61cf85f152adad84c54c0a21
3
+ metadata.gz: 746ed069102e6b5bc2999ce9f9bbfd7cb7ce5e0e
4
+ data.tar.gz: f145ae25ea9a7443a477307e82dbb39b72cbe521
5
5
  SHA512:
6
- metadata.gz: b4ab09265f720b24aa175e4913d52b5c71c28bbfba35a39e7a7efd3c0d0dbf8c6363c72a4532b215e20d4d58952f11d671e3d0b070384bb731e6e579f8495316
7
- data.tar.gz: 71e1fdee9f2c3cc00feae3b7a5c98a30dc02ef54d654f221d1390dcfb8792731ec8d7f3d3b8f812a3c30a24edb4faa5c4fceec0e1ef5c1d5f5238fa62c6306ab
6
+ metadata.gz: e638659f77839d5ceffe7cc3d88c271c00d379a58907b412ca9b33beae4e39b9f9c4f4de451e049c14a5dfda2281aa99824d9d66a9286bd2cd077e8450b24723
7
+ data.tar.gz: 2bfad2e9cd149f0f9ec503d306de8a8e4733dd5cdd5d52a8a714176d9525075332a58edde943ba6072cf9c7b300daad0178321847a42557da5f267fd96d27730
data/README.md CHANGED
@@ -9,13 +9,19 @@ Searches for regexp in files and print out strings that match.
9
9
  ## Usage
10
10
 
11
11
  Usage: rubygrep [options] expression file1 [file2 file3 ...]
12
+
12
13
  -r, --recursive recursively read directories
14
+
13
15
  -i, --ignore-case Ignore case when matching strings.
16
+
14
17
  -v, --invert-selection Invert the sense of matching, to select non-matching lines.
18
+
15
19
  -n, --line-number Prefix each line of output with the 1-based line number within its input file.
20
+
16
21
  -H, --with-filename Print the file name for each match. This is the default when there is more than one file to search.
17
22
 
18
23
 
24
+
19
25
  ## Contributing
20
26
 
21
27
  1. Fork it ( http://github.com/<my-github-username>/rubygrep/fork )
@@ -1,3 +1,3 @@
1
1
  module Rubygrep
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -10,7 +10,7 @@ It was popularised in the 1960s with the release of Letraset sheets
10
10
  containing Lorem Ipsum passages, and more recently with desktop
11
11
  publishing software like Aldus PageMaker including versions of Lorem Ipsum.
12
12
  HERE
13
- text1 = <<-'HERE'
13
+ text1 = <<-HERE
14
14
  Contrary to popular belief, Lorem Ipsum is not simply random text
15
15
  It has roots in a piece of classical Latin literature from 45 BC, making it over
16
16
  2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College
@@ -23,10 +23,10 @@ This book is a treatise on the theory of ethics, very popular
23
23
  during the Renaissance. The first line of Lorem Ipsum,
24
24
  "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32.
25
25
  HERE
26
- match_output = <<-'HERE'
27
- text1: 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College
28
- text2: standard dummy text ever since the 1500s, when an unknown
29
- text2: It was popularised in the 1960s with the release of Letraset sheets
26
+ match_output = <<-HERE
27
+ \033[35mtext1\033[0m: \033[31m2000\033[0m years old. Richard McClintock, a Latin professor at Hampden-Sydney College
28
+ \033[35mtext2\033[0m: standard dummy text ever since the \033[31m1500\033[0ms, when an unknown
29
+ \033[35mtext2\033[0m: It was popularised in the \033[31m1960\033[0ms with the release of Letraset sheets
30
30
  HERE
31
31
 
32
32
 
@@ -1,15 +1,18 @@
1
+ require 'ostruct'
2
+
1
3
  RSpec.describe Rubygrep::Outputter do
2
4
 
3
5
  let (:line_data) {{str: 'test', str_num: 5} }
6
+ let (:match_data) { OpenStruct.new({regexp: /test/})}
4
7
 
5
8
  it 'should output string data' do
6
9
  outputter = Rubygrep::Outputter.new
7
- expect { outputter.out(nil, line_data) }.to output('test').to_stdout
10
+ expect { outputter.out(match_data, line_data) }.to output("\033[31mtest\033[0m\n").to_stdout
8
11
  end
9
12
 
10
13
  it 'should output string data with string number' do
11
14
  outputter = Rubygrep::Outputter.new({line_number: true})
12
- expect { outputter.out(nil, line_data) }.to output('5: test').to_stdout
15
+ expect { outputter.out(match_data, line_data) }.to output("\033[35m5\033[0m: \033[31mtest\033[0m\n").to_stdout
13
16
  end
14
17
 
15
18
  end
metadata CHANGED
@@ -1,55 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubygrep
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - andrey
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-05 00:00:00.000000000 Z
11
+ date: 2014-10-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.5'
20
20
  type: :development
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: '1.5'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
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: :development
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: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - '>='
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
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: '0'
55
55
  description: Globally searches for in files regexp and prints it
@@ -60,8 +60,8 @@ executables:
60
60
  extensions: []
61
61
  extra_rdoc_files: []
62
62
  files:
63
- - ".gitignore"
64
- - ".rspec"
63
+ - .gitignore
64
+ - .rspec
65
65
  - Gemfile
66
66
  - LICENSE.txt
67
67
  - README.md
@@ -93,17 +93,17 @@ require_paths:
93
93
  - lib
94
94
  required_ruby_version: !ruby/object:Gem::Requirement
95
95
  requirements:
96
- - - ">="
96
+ - - '>='
97
97
  - !ruby/object:Gem::Version
98
98
  version: '0'
99
99
  required_rubygems_version: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ">="
101
+ - - '>='
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0'
104
104
  requirements: []
105
105
  rubyforge_project:
106
- rubygems_version: 2.2.1
106
+ rubygems_version: 2.1.11
107
107
  signing_key:
108
108
  specification_version: 4
109
109
  summary: Analog of unix grep utility.