ackr 0.2.4 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +4 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/Gemfile +2 -2
- data/Gemfile.lock +24 -15
- data/LICENSE.txt +2 -2
- data/README.markdown +6 -27
- data/Rakefile +3 -19
- data/VERSION +1 -1
- data/ackr.gemspec +17 -0
- data/bin/ackr +1 -2
- data/lib/ackr.rb +0 -2
- data/lib/ackr/colorizer.rb +4 -6
- data/lib/ackr/finder.rb +25 -8
- data/spec/colorizer_spec.rb +33 -0
- data/spec/example1/.hidden-folder/.file +0 -0
- data/spec/example1/.hidden-folder/file +0 -0
- data/spec/example1/.visible-file +0 -0
- data/spec/example1/CVS/cvs.txt +0 -0
- data/spec/example1/folder/.hidden-subfoder/not-me +0 -0
- data/spec/example1/folder/CVS/cvs.txt +0 -0
- data/spec/example1/folder/folder/.visible-file +0 -0
- data/spec/example1/folder/folder/CVS/cvs.txt +0 -0
- data/spec/example1/folder/folder/level2 +1 -0
- data/spec/example1/folder/level1 +2 -0
- data/spec/example1/root +5 -0
- data/spec/example1/tmp/tmp.txt +1 -0
- data/spec/finder_spec.rb +75 -0
- data/spec/formatter_spec.rb +35 -0
- data/spec/helper.rb +6 -0
- data/spec/search_spec.rb +43 -0
- data/spec/string_spec.rb +26 -0
- metadata +49 -11
- data/TODO +0 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c7786a41cb79edccf41532324d4a365511863ede
|
4
|
+
data.tar.gz: d2eef2e79dcd3a6d5d2fb14f80fa6dad7baf134d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57cd732e678cc9f5c0a766bf8d84a52daaaf994438209d11e8b9846d37016ee0af2650650df205679f625c3cf0fbed54799d6c455778fa7e4618d96227d430bd
|
7
|
+
data.tar.gz: 87063c8935cd140db729723c01281ec10e9c138ed3b49f8e8498c6abe06cd3ffb413416f14c238cdb0bb1dc7855dfe0eb037498eb9e37c3a07ada6d0898ae8c3
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,28 +1,37 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
ackr (0.
|
5
|
-
rainbow (
|
4
|
+
ackr (0.3.0)
|
5
|
+
rainbow (~> 2.2)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
diff-lcs (1.
|
11
|
-
rainbow (
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
rspec-
|
16
|
-
rspec-
|
17
|
-
|
18
|
-
rspec-
|
19
|
-
|
20
|
-
rspec-
|
10
|
+
diff-lcs (1.3)
|
11
|
+
rainbow (2.2.2)
|
12
|
+
rake
|
13
|
+
rake (12.0.0)
|
14
|
+
rspec (3.6.0)
|
15
|
+
rspec-core (~> 3.6.0)
|
16
|
+
rspec-expectations (~> 3.6.0)
|
17
|
+
rspec-mocks (~> 3.6.0)
|
18
|
+
rspec-core (3.6.0)
|
19
|
+
rspec-support (~> 3.6.0)
|
20
|
+
rspec-expectations (3.6.0)
|
21
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
22
|
+
rspec-support (~> 3.6.0)
|
23
|
+
rspec-mocks (3.6.0)
|
24
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
25
|
+
rspec-support (~> 3.6.0)
|
26
|
+
rspec-support (3.6.0)
|
21
27
|
|
22
28
|
PLATFORMS
|
23
29
|
ruby
|
24
30
|
|
25
31
|
DEPENDENCIES
|
26
32
|
ackr!
|
27
|
-
rake (>=
|
28
|
-
rspec
|
33
|
+
rake (>= 12.0.0)
|
34
|
+
rspec (>= 3.6.0)
|
35
|
+
|
36
|
+
BUNDLED WITH
|
37
|
+
1.14.6
|
data/LICENSE.txt
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Copyright (c) 2013
|
1
|
+
Copyright (c) 2013-2017 Xavier Nayrac
|
2
2
|
|
3
3
|
MIT License
|
4
4
|
|
@@ -19,4 +19,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
19
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
20
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
21
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.markdown
CHANGED
@@ -16,12 +16,12 @@ most possible simple tool.
|
|
16
16
|
|
17
17
|
Here comes ackr:
|
18
18
|
|
19
|
-
* Ackr look for a search term into all text files, into all subfolders,
|
19
|
+
* Ackr look for a search term into all text files, into all subfolders,
|
20
20
|
from the working directory
|
21
21
|
* A search term is either **a string** (in this case Ackr is *case insensitive*)
|
22
22
|
or **a regexp**
|
23
23
|
* Ackr has **no options**
|
24
|
-
* Ackr doesn't
|
24
|
+
* Ackr doesn't search inside hidden folders, **but** looks to hidden files
|
25
25
|
* Search term is displayed in bold font
|
26
26
|
|
27
27
|
It runs on unixes. I guess it won't run on windows.
|
@@ -80,12 +80,12 @@ you must use:
|
|
80
80
|
|
81
81
|
### Ignored files and directories
|
82
82
|
|
83
|
-
Ackr doesn't look into
|
83
|
+
Ackr doesn't look into directories. In addition, ackr
|
84
84
|
ignores the following list of directories:
|
85
|
-
|
85
|
+
|
86
86
|
* `blib`
|
87
87
|
* `CVS`
|
88
|
-
* `_darcs`
|
88
|
+
* `_darcs`
|
89
89
|
* `RCS`
|
90
90
|
* `SCCS`
|
91
91
|
* `pkg`
|
@@ -93,7 +93,7 @@ ignores the following list of directories:
|
|
93
93
|
* `temp`
|
94
94
|
* `log`
|
95
95
|
|
96
|
-
If you
|
96
|
+
If you want to search into such a directory anyway, simply `cd`
|
97
97
|
into it and make the search.
|
98
98
|
|
99
99
|
### Caveats
|
@@ -101,27 +101,6 @@ into it and make the search.
|
|
101
101
|
Ackr is slow, very slow...
|
102
102
|
May be I will consider performance in a future version.
|
103
103
|
|
104
|
-
Dependencies
|
105
|
-
--------------------------
|
106
|
-
|
107
|
-
* ruby >= 1.9.3
|
108
|
-
|
109
|
-
## Contributing
|
110
|
-
|
111
|
-
1. Fork it
|
112
|
-
2. Create your feature branch (`git checkout -b my-new-feature develop`)
|
113
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
114
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
115
|
-
5. Create new Pull Request
|
116
|
-
|
117
|
-
### There is many other ways to contibute to ackr
|
118
|
-
|
119
|
-
1. Report any bug
|
120
|
-
2. Give me ideas
|
121
|
-
3. Correct my poor english syntax
|
122
|
-
4. Blog about ackr
|
123
|
-
5. Tell ackr to your friends and colleagues
|
124
|
-
|
125
104
|
License
|
126
105
|
--------------------------
|
127
106
|
|
data/Rakefile
CHANGED
@@ -1,22 +1,6 @@
|
|
1
|
-
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
require "rspec/core/rake_task"
|
2
3
|
|
3
|
-
|
4
|
-
require 'rake'
|
5
|
-
require 'rspec/core/rake_task'
|
4
|
+
RSpec::Core::RakeTask.new(:spec)
|
6
5
|
|
7
|
-
desc 'Test GEM'
|
8
6
|
task :default => :spec
|
9
|
-
|
10
|
-
desc 'Test GEM with rspec'
|
11
|
-
RSpec::Core::RakeTask.new(:spec) do |t|
|
12
|
-
t.rspec_opts = ['--color']
|
13
|
-
end
|
14
|
-
|
15
|
-
desc 'Check for code smells'
|
16
|
-
task :reek do
|
17
|
-
puts 'Checking for code smells...'
|
18
|
-
files = Dir.glob 'lib/**/*.rb'
|
19
|
-
# files.delete FILE_TO_EXCLUDE
|
20
|
-
args = files.join(' ')
|
21
|
-
sh "reek --quiet #{args} | ./reek.sed"
|
22
|
-
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.3.0
|
data/ackr.gemspec
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = 'ackr'
|
3
|
+
s.version = File.read('VERSION').strip
|
4
|
+
s.authors = ['Xavier Nayrac']
|
5
|
+
s.email = 'xavier.nayrac@gmail.com'
|
6
|
+
s.summary = 'The smallest subset of ack/rak/ag. For lazy developers'
|
7
|
+
s.homepage = 'https://github.com/lkdjiin/ackr'
|
8
|
+
s.description = %q{Ackr is the smallest subset of ack/rak/ag I can think of. For lazy developers}
|
9
|
+
|
10
|
+
s.files = `git ls-files -z`.split("\x0")
|
11
|
+
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
12
|
+
s.require_paths = ["lib"]
|
13
|
+
s.license = 'MIT'
|
14
|
+
s.required_ruby_version = '>= 2.2.0'
|
15
|
+
s.executables = ['ackr']
|
16
|
+
s.add_dependency 'rainbow', '~> 2.2'
|
17
|
+
end
|
data/bin/ackr
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
# -*- encoding: utf-8 -*-
|
3
2
|
|
4
3
|
$LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
|
5
4
|
$ACKR_PATH = File.expand_path(File.dirname(__FILE__)) + '/..'
|
@@ -7,7 +6,7 @@ $ACKR_PATH = File.expand_path(File.dirname(__FILE__)) + '/..'
|
|
7
6
|
require 'ackr'
|
8
7
|
|
9
8
|
if ARGV[0].nil?
|
10
|
-
puts "ackr version " + File.read('VERSION').strip
|
9
|
+
puts "ackr version " + File.read($ACKR_PATH + '/VERSION').strip
|
11
10
|
puts "
|
12
11
|
usage:
|
13
12
|
|
data/lib/ackr.rb
CHANGED
data/lib/ackr/colorizer.rb
CHANGED
@@ -1,6 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
gem 'rainbow', '= 1.99.2'
|
1
|
+
gem 'rainbow', '~> 2.2'
|
4
2
|
require 'rainbow'
|
5
3
|
|
6
4
|
module Ackr
|
@@ -14,7 +12,7 @@ module Ackr
|
|
14
12
|
#
|
15
13
|
# Returns the String filename highlighted.
|
16
14
|
def self.for_file string
|
17
|
-
string.
|
15
|
+
Rainbow(string).fg(:blue).bright.underline
|
18
16
|
end
|
19
17
|
|
20
18
|
# Public: Highlight a matched file line.
|
@@ -26,9 +24,9 @@ module Ackr
|
|
26
24
|
def self.for_line string, search
|
27
25
|
search = Regexp.new(search, Regexp::IGNORECASE) if search.is_a?(String)
|
28
26
|
begin
|
29
|
-
string.gsub(search) {|exp| exp.bright }
|
27
|
+
string.gsub(search) {|exp| Rainbow(exp).bright }
|
30
28
|
rescue Exception => ex
|
31
|
-
puts "Error ".
|
29
|
+
puts Rainbow("Error ").bg(:red) + ex.message
|
32
30
|
end
|
33
31
|
end
|
34
32
|
end
|
data/lib/ackr/finder.rb
CHANGED
@@ -1,27 +1,44 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
|
3
1
|
module Ackr
|
4
2
|
|
5
3
|
# All 'find a file' relatives.
|
6
4
|
module Finder
|
7
5
|
|
8
|
-
#
|
6
|
+
# Get all files to look for.
|
9
7
|
#
|
10
8
|
# Files of interest are those who are
|
11
9
|
# + not directory
|
12
10
|
# + not binary
|
13
|
-
# + not hidden
|
11
|
+
# + not inside a hidden folder
|
12
|
+
#
|
13
|
+
# Returns nothing.
|
14
14
|
#
|
15
|
-
# Returns an Enumerator of String filename.
|
16
15
|
def self.all_files
|
17
|
-
Dir.glob('**/*').each do |file|
|
18
|
-
next if
|
16
|
+
Dir.glob('**/*', File::FNM_DOTMATCH).each do |file|
|
17
|
+
next if File.directory?(file)
|
18
|
+
next if inside_hidden_folder?(file)
|
19
|
+
next if Ackr.binary?(file)
|
20
|
+
|
19
21
|
next if EXCLUDE_DIRS.any? do |dir|
|
20
|
-
file.start_with?(dir + File::Separator) ||
|
22
|
+
file.start_with?(dir + File::Separator) ||
|
21
23
|
file.include?(File::Separator + dir + File::Separator)
|
22
24
|
end
|
25
|
+
|
23
26
|
yield(file)
|
24
27
|
end
|
25
28
|
end
|
29
|
+
|
30
|
+
def self.inside_hidden_folder?(file)
|
31
|
+
part_of_hidden_folder?(file) || part_of_hidden_subfolder?(file)
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
def self.part_of_hidden_folder?(file)
|
37
|
+
file.start_with?('.') && file.include?(File::Separator)
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.part_of_hidden_subfolder?(file)
|
41
|
+
file =~ /\/\..*\//
|
42
|
+
end
|
26
43
|
end
|
27
44
|
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require './spec/helper'
|
2
|
+
|
3
|
+
describe Colorizer do
|
4
|
+
|
5
|
+
describe "#for_file" do
|
6
|
+
it "should colorize filename" do
|
7
|
+
string = "path/to/file"
|
8
|
+
expected = Rainbow(string).fg(:blue).bright.underline
|
9
|
+
expect(Colorizer::for_file(string)).to eq(expected)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
describe "#for_line" do
|
14
|
+
it "should colorize matched term" do
|
15
|
+
string = "123 456 789"
|
16
|
+
expected = "123 " + Rainbow("456").bright + " 789"
|
17
|
+
expect(Colorizer::for_line(string, "456")).to eq(expected)
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should colorize matched terms" do
|
21
|
+
string = "123 456 789 456"
|
22
|
+
expected = "123 " + Rainbow("456").bright + " 789 " + Rainbow("456").bright
|
23
|
+
expect(Colorizer::for_line(string, "456")).to eq(expected)
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should be case insensitive" do
|
27
|
+
string = "AAA BBB CCC"
|
28
|
+
expected = "AAA " + Rainbow("BBB").bright + " CCC"
|
29
|
+
expect(Colorizer::for_line(string, "bbb")).to eq(expected)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
level2
|
@@ -0,0 +1 @@
|
|
1
|
+
tmp
|
data/spec/finder_spec.rb
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
require './spec/helper'
|
2
|
+
|
3
|
+
# spec/example1/
|
4
|
+
# ├── CVS
|
5
|
+
# │ └── cvs.txt
|
6
|
+
# ├── folder
|
7
|
+
# │ ├── CVS
|
8
|
+
# │ │ └── cvs.txt
|
9
|
+
# │ ├── folder
|
10
|
+
# │ │ ├── CVS
|
11
|
+
# │ │ │ └── cvs.txt
|
12
|
+
# │ │ └── level2
|
13
|
+
# │ ├── .hidden-subfoder
|
14
|
+
# │ │ └── not-me
|
15
|
+
# │ └── level1
|
16
|
+
# ├── .hidden-folder
|
17
|
+
# │ ├── file
|
18
|
+
# │ └── .file
|
19
|
+
# ├── root
|
20
|
+
# ├── tmp
|
21
|
+
# │ └── tmp.txt
|
22
|
+
# └── .visible-file
|
23
|
+
|
24
|
+
describe Finder do
|
25
|
+
|
26
|
+
describe "#all_files" do
|
27
|
+
before do
|
28
|
+
@results = []
|
29
|
+
Dir.chdir('spec/example1/') do
|
30
|
+
Finder::all_files {|file| @results << file }
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
it "doesnt return a directory" do
|
35
|
+
expect(@results.include?('folder/')).to be_falsey
|
36
|
+
end
|
37
|
+
|
38
|
+
it "doesnt return a binary" do
|
39
|
+
expect(@results.include?('ackr-0.1.gem')).to be_falsey
|
40
|
+
end
|
41
|
+
|
42
|
+
it "returns root file" do
|
43
|
+
expect(@results.include?('root')).to be_truthy
|
44
|
+
end
|
45
|
+
|
46
|
+
it "returns files in subfolders" do
|
47
|
+
expect(@results.include?('folder/level1')).to be_truthy
|
48
|
+
expect(@results.include?('folder/folder/level2')).to be_truthy
|
49
|
+
end
|
50
|
+
|
51
|
+
it "doesnt return files in tmp/" do
|
52
|
+
expect(@results.include?('tmp/tmp.txt')).to be_falsey
|
53
|
+
end
|
54
|
+
|
55
|
+
it "doesnt return files in CVS/" do
|
56
|
+
expect(@results.include?('CVS/cvs.txt')).to be_falsey
|
57
|
+
end
|
58
|
+
|
59
|
+
it "doesnt return files in CVS/ subfolders" do
|
60
|
+
expect(@results.include?('folder/CVS/cvs.txt')).to be_falsey
|
61
|
+
expect(@results.include?('folder/folder/CVS/cvs.txt')).to be_falsey
|
62
|
+
end
|
63
|
+
|
64
|
+
it "returns hidden files" do
|
65
|
+
expect(@results).to include('.visible-file')
|
66
|
+
expect(@results).to include('folder/folder/.visible-file')
|
67
|
+
end
|
68
|
+
|
69
|
+
it "doesnt look into hidden folders" do
|
70
|
+
expect(@results).not_to include('.hidden-folder/file')
|
71
|
+
expect(@results).not_to include('.hidden-folder/.file')
|
72
|
+
expect(@results).not_to include /not-me$/
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require './spec/helper'
|
2
|
+
|
3
|
+
describe Formatter do
|
4
|
+
before do
|
5
|
+
@format = Formatter.new("search")
|
6
|
+
end
|
7
|
+
|
8
|
+
describe "#line" do
|
9
|
+
|
10
|
+
it "should format line number" do
|
11
|
+
result = @format.line("abc search", 1)
|
12
|
+
expect(result.start_with?(" 1")).to be_truthy
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should add a pipe and a space after line number" do
|
16
|
+
result = @format.line("abc search", 1)
|
17
|
+
expect(result.start_with?(" 1| ")).to be_truthy
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should colorize search term" do
|
21
|
+
result = @format.line("abc search", 1)
|
22
|
+
expect(result).to eq(" 1| abc " + Rainbow("search").bright)
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should suppress trailing spaces" do
|
26
|
+
result = @format.line(" abc search", 1)
|
27
|
+
expect(result).to eq(" 1| abc " + Rainbow("search").bright)
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should suppress trailing tabs" do
|
31
|
+
result = @format.line("\t\tabc search", 1)
|
32
|
+
expect(result).to eq(" 1| abc " + Rainbow("search").bright)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/spec/helper.rb
ADDED
data/spec/search_spec.rb
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
require './spec/helper'
|
4
|
+
|
5
|
+
describe Search do
|
6
|
+
|
7
|
+
context "when looking for a string" do
|
8
|
+
|
9
|
+
it "should print file, line number and line" do
|
10
|
+
Dir.chdir('spec/example1/') do
|
11
|
+
@search = Search.new("xavier")
|
12
|
+
expect($stdout).to receive(:puts).with("\e[34m\e[1m\e[4mroot\e[0m")
|
13
|
+
expect($stdout).to receive(:puts).with(" 5| \e[1mxavier\e[0m")
|
14
|
+
expect($stdout).to receive(:puts).with("")
|
15
|
+
@search.run
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should be case insensitive" do
|
20
|
+
Dir.chdir('spec/example1/') do
|
21
|
+
@search = Search.new("alice")
|
22
|
+
expect($stdout).to receive(:puts).with("\e[34m\e[1m\e[4mfolder/level1\e[0m")
|
23
|
+
expect($stdout).to receive(:puts).with(" 2| \e[1mALICE\e[0m")
|
24
|
+
expect($stdout).to receive(:puts).with("")
|
25
|
+
@search.run
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
context "when looking for a regexp" do
|
32
|
+
it "should print file, line number and line" do
|
33
|
+
Dir.chdir('spec/example1/') do
|
34
|
+
@search = Search.new('/xavier/')
|
35
|
+
expect($stdout).to receive(:puts).with("\e[34m\e[1m\e[4mroot\e[0m")
|
36
|
+
expect($stdout).to receive(:puts).with(" 5| \e[1mxavier\e[0m")
|
37
|
+
expect($stdout).to receive(:puts).with("")
|
38
|
+
@search.run
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
data/spec/string_spec.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
require './spec/helper'
|
4
|
+
|
5
|
+
describe "String#to_regexp" do
|
6
|
+
|
7
|
+
context "fail cases" do
|
8
|
+
specify { expect("reg".to_regexp).to be_nil }
|
9
|
+
specify { expect("/reg".to_regexp).to be_nil }
|
10
|
+
specify { expect("reg/".to_regexp).to be_nil }
|
11
|
+
specify { expect("reg/i".to_regexp).to be_nil }
|
12
|
+
specify { expect("/reg/mk".to_regexp).to be_nil }
|
13
|
+
end
|
14
|
+
|
15
|
+
context "pass cases" do
|
16
|
+
specify { expect("/reg/".to_regexp).to eq(/reg/) }
|
17
|
+
specify { expect("/reg/i".to_regexp).to eq(/reg/i) }
|
18
|
+
specify { expect("/reg/m".to_regexp).to eq(/reg/m) }
|
19
|
+
specify { expect("/reg/x".to_regexp).to eq(/reg/x) }
|
20
|
+
specify { expect("/reg/im".to_regexp).to eq(/reg/im) }
|
21
|
+
specify { expect("/reg/ix".to_regexp).to eq(/reg/ix) }
|
22
|
+
specify { expect("/reg/imx".to_regexp).to eq(/reg/imx) }
|
23
|
+
specify { expect(" /reg/i ".to_regexp).to eq(/reg/i) }
|
24
|
+
specify { expect(" /reg/ ".to_regexp).to eq(/reg/) }
|
25
|
+
end
|
26
|
+
end
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ackr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Xavier Nayrac
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-09-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rainbow
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: '2.2'
|
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
|
-
version:
|
26
|
+
version: '2.2'
|
27
27
|
description: Ackr is the smallest subset of ack/rak/ag I can think of. For lazy developers
|
28
28
|
email: xavier.nayrac@gmail.com
|
29
29
|
executables:
|
@@ -31,13 +31,16 @@ executables:
|
|
31
31
|
extensions: []
|
32
32
|
extra_rdoc_files: []
|
33
33
|
files:
|
34
|
+
- ".gitignore"
|
35
|
+
- ".rspec"
|
36
|
+
- ".travis.yml"
|
34
37
|
- Gemfile
|
35
38
|
- Gemfile.lock
|
36
39
|
- LICENSE.txt
|
37
40
|
- README.markdown
|
38
41
|
- Rakefile
|
39
|
-
- TODO
|
40
42
|
- VERSION
|
43
|
+
- ackr.gemspec
|
41
44
|
- bin/ackr
|
42
45
|
- lib/ackr.rb
|
43
46
|
- lib/ackr/colorizer.rb
|
@@ -45,6 +48,24 @@ files:
|
|
45
48
|
- lib/ackr/finder.rb
|
46
49
|
- lib/ackr/formatter.rb
|
47
50
|
- lib/ackr/search.rb
|
51
|
+
- spec/colorizer_spec.rb
|
52
|
+
- spec/example1/.hidden-folder/.file
|
53
|
+
- spec/example1/.hidden-folder/file
|
54
|
+
- spec/example1/.visible-file
|
55
|
+
- spec/example1/CVS/cvs.txt
|
56
|
+
- spec/example1/folder/.hidden-subfoder/not-me
|
57
|
+
- spec/example1/folder/CVS/cvs.txt
|
58
|
+
- spec/example1/folder/folder/.visible-file
|
59
|
+
- spec/example1/folder/folder/CVS/cvs.txt
|
60
|
+
- spec/example1/folder/folder/level2
|
61
|
+
- spec/example1/folder/level1
|
62
|
+
- spec/example1/root
|
63
|
+
- spec/example1/tmp/tmp.txt
|
64
|
+
- spec/finder_spec.rb
|
65
|
+
- spec/formatter_spec.rb
|
66
|
+
- spec/helper.rb
|
67
|
+
- spec/search_spec.rb
|
68
|
+
- spec/string_spec.rb
|
48
69
|
homepage: https://github.com/lkdjiin/ackr
|
49
70
|
licenses:
|
50
71
|
- MIT
|
@@ -57,7 +78,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
57
78
|
requirements:
|
58
79
|
- - ">="
|
59
80
|
- !ruby/object:Gem::Version
|
60
|
-
version:
|
81
|
+
version: 2.2.0
|
61
82
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
62
83
|
requirements:
|
63
84
|
- - ">="
|
@@ -65,9 +86,26 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
65
86
|
version: '0'
|
66
87
|
requirements: []
|
67
88
|
rubyforge_project:
|
68
|
-
rubygems_version: 2.
|
89
|
+
rubygems_version: 2.6.11
|
69
90
|
signing_key:
|
70
91
|
specification_version: 4
|
71
92
|
summary: The smallest subset of ack/rak/ag. For lazy developers
|
72
|
-
test_files:
|
73
|
-
|
93
|
+
test_files:
|
94
|
+
- spec/colorizer_spec.rb
|
95
|
+
- spec/example1/.hidden-folder/.file
|
96
|
+
- spec/example1/.hidden-folder/file
|
97
|
+
- spec/example1/.visible-file
|
98
|
+
- spec/example1/CVS/cvs.txt
|
99
|
+
- spec/example1/folder/.hidden-subfoder/not-me
|
100
|
+
- spec/example1/folder/CVS/cvs.txt
|
101
|
+
- spec/example1/folder/folder/.visible-file
|
102
|
+
- spec/example1/folder/folder/CVS/cvs.txt
|
103
|
+
- spec/example1/folder/folder/level2
|
104
|
+
- spec/example1/folder/level1
|
105
|
+
- spec/example1/root
|
106
|
+
- spec/example1/tmp/tmp.txt
|
107
|
+
- spec/finder_spec.rb
|
108
|
+
- spec/formatter_spec.rb
|
109
|
+
- spec/helper.rb
|
110
|
+
- spec/search_spec.rb
|
111
|
+
- spec/string_spec.rb
|
data/TODO
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
[x] Ruby 2.1 sur travis à la place de 2.1.0
|
2
|
-
[x] Remove 1.9.2 on travis
|
3
|
-
[x] Fix the rainbow issue (test 1.99.2)
|
4
|
-
[ ] Make it pipeable
|
5
|
-
[ ] Make it themeable
|
6
|
-
|
7
|
-
---------------------------
|
8
|
-
annonce release sur freecode, mon blog
|
9
|
-
ajouter screenshot sur freecode
|
10
|
-
|
11
|
-
---------------------------
|
12
|
-
Site web
|
13
|
-
|
14
|
-
---------------------------
|
15
|
-
Écrire à rainbow owner pour lui dire que j'utilise son truc
|
16
|
-
dans ce projet.
|
17
|
-
|
18
|
-
---------------------------
|
19
|
-
Améliorer les perfs
|
20
|
-
|
21
|
-
---------------------------
|
22
|
-
une ligne sur le terminal fait 80 char max
|