gem-ripper-tags 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown CHANGED
@@ -48,6 +48,26 @@ outdated (no Ruby 1.9+ support) or very slow. This project makes use of
48
48
  [ripper-tags][] that leverages built-in Ruby parser API called Ripper. It is
49
49
  fast and it works as expected.
50
50
 
51
+ Regeneration
52
+ ------------
53
+
54
+ If you want to regenerate all tagfiles from scratch, use:
55
+
56
+ gem ripper_tags --reindex
57
+
58
+ Emacs support
59
+ -------------
60
+
61
+ To support Emacs, you need two steps. First, reindex everything with Emacs
62
+ enabled:
63
+
64
+ gem ripper_tags --reindex --emacs
65
+
66
+ And make sure this environment variable is set to all shells where you use
67
+ "gem install" command so new gems are generated with Emacs TAGS files.
68
+
69
+ RIPPER_TAGS_EMACS=1
70
+
51
71
  Vim Tips
52
72
  --------
53
73
 
@@ -14,6 +14,6 @@ Gem::Specification.new do |s|
14
14
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
15
15
  s.require_paths = ["lib"]
16
16
 
17
- s.add_dependency 'ripper-tags'
17
+ s.add_dependency 'ripper-tags', '>= 0.1.2'
18
18
  s.add_development_dependency 'rake'
19
19
  end
@@ -4,6 +4,16 @@ require 'ripper-tags'
4
4
  class Gem::Commands::RipperTagsCommand < Gem::Command
5
5
  def initialize
6
6
  super 'ripper_tags', 'Generate ctags for gems with Ruby/Ripper parser'
7
+
8
+ add_option("--emacs", "Generate Emacs TAGS instead Vim tags") do |value, options|
9
+ options[:emacs] = true
10
+ end
11
+ add_option("--reindex", "Reindex all tags again") do |value, options|
12
+ options[:reindex] = true
13
+ end
14
+ add_option("--debug", "Enable debugging output") do |value, options|
15
+ options[:debug] = true
16
+ end
7
17
  end
8
18
 
9
19
  def execute
@@ -12,27 +22,40 @@ class Gem::Commands::RipperTagsCommand < Gem::Command
12
22
  else
13
23
  Gem.source_index.gems.values
14
24
  end.each do |spec|
15
- self.class.index(spec) do |message|
25
+ self.class.index(spec,
26
+ options[:reindex],
27
+ (options[:emacs] || ENV['RIPPER_TAGS_EMACS'])) do |message|
16
28
  say message
17
29
  end
18
30
  end
31
+ rescue Exception => e
32
+ if options[:debug]
33
+ puts e.message
34
+ puts e.backtrace.join("\n")
35
+ end
36
+ raise e
19
37
  end
20
38
 
21
- def self.index(spec)
39
+ def self.index(spec, reindex, emacs)
22
40
  return unless File.directory?(spec.full_gem_path)
23
41
 
24
- Dir.chdir(spec.full_gem_path) do
42
+ if emacs
43
+ tag_filename = 'TAGS'
44
+ format = "emacs"
45
+ else
46
+ tag_filename = 'tags'
47
+ format = "vim"
48
+ end
25
49
 
26
- # TODO support for full regeneration via param (+ emacs)
27
- # http://rubygems.rubyforge.org/rubygems-update/Gem/CommandManager.html
28
- #if !File.directory?('tags')
29
- if !(File.file?('tags') && File.read('tags', 1) == '!') && !File.directory?('tags')
50
+ Dir.chdir(spec.full_gem_path) do
51
+ if (!File.directory?(tag_filename) && reindex) || (!File.file?(tag_filename) && !File.directory?(tag_filename))
30
52
  yield "Ripper is generating ctags for #{spec.full_name}" if block_given?
31
- options = RipperTags.default_options
32
- options.format = "vim"
33
- options.recursive = true
34
- options.force = true
35
- RipperTags.run options
53
+ riopt = RipperTags.default_options
54
+ riopt.tag_file_name = "./#{tag_filename}"
55
+ riopt.format = format
56
+ riopt.recursive = true
57
+ riopt.force = true
58
+ RipperTags.run riopt
36
59
  end
37
60
 
38
61
  target = 'lib/bundler/cli.rb'
data/release.sh CHANGED
@@ -6,4 +6,5 @@
6
6
  VERSION=$(git describe --abbrev=0 --tags)
7
7
  git checkout $VERSION && \
8
8
  gem build gem-ripper-tags.gemspec && \
9
- gem push gem-ripper-tags-$VERSION.gem
9
+ gem push gem-ripper-tags-$VERSION.gem && \
10
+ git checkout master
data/test.sh CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/bin/bash
2
- rm gem-ripper-tags*.gem; gem build gem-ripper-tags.gemspec && gem install -f gem-ripper-tags-*.gem && gem ripper
2
+ rm gem-ripper-tags*.gem; gem build gem-ripper-tags.gemspec && gem uninstall gem-ripper-tags && gem install gem-ripper-tags-*.gem && gem ripper
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gem-ripper-tags
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -19,7 +19,7 @@ dependencies:
19
19
  requirements:
20
20
  - - ! '>='
21
21
  - !ruby/object:Gem::Version
22
- version: '0'
22
+ version: 0.1.2
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -27,7 +27,7 @@ dependencies:
27
27
  requirements:
28
28
  - - ! '>='
29
29
  - !ruby/object:Gem::Version
30
- version: '0'
30
+ version: 0.1.2
31
31
  - !ruby/object:Gem::Dependency
32
32
  name: rake
33
33
  requirement: !ruby/object:Gem::Requirement