GithubHelp home page GithubHelp logo

mactag's Introduction

Mactag

Mactag is a Ruby gem for Ruby developers that do their development in an editor that supports Ctags (Emacs, Vim, TextMate, ...). With Ctags you can follow tags (of functions, variables, macros, whatever) to their definitions.

Mactag works with both Ruby projects and Rails applications.

Exuberant Ctags

Mactag requires a tool called Exuberant Ctags, which is used to create the tags file. Install it if you don't have it already. Some systems includes a ctags exectuable. If you use that and you have trouble creating the tags file, then install it from your package manager instead. The package is called ctags in Homebrew and exuberant-ctags in Ubuntu.

Installation

Install the gem:

$ gem install mactag

Add mactag to the Gemfile (add to development group in Rails):

# Ruby gem
gem 'mactag'

# Rails app
group :development do
  gem 'mactag'
end

Then run bundle install.

Configuration

You specify what you want to index in the configuration file (default is config/mactag.rb). To generate such as file with a basic setup, run the command:

 $ mactag new

Or if you want the config file someplace else:

 $ mactag new conf/mactag.rb

That will generate a configuration file looking something like this:

Mactag.configure do |config|
  # Use RVM to locate project gems.
  # config.rvm = false

  # Path to gems. No need to set this when RVM is used!
  # config.gem_home = '/Library/Ruby/Gems/1.8/gems'

  # Name of tags file to create.
  # config.tags_file = '.tags'

  # Command used to create the tags table. {INPUT} and {OUTPUT} are required!
  # config.binary = '/usr/local/Cellar/ctags/5.8/bin/ctags -e -o {OUTPUT} {INPUT}'
end

Mactag do
  # Index current project.
  # index :lib

  # Index current Rails project.
  # index :app

  # Index all models and helpers.
  # index 'app/models/*.rb', 'app/helpers/*.rb'

  # Index the gems carrierwave and redcarpet.
  # index 'carrierwave', 'redcarpet'

  # Index the gem simple_form version 1.5.2.
  # index 'simple_form', :version => '1.5.2'

  # Index rails.
  # index :rails

  # Index rails except action mailer.
  # index :rails, :except => :actionmailer

  # Index only rails packages activerecord and activesupport.
  # index :rails, :only => %w(activerecord activesupport)

  # Index rails, version 3.1.3.
  # index :rails, :version => '3.1.3'
end

Usage

When you are done configuring, create the tags file with the command:

$ mactag

Or if the config file is someplace else than config/mactag.rb.

$ mactag conf/mactag.rb

License

Copyright (c) 2010-2012 Johan Andersson, released under the MIT license

mactag's People

Contributors

rejeep avatar rwc9u avatar stjernstrom avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

mactag's Issues

Add support for RVM

Add configuration option to support RVM. If enabled, use that as gem_home.

No such file to load -- tasks/mactag.rake

Looks like adding mactag ruins rake command in my rails project. Check out call stack.

Rails 3.0.9
mactag 0.7.0

$ rake -vT
rake aborted!
No such file to load -- tasks/mactag.rake
org/jruby/RubyKernel.java:1063:in load' /home/alex/.rvm/gems/jruby-1.6.2@report/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:235:inload'
/home/alex/.rvm/gems/jruby-1.6.2@report/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:225:in load_dependency' /home/alex/.rvm/gems/jruby-1.6.2@report/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:596:innew_constants_in'
/home/alex/.rvm/gems/jruby-1.6.2@report/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:595:in new_constants_in' /home/alex/.rvm/gems/jruby-1.6.2@report/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:225:inload_dependency'
/home/alex/.rvm/gems/jruby-1.6.2@report/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:235:in load' /home/alex/.rvm/gems/jruby-1.6.2@report/gems/mactag-0.7.0/lib/mactag/railtie.rb:4:inRailtie'

1 module Mactag
2   class Railtie < Rails::Railtie
3     rake_tasks do
4       load 'tasks/mactag.rake'
5     end
6   end
7 end

Generate tags for development and dependent gems

Hi,

This is very nice. Thanks!

I am using rvm and bundler. mactag generates tags for gems listed in the default group of the Gemfile. I have two questions:

  • Is there some way to generate tags for gems in the development group?
  • Is there some way to generate tags for dependent gems. Gem A is in the Gemfile and it depends on gems B, C. I would like to generate tags for B and C as well.

Thanks, Rohit

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.