gem-ripper-tags-optional 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +4 -0
- data/Gemfile +4 -0
- data/MIT-LICENSE +20 -0
- data/README.markdown +111 -0
- data/Rakefile +11 -0
- data/gem-ripper-tags-optional.gemspec +20 -0
- data/lib/rubygems/commands/ripper_tags_command.rb +69 -0
- data/lib/rubygems_plugin.rb +16 -0
- data/release.sh +12 -0
- data/test.sh +8 -0
- metadata +83 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 40daf008565e59498df0a4aadc391c0a933f11f324b0dd6004cf5708f6462a36
|
4
|
+
data.tar.gz: 69d929c7f968d802bfe51ace4f95badb2e9aaa0fa52283865c169b5352214b96
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a29f0cf9b1ab6a5ee44db79ebef6512e21fb0273774faa359167bfb132425da664d3fcc3395a557ee4bcba3ce5739fd7cf373b27a78868aebf67a2e29f71a8ca
|
7
|
+
data.tar.gz: 30a750cc5f95c863b17f04a38e9f9d6d2a8bc86f7fdbf74f7a3ce31adaa751a9c9e499516b4559163402cd7e59600bc32aff0047a05a0eaf2ec996bed3c2c902
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) Tim Pope
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.markdown
ADDED
@@ -0,0 +1,111 @@
|
|
1
|
+
RubyGems Automatic Ctags Generator
|
2
|
+
==================================
|
3
|
+
|
4
|
+
If you do like Vim and Ctags like I or [Tim Pope][] do, you maybe appreciate
|
5
|
+
automatic generation of ctags for each installed gem. This small project is
|
6
|
+
based on Tim's [gem-ctags][], but the main difference is it does *not* use
|
7
|
+
[Exuberant Ctags][].
|
8
|
+
|
9
|
+
Upstream site is at: https://github.com/RobertAudi/gem-ripper-tags
|
10
|
+
|
11
|
+
Usage
|
12
|
+
-----
|
13
|
+
|
14
|
+
Install the thing (only Ruby 1.9+):
|
15
|
+
|
16
|
+
gem install gem-ripper-tags
|
17
|
+
|
18
|
+
Then generate tags for all already installed gems:
|
19
|
+
|
20
|
+
gem ripper_tags
|
21
|
+
|
22
|
+
Anytime you install a gem now, tags will be automatically created.
|
23
|
+
|
24
|
+
gem instal some_gem ...
|
25
|
+
|
26
|
+
If you're using RVM, I recommend extending your global gemset by adding
|
27
|
+
`gem-ripper-tags` to `~/.rvm/gemsets/global.gems`. Put it at the top so the
|
28
|
+
gems below it will be indexed.
|
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
|
+
|
33
|
+
### Skip tags generation
|
34
|
+
|
35
|
+
Set the `SKIP_RIPPER_TAGS` environment variable to skip tags generation:
|
36
|
+
|
37
|
+
SKIP_RIPPER_TAGS=1 gem instal some_gem ...
|
38
|
+
|
39
|
+
Motivation
|
40
|
+
----------
|
41
|
+
|
42
|
+
Why would you care about not using ctags in the first place? Ctags is a great
|
43
|
+
project and it does support many (like 50) languages. But Ruby support is very
|
44
|
+
weak, the parser is not in good condition and it has not been changed 4 years
|
45
|
+
now.
|
46
|
+
|
47
|
+
* Ctags doesn't deal with: module A::B
|
48
|
+
* Ctags doesn't tag (at least some of) the operator methods like ==
|
49
|
+
* Ctags doesn't support qualified tags, -type=+
|
50
|
+
* Ctags doesn't output tags for constants or attributes.
|
51
|
+
|
52
|
+
Unfortunately all the others (I found 2) Ruby ctags generators are either
|
53
|
+
outdated (no Ruby 1.9+ support) or very slow. This project makes use of
|
54
|
+
[ripper-tags][] that leverages built-in Ruby parser API called Ripper. It is
|
55
|
+
fast and it works as expected.
|
56
|
+
|
57
|
+
Regeneration
|
58
|
+
------------
|
59
|
+
|
60
|
+
If you want to regenerate all tagfiles from scratch, use:
|
61
|
+
|
62
|
+
gem ripper_tags --reindex
|
63
|
+
|
64
|
+
Emacs support
|
65
|
+
-------------
|
66
|
+
|
67
|
+
To support Emacs, you need two steps. First, reindex everything with Emacs
|
68
|
+
enabled:
|
69
|
+
|
70
|
+
gem ripper_tags --reindex --emacs
|
71
|
+
|
72
|
+
And make sure this environment variable is set to all shells where you use
|
73
|
+
"gem install" command so new gems are generated with Emacs TAGS files.
|
74
|
+
|
75
|
+
RIPPER_TAGS_EMACS=1
|
76
|
+
|
77
|
+
Vim Tips
|
78
|
+
--------
|
79
|
+
|
80
|
+
To easily edit a gem with your current working directory set to the
|
81
|
+
gem's root, install [gem-browse][].
|
82
|
+
|
83
|
+
If you have [rake.vim][] installed (which, by the way, is a misleading
|
84
|
+
name), Vim will already know where to look for the tags file when
|
85
|
+
editing a gem.
|
86
|
+
|
87
|
+
If you have [bundler.vim][] installed, Vim will be aware of all tags
|
88
|
+
files from all gems in your bundle.
|
89
|
+
|
90
|
+
If you want to get crazy, add this to your vimrc to get Vim to search
|
91
|
+
all gems in your current RVM gemset (requires [pathogen.vim][]):
|
92
|
+
|
93
|
+
autocmd FileType ruby let &l:tags = pathogen#legacyjoin(pathogen#uniq(
|
94
|
+
\ pathogen#split(&tags) +
|
95
|
+
\ map(split($GEM_PATH,':'),'v:val."/gems/*/tags"')))
|
96
|
+
|
97
|
+
Tim Pope doesn't like to get crazy. ;-)
|
98
|
+
|
99
|
+
License
|
100
|
+
-------
|
101
|
+
|
102
|
+
Copyright (c) Tim Pope; Lukáš Zapletal. MIT License.
|
103
|
+
|
104
|
+
[Tim Pope]: http://tpo.pe/
|
105
|
+
[Exuberant Ctags]: http://ctags.sourceforge.net/
|
106
|
+
[gem-ctags]: https://github.com/tpope/gem-ctags
|
107
|
+
[gem-browse]: https://github.com/tpope/gem-browse
|
108
|
+
[bundler.vim]: https://github.com/tpope/vim-bundler
|
109
|
+
[pathogen.vim]: https://github.com/tpope/vim-pathogen
|
110
|
+
[rake.vim]: https://github.com/tpope/vim-rake
|
111
|
+
[ripper-tags]: https://github.com/tmm1/ripper-tags
|
data/Rakefile
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = "gem-ripper-tags-optional"
|
6
|
+
s.version = `git describe --abbrev=0 --tags`
|
7
|
+
s.authors = ["Tim Pope", "Lukas Zapletal"]
|
8
|
+
s.email = ["code@tpop"+'e.net', "lzap+rpm@red"+'hat.com']
|
9
|
+
s.homepage = "https://github.com/lzap/gem-ripper-tags"
|
10
|
+
s.summary = %q{fast and accurate ctags generator on gem install}
|
11
|
+
s.license = 'MIT'
|
12
|
+
|
13
|
+
s.files = `git ls-files`.split("\n")
|
14
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
15
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
16
|
+
s.require_paths = ["lib"]
|
17
|
+
|
18
|
+
s.add_dependency 'ripper-tags', '>= 0.1.2'
|
19
|
+
s.add_development_dependency 'rake'
|
20
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
require 'rubygems/command'
|
2
|
+
require 'ripper-tags'
|
3
|
+
|
4
|
+
class Gem::Commands::RipperTagsCommand < Gem::Command
|
5
|
+
def initialize
|
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
|
17
|
+
end
|
18
|
+
|
19
|
+
def execute
|
20
|
+
if Gem::Specification.respond_to?(:each)
|
21
|
+
Gem::Specification
|
22
|
+
else
|
23
|
+
Gem.source_index.gems.values
|
24
|
+
end.each do |spec|
|
25
|
+
self.class.index(spec, options[:reindex], options[:emacs]) do |message|
|
26
|
+
say message
|
27
|
+
end
|
28
|
+
end
|
29
|
+
rescue Exception => e
|
30
|
+
if options[:debug] || ENV['RIPPER_TAGS_DEBUG']
|
31
|
+
puts e.message
|
32
|
+
puts e.backtrace.join("\n")
|
33
|
+
end
|
34
|
+
raise e
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.index(spec, reindex, emacs)
|
38
|
+
return unless File.directory?(spec.full_gem_path)
|
39
|
+
|
40
|
+
if emacs
|
41
|
+
tag_filename = 'TAGS'
|
42
|
+
format = "emacs"
|
43
|
+
else
|
44
|
+
tag_filename = 'tags'
|
45
|
+
format = "vim"
|
46
|
+
end
|
47
|
+
|
48
|
+
Dir.chdir(spec.full_gem_path) do
|
49
|
+
if (!File.directory?(tag_filename) && reindex) || (!File.file?(tag_filename) && !File.directory?(tag_filename))
|
50
|
+
yield "Ripper is generating ctags for #{spec.full_name}" if block_given?
|
51
|
+
riopt = RipperTags.default_options
|
52
|
+
riopt.tag_file_name = "./#{tag_filename}"
|
53
|
+
riopt.format = format
|
54
|
+
riopt.recursive = true
|
55
|
+
riopt.force = true
|
56
|
+
RipperTags.run riopt
|
57
|
+
end
|
58
|
+
|
59
|
+
target = 'lib/bundler/cli.rb'
|
60
|
+
if File.writable?(target) && !File.read(target).include?('load_plugins')
|
61
|
+
yield "Injecting gem-ripper-tags into #{spec.full_name}" if block_given?
|
62
|
+
File.open(target, 'a') do |f|
|
63
|
+
f.write "\nGem.load_plugins rescue nil\n"
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'rubygems/command_manager'
|
2
|
+
begin
|
3
|
+
require 'rubygems/commands/ripper_tags_command'
|
4
|
+
rescue LoadError => e
|
5
|
+
old_ruby = true
|
6
|
+
end
|
7
|
+
|
8
|
+
unless old_ruby
|
9
|
+
Gem::CommandManager.instance.register_command :ripper_tags
|
10
|
+
|
11
|
+
Gem.post_install do |installer|
|
12
|
+
unless ENV['SKIP_RIPPER_TAGS']
|
13
|
+
Gem::Commands::RipperTagsCommand.index(installer.spec, false, !ENV['RIPPER_TAGS_EMACS'].nil?)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/release.sh
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
#
|
3
|
+
# Before running this make sure you tagged and pushed!
|
4
|
+
#
|
5
|
+
|
6
|
+
VERSION=$(git describe --abbrev=0 --tags)
|
7
|
+
|
8
|
+
git checkout $VERSION && \
|
9
|
+
gem build gem-ripper-tags-optional.gemspec && \
|
10
|
+
gem push gem-ripper-tags-optional-$VERSION.gem
|
11
|
+
|
12
|
+
git checkout master
|
data/test.sh
ADDED
metadata
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: gem-ripper-tags-optional
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.7
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Tim Pope
|
8
|
+
- Lukas Zapletal
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2019-04-19 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: ripper-tags
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ">="
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: 0.1.2
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: 0.1.2
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: rake
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
description:
|
43
|
+
email:
|
44
|
+
- code@tpope.net
|
45
|
+
- lzap+rpm@redhat.com
|
46
|
+
executables: []
|
47
|
+
extensions: []
|
48
|
+
extra_rdoc_files: []
|
49
|
+
files:
|
50
|
+
- ".gitignore"
|
51
|
+
- Gemfile
|
52
|
+
- MIT-LICENSE
|
53
|
+
- README.markdown
|
54
|
+
- Rakefile
|
55
|
+
- gem-ripper-tags-optional.gemspec
|
56
|
+
- lib/rubygems/commands/ripper_tags_command.rb
|
57
|
+
- lib/rubygems_plugin.rb
|
58
|
+
- release.sh
|
59
|
+
- test.sh
|
60
|
+
homepage: https://github.com/lzap/gem-ripper-tags
|
61
|
+
licenses:
|
62
|
+
- MIT
|
63
|
+
metadata: {}
|
64
|
+
post_install_message:
|
65
|
+
rdoc_options: []
|
66
|
+
require_paths:
|
67
|
+
- lib
|
68
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '0'
|
73
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
requirements: []
|
79
|
+
rubygems_version: 3.0.3
|
80
|
+
signing_key:
|
81
|
+
specification_version: 4
|
82
|
+
summary: fast and accurate ctags generator on gem install
|
83
|
+
test_files: []
|