guard-ctags-bundler 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
data/lib/guard/ctags-bundler.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
require "guard/ctags-bundler/ctags_generator"
|
2
1
|
require 'guard'
|
3
2
|
require 'guard/guard'
|
4
3
|
require 'bundler'
|
@@ -6,9 +5,11 @@ require 'bundler/runtime'
|
|
6
5
|
|
7
6
|
module Guard
|
8
7
|
class CtagsBundler < Guard
|
8
|
+
autoload 'CtagsGenerator', 'guard/ctags-bundler/ctags_generator'
|
9
|
+
|
9
10
|
def initialize(watchers = [], options = {})
|
10
11
|
super(watchers, options)
|
11
|
-
@ctags_generator = ::Guard::
|
12
|
+
@ctags_generator = ::Guard::CtagsBundler::CtagsGenerator.new(options)
|
12
13
|
end
|
13
14
|
|
14
15
|
def start
|
@@ -1,29 +1,33 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
module Guard
|
2
|
+
class CtagsBundler
|
3
|
+
class CtagsGenerator
|
4
|
+
def initialize(opts = {})
|
5
|
+
@opts = opts
|
6
|
+
end
|
5
7
|
|
6
|
-
|
7
|
-
|
8
|
-
|
8
|
+
def generate_project_tags
|
9
|
+
generate_tags(@opts[:src_path] || ".", "tags")
|
10
|
+
end
|
9
11
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
12
|
+
def generate_bundler_tags
|
13
|
+
definition = Bundler::Definition.build("Gemfile", "Gemfile.lock", nil)
|
14
|
+
runtime = Bundler::Runtime.new(Dir.pwd, definition)
|
15
|
+
paths = runtime.requested_specs.map(&:full_gem_path)
|
16
|
+
generate_tags(paths, "gems.tags")
|
17
|
+
end
|
16
18
|
|
17
|
-
|
19
|
+
private
|
18
20
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
21
|
+
def generate_tags(path, tag_file)
|
22
|
+
if path.instance_of?(Array)
|
23
|
+
path = path.join(' ').strip
|
24
|
+
end
|
23
25
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
26
|
+
cmd = "find #{path} -type f -name \\*.rb | ctags -f #{tag_file} -L -"
|
27
|
+
cmd << " -e" if @opts[:emacs]
|
28
|
+
system(cmd)
|
29
|
+
system("cat tags gems.tags > TAGS") if @opts[:emacs]
|
30
|
+
end
|
31
|
+
end
|
28
32
|
end
|
29
33
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: guard-ctags-bundler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -130,7 +130,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
130
130
|
version: '0'
|
131
131
|
segments:
|
132
132
|
- 0
|
133
|
-
hash:
|
133
|
+
hash: -1101205821171756912
|
134
134
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
135
135
|
none: false
|
136
136
|
requirements:
|
@@ -139,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
139
139
|
version: '0'
|
140
140
|
segments:
|
141
141
|
- 0
|
142
|
-
hash:
|
142
|
+
hash: -1101205821171756912
|
143
143
|
requirements: []
|
144
144
|
rubyforge_project: guard-ctags-bundler
|
145
145
|
rubygems_version: 1.8.24
|