Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
79 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,25 @@ | ||
# ctags_bundler_rails | ||
|
||
CTags builder rake task for rails project. | ||
|
||
Originally used for [Sublime Text 2](http://sublimetext.com) with [CTags package](https://github.com/SublimeText/CTags). | ||
|
||
## Requirements | ||
|
||
* [Exuberant CTags](http://ctags.sourceforge.net) | ||
|
||
## Installation | ||
|
||
Add to ```Gemfile``` | ||
|
||
gem 'ctags_bundler_rails', :group => :development | ||
|
||
## Usage | ||
|
||
rake ctags:project # generate .tags for the project | ||
rake ctags:gems # generate .gemtags for all gems in gemfile | ||
rake ctags:all # generate both .tags and .gemtags | ||
It's also possible to change gem path to somewhere else, for example: | ||
|
||
rake ctags:all CTAGS_GEM_PATH=C:/your-awesome-ruby-dir/lib/ruby/gems/1.9.1/gems | ||
# ctags_bundler_rails | ||
|
||
CTags builder rake task for rails project. | ||
|
||
Originally used for [Sublime Text 2](http://sublimetext.com) with [CTags package](https://github.com/SublimeText/CTags). | ||
|
||
## Requirements | ||
|
||
* [Exuberant CTags](http://ctags.sourceforge.net) | ||
|
||
## Installation | ||
|
||
Add to ```Gemfile``` | ||
|
||
gem 'ctags_bundler_rails', :group => :development | ||
|
||
## Usage | ||
|
||
rake ctags:project # generate .tags for the project | ||
rake ctags:gems # generate .gemtags for all gems in gemfile | ||
rake ctags:all # generate both .tags and .gemtags | ||
|
||
It's also possible to change gem path to somewhere else, for example: | ||
|
||
rake ctags:all CTAGS_GEM_PATH=C:/your-awesome-ruby-dir/lib/ruby/gems/2.1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
# -*- encoding: utf-8 -*- | ||
Gem::Specification.new do |s| | ||
s.name = 'ctags_bundler_rails' | ||
s.version = '1.0.2' | ||
s.date = '2013-06-27' | ||
s.summary = "Add rake task for generating ctags from bundler" | ||
s.description = "Add rake task for generating ctags from bundler" | ||
s.authors = ["Roy Hadrianoro"] | ||
s.email = 'dev@maysora.com' | ||
s.files = Dir.glob("lib/**/*.*") | ||
s.homepage = 'https://github.com/Maysora/ctags_bundler_rails' | ||
s.license = 'MIT' | ||
|
||
s.add_dependency 'bundler', '>= 1.0' | ||
s.add_dependency 'rails', '>= 3.0' | ||
end | ||
# -*- encoding: utf-8 -*- | ||
Gem::Specification.new do |s| | ||
s.name = 'ctags_bundler_rails' | ||
s.version = '2.0.0' | ||
s.date = '2014-04-14' | ||
s.summary = "Add rake task for generating ctags from bundler" | ||
s.description = "Add rake task for generating ctags from bundler" | ||
s.authors = ["Roy Hadrianoro"] | ||
s.email = 'dev@maysora.com' | ||
s.files = Dir.glob("lib/**/*.*") | ||
s.homepage = 'https://github.com/Maysora/ctags_bundler_rails' | ||
s.license = 'MIT' | ||
|
||
s.add_dependency 'bundler', '>= 1.0' | ||
s.add_dependency 'rails', '>= 3.0' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,38 @@ | ||
namespace :ctags do | ||
desc 'Build tags for project files and gems in gemfile' | ||
task :all do | ||
%w(project gems).each do |t| | ||
Rake::Task["ctags:#{t}"].execute | ||
end | ||
end | ||
|
||
desc 'Build tags for project files' | ||
task :project do | ||
Dir.chdir Rails.root do | ||
system("ctags -R -f .tags .") | ||
end | ||
end | ||
|
||
desc 'Build tags for gems in gemfile' | ||
task :gems do | ||
Dir.chdir Rails.root do | ||
paths = Bundler.load.specs.reject{|s| s.name == 'rails_ctags_bundler'}.map(&:full_gem_path) | ||
system("ctags -R -f .gemtags #{paths.join(' ')}") | ||
|
||
if ENV['CTAGS_GEM_PATH'].present? && paths.present? | ||
current_gem_path = File.dirname(paths.first) | ||
if current_gem_path != ENV['CTAGS_GEM_PATH'] | ||
original = File.read(".gemtags") | ||
if String.method_defined?(:encode) | ||
original.encode!('UTF-16', 'UTF-8', :invalid => :replace, :replace => '') | ||
original.encode!('UTF-8', 'UTF-16') | ||
else | ||
require 'iconv' | ||
ic = Iconv.new('UTF-8', 'UTF-8//IGNORE') | ||
original = ic.iconv(original) | ||
end | ||
File.open(".gemtags", "w"){|f| f.write original.gsub(current_gem_path, ENV["CTAGS_GEM_PATH"])} | ||
end | ||
end | ||
end | ||
end | ||
end | ||
namespace :ctags do | ||
desc 'Build tags for project files and gems in gemfile' | ||
task :all do | ||
%w(project gems).each do |t| | ||
Rake::Task["ctags:#{t}"].execute | ||
end | ||
end | ||
|
||
desc 'Build tags for project files' | ||
task :project do | ||
Dir.chdir Rails.root do | ||
system("ctags -R -f .tags .") | ||
end | ||
end | ||
|
||
desc 'Build tags for gems in gemfile' | ||
task :gems do | ||
Dir.chdir Rails.root do | ||
paths = Bundler.load.specs.reject{|s| s.name == 'rails_ctags_bundler'}.map(&:full_gem_path) | ||
system("ctags -R -f .gemtags #{paths.join(' ')}") | ||
|
||
if ENV['CTAGS_GEM_PATH'].present? && (current_gem_path = Gem.path.detect{|p| File.exists? p}) | ||
if current_gem_path != ENV['CTAGS_GEM_PATH'] | ||
original = File.read(".gemtags") | ||
if String.method_defined?(:encode) | ||
original.encode!('UTF-16', 'UTF-8', :invalid => :replace, :replace => '') | ||
original.encode!('UTF-8', 'UTF-16') | ||
else | ||
require 'iconv' | ||
ic = Iconv.new('UTF-8', 'UTF-8//IGNORE') | ||
original = ic.iconv(original) | ||
end | ||
File.open(".gemtags", "w"){|f| f.write original.gsub(current_gem_path, ENV["CTAGS_GEM_PATH"])} | ||
end | ||
end | ||
end | ||
end | ||
end |