tagmatic 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +2 -0
- data/LICENSE.txt +22 -0
- data/README.md +33 -0
- data/Rakefile +1 -0
- data/bin/tagmatic +4 -0
- data/lib/tagmatic.rb +102 -0
- data/tagmatic.gemspec +23 -0
- metadata +81 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6e02cd80599f10c1542303ca9ea7853c5065971f
|
4
|
+
data.tar.gz: 4fe8daa3aee4f6e616f5f3aeb58ff13aa132f1fa
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a57f33282554bc93218c98da0b7189098cdcf403411460880a402b211f76964afaef58c6192363a917d0aee49ad74a88840064cdda4e49f1d36ad0b0929dc016
|
7
|
+
data.tar.gz: 0380955ef1418e75ae2922412d4f27221f931be11370173abe8fcbf1b36e665431fd3ac381eda8384c23faf426b823a032e137dbc708a397b03e0e358df013c7
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Adan Alvarado
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# TagMatic
|
2
|
+
|
3
|
+
Automates regenerating the tags file by using Git's post hook functionality.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
```
|
8
|
+
$ gem install tagmatic
|
9
|
+
```
|
10
|
+
|
11
|
+
## Usage
|
12
|
+
|
13
|
+
In any Git repository run:
|
14
|
+
|
15
|
+
```
|
16
|
+
$ tagmatic install
|
17
|
+
```
|
18
|
+
|
19
|
+
This will install a post-hook and regenerate tags for the `app, lib and config` directories.
|
20
|
+
|
21
|
+
|
22
|
+
## TODO:
|
23
|
+
|
24
|
+
* Write tests
|
25
|
+
* Create website
|
26
|
+
|
27
|
+
## Contributing
|
28
|
+
|
29
|
+
1. Fork it
|
30
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
31
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
32
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
33
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/tagmatic
ADDED
data/lib/tagmatic.rb
ADDED
@@ -0,0 +1,102 @@
|
|
1
|
+
class TagMatic
|
2
|
+
VERSION = "0.0.1"
|
3
|
+
|
4
|
+
HASH_BANG = "#!/bin/bash"
|
5
|
+
TAGS_FILE_NAME = "tags"
|
6
|
+
TAGMATIC_BIN = 'tagmatic'
|
7
|
+
|
8
|
+
TEMPLATE = <<-TMPL
|
9
|
+
#{TAGMATIC_BIN} generate-tags .
|
10
|
+
TMPL
|
11
|
+
|
12
|
+
CTAGS_CMD = 'ctags -Ra'
|
13
|
+
LANGUAGES_FLAGS = '--languages='
|
14
|
+
APP_DIRECTORIES = [
|
15
|
+
'app',
|
16
|
+
'config',
|
17
|
+
'lib'
|
18
|
+
]
|
19
|
+
|
20
|
+
IGNORE_FILES = [
|
21
|
+
'javascript',
|
22
|
+
'sql'
|
23
|
+
]
|
24
|
+
|
25
|
+
HELP = <<-HELP
|
26
|
+
run install to install to hooks to regenerate your tags file
|
27
|
+
HELP
|
28
|
+
|
29
|
+
attr_accessor :current_dir
|
30
|
+
|
31
|
+
def initialize *argv
|
32
|
+
command = argv.shift
|
33
|
+
command = command.tr('-', '_') if command
|
34
|
+
|
35
|
+
if command && respond_to?( command )
|
36
|
+
send( command, argv )
|
37
|
+
else
|
38
|
+
display_help
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def git_dir
|
43
|
+
@git_dir = %x[git rev-parse --git-dir].chomp
|
44
|
+
@git_dir
|
45
|
+
end
|
46
|
+
|
47
|
+
def install *argv
|
48
|
+
append(File.join(git_dir, 'hooks', 'post-checkout'), 0777) do |body, f|
|
49
|
+
f.puts HASH_BANG unless body
|
50
|
+
f.puts TEMPLATE
|
51
|
+
end
|
52
|
+
puts 'all tagged up'
|
53
|
+
end
|
54
|
+
|
55
|
+
def display_help
|
56
|
+
puts HELP
|
57
|
+
end
|
58
|
+
|
59
|
+
def tags_file_name
|
60
|
+
TAGS_FILE_NAME
|
61
|
+
end
|
62
|
+
|
63
|
+
def append(file, *args)
|
64
|
+
Dir.mkdir(File.dirname(file)) unless File.directory?(File.dirname(file))
|
65
|
+
body = File.read(file) if File.exist?(file)
|
66
|
+
File.open(file, 'a', *args) do |f|
|
67
|
+
yield body, f
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def generate_tags dir_path
|
72
|
+
puts 'Regenerating tags...'
|
73
|
+
self.current_dir = File.expand_path( dir_path.pop )
|
74
|
+
remove_tags_file( dir_path )
|
75
|
+
APP_DIRECTORIES.each do |path|
|
76
|
+
result = `#{CTAGS_CMD} #{ignore} #{path}` if File.exists?( path )
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
def remove_tags_file dir_path
|
81
|
+
File.delete( tags_path ) if File.exists?( tags_path )
|
82
|
+
end
|
83
|
+
|
84
|
+
def tags_path
|
85
|
+
File.join current_dir, tags_file_name
|
86
|
+
end
|
87
|
+
|
88
|
+
def ignore
|
89
|
+
"#{LANGUAGES_FLAGS}#{ignore_file_types}" if ignore_file_types
|
90
|
+
end
|
91
|
+
|
92
|
+
def ignore_file_types
|
93
|
+
langs = ''
|
94
|
+
IGNORE_FILES.each do |ft|
|
95
|
+
langs << "," unless langs.empty?
|
96
|
+
langs << "-#{ft}"
|
97
|
+
end
|
98
|
+
langs
|
99
|
+
end
|
100
|
+
|
101
|
+
protected :append
|
102
|
+
end
|
data/tagmatic.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'tagmatic'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "tagmatic"
|
8
|
+
spec.version = TagMatic::VERSION
|
9
|
+
spec.authors = ["Adan Alvarado"]
|
10
|
+
spec.email = ["adan.alvarado7@gmail.com"]
|
11
|
+
spec.description = %q{Automatically regenarate tags files with Git hooks}
|
12
|
+
spec.summary = %q{Tagmatic will recreate the tags file for you whenever your HEAD changes}
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
end
|
metadata
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: tagmatic
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Adan Alvarado
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-07-22 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: Automatically regenarate tags files with Git hooks
|
42
|
+
email:
|
43
|
+
- adan.alvarado7@gmail.com
|
44
|
+
executables:
|
45
|
+
- tagmatic
|
46
|
+
extensions: []
|
47
|
+
extra_rdoc_files: []
|
48
|
+
files:
|
49
|
+
- .gitignore
|
50
|
+
- Gemfile
|
51
|
+
- LICENSE.txt
|
52
|
+
- README.md
|
53
|
+
- Rakefile
|
54
|
+
- bin/tagmatic
|
55
|
+
- lib/tagmatic.rb
|
56
|
+
- tagmatic.gemspec
|
57
|
+
homepage: ''
|
58
|
+
licenses:
|
59
|
+
- MIT
|
60
|
+
metadata: {}
|
61
|
+
post_install_message:
|
62
|
+
rdoc_options: []
|
63
|
+
require_paths:
|
64
|
+
- lib
|
65
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - '>='
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
75
|
+
requirements: []
|
76
|
+
rubyforge_project:
|
77
|
+
rubygems_version: 2.0.5
|
78
|
+
signing_key:
|
79
|
+
specification_version: 4
|
80
|
+
summary: Tagmatic will recreate the tags file for you whenever your HEAD changes
|
81
|
+
test_files: []
|