rb_tags 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/README.md +2 -0
- data/bin/rb_tags +4 -3
- data/lib/rb_tags.rb +17 -12
- data/lib/rb_tags/tags.rb +1 -1
- data/lib/rb_tags/version.rb +1 -1
- data/rb_tags.gemspec +1 -1
- data/spec/rb_tags_spec.rb +51 -52
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 43fc6f32e34897b98afc08b94909ad31ba85d1cf
|
4
|
+
data.tar.gz: 7caa78d7f8cf0db92e91c99f4c0041c43d7321b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ad7650a93ce7e5e77defcb94b22372bdf8f8207469ec9e64f703bf50d73b3bd39ab8ef786be71f45b14e3c9422b34ffbfccb1f658df150ef482c68cc9c643e3
|
7
|
+
data.tar.gz: d492794e4e1b0b705f57050f15b7ab5cde9cac4dad27864b586b13b1c15caa0289f284f8467844a17a95cf4c53b289736e01052ce0819672300ce13fc6c9355c
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
data/bin/rb_tags
CHANGED
@@ -53,13 +53,14 @@ end
|
|
53
53
|
desc 'search for a tag'
|
54
54
|
command :find do |c|
|
55
55
|
c.action do |global_options,options,args|
|
56
|
-
|
57
|
-
ap
|
58
|
-
$stdout.print "open [#{(0 ...
|
56
|
+
found = complete_tag
|
57
|
+
ap found
|
58
|
+
$stdout.print "open [#{(0 ... found.length).to_a.join(',')}]: ".green
|
59
59
|
what = ''
|
60
60
|
while (what += $stdin.getch) !~ /(\w\s)/
|
61
61
|
$stdout.print "#{what}".blue
|
62
62
|
end
|
63
|
+
$stdout.print "\n"
|
63
64
|
open what
|
64
65
|
end
|
65
66
|
end
|
data/lib/rb_tags.rb
CHANGED
@@ -23,6 +23,10 @@ module RbTags
|
|
23
23
|
include SysInfo
|
24
24
|
include Completion
|
25
25
|
|
26
|
+
#
|
27
|
+
# create or update tag list
|
28
|
+
#
|
29
|
+
|
26
30
|
def generate(options={})
|
27
31
|
tags = Tags.new(default_dir)
|
28
32
|
tags.tag
|
@@ -65,20 +69,25 @@ module RbTags
|
|
65
69
|
$stdout.print " first time\n".blue
|
66
70
|
end
|
67
71
|
|
72
|
+
#
|
73
|
+
# using tag list
|
74
|
+
#
|
75
|
+
|
76
|
+
# get list of all names of methods/classes/modules
|
68
77
|
def tags
|
69
|
-
|
78
|
+
@tags ||= Tags.new(read: true)
|
70
79
|
@tags.names
|
71
80
|
end
|
72
81
|
|
73
|
-
#
|
74
|
-
def
|
75
|
-
|
76
|
-
arg
|
77
|
-
@found = found(arg)
|
82
|
+
# get a tag name via readline
|
83
|
+
def complete_tag
|
84
|
+
arg = complete(tags).first
|
85
|
+
found(arg)
|
78
86
|
end
|
79
87
|
|
80
|
-
|
81
|
-
|
88
|
+
# get all occurences of given tag name
|
89
|
+
def found(tag_name)
|
90
|
+
@found = @tags.tags[tag_name]
|
82
91
|
end
|
83
92
|
|
84
93
|
def open(what = 0)
|
@@ -106,10 +115,6 @@ module RbTags
|
|
106
115
|
|
107
116
|
private
|
108
117
|
|
109
|
-
def get_existend_tags
|
110
|
-
@tags ||= Tags.new(read: true)
|
111
|
-
end
|
112
|
-
|
113
118
|
def build_gem_list
|
114
119
|
if File.exist? gem_file
|
115
120
|
@gem_list = Bundler.load.specs.map(&:full_gem_path) - [default_dir]
|
data/lib/rb_tags/tags.rb
CHANGED
data/lib/rb_tags/version.rb
CHANGED
data/rb_tags.gemspec
CHANGED
@@ -24,8 +24,8 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.add_development_dependency "guard-bundler"
|
25
25
|
spec.add_development_dependency "rb-fsevent"
|
26
26
|
spec.add_development_dependency "terminal-notifier-guard"
|
27
|
-
spec.add_development_dependency "awesome_print"
|
28
27
|
|
28
|
+
spec.add_runtime_dependency "awesome_print"
|
29
29
|
spec.add_runtime_dependency "bundler"
|
30
30
|
spec.add_runtime_dependency "colorize"
|
31
31
|
spec.add_runtime_dependency "rake"
|
data/spec/rb_tags_spec.rb
CHANGED
@@ -16,76 +16,81 @@ describe RbTags do
|
|
16
16
|
context Foo do
|
17
17
|
let(:foo) { Foo.new }
|
18
18
|
|
19
|
-
|
20
|
-
describe '
|
21
|
-
|
22
|
-
|
19
|
+
context 'create or update tag list' do
|
20
|
+
describe '#generate' do
|
21
|
+
describe 'in work dir' do
|
22
|
+
it { expect { foo.generate }.to_not raise_error }
|
23
|
+
end
|
23
24
|
|
24
|
-
|
25
|
-
|
25
|
+
describe 'in gems' do
|
26
|
+
it { expect { foo.generate(gems: true) }.to_not raise_error }
|
27
|
+
end
|
26
28
|
end
|
27
|
-
end
|
28
29
|
|
29
|
-
|
30
|
-
|
31
|
-
|
30
|
+
describe '#say_tagging' do
|
31
|
+
let(:dir) { '/something' }
|
32
|
+
let(:message) { "tag gem: #{dir} first time\n"}
|
32
33
|
|
33
|
-
|
34
|
-
|
35
|
-
|
34
|
+
it 'does something' do
|
35
|
+
expect(foo).to receive(:say_tagging).with(dir).and_return(message)
|
36
|
+
foo.say_tagging(dir)
|
37
|
+
end
|
36
38
|
end
|
37
39
|
end
|
38
40
|
|
39
|
-
|
40
|
-
|
41
|
+
context 'using tag list' do
|
42
|
+
before { foo.tags }
|
43
|
+
|
44
|
+
describe '#tags' do
|
45
|
+
let(:tag_tags) { Tags.new(read: true).names}
|
41
46
|
|
42
|
-
|
43
|
-
|
47
|
+
it 'has tags' do
|
48
|
+
expect(foo.tags).to eq tag_tags
|
49
|
+
end
|
44
50
|
end
|
45
|
-
end
|
46
51
|
|
47
|
-
|
48
|
-
|
49
|
-
|
52
|
+
describe '#complete_tag' do
|
53
|
+
let(:tag) { Tags.new(read: true).tags}
|
54
|
+
let(:arg) { tag.first.first }
|
50
55
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
end
|
56
|
+
before do
|
57
|
+
allow(foo).to receive(:complete).and_return(tag[arg])
|
58
|
+
end
|
55
59
|
|
56
|
-
|
57
|
-
|
58
|
-
|
60
|
+
it 'does something' do
|
61
|
+
expect(foo.found(arg)).to eq tag[arg]
|
62
|
+
foo.complete_tag
|
63
|
+
end
|
59
64
|
end
|
60
|
-
end
|
61
65
|
|
62
|
-
|
63
|
-
|
64
|
-
|
66
|
+
describe '#found' do
|
67
|
+
let(:tag) { Tags.new(read: true).tags.first}
|
68
|
+
let(:key) { tag.first }
|
65
69
|
|
66
|
-
|
67
|
-
|
68
|
-
|
70
|
+
it 'does something' do
|
71
|
+
expect(foo.found(key)).to eq tag.last
|
72
|
+
end
|
69
73
|
end
|
70
|
-
end
|
71
74
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
+
describe '#open' do
|
76
|
+
describe 'what is valid' do
|
77
|
+
let(:what) { 0 }
|
75
78
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
+
it 'call open' do
|
80
|
+
expect(foo).to receive(:open).with(what)
|
81
|
+
foo.open(what)
|
82
|
+
end
|
79
83
|
end
|
80
|
-
end
|
81
84
|
|
82
|
-
|
83
|
-
|
85
|
+
describe 'what is invalid' do
|
86
|
+
let(:what) { 'a' }
|
84
87
|
|
85
|
-
|
88
|
+
it { expect{ foo.open(what) }.to output.to_stdout }
|
89
|
+
end
|
86
90
|
end
|
87
91
|
end
|
88
92
|
|
93
|
+
|
89
94
|
describe 'private methods' do
|
90
95
|
describe '#default_options' do
|
91
96
|
describe 'defaults' do
|
@@ -124,12 +129,6 @@ describe RbTags do
|
|
124
129
|
it { expect(bar).to_not include(foo.send(:default_dir))}
|
125
130
|
end
|
126
131
|
|
127
|
-
describe '#get_existend_tags' do
|
128
|
-
let(:tags) { foo.send(:get_existend_tags) }
|
129
|
-
|
130
|
-
it { expect(tags).to be_a Tags }
|
131
|
-
end
|
132
|
-
|
133
132
|
end
|
134
133
|
end
|
135
134
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rb_tags
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- LeFnord
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -87,7 +87,7 @@ dependencies:
|
|
87
87
|
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
|
-
type: :
|
90
|
+
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|