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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a67c84f973778879cabed5a52a9bf9b8d9328af9
4
- data.tar.gz: 230f1a39761dff1665a17db4a88ca8b27c8debb9
3
+ metadata.gz: 43fc6f32e34897b98afc08b94909ad31ba85d1cf
4
+ data.tar.gz: 7caa78d7f8cf0db92e91c99f4c0041c43d7321b3
5
5
  SHA512:
6
- metadata.gz: b3d389f0dff8660b3d505906545683cea667711e3bf1b52855580637059d2e710dee798169175051a59f5395047790a2b9b7722f52692f889693f9802ef3db43
7
- data.tar.gz: 54fd41a42fc5f63b2d0b3a63dab5597a3ed8d86599e650633d0241985cd3f6df2a2fad34f6526063c64093833813ed4b65a7e8c8206e9dd7ca2541cbfec99c83
6
+ metadata.gz: 9ad7650a93ce7e5e77defcb94b22372bdf8f8207469ec9e64f703bf50d73b3bd39ab8ef786be71f45b14e3c9422b34ffbfccb1f658df150ef482c68cc9c643e3
7
+ data.tar.gz: d492794e4e1b0b705f57050f15b7ab5cde9cac4dad27864b586b13b1c15caa0289f284f8467844a17a95cf4c53b289736e01052ce0819672300ce13fc6c9355c
@@ -1,7 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rb_tags (0.1.0)
4
+ rb_tags (0.1.1)
5
+ awesome_print
5
6
  bundler
6
7
  colorize
7
8
  gli
@@ -93,7 +94,6 @@ PLATFORMS
93
94
  ruby
94
95
 
95
96
  DEPENDENCIES
96
- awesome_print
97
97
  guard-bundler
98
98
  guard-rspec
99
99
  rb-fsevent
data/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ [![Gem Version](https://badge.fury.io/rb/rb_tags.svg)](http://badge.fury.io/rb/rb_tags)
2
+
1
3
  # RbTags
2
4
 
3
5
  Generate tags file for your ruby project and bundled gems, based on ctags.
@@ -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
- find
57
- ap @found
58
- $stdout.print "open [#{(0 ... @found.length).to_a.join(',')}]: ".green
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
@@ -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
- get_existend_tags
78
+ @tags ||= Tags.new(read: true)
70
79
  @tags.names
71
80
  end
72
81
 
73
- # used for command line
74
- def find
75
- get_existend_tags
76
- arg = complete(@tags.names).first
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
- def found(arg)
81
- @tags.tags[arg]
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]
@@ -36,6 +36,6 @@ class Tags
36
36
  end
37
37
 
38
38
  def names
39
- @name ||= @tags.keys
39
+ @tags.keys
40
40
  end
41
41
  end
@@ -1,3 +1,3 @@
1
1
  module RbTags
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
3
3
  end
@@ -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"
@@ -16,76 +16,81 @@ describe RbTags do
16
16
  context Foo do
17
17
  let(:foo) { Foo.new }
18
18
 
19
- describe '#generate' do
20
- describe 'in work dir' do
21
- it { expect { foo.generate }.to_not raise_error }
22
- end
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
- describe 'in gems' do
25
- it { expect { foo.generate(gems: true) }.to_not raise_error }
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
- describe '#say_tagging' do
30
- let(:dir) { '/something' }
31
- let(:message) { "tag gem: #{dir} first time\n"}
30
+ describe '#say_tagging' do
31
+ let(:dir) { '/something' }
32
+ let(:message) { "tag gem: #{dir} first time\n"}
32
33
 
33
- it 'does something' do
34
- expect(foo).to receive(:say_tagging).with(dir).and_return(message)
35
- foo.say_tagging(dir)
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
- describe '#tags' do
40
- let(:tag_tags) { Tags.new(read: true).names}
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
- it 'has tags' do
43
- expect(foo.tags).to eq tag_tags
47
+ it 'has tags' do
48
+ expect(foo.tags).to eq tag_tags
49
+ end
44
50
  end
45
- end
46
51
 
47
- describe '#find' do
48
- let(:tag) { Tags.new(read: true).tags}
49
- let(:arg) { tag.first.first }
52
+ describe '#complete_tag' do
53
+ let(:tag) { Tags.new(read: true).tags}
54
+ let(:arg) { tag.first.first }
50
55
 
51
- before do
52
- foo.send(:get_existend_tags)
53
- allow(foo).to receive(:complete).and_return(tag[arg])
54
- end
56
+ before do
57
+ allow(foo).to receive(:complete).and_return(tag[arg])
58
+ end
55
59
 
56
- it 'does something' do
57
- expect(foo.found(arg)).to eq tag[arg]
58
- foo.find
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
- describe '#found' do
63
- let(:tag) { Tags.new(read: true).tags.first}
64
- let(:key) { tag.first }
66
+ describe '#found' do
67
+ let(:tag) { Tags.new(read: true).tags.first}
68
+ let(:key) { tag.first }
65
69
 
66
- it 'does something' do
67
- foo.send(:get_existend_tags)
68
- expect(foo.found(key)).to eq tag.last
70
+ it 'does something' do
71
+ expect(foo.found(key)).to eq tag.last
72
+ end
69
73
  end
70
- end
71
74
 
72
- describe '#open' do
73
- describe 'what is valid' do
74
- let(:what) { 0 }
75
+ describe '#open' do
76
+ describe 'what is valid' do
77
+ let(:what) { 0 }
75
78
 
76
- it 'call open' do
77
- expect(foo).to receive(:open).with(what)
78
- foo.open(what)
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
- describe 'what is invalid' do
83
- let(:what) { 'a' }
85
+ describe 'what is invalid' do
86
+ let(:what) { 'a' }
84
87
 
85
- it { expect{ foo.open(what) }.to output.to_stdout }
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.0
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-26 00:00:00.000000000 Z
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: :development
90
+ type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements: