rb_tags 0.1.1 → 0.2.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 +23 -26
- data/lib/rb_tags/concerns/yaml_tasks.rb +11 -5
- data/lib/rb_tags/version.rb +1 -1
- data/lib/rb_tags.rb +10 -13
- data/rb_tags.gemspec +2 -0
- data/spec/doc_formatter.rb +28 -0
- data/spec/rb_tags/concerns/yaml_tasks_spec.rb +1 -1
- data/spec/rb_tags/tags_spec.rb +1 -3
- data/spec/rb_tags_spec.rb +10 -8
- data/spec/spec_helper.rb +2 -1
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5d38f04803da66d3938e15ce577cd70927706b68
|
4
|
+
data.tar.gz: 190641f6d9a521c14eb276837e4f9f5f9d4ed457
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: abcfd1a25415d8e1618afeb8a80306fefea6043d3f58e2e398407de2a668899dacb2a2d309f3ab14ba2d1ce78e0fe24d8241035d814d0446f5ead50a352b4eb0
|
7
|
+
data.tar.gz: e7a9dc02c0c234539f82be4705c3b03205bc37485a78b74554b9ab11b7a0667b97a677addb081711f6218134f7c89ad47b344ff504648d4ede88a365ff55f185
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rb_tags (0.
|
4
|
+
rb_tags (0.2.1)
|
5
5
|
awesome_print
|
6
6
|
bundler
|
7
7
|
colorize
|
@@ -15,18 +15,16 @@ GEM
|
|
15
15
|
specs:
|
16
16
|
awesome_print (1.6.1)
|
17
17
|
blankslate (3.1.3)
|
18
|
-
celluloid (0.16.0)
|
19
|
-
timers (~> 4.0.0)
|
20
18
|
coderay (1.1.0)
|
21
19
|
colorize (0.7.7)
|
22
20
|
diff-lcs (1.2.5)
|
23
21
|
docile (1.1.5)
|
24
|
-
ffi (1.9.
|
22
|
+
ffi (1.9.10)
|
25
23
|
formatador (0.2.5)
|
26
24
|
gli (2.13.1)
|
27
|
-
guard (2.
|
25
|
+
guard (2.13.0)
|
28
26
|
formatador (>= 0.2.4)
|
29
|
-
listen (
|
27
|
+
listen (>= 2.7, <= 4.0)
|
30
28
|
lumberjack (~> 1.0)
|
31
29
|
nenv (~> 0.1)
|
32
30
|
notiffany (~> 0.0)
|
@@ -38,23 +36,21 @@ GEM
|
|
38
36
|
guard (~> 2.2)
|
39
37
|
guard-compat (~> 1.1)
|
40
38
|
guard-compat (1.2.1)
|
41
|
-
guard-rspec (4.
|
39
|
+
guard-rspec (4.6.4)
|
42
40
|
guard (~> 2.1)
|
43
41
|
guard-compat (~> 1.1)
|
44
42
|
rspec (>= 2.99.0, < 4.0)
|
45
|
-
|
46
|
-
|
47
|
-
listen (2.10.0)
|
48
|
-
celluloid (~> 0.16.0)
|
43
|
+
json (1.8.3)
|
44
|
+
listen (3.0.3)
|
49
45
|
rb-fsevent (>= 0.9.3)
|
50
46
|
rb-inotify (>= 0.9)
|
51
47
|
lumberjack (1.0.9)
|
52
48
|
method_source (0.8.2)
|
53
49
|
nenv (0.2.0)
|
54
|
-
notiffany (0.0.
|
50
|
+
notiffany (0.0.7)
|
55
51
|
nenv (~> 0.1)
|
56
52
|
shellany (~> 0.0)
|
57
|
-
parallel (1.6.
|
53
|
+
parallel (1.6.1)
|
58
54
|
parslet (1.7.0)
|
59
55
|
blankslate (>= 2.0, <= 4.0)
|
60
56
|
pry (0.10.1)
|
@@ -65,19 +61,19 @@ GEM
|
|
65
61
|
rb-fsevent (0.9.5)
|
66
62
|
rb-inotify (0.9.5)
|
67
63
|
ffi (>= 0.5.0)
|
68
|
-
rspec (3.
|
69
|
-
rspec-core (~> 3.
|
70
|
-
rspec-expectations (~> 3.
|
71
|
-
rspec-mocks (~> 3.
|
72
|
-
rspec-core (3.2
|
73
|
-
rspec-support (~> 3.
|
74
|
-
rspec-expectations (3.
|
64
|
+
rspec (3.3.0)
|
65
|
+
rspec-core (~> 3.3.0)
|
66
|
+
rspec-expectations (~> 3.3.0)
|
67
|
+
rspec-mocks (~> 3.3.0)
|
68
|
+
rspec-core (3.3.2)
|
69
|
+
rspec-support (~> 3.3.0)
|
70
|
+
rspec-expectations (3.3.1)
|
75
71
|
diff-lcs (>= 1.2.0, < 2.0)
|
76
|
-
rspec-support (~> 3.
|
77
|
-
rspec-mocks (3.2
|
72
|
+
rspec-support (~> 3.3.0)
|
73
|
+
rspec-mocks (3.3.2)
|
78
74
|
diff-lcs (>= 1.2.0, < 2.0)
|
79
|
-
rspec-support (~> 3.
|
80
|
-
rspec-support (3.
|
75
|
+
rspec-support (~> 3.3.0)
|
76
|
+
rspec-support (3.3.0)
|
81
77
|
shellany (0.0.1)
|
82
78
|
simplecov (0.10.0)
|
83
79
|
docile (~> 1.1.0)
|
@@ -87,8 +83,6 @@ GEM
|
|
87
83
|
slop (3.6.0)
|
88
84
|
terminal-notifier-guard (1.6.4)
|
89
85
|
thor (0.19.1)
|
90
|
-
timers (4.0.1)
|
91
|
-
hitimes
|
92
86
|
|
93
87
|
PLATFORMS
|
94
88
|
ruby
|
@@ -101,3 +95,6 @@ DEPENDENCIES
|
|
101
95
|
rspec
|
102
96
|
simplecov
|
103
97
|
terminal-notifier-guard
|
98
|
+
|
99
|
+
BUNDLED WITH
|
100
|
+
1.10.6
|
@@ -1,13 +1,19 @@
|
|
1
1
|
module YamlTasks
|
2
|
-
|
3
|
-
|
2
|
+
# # WRITE
|
3
|
+
def write_to_yaml(dir: nil, this: {})
|
4
|
+
FileUtils.rm(store(dir)) if File.exist?(store(dir))
|
5
|
+
db = YAML::Store.new(store(dir), thread_safe: true)
|
6
|
+
db.transaction { db["tags"] = this } unless this.nil?
|
4
7
|
end
|
5
8
|
|
6
|
-
|
7
|
-
|
9
|
+
# # READ
|
10
|
+
def read_from_yaml_file(dir: nil)
|
11
|
+
db = YAML::Store.new(store(dir), thread_safe: true)
|
12
|
+
db.transaction { db.fetch("tags") }
|
8
13
|
end
|
9
14
|
|
10
15
|
private
|
16
|
+
|
11
17
|
def store(dir = nil)
|
12
18
|
if !!dir
|
13
19
|
store = File.join(dir,".tags")
|
@@ -15,4 +21,4 @@ module YamlTasks
|
|
15
21
|
store = File.join(Dir.getwd,".tags")
|
16
22
|
end
|
17
23
|
end
|
18
|
-
end
|
24
|
+
end
|
data/lib/rb_tags/version.rb
CHANGED
data/lib/rb_tags.rb
CHANGED
@@ -7,6 +7,7 @@ require 'parallel'
|
|
7
7
|
require 'parslet'
|
8
8
|
require 'parslet/convenience'
|
9
9
|
require 'colorize'
|
10
|
+
require 'yaml/store'
|
10
11
|
|
11
12
|
# internal requirements
|
12
13
|
require 'rb_tags/version.rb'
|
@@ -28,10 +29,10 @@ module RbTags
|
|
28
29
|
#
|
29
30
|
|
30
31
|
def generate(options={})
|
31
|
-
tags = Tags.new(default_dir)
|
32
|
-
tags.tag
|
33
|
-
|
34
32
|
default_options(options)
|
33
|
+
|
34
|
+
tags = Tags.new(@options[:dir])
|
35
|
+
tags.tag
|
35
36
|
if @options[:gems]
|
36
37
|
result = tag_bundled_gems
|
37
38
|
result.each { |g| tags.add(g.tags) }
|
@@ -41,14 +42,14 @@ module RbTags
|
|
41
42
|
end
|
42
43
|
|
43
44
|
def tag_bundled_gems
|
44
|
-
build_gem_list
|
45
|
-
results = ::Parallel.map(
|
45
|
+
gem_list = build_gem_list
|
46
|
+
results = ::Parallel.map(gem_list.each_slice(number_of_processors),
|
46
47
|
in_processes: number_of_processors) do |dir_list|
|
47
48
|
gem_list = Tags.new(dir_list.shift)
|
48
49
|
gem_list.tag
|
49
50
|
|
50
51
|
dir_list.each do |dir|
|
51
|
-
gem_tags = Tags.new(dir, read:
|
52
|
+
gem_tags = Tags.new(dir, read: false)
|
52
53
|
unless !!gem_tags.tags
|
53
54
|
gem_tags.tag
|
54
55
|
gem_tags.save
|
@@ -108,17 +109,13 @@ module RbTags
|
|
108
109
|
@options
|
109
110
|
end
|
110
111
|
|
111
|
-
def gem_list
|
112
|
-
@gem_list
|
113
|
-
end
|
114
|
-
|
115
|
-
|
116
112
|
private
|
117
113
|
|
118
114
|
def build_gem_list
|
119
115
|
if File.exist? gem_file
|
120
|
-
|
116
|
+
return Bundler.load.specs.map(&:full_gem_path) - [default_dir]
|
121
117
|
end
|
118
|
+
[]
|
122
119
|
end
|
123
120
|
|
124
121
|
def gem_file
|
@@ -127,7 +124,7 @@ module RbTags
|
|
127
124
|
|
128
125
|
def default_options(options)
|
129
126
|
@options = options.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
|
130
|
-
@options
|
127
|
+
@options[:dir] = Dir.getwd if @options[:dir].nil? || @options[:dir].empty?
|
131
128
|
@options.merge!(defaults) { |key, opt, default| opt }
|
132
129
|
end
|
133
130
|
|
data/rb_tags.gemspec
CHANGED
@@ -19,6 +19,8 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
20
|
spec.require_paths = ["lib"]
|
21
21
|
|
22
|
+
spec.required_ruby_version = '>= 2.2'
|
23
|
+
|
22
24
|
spec.add_development_dependency "rspec"
|
23
25
|
spec.add_development_dependency "guard-rspec"
|
24
26
|
spec.add_development_dependency "guard-bundler"
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'rspec/core/formatters/console_codes'
|
2
|
+
|
3
|
+
class Doc
|
4
|
+
RSpec::Core::Formatters.register self, :example_passed, :example_pending, :example_failed, :close
|
5
|
+
|
6
|
+
def initialize(output)
|
7
|
+
@output = output
|
8
|
+
end
|
9
|
+
|
10
|
+
def example_passed(notification)
|
11
|
+
@output << RSpec::Core::Formatters::ConsoleCodes.wrap(". \
|
12
|
+
#{notification.example.metadata[:example_group][:description]}\n", :success)
|
13
|
+
end
|
14
|
+
|
15
|
+
def example_failed(notification)
|
16
|
+
@output << RSpec::Core::Formatters::ConsoleCodes.wrap("F \
|
17
|
+
#{notification.example.metadata[:example_group][:description]} \
|
18
|
+
#{notification.example.exception}\n", :failure)
|
19
|
+
end
|
20
|
+
|
21
|
+
def example_pending(notification)
|
22
|
+
@output << RSpec::Core::Formatters::ConsoleCodes.wrap("*", :pending)
|
23
|
+
end
|
24
|
+
|
25
|
+
def close(notification)
|
26
|
+
@output << "\n"
|
27
|
+
end
|
28
|
+
end
|
data/spec/rb_tags/tags_spec.rb
CHANGED
data/spec/rb_tags_spec.rb
CHANGED
@@ -11,7 +11,7 @@ describe RbTags do
|
|
11
11
|
|
12
12
|
it { expect(described_class).to eq(RbTags) }
|
13
13
|
it { expect(subject).to respond_to(:generate) }
|
14
|
-
it { expect(subject).to have_attributes(options: nil
|
14
|
+
it { expect(subject).to have_attributes(options: nil) }
|
15
15
|
|
16
16
|
context Foo do
|
17
17
|
let(:foo) { Foo.new }
|
@@ -23,7 +23,7 @@ describe RbTags do
|
|
23
23
|
end
|
24
24
|
|
25
25
|
describe 'in gems' do
|
26
|
-
it { expect { foo.generate(gems: true) }.to_not raise_error }
|
26
|
+
# it { expect { foo.generate(gems: true) }.to_not raise_error }
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
@@ -96,10 +96,10 @@ describe RbTags do
|
|
96
96
|
describe 'defaults' do
|
97
97
|
let(:tags) { foo.send(:default_options, {})}
|
98
98
|
let(:defaults) { foo.send(:defaults) }
|
99
|
-
let(:default) { {gems: false} }
|
99
|
+
let(:default) { {gems: false, dir: Dir.getwd} }
|
100
100
|
|
101
101
|
it { expect { tags }.to_not raise_error }
|
102
|
-
it { expect(tags).to eq
|
102
|
+
it { expect(tags).to eq default }
|
103
103
|
it 'has defaults' do
|
104
104
|
defs = foo.send(:default_options, {})
|
105
105
|
expect(defs).to eq default
|
@@ -108,7 +108,7 @@ describe RbTags do
|
|
108
108
|
end
|
109
109
|
|
110
110
|
describe 'set gems' do
|
111
|
-
let(:options) { {gems: true} }
|
111
|
+
let(:options) { {gems: true, dir: '/somewhere'} }
|
112
112
|
let(:tag_w_options) { foo.send(:default_options, options)}
|
113
113
|
it { expect(tag_w_options).to eq options }
|
114
114
|
end
|
@@ -124,11 +124,13 @@ describe RbTags do
|
|
124
124
|
|
125
125
|
describe '#gem_list' do
|
126
126
|
let(:bar) { foo.send(:build_gem_list) }
|
127
|
-
|
127
|
+
before do
|
128
|
+
foo.send(:default_options, {gems: false})
|
129
|
+
end
|
128
130
|
it { expect(bar).to be_a Array }
|
129
|
-
it { expect(bar).to_not include(
|
131
|
+
it { expect(bar).to_not include(Dir.getwd)}
|
130
132
|
end
|
131
133
|
|
132
134
|
end
|
133
135
|
end
|
134
|
-
end
|
136
|
+
end
|
data/spec/spec_helper.rb
CHANGED
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.
|
4
|
+
version: 0.2.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-
|
11
|
+
date: 2015-08-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -204,6 +204,7 @@ files:
|
|
204
204
|
- lib/rb_tags/tags.rb
|
205
205
|
- lib/rb_tags/version.rb
|
206
206
|
- rb_tags.gemspec
|
207
|
+
- spec/doc_formatter.rb
|
207
208
|
- spec/parser_helper.rb
|
208
209
|
- spec/rb_tags/concerns/completion_spec.rb
|
209
210
|
- spec/rb_tags/concerns/generate_tags_spec.rb
|
@@ -225,7 +226,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
225
226
|
requirements:
|
226
227
|
- - ">="
|
227
228
|
- !ruby/object:Gem::Version
|
228
|
-
version: '
|
229
|
+
version: '2.2'
|
229
230
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
230
231
|
requirements:
|
231
232
|
- - ">="
|
@@ -233,11 +234,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
233
234
|
version: '0'
|
234
235
|
requirements: []
|
235
236
|
rubyforge_project:
|
236
|
-
rubygems_version: 2.4.
|
237
|
+
rubygems_version: 2.4.8
|
237
238
|
signing_key:
|
238
239
|
specification_version: 4
|
239
240
|
summary: A wrapper around ctags.
|
240
241
|
test_files:
|
242
|
+
- spec/doc_formatter.rb
|
241
243
|
- spec/parser_helper.rb
|
242
244
|
- spec/rb_tags/concerns/completion_spec.rb
|
243
245
|
- spec/rb_tags/concerns/generate_tags_spec.rb
|