CoffeeTags 0.0.2.0 → 0.0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +58 -17
- data/lib/CoffeeTags/version.rb +1 -1
- data/lib/CoffeeTags.rb +19 -22
- data/spec/fixtures/out.test-two.ctags +1 -1
- data/spec/fixtures/out.test.ctags +1 -1
- data/tagbar-info.markdown +40 -0
- data/vim/tagbar-coffee.vim.erb +15 -0
- metadata +6 -4
data/README.md
CHANGED
@@ -1,20 +1,23 @@
|
|
1
1
|
# CoffeeTags
|
2
2
|
|
3
|
-
A simple tool for generating CoffeeScript tags (Ctags compatible
|
4
|
-
|
5
|
-
Showing only functions (right) or with variables included (left)
|
3
|
+
A simple tool for generating CoffeeScript tags (Ctags compatible).
|
6
4
|
|
7
5
|
|
8
|
-
|
6
|
+
### Example + Screenshot
|
7
|
+
Showing only functions (right) or with variables included (left)
|
9
8
|
|
10
9
|
<a href="http://skitch.com/plugawy/gyfnb/1-coffeetags-1-vim-unicorn.local-tmux"><img src="http://img.skitch.com/20111012-8cjesum8ru8usqusra4yppj5cc.preview.png" alt="1. CoffeeTags:1:vim - "unicorn.local" (tmux)" /></a><br /><span>Uploaded with <a href="http://skitch.com">Skitch</a>!</span>
|
11
10
|
|
12
|
-
|
11
|
+
## Huh?
|
13
12
|
|
14
|
-
|
13
|
+
CoffeeTags was created for use with Vim and [TagBar plugin](https://github.com/majutsushi/tagbar), however it
|
14
|
+
accepts most common ctags arguments, therefore the following:
|
15
15
|
|
16
16
|
`coffeetags -R -f TAGS`
|
17
17
|
|
18
|
+
|
19
|
+
will generate standard TAGS file which later can be used with Vim (standard `:tag` command works as expected)
|
20
|
+
|
18
21
|
# Requirements
|
19
22
|
|
20
23
|
* ruby (either 1.8.7 or 1.9.2)
|
@@ -22,29 +25,62 @@ Designed for use with Vim + [TagBar plugin](https://github.com/majutsushi/tagbar
|
|
22
25
|
|
23
26
|
### optional
|
24
27
|
|
25
|
-
* [TagBar
|
28
|
+
* [TagBar](https://github.com/majutsushi/tagbar)
|
26
29
|
|
27
30
|
# Halp!
|
28
31
|
|
29
|
-
`coffeetags --help`
|
30
|
-
|
31
|
-
-R - process current directory recursively and look for all *.coffee files
|
32
|
-
--f <file> - save tags to <file>, if <file> == '-' tags get print out to STDOUT (jscatgs style)
|
33
|
-
--version - coffeetags version
|
34
|
-
--vim-conf - print out tagbar config for vim
|
35
|
-
--include-vars - include objects/variables in generated tags
|
36
|
-
combine --vim-conf and --include-vars to create a config which adds '--include-vars' option
|
32
|
+
Just use `coffeetags --help`
|
37
33
|
|
38
34
|
# Installation
|
39
35
|
|
40
|
-
* get
|
36
|
+
* get `coffeetags`
|
41
37
|
|
42
38
|
`gem install CoffeeTags`
|
43
39
|
|
44
40
|
|
45
41
|
* add TagBar config to your .vimrc
|
46
42
|
|
47
|
-
|
43
|
+
`coffeetags --vim-conf >> ~/.vimrc`
|
44
|
+
|
45
|
+
|
46
|
+
## Config types
|
47
|
+
|
48
|
+
CoffeeTags can work in 2 modes:
|
49
|
+
|
50
|
+
- tags only for functions (default)
|
51
|
+
- tags for functions and objects containing them
|
52
|
+
|
53
|
+
Second mode is activated by adding `--include-vars` to command line arguments
|
54
|
+
|
55
|
+
# CoffeeTags + TagBar + Vim
|
56
|
+
|
57
|
+
## Config in vimrc
|
58
|
+
|
59
|
+
You can add the config to your .vimrc (making sure that the old one is removed)
|
60
|
+
by:
|
61
|
+
|
62
|
+
coffeetags --vim-conf >> ~/.vimrc
|
63
|
+
|
64
|
+
or (for 2nd mode)
|
65
|
+
|
66
|
+
coffeetags --include-vars --vim-conf >> ~/.vimrc
|
67
|
+
|
68
|
+
|
69
|
+
## Config as a filetype plugin
|
70
|
+
|
71
|
+
You can generate a special filetype plugin and tagbar will use that
|
72
|
+
automatically.
|
73
|
+
|
74
|
+
This option is preferable if you want to keep your vimrc short.
|
75
|
+
|
76
|
+
coffeetags --vim-conf > ~/vim/ftplugin/coffee/tagbar-coffee.vim
|
77
|
+
coffeetags [--include-vars] --vim-conf > ~/vim/ftplugin/coffee/tagbar-coffee.vim
|
78
|
+
|
79
|
+
or if you're using pathogen
|
80
|
+
|
81
|
+
coffeetags [--include-vars] --vim-conf > ~/vim/bundle/coffeetags/ftplugin/coffee/tagbar-coffee.vim
|
82
|
+
coffeetags --vim-conf > ~/vim/bundle/coffeetags/ftplugin/coffee/tagbar-coffee.vim
|
83
|
+
|
48
84
|
|
49
85
|
* open your coffeescript file and open TagBar.
|
50
86
|
|
@@ -53,3 +89,8 @@ Done!
|
|
53
89
|
# TODO
|
54
90
|
|
55
91
|
- squash all bugs
|
92
|
+
|
93
|
+
|
94
|
+
# License
|
95
|
+
|
96
|
+
MIT
|
data/lib/CoffeeTags/version.rb
CHANGED
data/lib/CoffeeTags.rb
CHANGED
@@ -3,6 +3,7 @@ require "CoffeeTags/version"
|
|
3
3
|
require "CoffeeTags/parser"
|
4
4
|
require "CoffeeTags/formatter"
|
5
5
|
require 'optparse'
|
6
|
+
require 'erb'
|
6
7
|
|
7
8
|
class Object
|
8
9
|
def blank?
|
@@ -21,41 +22,33 @@ module Coffeetags
|
|
21
22
|
|
22
23
|
class Utils
|
23
24
|
def self.tagbar_conf include_vars
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
\\ 'kinds' : [
|
31
|
-
\\ 'f:functions',
|
32
|
-
\\ 'o:object'
|
33
|
-
\\ ],
|
34
|
-
\\ 'kind2scope' : {
|
35
|
-
\\ 'f' : 'object',
|
36
|
-
\\ 'o' : 'object'
|
37
|
-
\\},
|
38
|
-
\\ 'sro' : ".",
|
39
|
-
\\ 'ctagsbin' : 'coffeetags',
|
40
|
-
\\ 'ctagsargs' : '#{include_vars ? "--include-vars" : "" } ',
|
41
|
-
\\}
|
42
|
-
CONF
|
25
|
+
include_vars_opt = include_vars ? "--include-vars" : ''
|
26
|
+
|
27
|
+
tmpl_file = File.read(File.expand_path("../../vim/tagbar-coffee.vim.erb", __FILE__))
|
28
|
+
tmpl = ERB.new(tmpl_file)
|
29
|
+
|
30
|
+
tmpl.result(binding)
|
43
31
|
end
|
44
32
|
|
45
33
|
def self.option_parser args
|
46
34
|
args << '-h' if args.empty?
|
47
35
|
options = {}
|
48
36
|
optparse = OptionParser.new do |opts|
|
49
|
-
|
50
37
|
opts.banner = (<<-BAN
|
38
|
+
---------------------------------------------------------------------
|
51
39
|
#{NAME} #{Coffeetags::VERSION}
|
40
|
+
---------------------------------------------------------------------
|
52
41
|
by #{AUTHOR} ( #{URL} )
|
53
42
|
Usage:
|
54
43
|
coffeetags [OPTIONS] <list of files>
|
44
|
+
|
45
|
+
CoffeeTags + TagBar + Vim ---> https://gist.github.com/1935512
|
46
|
+
---------------------------------------------------------------------
|
55
47
|
BAN
|
56
48
|
).gsub(/^\s*/,'')
|
57
49
|
|
58
|
-
|
50
|
+
|
51
|
+
opts.on('--include-vars', "Include variables in generated tags") do |o|
|
59
52
|
options[:include_vars] = true
|
60
53
|
end
|
61
54
|
|
@@ -68,10 +61,14 @@ module Coffeetags
|
|
68
61
|
options[:recur] = true
|
69
62
|
end
|
70
63
|
|
64
|
+
opts.on('--vim-conf', 'Generate TagBar config (more info https://gist.github.com/1935512 )') do
|
65
|
+
puts tagbar_conf options[:include_vars]
|
66
|
+
exit
|
67
|
+
end
|
68
|
+
|
71
69
|
opts.on('-v', '--version', 'Current version') do
|
72
70
|
puts Coffeetags::VERSION
|
73
71
|
exit
|
74
|
-
|
75
72
|
end
|
76
73
|
|
77
74
|
opts.on('-h','--help','HALP') do
|
@@ -3,7 +3,7 @@
|
|
3
3
|
!_TAG_PROGRAM_AUTHOR Łukasz Korecki /lukasz@coffeesounds.com/
|
4
4
|
!_TAG_PROGRAM_NAME CoffeeTags //
|
5
5
|
!_TAG_PROGRAM_URL https://github.com/lukaszkorecki/CoffeeTags /GitHub repository/
|
6
|
-
!_TAG_PROGRAM_VERSION 0.0.
|
6
|
+
!_TAG_PROGRAM_VERSION 0.0.2.2 //
|
7
7
|
bump spec/fixtures/test.coffee /bump/;" f lineno:1 object:window type:function
|
8
8
|
ho spec/fixtures/test.coffee /ho/;" f lineno:5 object:Wat type:function
|
9
9
|
bump spec/fixtures/test.coffee /bump/;" f lineno:10 object:Wat.ho.@lolWat type:function
|
@@ -3,7 +3,7 @@
|
|
3
3
|
!_TAG_PROGRAM_AUTHOR Łukasz Korecki /lukasz@coffeesounds.com/
|
4
4
|
!_TAG_PROGRAM_NAME CoffeeTags //
|
5
5
|
!_TAG_PROGRAM_URL https://github.com/lukaszkorecki/CoffeeTags /GitHub repository/
|
6
|
-
!_TAG_PROGRAM_VERSION 0.0.
|
6
|
+
!_TAG_PROGRAM_VERSION 0.0.2.2 //
|
7
7
|
bump spec/fixtures/test.coffee /bump/;" f lineno:1 object:window type:function
|
8
8
|
ho spec/fixtures/test.coffee /ho/;" f lineno:5 object:Wat type:function
|
9
9
|
bump spec/fixtures/test.coffee /bump/;" f lineno:10 object:Wat.ho.@lolWat type:function
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# How to use CoffeeTags with [TagBar ](https://github.com/majutsushi/tagbar)
|
2
|
+
|
3
|
+
## Config types
|
4
|
+
|
5
|
+
CoffeeTags can work in 2 modes:
|
6
|
+
|
7
|
+
- tags only for functions (default)
|
8
|
+
- tags for functions and objects containing them
|
9
|
+
|
10
|
+
Second mode is activated by adding --include-vars to command line arguments
|
11
|
+
|
12
|
+
# CoffeeTags + TagBar + Vim
|
13
|
+
|
14
|
+
## Config in vimrc
|
15
|
+
|
16
|
+
You can add the config to your .vimrc (making sure that the old one is removed)
|
17
|
+
by:
|
18
|
+
|
19
|
+
coffeetags --vim-conf >> ~/.vimrc
|
20
|
+
|
21
|
+
or (for 2nd mode)
|
22
|
+
|
23
|
+
coffeetags --include-vars --vim-conf >> ~/.vimrc
|
24
|
+
|
25
|
+
|
26
|
+
## Config as a filetype plugin
|
27
|
+
|
28
|
+
You can generate a special filetype plugin and tagbar will use that
|
29
|
+
automatically.
|
30
|
+
|
31
|
+
This option is preferable if you want to keep your vimrc short.
|
32
|
+
|
33
|
+
coffeetags --vim-conf > ~/vim/ftplugin/coffee/tagbar-coffee.vim
|
34
|
+
coffeetags [--include-vars] --vim-conf > ~/vim/ftplugin/coffee/tagbar-coffee.vim
|
35
|
+
|
36
|
+
or if you're using pathogen
|
37
|
+
|
38
|
+
coffeetags [--include-vars] --vim-conf > ~/vim/bundle/coffeetags/ftplugin/coffee/tagbar-coffee.vim
|
39
|
+
coffeetags --vim-conf > ~/vim/bundle/coffeetags/ftplugin/coffee/tagbar-coffee.vim
|
40
|
+
|
@@ -0,0 +1,15 @@
|
|
1
|
+
if executable('coffeetags')
|
2
|
+
let g:tagbar_type_coffee = {
|
3
|
+
\ 'ctagsbin' : 'coffeetags',
|
4
|
+
\ 'ctagsargs' : '<%= include_vars_opt %>',
|
5
|
+
\ 'kinds' : [
|
6
|
+
\ 'f:functions',
|
7
|
+
\ 'o:object',
|
8
|
+
\ ],
|
9
|
+
\ 'sro' : ".",
|
10
|
+
\ 'kind2scope' : {
|
11
|
+
\ 'f' : 'object',
|
12
|
+
\ 'o' : 'object',
|
13
|
+
\ }
|
14
|
+
\ }
|
15
|
+
endif
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: CoffeeTags
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 67
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
9
|
- 2
|
10
|
-
-
|
11
|
-
version: 0.0.2.
|
10
|
+
- 2
|
11
|
+
version: 0.0.2.2
|
12
12
|
platform: ruby
|
13
13
|
authors:
|
14
14
|
- "\xC5\x81ukasz Korecki"
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2012-
|
19
|
+
date: 2012-03-06 00:00:00 +00:00
|
20
20
|
default_executable:
|
21
21
|
dependencies: []
|
22
22
|
|
@@ -57,7 +57,9 @@ files:
|
|
57
57
|
- spec/formatter_spec.rb
|
58
58
|
- spec/parser_spec.rb
|
59
59
|
- spec/spec_helper.rb
|
60
|
+
- tagbar-info.markdown
|
60
61
|
- test.rb
|
62
|
+
- vim/tagbar-coffee.vim.erb
|
61
63
|
has_rdoc: true
|
62
64
|
homepage: http://github.com/lukaszkorecki/CoffeeTags
|
63
65
|
licenses: []
|