gem-ripper-tags 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown CHANGED
@@ -17,7 +17,7 @@ Install the thing (only Ruby 1.9+):
17
17
 
18
18
  Then generate tags for all already installed gems:
19
19
 
20
- gem ripper
20
+ gem ripper_tags
21
21
 
22
22
  Anytime you install a gem now, tags will be automatically created.
23
23
 
@@ -27,6 +27,9 @@ If you're using RVM, I recommend extending your global gemset by adding
27
27
  `gem-ripper-tags` to `~/.rvm/gemsets/global.gems`. Put it at the top so the
28
28
  gems below it will be indexed.
29
29
 
30
+ You can use the gem even with 1.8 gemsets, but since Ruby 1.8 is not
31
+ supported, it will (silently) not register the gem hook.
32
+
30
33
  Motivation
31
34
  ----------
32
35
 
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "gem-ripper-tags"
6
- s.version = "1.0.1"
6
+ s.version = "1.0.2"
7
7
  s.authors = ["Tim Pope", "Lukas Zapletal"]
8
8
  s.email = ["code@tpop"+'e.net', "lzap+rpm@red"+'hat.com']
9
9
  s.homepage = "https://github.com/lzap/gem-ripper-tags"
@@ -1,9 +1,9 @@
1
1
  require 'rubygems/command'
2
- require 'tag_ripper'
2
+ require 'ripper-tags'
3
3
 
4
4
  class Gem::Commands::RipperTagsCommand < Gem::Command
5
5
  def initialize
6
- super 'ripper', 'Generate ctags for gems with Ruby/Ripper parser'
6
+ super 'ripper_tags', 'Generate ctags for gems with Ruby/Ripper parser'
7
7
  end
8
8
 
9
9
  def execute
@@ -18,60 +18,21 @@ class Gem::Commands::RipperTagsCommand < Gem::Command
18
18
  end
19
19
  end
20
20
 
21
- def self.ctags(paths)
22
- # this bit is taken from ripper-tags/bin
23
- all_tags = []
24
- paths.each do |file|
25
- begin
26
- if File.directory?(file)
27
- Dir.foreach(file){ |f| paths << File.expand_path(File.join(file, f)) if f !~ /^\.\.?/ }
28
- next
29
- else
30
- next if file !~ /\.rb$/
31
- data = File.read(file)
32
- end
33
- sexp = TagRipper.new(data, file).parse
34
- v = TagRipper::Visitor.new(sexp, file, data)
35
- all_tags += v.tags
36
- rescue Exception => e
37
- #STDERR.puts "Skipping invalid file #{file}"
38
- end
39
- end
40
-
41
- File.open('tags', 'w') do |file|
42
- file.puts <<-EOC
43
- !_TAG_FILE_FORMAT\t2\t/extended format; --format=1 will not append ;" to lines/
44
- !_TAG_FILE_SORTED\t1\t/0=unsorted, 1=sorted, 2=foldcase/
45
- EOC
46
-
47
- all_tags.sort_by!{ |t| t[:name] }
48
- all_tags.each do |tag|
49
- kwargs = ''
50
- kwargs << "\tclass:#{tag[:class].gsub('::','.')}" if tag[:class]
51
- kwargs << "\tinherits:#{tag[:inherits].gsub('::','.')}" if tag[:inherits]
52
-
53
- kind = case tag[:kind]
54
- when 'method' then 'f'
55
- when 'singleton method' then 'F'
56
- when 'constant' then 'C'
57
- else tag[:kind].slice(0,1)
58
- end
59
-
60
- code = tag[:pattern].gsub('\\','\\\\\\\\').gsub('/','\\/')
61
- file.puts "%s\t%s\t/^%s$/;\"\t%c%s" % [tag[:name], tag[:path], code, kind, kwargs]
62
- end
63
- end
64
- end
65
-
66
21
  def self.index(spec)
67
22
  return unless File.directory?(spec.full_gem_path)
68
23
 
69
24
  Dir.chdir(spec.full_gem_path) do
70
25
 
71
- #if !(File.file?('tags') && File.read('tags', 1) == '!') && !File.directory?('tags')
72
- if !File.directory?('tags')
73
- yield "Generating ctags for #{spec.full_name}" if block_given?
74
- ctags(spec.require_paths.select { |p| File.directory?(p) })
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')
30
+ 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
75
36
  end
76
37
 
77
38
  target = 'lib/bundler/cli.rb'
@@ -6,7 +6,7 @@ rescue LoadError => e
6
6
  end
7
7
 
8
8
  unless old_ruby
9
- Gem::CommandManager.instance.register_command :ripper
9
+ Gem::CommandManager.instance.register_command :ripper_tags
10
10
 
11
11
  Gem.post_install do |installer|
12
12
  Gem::Commands::RipperTagsCommand.index(installer.spec)
data/rebuild-gems.sh ADDED
@@ -0,0 +1,2 @@
1
+ #!/bin/bash
2
+ rm gem-ripper-tags*.gem; gem build gem-ripper-tags.gemspec && gem install -f gem-ripper-tags-*.gem && gem ripper
data/release.sh ADDED
@@ -0,0 +1,9 @@
1
+ #!/bin/bash
2
+ #
3
+ # Before running this make sure you tagged and pushed!
4
+ #
5
+
6
+ VERSION=$(git describe --abbrev=0 --tags)
7
+ git checkout $VERSION && \
8
+ gem build gem-ripper-tags-$VERSION.gem && \
9
+ gem push gem-ripper-tags-$VERSION.gem
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.1
4
+ version: 1.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-06-28 00:00:00.000000000 Z
13
+ date: 2013-08-15 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: ripper-tags
@@ -60,6 +60,8 @@ files:
60
60
  - gem-ripper-tags.gemspec
61
61
  - lib/rubygems/commands/ripper_tags_command.rb
62
62
  - lib/rubygems_plugin.rb
63
+ - rebuild-gems.sh
64
+ - release.sh
63
65
  homepage: https://github.com/lzap/gem-ripper-tags
64
66
  licenses: []
65
67
  post_install_message: