rb_tags 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +24 -0
- data/.rubocop_todo.yml +12 -0
- data/.travis.yml +17 -0
- data/Gemfile +16 -2
- data/Gemfile.lock +61 -46
- data/Guardfile +3 -2
- data/Rakefile +11 -3
- data/bin/rb_tags +16 -15
- data/lib/rb_tags.rb +6 -6
- data/lib/rb_tags/concerns/completion.rb +5 -6
- data/lib/rb_tags/concerns/generate_tags.rb +12 -5
- data/lib/rb_tags/concerns/parser.rb +21 -22
- data/lib/rb_tags/concerns/sys_info.rb +6 -7
- data/lib/rb_tags/concerns/yaml_tasks.rb +9 -10
- data/lib/rb_tags/tags.rb +5 -4
- data/lib/rb_tags/version.rb +2 -1
- data/rb_tags.gemspec +16 -24
- data/spec/doc_formatter.rb +4 -3
- data/spec/parser_helper.rb +15 -14
- data/spec/rb_tags/concerns/completion_spec.rb +1 -1
- data/spec/rb_tags/concerns/generate_tags_spec.rb +4 -4
- data/spec/rb_tags/concerns/parser_spec.rb +4 -5
- data/spec/rb_tags/concerns/sys_info_spec.rb +3 -2
- data/spec/rb_tags/concerns/yaml_tasks_spec.rb +8 -9
- data/spec/rb_tags/tags_spec.rb +24 -7
- data/spec/rb_tags_spec.rb +15 -16
- data/spec/spec_helper.rb +2 -2
- metadata +7 -102
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 17dfdca73aedbfd8eb62527c5c98d3b24b0b82c0
|
4
|
+
data.tar.gz: d328a2ce7c383204c32438e118fa126ac96f3384
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d60be1ee79dc78e6918f6b2c3d5731c61b31547fa57f79ea889502de46990843ce3d506d40ddea1474192962e9302f78a41bffe7e44bdf313e902520c0c55fb6
|
7
|
+
data.tar.gz: b296165abc440f885542d8bd69d90ef2384546b26102cb1d14398a21c222d1b65bdbbb6134d4d87b6a8f516b8db582438e3f6189bfc30ab85b68ef1dd38317ec
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
inherit_from: .rubocop_todo.yml
|
2
|
+
|
3
|
+
AllCops:
|
4
|
+
Exclude:
|
5
|
+
- rb_tags.gemspec
|
6
|
+
UseCache: true
|
7
|
+
TargetRubyVersion: 2.4
|
8
|
+
|
9
|
+
Metrics/BlockLength:
|
10
|
+
Exclude:
|
11
|
+
- 'spec/**/*'
|
12
|
+
|
13
|
+
Metrics/LineLength:
|
14
|
+
Max: 120
|
15
|
+
Exclude:
|
16
|
+
- 'spec/**/*'
|
17
|
+
|
18
|
+
Style/AsciiComments:
|
19
|
+
Enabled: false
|
20
|
+
|
21
|
+
Style/Documentation:
|
22
|
+
Exclude:
|
23
|
+
- 'lib/**/*'
|
24
|
+
- 'spec/**/*'
|
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config`
|
3
|
+
# on 2016-10-18 20:40:59 +0200 using RuboCop version 0.44.1.
|
4
|
+
# The point is for the user to remove these configuration records
|
5
|
+
# one by one as the offenses are removed from the code base.
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
8
|
+
|
9
|
+
# Offense count: 1
|
10
|
+
# Configuration parameters: CountComments.
|
11
|
+
Metrics/MethodLength:
|
12
|
+
Max: 20
|
data/.travis.yml
ADDED
data/Gemfile
CHANGED
@@ -1,4 +1,18 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
source 'http://rubygems.org'
|
3
|
+
|
2
4
|
gemspec
|
3
5
|
|
4
|
-
|
6
|
+
group :development, :test do
|
7
|
+
gem 'guard-bundler'
|
8
|
+
gem 'guard-rspec'
|
9
|
+
gem 'rb-fsevent'
|
10
|
+
gem 'terminal-notifier-guard'
|
11
|
+
|
12
|
+
gem 'pry', platforms: [:mri]
|
13
|
+
gem 'pry-byebug', platforms: [:mri]
|
14
|
+
gem 'rake', '>= 10.0'
|
15
|
+
gem 'rspec', '>= 3.0'
|
16
|
+
gem 'rubocop', '>= 0.47'
|
17
|
+
gem 'simplecov', require: false
|
18
|
+
end
|
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.4.0)
|
5
5
|
awesome_print
|
6
6
|
bundler
|
7
7
|
colorize
|
@@ -11,23 +11,22 @@ PATH
|
|
11
11
|
rake
|
12
12
|
|
13
13
|
GEM
|
14
|
-
remote:
|
14
|
+
remote: http://rubygems.org/
|
15
15
|
specs:
|
16
|
-
|
16
|
+
ast (2.3.0)
|
17
|
+
awesome_print (1.7.0)
|
17
18
|
blankslate (3.1.3)
|
18
|
-
byebug (
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
columnize (0.9.0)
|
23
|
-
diff-lcs (1.2.5)
|
19
|
+
byebug (9.0.6)
|
20
|
+
coderay (1.1.1)
|
21
|
+
colorize (0.8.1)
|
22
|
+
diff-lcs (1.3)
|
24
23
|
docile (1.1.5)
|
25
|
-
ffi (1.9.
|
24
|
+
ffi (1.9.17)
|
26
25
|
formatador (0.2.5)
|
27
|
-
gli (2.
|
28
|
-
guard (2.
|
26
|
+
gli (2.15.0)
|
27
|
+
guard (2.14.1)
|
29
28
|
formatador (>= 0.2.4)
|
30
|
-
listen (>= 2.7,
|
29
|
+
listen (>= 2.7, < 4.0)
|
31
30
|
lumberjack (~> 1.0)
|
32
31
|
nenv (~> 0.1)
|
33
32
|
notiffany (~> 0.0)
|
@@ -39,56 +38,70 @@ GEM
|
|
39
38
|
guard (~> 2.2)
|
40
39
|
guard-compat (~> 1.1)
|
41
40
|
guard-compat (1.2.1)
|
42
|
-
guard-rspec (4.
|
41
|
+
guard-rspec (4.7.3)
|
43
42
|
guard (~> 2.1)
|
44
43
|
guard-compat (~> 1.1)
|
45
44
|
rspec (>= 2.99.0, < 4.0)
|
46
|
-
json (
|
47
|
-
listen (3.
|
48
|
-
rb-fsevent (>= 0.9.
|
49
|
-
rb-inotify (>= 0.9)
|
50
|
-
|
45
|
+
json (2.0.3)
|
46
|
+
listen (3.1.5)
|
47
|
+
rb-fsevent (~> 0.9, >= 0.9.4)
|
48
|
+
rb-inotify (~> 0.9, >= 0.9.7)
|
49
|
+
ruby_dep (~> 1.2)
|
50
|
+
lumberjack (1.0.11)
|
51
51
|
method_source (0.8.2)
|
52
|
-
nenv (0.
|
53
|
-
notiffany (0.
|
52
|
+
nenv (0.3.0)
|
53
|
+
notiffany (0.1.1)
|
54
54
|
nenv (~> 0.1)
|
55
55
|
shellany (~> 0.0)
|
56
|
-
parallel (1.
|
57
|
-
|
56
|
+
parallel (1.10.0)
|
57
|
+
parser (2.4.0.0)
|
58
|
+
ast (~> 2.2)
|
59
|
+
parslet (1.7.1)
|
58
60
|
blankslate (>= 2.0, <= 4.0)
|
59
|
-
|
61
|
+
powerpack (0.1.1)
|
62
|
+
pry (0.10.4)
|
60
63
|
coderay (~> 1.1.0)
|
61
64
|
method_source (~> 0.8.1)
|
62
65
|
slop (~> 3.4)
|
63
|
-
pry-byebug (3.2
|
64
|
-
byebug (~>
|
66
|
+
pry-byebug (3.4.2)
|
67
|
+
byebug (~> 9.0)
|
65
68
|
pry (~> 0.10)
|
66
|
-
|
67
|
-
|
68
|
-
rb-
|
69
|
+
rainbow (2.2.1)
|
70
|
+
rake (12.0.0)
|
71
|
+
rb-fsevent (0.9.8)
|
72
|
+
rb-inotify (0.9.8)
|
69
73
|
ffi (>= 0.5.0)
|
70
|
-
rspec (3.
|
71
|
-
rspec-core (~> 3.
|
72
|
-
rspec-expectations (~> 3.
|
73
|
-
rspec-mocks (~> 3.
|
74
|
-
rspec-core (3.
|
75
|
-
rspec-support (~> 3.
|
76
|
-
rspec-expectations (3.
|
74
|
+
rspec (3.5.0)
|
75
|
+
rspec-core (~> 3.5.0)
|
76
|
+
rspec-expectations (~> 3.5.0)
|
77
|
+
rspec-mocks (~> 3.5.0)
|
78
|
+
rspec-core (3.5.4)
|
79
|
+
rspec-support (~> 3.5.0)
|
80
|
+
rspec-expectations (3.5.0)
|
77
81
|
diff-lcs (>= 1.2.0, < 2.0)
|
78
|
-
rspec-support (~> 3.
|
79
|
-
rspec-mocks (3.
|
82
|
+
rspec-support (~> 3.5.0)
|
83
|
+
rspec-mocks (3.5.0)
|
80
84
|
diff-lcs (>= 1.2.0, < 2.0)
|
81
|
-
rspec-support (~> 3.
|
82
|
-
rspec-support (3.
|
85
|
+
rspec-support (~> 3.5.0)
|
86
|
+
rspec-support (3.5.0)
|
87
|
+
rubocop (0.47.1)
|
88
|
+
parser (>= 2.3.3.1, < 3.0)
|
89
|
+
powerpack (~> 0.1)
|
90
|
+
rainbow (>= 1.99.1, < 3.0)
|
91
|
+
ruby-progressbar (~> 1.7)
|
92
|
+
unicode-display_width (~> 1.0, >= 1.0.1)
|
93
|
+
ruby-progressbar (1.8.1)
|
94
|
+
ruby_dep (1.5.0)
|
83
95
|
shellany (0.0.1)
|
84
|
-
simplecov (0.
|
96
|
+
simplecov (0.13.0)
|
85
97
|
docile (~> 1.1.0)
|
86
|
-
json (
|
98
|
+
json (>= 1.8, < 3)
|
87
99
|
simplecov-html (~> 0.10.0)
|
88
100
|
simplecov-html (0.10.0)
|
89
101
|
slop (3.6.0)
|
90
|
-
terminal-notifier-guard (1.
|
91
|
-
thor (0.19.
|
102
|
+
terminal-notifier-guard (1.7.0)
|
103
|
+
thor (0.19.4)
|
104
|
+
unicode-display_width (1.1.3)
|
92
105
|
|
93
106
|
PLATFORMS
|
94
107
|
ruby
|
@@ -98,11 +111,13 @@ DEPENDENCIES
|
|
98
111
|
guard-rspec
|
99
112
|
pry
|
100
113
|
pry-byebug
|
114
|
+
rake (>= 10.0)
|
101
115
|
rb-fsevent
|
102
116
|
rb_tags!
|
103
|
-
rspec
|
117
|
+
rspec (>= 3.0)
|
118
|
+
rubocop (>= 0.47)
|
104
119
|
simplecov
|
105
120
|
terminal-notifier-guard
|
106
121
|
|
107
122
|
BUNDLED WITH
|
108
|
-
1.
|
123
|
+
1.14.3
|
data/Guardfile
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
# A sample Guardfile
|
2
3
|
# More info at https://github.com/guard/guard#readme
|
3
4
|
|
@@ -35,8 +36,8 @@ guard :bundler do
|
|
35
36
|
files.each { |file| watch(helper.real_path(file)) }
|
36
37
|
end
|
37
38
|
|
38
|
-
guard :rspec, cmd:
|
39
|
-
require
|
39
|
+
guard :rspec, cmd: 'bundle exec rspec' do
|
40
|
+
require 'guard/rspec/dsl'
|
40
41
|
dsl = Guard::RSpec::Dsl.new(self)
|
41
42
|
|
42
43
|
# Ruby files
|
data/Rakefile
CHANGED
@@ -1,6 +1,14 @@
|
|
1
|
-
|
2
|
-
require
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'bundler/gem_tasks'
|
3
|
+
|
4
|
+
require 'rake'
|
5
|
+
|
6
|
+
require 'rspec/core'
|
7
|
+
require 'rspec/core/rake_task'
|
3
8
|
|
4
9
|
RSpec::Core::RakeTask.new(:spec)
|
5
10
|
|
6
|
-
|
11
|
+
require 'rubocop/rake_task'
|
12
|
+
RuboCop::RakeTask.new(:rubocop)
|
13
|
+
|
14
|
+
task default: [:spec, :rubocop]
|
data/bin/rb_tags
CHANGED
@@ -1,15 +1,16 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
4
|
require 'gli'
|
4
5
|
require 'readline'
|
5
6
|
|
6
7
|
begin # XXX: Remove this begin/rescue before distributing your app
|
7
|
-
require 'rb_tags'
|
8
|
-
|
8
|
+
require 'rb_tags'
|
9
|
+
extend RbTags
|
9
10
|
rescue LoadError
|
10
|
-
STDERR.puts
|
11
|
-
STDERR.puts
|
12
|
-
STDERR.puts
|
11
|
+
STDERR.puts 'In development, you need to use `bundle exec bin/rb_tags` to run your app'
|
12
|
+
STDERR.puts 'At install-time, RubyGems will make sure lib, etc. are in the load path'
|
13
|
+
STDERR.puts 'Feel free to remove this message from bin/rb_tags now'
|
13
14
|
exit 64
|
14
15
|
end
|
15
16
|
|
@@ -35,18 +36,18 @@ desc 'tags a given directory'
|
|
35
36
|
command :tag do |c|
|
36
37
|
# switches
|
37
38
|
c.desc 'tag also bundled gems'
|
38
|
-
c.switch [:gems], :
|
39
|
+
c.switch [:gems], default_value: false
|
39
40
|
c.desc 'forces deleting of tag file before tagging'
|
40
|
-
c.switch [:force], :
|
41
|
+
c.switch [:force], default_value: false
|
41
42
|
|
42
|
-
c.action do |
|
43
|
+
c.action do |_global_options, options, _args|
|
43
44
|
generate(options)
|
44
45
|
end
|
45
46
|
end
|
46
47
|
|
47
48
|
desc 'show esisting tags'
|
48
49
|
command :show do |c|
|
49
|
-
c.action do |
|
50
|
+
c.action do |_global_options, _options, _args|
|
50
51
|
ap tags
|
51
52
|
ap tags.length
|
52
53
|
end
|
@@ -54,20 +55,20 @@ end
|
|
54
55
|
|
55
56
|
desc 'search for a tag'
|
56
57
|
command :find do |c|
|
57
|
-
c.action do |
|
58
|
+
c.action do |_global_options, _options, _args|
|
58
59
|
found = complete_tag
|
59
60
|
ap found
|
60
|
-
$stdout.print "open [#{(0
|
61
|
+
$stdout.print "open [#{(0...found.length).to_a.join(',')}]: ".green
|
61
62
|
what = ''
|
62
63
|
while (what += $stdin.getch) !~ /(\w\s)/
|
63
|
-
$stdout.print
|
64
|
+
$stdout.print what.to_s.blue
|
64
65
|
end
|
65
66
|
$stdout.print "\n"
|
66
67
|
open what
|
67
68
|
end
|
68
69
|
end
|
69
70
|
|
70
|
-
pre do |
|
71
|
+
pre do |_global, _command, _options, _args|
|
71
72
|
# Pre logic here
|
72
73
|
# Return true to proceed; false to abort and not call the
|
73
74
|
# chosen command
|
@@ -76,13 +77,13 @@ pre do |global,command,options,args|
|
|
76
77
|
true
|
77
78
|
end
|
78
79
|
|
79
|
-
post do |global,command,options,args|
|
80
|
+
post do |global, command, options, args|
|
80
81
|
# Post logic here
|
81
82
|
# Use skips_post before a command to skip this
|
82
83
|
# block on that command only
|
83
84
|
end
|
84
85
|
|
85
|
-
on_error do |
|
86
|
+
on_error do |_exception|
|
86
87
|
# Error logic here
|
87
88
|
# return false to skip default error handling
|
88
89
|
true
|
data/lib/rb_tags.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
# external requirements
|
2
3
|
require 'bundler'
|
3
4
|
require 'awesome_print'
|
@@ -28,7 +29,7 @@ module RbTags
|
|
28
29
|
# create or update tag list
|
29
30
|
#
|
30
31
|
|
31
|
-
def generate(options={})
|
32
|
+
def generate(options = {})
|
32
33
|
default_options(options)
|
33
34
|
|
34
35
|
tags = Tags.new(dir: @options[:dir], force: (@options[:gems] || @options[:force]))
|
@@ -61,7 +62,7 @@ module RbTags
|
|
61
62
|
end
|
62
63
|
|
63
64
|
def say_tagging(dir)
|
64
|
-
$stdout.print
|
65
|
+
$stdout.print 'tag gem: '.blue
|
65
66
|
$stdout.print "#{dir}\n".colorize(:yellow_light)
|
66
67
|
end
|
67
68
|
|
@@ -118,9 +119,9 @@ module RbTags
|
|
118
119
|
end
|
119
120
|
|
120
121
|
def default_options(options)
|
121
|
-
@options = options.
|
122
|
+
@options = options.each_with_object({}) { |(k, v), memo| memo[k.to_sym] = v; }
|
122
123
|
@options[:dir] = Dir.getwd if @options[:dir].nil? || @options[:dir].empty?
|
123
|
-
@options.merge!(defaults) { |
|
124
|
+
@options.merge!(defaults) { |_key, opt, _default| opt }
|
124
125
|
end
|
125
126
|
|
126
127
|
def defaults
|
@@ -131,7 +132,7 @@ module RbTags
|
|
131
132
|
Dir.getwd
|
132
133
|
end
|
133
134
|
|
134
|
-
def opend_found
|
135
|
+
def opend_found(selected: {}, editor: 'mate')
|
135
136
|
# :nocov:
|
136
137
|
file_line = "#{selected[:line]} #{selected[:path]}"
|
137
138
|
case editor
|
@@ -146,5 +147,4 @@ module RbTags
|
|
146
147
|
end
|
147
148
|
# :nocov:
|
148
149
|
end
|
149
|
-
|
150
150
|
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module Completion
|
2
3
|
module_function
|
3
4
|
|
@@ -5,12 +6,12 @@ module Completion
|
|
5
6
|
# :nocov:
|
6
7
|
comp = proc { |s| list.grep(/^#{Regexp.escape(s)}/) }
|
7
8
|
|
8
|
-
Readline.completer_word_break_characters =
|
9
|
-
Readline.completion_append_character =
|
9
|
+
Readline.completer_word_break_characters = ''
|
10
|
+
Readline.completion_append_character = ' '
|
10
11
|
Readline.completion_proc = comp
|
11
12
|
|
12
|
-
while line = Readline.readline('$ ', true)
|
13
|
-
unless line[-1]
|
13
|
+
while (line = Readline.readline('$ ', true))
|
14
|
+
unless line[-1].match?(/(\n\r)/)
|
14
15
|
args = line.split(' ')
|
15
16
|
break
|
16
17
|
end
|
@@ -19,6 +20,4 @@ module Completion
|
|
19
20
|
args
|
20
21
|
# :nocov:
|
21
22
|
end
|
22
|
-
|
23
23
|
end
|
24
|
-
|
@@ -1,12 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module GenerateTags
|
2
3
|
# find ctags and split in single lines
|
3
|
-
|
4
|
+
# dir - the gem directory
|
5
|
+
# mask - source file type, defaults to ruby
|
6
|
+
def find_expressions(dir, _mask)
|
4
7
|
found_tags = `find #{dir} -name '*.rb' | ctags -x -L -`.split("\n")
|
5
8
|
parse_expression_line(found_tags)
|
6
9
|
generate_hash
|
7
10
|
end
|
8
11
|
|
9
|
-
#parse found expression line
|
12
|
+
# parse found expression line
|
13
|
+
# found_tags - the tags found by ctags
|
10
14
|
def parse_expression_line(found_tags)
|
11
15
|
@tags = []
|
12
16
|
found_tags.each do |tag_line|
|
@@ -14,8 +18,8 @@ module GenerateTags
|
|
14
18
|
parsed_line = Parser.new.parse(tag_line)
|
15
19
|
@tags << ParserTransform.new.apply(parsed_line)
|
16
20
|
rescue Parslet::ParseFailed => error
|
17
|
-
message = [
|
18
|
-
message.each { |m| $stdout.puts
|
21
|
+
message = ['[RbTags] Error: ', 'line: ', "#{tag_line} ", 'error: ', error.cause.ascii_tree.to_s]
|
22
|
+
message.each { |m| $stdout.puts m.to_s }
|
19
23
|
@tags << message.join("\n")
|
20
24
|
end
|
21
25
|
end
|
@@ -25,6 +29,9 @@ module GenerateTags
|
|
25
29
|
|
26
30
|
# converts array of hashes into single hash
|
27
31
|
def generate_hash
|
28
|
-
@tags.group_by
|
32
|
+
@tags.group_by do |x|
|
33
|
+
x[:name]
|
34
|
+
x.delete(:name)
|
35
|
+
end
|
29
36
|
end
|
30
37
|
end
|
@@ -1,5 +1,6 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
class Parser < Parslet::Parser
|
2
|
-
#atomic rules
|
3
|
+
# atomic rules
|
3
4
|
rule(:space) { match['[:space:]'] }
|
4
5
|
rule(:spaces) { space.repeat(1) }
|
5
6
|
rule(:word) { match['\w'].repeat(1) }
|
@@ -10,37 +11,35 @@ class Parser < Parslet::Parser
|
|
10
11
|
## names, word-or_foo
|
11
12
|
rule(:name_adds) { match['$_-'] >> word.repeat(1) }
|
12
13
|
rule(:simple_name) { word.repeat(1) >> name_adds.repeat }
|
13
|
-
rule(:name) { match['$'].maybe >> simple_name >> match['\S'].maybe | match['\W'].repeat(1,3)}
|
14
|
+
rule(:name) { match['$'].maybe >> simple_name >> match['\S'].maybe | match['\W'].repeat(1, 3) }
|
14
15
|
|
15
16
|
## part of path, word/
|
16
17
|
rule(:path) { separator >> match['\S'].repeat(1) }
|
17
18
|
|
18
19
|
## full input
|
19
|
-
rule(:whole_line)
|
20
|
+
rule(:whole_line) do
|
20
21
|
name.as(:name) >> spaces >>
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
22
|
+
(word >> space >> word | word).as(:type) >> spaces >>
|
23
|
+
line.as(:line) >> spaces >>
|
24
|
+
path.as(:path) >> spaces >>
|
25
|
+
any.repeat.as(:definition)
|
26
|
+
end
|
27
27
|
|
28
28
|
root(:whole_line)
|
29
29
|
end
|
30
30
|
|
31
31
|
class ParserTransform < Parslet::Transform
|
32
32
|
rule(name: simple(:name),
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
}
|
33
|
+
type: simple(:type),
|
34
|
+
line: simple(:line),
|
35
|
+
path: simple(:path),
|
36
|
+
definition: simple(:definition)) do
|
37
|
+
{
|
38
|
+
name: name.str,
|
39
|
+
type: type.str,
|
40
|
+
line: line.str,
|
41
|
+
path: path.str,
|
42
|
+
definition: definition.str
|
43
|
+
}
|
44
|
+
end
|
46
45
|
end
|
@@ -1,21 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
# author LeFnord
|
2
3
|
# email pscholz.le@gmail.com
|
3
4
|
# date 2013-12-18
|
4
5
|
|
5
|
-
|
6
6
|
module SysInfo
|
7
7
|
module_function
|
8
8
|
|
9
9
|
def number_of_processors
|
10
10
|
# :nocov:
|
11
|
-
if RUBY_PLATFORM
|
12
|
-
|
13
|
-
elsif RUBY_PLATFORM
|
14
|
-
|
11
|
+
if RUBY_PLATFORM.match?(/linux/)
|
12
|
+
`cat /proc/cpuinfo | grep processor | wc -l`.to_i
|
13
|
+
elsif RUBY_PLATFORM.match?(/darwin/)
|
14
|
+
`sysctl -n hw.logicalcpu`.to_i
|
15
15
|
else
|
16
|
-
|
16
|
+
2
|
17
17
|
end
|
18
18
|
# :nocov:
|
19
19
|
end
|
20
|
-
|
21
20
|
end
|
@@ -1,27 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module YamlTasks
|
2
3
|
# # WRITE
|
3
4
|
def write_to_yaml(dir: nil, this: {})
|
4
5
|
db = YAML::Store.new(store(dir), thread_safe: true)
|
5
|
-
db.transaction { db[
|
6
|
+
db.transaction { db['tags'] = this }
|
6
7
|
end
|
7
8
|
|
8
9
|
# # READ
|
9
10
|
def read_from_yaml(dir: nil)
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
end
|
15
|
-
|
11
|
+
db = YAML::Store.new(store(dir), thread_safe: true)
|
12
|
+
db.transaction { db.fetch('tags') }
|
13
|
+
rescue StandardError => e
|
14
|
+
$stdout.puts e
|
16
15
|
end
|
17
16
|
|
18
17
|
private
|
19
18
|
|
20
19
|
def store(dir = nil)
|
21
|
-
if
|
22
|
-
|
20
|
+
if dir
|
21
|
+
File.join(dir, '.tags')
|
23
22
|
else
|
24
|
-
|
23
|
+
File.join(Dir.getwd, '.tags')
|
25
24
|
end
|
26
25
|
end
|
27
26
|
end
|
data/lib/rb_tags/tags.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
class Tags
|
2
3
|
include GenerateTags
|
3
4
|
include YamlTasks
|
@@ -7,8 +8,8 @@ class Tags
|
|
7
8
|
def initialize(dir: Dir.getwd, force: false)
|
8
9
|
@dir = check(dir)
|
9
10
|
|
10
|
-
|
11
|
-
|
11
|
+
delete if force
|
12
|
+
read
|
12
13
|
end
|
13
14
|
|
14
15
|
def tag
|
@@ -17,7 +18,7 @@ class Tags
|
|
17
18
|
end
|
18
19
|
|
19
20
|
def add(tags)
|
20
|
-
tags.each do |key,value|
|
21
|
+
tags.each do |key, value|
|
21
22
|
if self.tags.key?(key)
|
22
23
|
self.tags[key] += value
|
23
24
|
else
|
@@ -36,7 +37,7 @@ class Tags
|
|
36
37
|
end
|
37
38
|
|
38
39
|
def delete
|
39
|
-
tag_file = File.join(@dir,
|
40
|
+
tag_file = File.join(@dir, '.tags')
|
40
41
|
FileUtils.rm(tag_file) if File.exist?(tag_file)
|
41
42
|
end
|
42
43
|
|
data/lib/rb_tags/version.rb
CHANGED
data/rb_tags.gemspec
CHANGED
@@ -4,36 +4,28 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
require 'rb_tags/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
7
|
+
spec.name = 'rb_tags'
|
8
8
|
spec.version = RbTags::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
9
|
+
spec.authors = ['LeFnord']
|
10
|
+
spec.email = ['pscholz.le@gmail.com']
|
11
11
|
|
12
|
-
spec.summary =
|
13
|
-
spec.description =
|
14
|
-
spec.homepage =
|
15
|
-
spec.license =
|
12
|
+
spec.summary = 'A wrapper around ctags.'
|
13
|
+
spec.description = 'A wrapper around ctags, with search for tag and open file if found.'
|
14
|
+
spec.homepage = ''
|
15
|
+
spec.license = 'MIT'
|
16
16
|
|
17
17
|
spec.files = `git ls-files -z`.split("\x0")
|
18
18
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
19
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
|
-
spec.require_paths = [
|
20
|
+
spec.require_paths = ['lib']
|
21
21
|
|
22
|
-
spec.required_ruby_version = '>= 2.2'
|
22
|
+
spec.required_ruby_version = '>= 2.2.6'
|
23
23
|
|
24
|
-
spec.
|
25
|
-
spec.
|
26
|
-
spec.
|
27
|
-
spec.
|
28
|
-
spec.
|
29
|
-
spec.
|
30
|
-
spec.
|
31
|
-
|
32
|
-
spec.add_runtime_dependency "awesome_print"
|
33
|
-
spec.add_runtime_dependency "bundler"
|
34
|
-
spec.add_runtime_dependency "colorize"
|
35
|
-
spec.add_runtime_dependency "rake"
|
36
|
-
spec.add_runtime_dependency "parslet"
|
37
|
-
spec.add_runtime_dependency "parallel"
|
38
|
-
spec.add_runtime_dependency "gli"
|
24
|
+
spec.add_runtime_dependency 'awesome_print'
|
25
|
+
spec.add_runtime_dependency 'bundler'
|
26
|
+
spec.add_runtime_dependency 'colorize'
|
27
|
+
spec.add_runtime_dependency 'rake'
|
28
|
+
spec.add_runtime_dependency 'parslet'
|
29
|
+
spec.add_runtime_dependency 'parallel'
|
30
|
+
spec.add_runtime_dependency 'gli'
|
39
31
|
end
|
data/spec/doc_formatter.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require 'rspec/core/formatters/console_codes'
|
2
3
|
|
3
4
|
class Doc
|
@@ -18,11 +19,11 @@ class Doc
|
|
18
19
|
#{notification.example.exception}\n", :failure)
|
19
20
|
end
|
20
21
|
|
21
|
-
def example_pending(
|
22
|
-
@output << RSpec::Core::Formatters::ConsoleCodes.wrap(
|
22
|
+
def example_pending(_notification)
|
23
|
+
@output << RSpec::Core::Formatters::ConsoleCodes.wrap('*', :pending)
|
23
24
|
end
|
24
25
|
|
25
|
-
def close(
|
26
|
+
def close(_notification)
|
26
27
|
@output << "\n"
|
27
28
|
end
|
28
29
|
end
|
data/spec/parser_helper.rb
CHANGED
@@ -1,22 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
def samples
|
2
3
|
[
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
4
|
+
'RbTags module 1 /Users/le_fnord/sandbox/github/rb_tags/lib/rb_tags/version.rb module RbTags',
|
5
|
+
'ctags_expression method 18 /Users/le_fnord/sandbox/github/rb_tags/lib/rb_tags/gem_tags.rb def ctags_expression',
|
6
|
+
'generate method 11 /Users/le_fnord/sandbox/github/rb_tags/lib/rb_tags/gem_tags.rb def generate',
|
7
|
+
'Parser class 1 /Users/le_fnord/sandbox/github/rb_tags/lib/rb_tags/parser.rb class Parser < Parslet::Parser',
|
8
|
+
'add_to_hash method 23 /Users/le_fnord/sandbox/github/rb_tags/lib/rb_tags/json.rb def add_to_hash(tag)',
|
9
|
+
'find_expressions method 2 /Users/le_fnord/sandbox/github/rb_tags/lib/rb_tags/generate_tags.rb def find_expressions(dir,mask)',
|
9
10
|
"generate method 12 /Users/le_fnord/sandbox/github/rb_tags/lib/rb_tags.rb def generate(format: 'vim', gems: false)",
|
10
11
|
"initialize method 5 /Users/le_fnord/sandbox/github/rb_tags/lib/rb_tags/gem_tags.rb def initialize(filename: \".gem_tags\", mask: '*.rb', format: 'vim')",
|
11
12
|
"initialize method 6 /Users/le_fnord/sandbox/github/rb_tags/lib/rb_tags/tags.rb def initialize(dir: Dir.getwd, filename: \".tags\", mask: '*.rb', format: 'vim')",
|
12
|
-
|
13
|
-
|
13
|
+
'initialize method 11 /Users/le_fnord/sandbox/github/rb_tags/lib/rb_tags/json.rb def initialize(tags)',
|
14
|
+
'parse singleton method 3 /Users/le_fnord/sandbox/github/rb_tags/lib/rb_tags/json.rb def self.parse(tags)',
|
14
15
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
16
|
+
'* method 189 /usr/local/var/rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/rake-10.4.2/lib/rake/file_list.rb def *(other)',
|
17
|
+
'<< method 199 /usr/local/var/rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/rake-10.4.2/lib/rake/file_list.rb def <<(obj)',
|
18
|
+
'<=> method 7 /usr/local/var/rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/rake-10.4.2/lib/rake/late_time.rb def <=>(other)',
|
19
|
+
'application= method 12 /usr/local/var/rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/rake-10.4.2/lib/rake/rake_module.rb def application=(app)',
|
20
|
+
'L_darwin64_struct_ret_by_value_p$stub label 542 /usr/local/var/rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/ffi-1.9.8/ext/ffi_c/libffi/src/powerpc/darwin_closure.S L_darwin64_struct_ret_by_value_p$stub:',
|
21
|
+
'$retint label 103 /usr/local/var/rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/ffi-1.9.8/ext/ffi_c/libffi/src/alpha/osf.S $retint:'
|
21
22
|
]
|
22
23
|
end
|
@@ -1,10 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
describe GenerateTags do
|
2
3
|
subject { described_class }
|
3
4
|
|
4
5
|
it { expect(subject.name).to eq 'GenerateTags' }
|
5
6
|
|
6
|
-
let(:valid) { [
|
7
|
-
let(:invalid) { [
|
7
|
+
let(:valid) { ['RbTags module 1 /Users/le_fnord/sandbox/github/rb_tags/lib/rb_tags/version.rb module RbTags'] }
|
8
|
+
let(:invalid) { ['Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.'] }
|
8
9
|
|
9
10
|
describe '#parse_expression_line' do
|
10
11
|
subject { Class.include described_class }
|
@@ -12,7 +13,7 @@ describe GenerateTags do
|
|
12
13
|
let(:no_tags) { subject.parse_expression_line(invalid) }
|
13
14
|
|
14
15
|
describe 'valid example' do
|
15
|
-
it { expect {tags}.not_to raise_error }
|
16
|
+
it { expect { tags }.not_to raise_error }
|
16
17
|
it { expect(tags).to be_a Array }
|
17
18
|
it { expect(tags.first).to be_a Hash }
|
18
19
|
it { expect(tags.first).to include(:name, :type, :line, :path, :definition) }
|
@@ -25,4 +26,3 @@ describe GenerateTags do
|
|
25
26
|
end
|
26
27
|
end
|
27
28
|
end
|
28
|
-
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
describe Parser do
|
2
3
|
it { expect(described_class).to eq(Parser) }
|
3
4
|
|
@@ -40,7 +41,7 @@ describe Parser do
|
|
40
41
|
|
41
42
|
it { expect(parser.line).not_to parse(' ') }
|
42
43
|
it { expect(parser.line).not_to parse("\t") }
|
43
|
-
it { expect(parser.line).not_to parse(
|
44
|
+
it { expect(parser.line).not_to parse('word') }
|
44
45
|
end
|
45
46
|
|
46
47
|
describe '#separator' do
|
@@ -50,7 +51,7 @@ describe Parser do
|
|
50
51
|
it { expect(parser.separator).not_to parse('23') }
|
51
52
|
it { expect(parser.separator).not_to parse(' ') }
|
52
53
|
it { expect(parser.separator).not_to parse("\t") }
|
53
|
-
it { expect(parser.separator).not_to parse(
|
54
|
+
it { expect(parser.separator).not_to parse('word') }
|
54
55
|
end
|
55
56
|
end
|
56
57
|
|
@@ -102,6 +103,4 @@ describe Parser do
|
|
102
103
|
it { expect(parser).to parse(line) }
|
103
104
|
end
|
104
105
|
end
|
105
|
-
|
106
|
-
|
107
|
-
end
|
106
|
+
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require 'spec_helper'
|
2
3
|
|
3
4
|
describe SysInfo do
|
@@ -9,11 +10,11 @@ describe SysInfo do
|
|
9
10
|
let(:number) { subject.number_of_processors }
|
10
11
|
|
11
12
|
it 'does something' do
|
12
|
-
expect(subject).to receive(:number_of_processors).and_return(
|
13
|
+
expect(subject).to receive(:number_of_processors).and_return(Integer)
|
13
14
|
subject.number_of_processors
|
14
15
|
end
|
15
16
|
|
16
|
-
it { expect(number).to be_a
|
17
|
+
it { expect(number).to be_a Integer }
|
17
18
|
it { expect(number).to be >= 2 }
|
18
19
|
end
|
19
20
|
end
|
@@ -1,6 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
describe YamlTasks do
|
2
3
|
after(:each) do
|
3
|
-
tag_file = File.join(Dir.getwd,'.tags')
|
4
|
+
tag_file = File.join(Dir.getwd, '.tags')
|
4
5
|
FileUtils.rm(tag_file) if File.exist?(tag_file)
|
5
6
|
end
|
6
7
|
|
@@ -12,15 +13,14 @@ describe YamlTasks do
|
|
12
13
|
subject { Class.include described_class }
|
13
14
|
|
14
15
|
describe '#write_to_yaml' do
|
15
|
-
it { expect{ subject.write_to_yaml(this: {}) }.not_to raise_error }
|
16
|
+
it { expect { subject.write_to_yaml(this: {}) }.not_to raise_error }
|
16
17
|
end
|
17
18
|
|
18
19
|
describe '#read_from_yaml' do
|
19
|
-
|
20
|
-
it { expect{ subject.read_from_yaml }.not_to raise_error }
|
20
|
+
it { expect { subject.read_from_yaml }.not_to raise_error }
|
21
21
|
it 'does something' do
|
22
|
-
subject.write_to_yaml(this: {foo:
|
23
|
-
expect{ subject.read_from_yaml }.not_to raise_error
|
22
|
+
subject.write_to_yaml(this: { foo: 'bar' })
|
23
|
+
expect { subject.read_from_yaml }.not_to raise_error
|
24
24
|
expect(subject.read_from_yaml).not_to be nil
|
25
25
|
end
|
26
26
|
end
|
@@ -29,15 +29,14 @@ describe YamlTasks do
|
|
29
29
|
describe 'default dir' do
|
30
30
|
let(:store) { subject.send(:store) }
|
31
31
|
|
32
|
-
it { expect(store).to eq File.join(Dir.getwd,'.tags') }
|
32
|
+
it { expect(store).to eq File.join(Dir.getwd, '.tags') }
|
33
33
|
end
|
34
34
|
|
35
35
|
describe 'dir given' do
|
36
36
|
let(:store) { subject.send(:store, '/somewhere') }
|
37
37
|
|
38
|
-
it { expect(store).to eq File.join('/somewhere',
|
38
|
+
it { expect(store).to eq File.join('/somewhere', '.tags') }
|
39
39
|
end
|
40
40
|
end
|
41
41
|
end
|
42
|
-
|
43
42
|
end
|
data/spec/rb_tags/tags_spec.rb
CHANGED
@@ -1,6 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
describe Tags do
|
3
|
+
let(:default_dir) { Dir.getwd }
|
4
|
+
|
2
5
|
after(:each) do
|
3
|
-
tag_file = File.join(
|
6
|
+
tag_file = File.join(default_dir, '.tags')
|
4
7
|
FileUtils.rm(tag_file) if File.exist?(tag_file)
|
5
8
|
end
|
6
9
|
|
@@ -16,16 +19,30 @@ describe Tags do
|
|
16
19
|
it { expect(subject.dir).to eq Dir.getwd }
|
17
20
|
|
18
21
|
describe '#check dir' do
|
19
|
-
|
22
|
+
it 'dir exist' do
|
23
|
+
dir = subject.check(default_dir)
|
24
|
+
expect(dir).to eql default_dir
|
25
|
+
expect(Dir.exist?(default_dir)).to be true
|
26
|
+
end
|
27
|
+
|
28
|
+
let(:to_create_dir) { File.join(default_dir, 'spec', 'what') }
|
29
|
+
|
30
|
+
before do
|
31
|
+
FileUtils.rmdir(to_create_dir)
|
32
|
+
end
|
20
33
|
|
21
34
|
it 'create dirs' do
|
22
|
-
|
35
|
+
expect(Dir.exist?(to_create_dir)).to be false
|
36
|
+
|
37
|
+
dir = subject.check(to_create_dir)
|
38
|
+
|
39
|
+
expect(dir).to eql to_create_dir
|
23
40
|
expect(Dir.exist?(to_create_dir)).to be true
|
24
41
|
end
|
25
42
|
end
|
26
43
|
|
27
44
|
describe 'with params' do
|
28
|
-
subject { Tags.new(dir: './wo')}
|
45
|
+
subject { Tags.new(dir: './wo') }
|
29
46
|
it { expect(subject.dir).to eq './wo' }
|
30
47
|
end
|
31
48
|
end
|
@@ -76,9 +93,9 @@ describe Tags do
|
|
76
93
|
|
77
94
|
it 'has same length, if both are equal' do
|
78
95
|
subject.tag
|
79
|
-
|
80
|
-
expect { subject.add(
|
81
|
-
expect(subject.tags.length).to eq
|
96
|
+
tags_one = subject.tags
|
97
|
+
expect { subject.add(tags_one) }.not_to raise_error
|
98
|
+
expect(subject.tags.length).to eq tags_one.length
|
82
99
|
end
|
83
100
|
|
84
101
|
it 'has greater length, if not equal' do
|
data/spec/rb_tags_spec.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: false
|
1
2
|
class Foo
|
2
3
|
include RbTags
|
3
4
|
end
|
@@ -29,7 +30,7 @@ describe RbTags do
|
|
29
30
|
|
30
31
|
describe '#say_tagging' do
|
31
32
|
let(:dir) { '/something' }
|
32
|
-
let(:message) { "tag gem: #{dir} first time\n"}
|
33
|
+
let(:message) { "tag gem: #{dir} first time\n" }
|
33
34
|
|
34
35
|
it 'does something' do
|
35
36
|
expect(foo).to receive(:say_tagging).with(dir).and_return(message)
|
@@ -42,7 +43,7 @@ describe RbTags do
|
|
42
43
|
before { foo.tags }
|
43
44
|
|
44
45
|
describe '#tags' do
|
45
|
-
let(:tag_tags) { Tags.new(force: true).names}
|
46
|
+
let(:tag_tags) { Tags.new(force: true).names }
|
46
47
|
|
47
48
|
it 'has tags' do
|
48
49
|
expect(foo.tags).to eq tag_tags
|
@@ -50,7 +51,7 @@ describe RbTags do
|
|
50
51
|
end
|
51
52
|
|
52
53
|
describe '#complete_tag' do
|
53
|
-
let(:tag) { Tags.new(force: true).tags}
|
54
|
+
let(:tag) { Tags.new(force: true).tags }
|
54
55
|
let(:arg) { tag.first.first }
|
55
56
|
|
56
57
|
before do
|
@@ -64,7 +65,7 @@ describe RbTags do
|
|
64
65
|
end
|
65
66
|
|
66
67
|
describe '#found' do
|
67
|
-
let(:tag) { Tags.new(force: true).tags.first}
|
68
|
+
let(:tag) { Tags.new(force: true).tags.first }
|
68
69
|
let(:key) { tag.first }
|
69
70
|
|
70
71
|
it 'does something' do
|
@@ -85,18 +86,17 @@ describe RbTags do
|
|
85
86
|
describe 'what is invalid' do
|
86
87
|
let(:what) { 'a' }
|
87
88
|
|
88
|
-
it { expect{ foo.open(what) }.to output.to_stdout }
|
89
|
+
it { expect { foo.open(what) }.to output.to_stdout }
|
89
90
|
end
|
90
91
|
end
|
91
92
|
end
|
92
93
|
|
93
|
-
|
94
94
|
describe 'private methods' do
|
95
95
|
describe '#default_options' do
|
96
96
|
describe 'defaults' do
|
97
|
-
let(:tags) { foo.send(:default_options, {})}
|
97
|
+
let(:tags) { foo.send(:default_options, {}) }
|
98
98
|
let(:defaults) { foo.send(:defaults) }
|
99
|
-
let(:default) { {gems: false, dir: Dir.getwd, force: false} }
|
99
|
+
let(:default) { { gems: false, dir: Dir.getwd, force: false } }
|
100
100
|
|
101
101
|
it { expect { tags }.to_not raise_error }
|
102
102
|
it { expect(tags).to eq default }
|
@@ -108,15 +108,15 @@ describe RbTags do
|
|
108
108
|
end
|
109
109
|
|
110
110
|
describe 'set gems' do
|
111
|
-
let(:options) { {gems: true, dir: '/somewhere', force: false} }
|
112
|
-
let(:tag_w_options) { foo.send(:default_options, options)}
|
111
|
+
let(:options) { { gems: true, dir: '/somewhere', force: false } }
|
112
|
+
let(:tag_w_options) { foo.send(:default_options, options) }
|
113
113
|
it { expect(tag_w_options).to eq options }
|
114
114
|
end
|
115
115
|
|
116
116
|
describe 'from gli' do
|
117
|
-
let(:income) { {
|
118
|
-
let(:options) { foo.send(:default_options, income)}
|
119
|
-
let(:expected) { { :
|
117
|
+
let(:income) { { 'dir' => '..', :dir => '..', 'save' => true, :save => true, 'gems' => true, :read => false } }
|
118
|
+
let(:options) { foo.send(:default_options, income) }
|
119
|
+
let(:expected) { { dir: '..', save: true, gems: true, read: false, force: false } }
|
120
120
|
|
121
121
|
it { expect(options).to eq expected }
|
122
122
|
end
|
@@ -125,12 +125,11 @@ describe RbTags do
|
|
125
125
|
describe '#gem_list' do
|
126
126
|
let(:bar) { foo.send(:build_gem_list) }
|
127
127
|
before do
|
128
|
-
foo.send(:default_options,
|
128
|
+
foo.send(:default_options, gems: false)
|
129
129
|
end
|
130
130
|
it { expect(bar).to be_a Array }
|
131
|
-
it { expect(bar).to_not include(Dir.getwd)}
|
131
|
+
it { expect(bar).to_not include(Dir.getwd) }
|
132
132
|
end
|
133
|
-
|
134
133
|
end
|
135
134
|
end
|
136
135
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,113 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rb_tags
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- LeFnord
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-02-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: rspec
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: guard-rspec
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: guard-bundler
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rb-fsevent
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: terminal-notifier-guard
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ">="
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - ">="
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: pry
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - ">="
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: pry-byebug
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - ">="
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '0'
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - ">="
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
111
13
|
- !ruby/object:Gem::Dependency
|
112
14
|
name: awesome_print
|
113
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -216,6 +118,9 @@ extra_rdoc_files: []
|
|
216
118
|
files:
|
217
119
|
- ".gitignore"
|
218
120
|
- ".rspec"
|
121
|
+
- ".rubocop.yml"
|
122
|
+
- ".rubocop_todo.yml"
|
123
|
+
- ".travis.yml"
|
219
124
|
- Gemfile
|
220
125
|
- Gemfile.lock
|
221
126
|
- Guardfile
|
@@ -254,7 +159,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
254
159
|
requirements:
|
255
160
|
- - ">="
|
256
161
|
- !ruby/object:Gem::Version
|
257
|
-
version:
|
162
|
+
version: 2.2.6
|
258
163
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
259
164
|
requirements:
|
260
165
|
- - ">="
|
@@ -262,7 +167,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
262
167
|
version: '0'
|
263
168
|
requirements: []
|
264
169
|
rubyforge_project:
|
265
|
-
rubygems_version: 2.
|
170
|
+
rubygems_version: 2.6.8
|
266
171
|
signing_key:
|
267
172
|
specification_version: 4
|
268
173
|
summary: A wrapper around ctags.
|