Skip to content

Commit

Permalink
2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Maysora committed Apr 14, 2014
1 parent 63553ea commit 6787cae
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 80 deletions.
50 changes: 25 additions & 25 deletions README.md
@@ -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
32 changes: 16 additions & 16 deletions ctags_bundler_rails.gemspec
@@ -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
77 changes: 38 additions & 39 deletions lib/tasks/tasks.rake
@@ -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

0 comments on commit 6787cae

Please sign in to comment.