gem-ctags 1.0.8 → 1.0.9

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
- SHA1:
3
- metadata.gz: 053a8a605e3ac7e4fb1b0a10bf818719646f0621
4
- data.tar.gz: 36d430a31be3ec7cd01d37ae5b947accfb3c4aa5
2
+ SHA256:
3
+ metadata.gz: df1621af79986d7c9a035e1fe95e3648c9b951a357907c15272e65cf411d2e81
4
+ data.tar.gz: 98227b8b61bf9c0ba8f2aeab90f9843ff4b6a27813f7dcb2aa288bd9f6045dd7
5
5
  SHA512:
6
- metadata.gz: c102424be8701bde1117e6e8543059902a75a86edf6f39fe28d9d4d7c339039ef313e167dced8922dd60404eb903ac48afdfc517d85ccec6fd1e3c425e340d40
7
- data.tar.gz: d1773f283ce343e109727027f2b4399d7f9fa0dd1faa2bffaebc1a5d0fa9ca08b4d316f1c91e0af11ba53af5b267cb0f77035f0d10bb29f0b4b9577540287841
6
+ metadata.gz: f401b6ceb5c919554e2de6d7b54e47bbac53796ee435418365ca26cc9910c5130e0f63e063ba8b73fceb770172ed6a9951c59f67364825103d12847e846e9dcc
7
+ data.tar.gz: fec15f783bc72380b56e75aebeed0d0f8627b54194e3f463bd50901ff14b6d5ac225b36cfdc01b30320bc315b3d41298ceb155fe72fe34ed0efe1afbbad5f6e5
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "gem-ctags"
6
- s.version = "1.0.8"
6
+ s.version = "1.0.9"
7
7
  s.authors = ["Tim Pope"]
8
8
  s.email = ["code@tpop"+'e.net']
9
9
  s.homepage = "https://github.com/tpope/gem-ctags"
@@ -12,40 +12,46 @@ class Gem::Commands::CtagsCommand < Gem::Command
12
12
  else
13
13
  Gem.source_index.gems.values
14
14
  end.each do |spec|
15
- self.class.index(spec) do |message|
16
- say message
17
- end
15
+ self.class.index(spec, ui)
18
16
  end
19
17
  end
20
18
 
21
- def self.index(spec)
22
- return unless File.directory?(spec.full_gem_path)
19
+ def self.invoke(languages, tag_file, *paths)
20
+ system(
21
+ 'ctags',
22
+ "--languages=#{languages}",
23
+ '-R',
24
+ '--tag-relative=yes',
25
+ '-f',
26
+ tag_file.to_s,
27
+ *paths.map { |p| Pathname.new(p).relative_path_from(Pathname.pwd).to_s }
28
+ )
29
+ end
30
+
31
+ def self.can_write?(path)
32
+ path.dirname.directory? && !path.directory? &&
33
+ !(path.file? && path.read(1) == '!')
34
+ end
35
+
36
+ def self.index(spec, ui = nil)
37
+ gem_path = Pathname.new(spec.full_gem_path)
23
38
 
24
- tag_file = File.expand_path('tags', spec.full_gem_path)
25
- if !(File.file?(tag_file) && File.read(tag_file, 1) == '!') && !File.directory?(tag_file)
26
- yield "Generating ctags for #{spec.full_name}" if block_given?
27
- paths = spec.require_paths.
28
- map { |p|
29
- Pathname.new(File.join(spec.full_gem_path, p)).
30
- relative_path_from(Pathname.pwd).to_s
31
- }.
32
- select { |p| File.directory?(p) }
33
- paths = [spec.full_gem_path] if paths.empty?
34
- system(
35
- 'ctags', '--languages=Ruby', '-R', '--tag-relative=yes', '-f', tag_file,
36
- *paths
37
- )
39
+ tag_file = gem_path.join('tags')
40
+ paths = spec.require_paths.map { |p| gem_path.join(p) }
41
+ if paths.any? && can_write?(tag_file)
42
+ ui.say "Generating ctags for #{spec.full_name}" if ui
43
+ invoke('Ruby', tag_file, *paths)
38
44
  end
39
45
 
40
- target = File.expand_path('lib/bundler/cli.rb', spec.full_gem_path)
41
- if File.writable?(target) && !File.read(target).include?('load_plugins')
42
- yield "Injecting gem-ctags into #{spec.full_name}" if block_given?
43
- File.open(target, 'a') do |f|
46
+ target = gem_path.join('lib/bundler/cli.rb')
47
+ if target.writable? && !target.read.include?('load_plugins')
48
+ ui.say "Injecting gem-ctags into #{spec.full_name}" if ui
49
+ target.open('a') do |f|
44
50
  f.write "\nGem.load_plugins rescue nil\n"
45
51
  end
46
52
  end
47
53
  rescue => e
48
- raise unless block_given?
49
- yield "Failed processing ctags for #{spec.full_name}:\n (#{e.class}) #{e}"
54
+ raise unless ui
55
+ ui.say "Failed processing ctags for #{spec.full_name}:\n (#{e.class}) #{e}"
50
56
  end
51
57
  end
@@ -4,5 +4,5 @@ require 'rubygems/commands/ctags_command'
4
4
  Gem::CommandManager.instance.register_command :ctags
5
5
 
6
6
  Gem.post_install do |installer|
7
- Gem::Commands::CtagsCommand.index(installer.spec)
7
+ Gem::Commands::CtagsCommand.index(installer.spec, installer.ui)
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gem-ctags
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.8
4
+ version: 1.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Pope
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-27 00:00:00.000000000 Z
11
+ date: 2018-05-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -59,7 +59,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
59
59
  version: '0'
60
60
  requirements: []
61
61
  rubyforge_project:
62
- rubygems_version: 2.6.8
62
+ rubygems_version: 2.7.3
63
63
  signing_key:
64
64
  specification_version: 4
65
65
  summary: Automatic ctags generation on gem install