mactag 0.4.0 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gemtest +0 -0
 - data/README.markdown +36 -65
 - data/Rakefile +12 -0
 - data/VERSION +1 -1
 - data/lib/generators/mactag/templates/mactag.rb +43 -19
 - data/lib/mactag.rb +2 -8
 - data/lib/mactag/builder.rb +24 -22
 - data/lib/mactag/bundler.rb +36 -0
 - data/lib/mactag/config.rb +6 -13
 - data/lib/mactag/ctags.rb +2 -2
 - data/lib/mactag/dsl.rb +16 -4
 - data/lib/mactag/errors.rb +32 -0
 - data/lib/mactag/tag.rb +3 -1
 - data/lib/mactag/tag/app.rb +3 -3
 - data/lib/mactag/tag/gem.rb +33 -33
 - data/lib/mactag/tag/plugin.rb +21 -15
 - data/lib/mactag/tag/rails.rb +22 -29
 - data/lib/tasks/mactag.rake +3 -16
 - data/spec/mactag/builder_spec.rb +68 -49
 - data/spec/mactag/bundler_spec.rb +4 -0
 - data/spec/mactag/config_spec.rb +13 -19
 - data/spec/mactag/ctags_spec.rb +11 -11
 - data/spec/mactag/dsl_spec.rb +46 -19
 - data/spec/mactag/tag/app_spec.rb +4 -9
 - data/spec/mactag/tag/gem_spec.rb +61 -65
 - data/spec/mactag/tag/plugin_spec.rb +42 -31
 - data/spec/mactag/tag/rails_spec.rb +54 -43
 - data/spec/mactag/tag_spec.rb +5 -0
 - metadata +23 -41
 - data/lib/mactag/event_handler.rb +0 -22
 - data/lib/mactag/server.rb +0 -48
 - data/lib/mactag/tags_file.rb +0 -31
 - data/spec/mactag/server_spec.rb +0 -4
 - data/spec/mactag/tags_file_spec.rb +0 -39
 
    
        data/.gemtest
    ADDED
    
    | 
         
            File without changes
         
     | 
    
        data/README.markdown
    CHANGED
    
    | 
         @@ -1,81 +1,49 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # Mactag
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            Mactag is a plugin for Rails developers that do their development in
         
     | 
| 
       4 
     | 
    
         
            -
            an editor that supports Ctags (Emacs, Vim, TextMate,  
     | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
      
 4 
     | 
    
         
            +
            an editor that supports Ctags (Emacs, Vim, TextMate, ...). With Ctags
         
     | 
| 
      
 5 
     | 
    
         
            +
            you can follow tags (of functions, variables, macros, whatever) to
         
     | 
| 
      
 6 
     | 
    
         
            +
            their definitions.
         
     | 
| 
       7 
7 
     | 
    
         | 
| 
       8 
8 
     | 
    
         | 
| 
       9 
9 
     | 
    
         
             
            # Exuberant Ctags
         
     | 
| 
       10 
10 
     | 
    
         
             
            First off, you must install [Ctags](http://ctags.sourceforge.net/).
         
     | 
| 
       11 
     | 
    
         
            -
            Some systems comes with a ctags command already. If you have the 
     | 
| 
       12 
     | 
    
         
            -
            executable, but have problems creating the tags file. Then make 
     | 
| 
       13 
     | 
    
         
            -
            that you are using **Exuberant Ctags** and not some other version.
         
     | 
| 
      
 11 
     | 
    
         
            +
            Some systems comes with a **ctags** command already. If you have the
         
     | 
| 
      
 12 
     | 
    
         
            +
            ctags executable, but have problems creating the tags file. Then make
         
     | 
| 
      
 13 
     | 
    
         
            +
            sure that you are using **Exuberant Ctags** and not some other version.
         
     | 
| 
       14 
14 
     | 
    
         | 
| 
       15 
15 
     | 
    
         | 
| 
       16 
16 
     | 
    
         
             
            # Installation
         
     | 
| 
       17 
17 
     | 
    
         | 
| 
       18 
     | 
    
         
            -
            ##  
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
            ### Plugin
         
     | 
| 
       21 
     | 
    
         
            -
            Install the plugin:
         
     | 
| 
       22 
     | 
    
         
            -
                $ ./script/plugin install git://github.com/rejeep/mactag.git --revision 'tags/v0.0.5'
         
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
            ### Gem
         
     | 
| 
       25 
     | 
    
         
            -
            Install the gem:
         
     | 
| 
       26 
     | 
    
         
            -
                $ gem install mactag --version='0.0.5'
         
     | 
| 
       27 
     | 
    
         
            -
                
         
     | 
| 
       28 
     | 
    
         
            -
            Load the gem in **config/environments/development.rb**:
         
     | 
| 
       29 
     | 
    
         
            -
                config.gem 'mactag'
         
     | 
| 
       30 
     | 
    
         
            -
                
         
     | 
| 
       31 
     | 
    
         
            -
            Load the rake tasks in **Rakefile**.
         
     | 
| 
       32 
     | 
    
         
            -
                require 'mactag/tasks'
         
     | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
       35 
     | 
    
         
            -
            ## Rails 3.x
         
     | 
| 
       36 
     | 
    
         
            -
             
     | 
| 
       37 
     | 
    
         
            -
            ### Plugin
         
     | 
| 
      
 18 
     | 
    
         
            +
            ## Plugin
         
     | 
| 
       38 
19 
     | 
    
         
             
            Install the plugin:
         
     | 
| 
       39 
20 
     | 
    
         
             
                $ rails plugin install git://github.com/rejeep/mactag.git
         
     | 
| 
       40 
21 
     | 
    
         | 
| 
       41 
     | 
    
         
            -
             
     | 
| 
      
 22 
     | 
    
         
            +
            ## Gem
         
     | 
| 
       42 
23 
     | 
    
         
             
            Install the gem:
         
     | 
| 
       43 
24 
     | 
    
         
             
                $ gem install mactag
         
     | 
| 
       44 
25 
     | 
    
         | 
| 
       45 
     | 
    
         
            -
             
     | 
| 
      
 26 
     | 
    
         
            +
            Add mactag to the **Gemfile**:
         
     | 
| 
       46 
27 
     | 
    
         
             
                group :development do
         
     | 
| 
       47 
     | 
    
         
            -
                  gem 'mactag' 
     | 
| 
      
 28 
     | 
    
         
            +
                  gem 'mactag'
         
     | 
| 
       48 
29 
     | 
    
         
             
                end
         
     | 
| 
       49 
30 
     | 
    
         | 
| 
       50 
31 
     | 
    
         | 
| 
       51 
32 
     | 
    
         
             
            # Configuration
         
     | 
| 
       52 
     | 
    
         
            -
            Generate a basic configuration file:
         
     | 
| 
       53 
33 
     | 
    
         | 
| 
       54 
     | 
    
         
            -
             
     | 
| 
       55 
     | 
    
         
            -
             
     | 
| 
       56 
     | 
    
         
            -
             
     | 
| 
       57 
     | 
    
         
            -
            ## Rails 3.x
         
     | 
| 
      
 34 
     | 
    
         
            +
            To generate a template configuration file (**config/mactag.rb**),
         
     | 
| 
      
 35 
     | 
    
         
            +
            which contains a basic setup and some examples of how to configure
         
     | 
| 
      
 36 
     | 
    
         
            +
            Mactag, use the **mactag** generator:
         
     | 
| 
       58 
37 
     | 
    
         
             
                $ rails generate mactag
         
     | 
| 
       59 
38 
     | 
    
         | 
| 
       60 
     | 
    
         
            -
            This will create the file **config/mactag.rb**, which contains some
         
     | 
| 
       61 
     | 
    
         
            -
            examples of how to configure Mactag.
         
     | 
| 
       62 
     | 
    
         
            -
             
     | 
| 
       63 
     | 
    
         
            -
            ## Options
         
     | 
| 
       64 
     | 
    
         
            -
             
     | 
| 
       65 
     | 
    
         
            -
            * **Mactag::Config.rvm:** If true, use RVM gems. Defaults to **true**
         
     | 
| 
       66 
     | 
    
         
            -
            * **Mactag::Config.gem_home:** The path where the gems are located. Defaults to **/Library/Ruby/Gems/1.8/gems**
         
     | 
| 
       67 
     | 
    
         
            -
            * **Mactag::Config.binary:** The command to run when creating the TAGS-file. Defaults to **ctags -o {OUTPUT} -e {INPUT}**
         
     | 
| 
       68 
     | 
    
         
            -
            * **Mactag::Config.tags_file:** Name of output file. Defaults to **TAGS**
         
     | 
| 
       69 
     | 
    
         
            -
            * **Mactag::Config.tags_dir:** Name of output directory to store tags files when using FSSM. Defaults to **.tags**
         
     | 
| 
       70 
     | 
    
         
            -
             
     | 
| 
       71 
39 
     | 
    
         
             
            ## Example mactag.rb file
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
       72 
41 
     | 
    
         
             
                Mactag::Config.rvm = false
         
     | 
| 
       73 
42 
     | 
    
         
             
                Mactag::Config.gem_home = '/usr/lib/ruby/gems/1.8/gems'
         
     | 
| 
       74 
43 
     | 
    
         
             
                Mactag::Config.binary = 'etags -o {OUTPUT} {INPUT}'
         
     | 
| 
       75 
44 
     | 
    
         
             
                Mactag::Config.tags_file = 'TAGS'
         
     | 
| 
       76 
     | 
    
         
            -
                Mactag::Config.tags_dir = '.tags' # See FSSM
         
     | 
| 
       77 
45 
     | 
    
         | 
| 
       78 
     | 
    
         
            -
                Mactag do 
     | 
| 
      
 46 
     | 
    
         
            +
                Mactag do
         
     | 
| 
       79 
47 
     | 
    
         
             
                  app 'app/**/*.rb', 'lib/*.rb'
         
     | 
| 
       80 
48 
     | 
    
         | 
| 
       81 
49 
     | 
    
         
             
                  plugins 'thinking-sphinx', 'whenever'
         
     | 
| 
         @@ -85,29 +53,32 @@ examples of how to configure Mactag. 
     | 
|
| 
       85 
53 
     | 
    
         | 
| 
       86 
54 
     | 
    
         
             
                  rails :except => :actionmailer, :version => '2.3.5'
         
     | 
| 
       87 
55 
     | 
    
         
             
                end
         
     | 
| 
      
 56 
     | 
    
         
            +
                
         
     | 
| 
      
 57 
     | 
    
         
            +
            ## Options
         
     | 
| 
      
 58 
     | 
    
         
            +
            The available configuration options are described below.
         
     | 
| 
       88 
59 
     | 
    
         | 
| 
       89 
     | 
    
         
            -
             
     | 
| 
       90 
     | 
    
         
            -
             
     | 
| 
       91 
     | 
    
         
            -
             
     | 
| 
       92 
     | 
    
         
            -
             
     | 
| 
      
 60 
     | 
    
         
            +
            ### Mactag::Config.rvm
         
     | 
| 
      
 61 
     | 
    
         
            +
            If true, use [Rvm](http://rvm.beginrescueend.com/) when indexing gems.  
         
     | 
| 
      
 62 
     | 
    
         
            +
            Defaults to: `true`
         
     | 
| 
       93 
63 
     | 
    
         | 
| 
       94 
     | 
    
         
            -
             
     | 
| 
       95 
     | 
    
         
            -
             
     | 
| 
       96 
     | 
    
         
            -
             
     | 
| 
       97 
     | 
    
         
            -
             
     | 
| 
      
 64 
     | 
    
         
            +
            ### Mactag::Config.gem_home
         
     | 
| 
      
 65 
     | 
    
         
            +
            Path to gems. No need to set this when using **Mactag::Config.rvm**.  
         
     | 
| 
      
 66 
     | 
    
         
            +
            Defaults to: `/Library/Ruby/Gems/1.8/gems`
         
     | 
| 
      
 67 
     | 
    
         
            +
             
         
     | 
| 
      
 68 
     | 
    
         
            +
            ### Mactag::Config.binary
         
     | 
| 
      
 69 
     | 
    
         
            +
            The command to run when creating the TAGS-file. **{OUTPUT}** will be
         
     | 
| 
      
 70 
     | 
    
         
            +
            replaced with the value of **Mactag::Config.tags_file**. **{INPUT}**
         
     | 
| 
      
 71 
     | 
    
         
            +
            will be replaced with all files to index.  
         
     | 
| 
      
 72 
     | 
    
         
            +
            Defaults to: `ctags -o {OUTPUT} -e {INPUT}`
         
     | 
| 
       98 
73 
     | 
    
         | 
| 
       99 
     | 
    
         
            -
             
     | 
| 
      
 74 
     | 
    
         
            +
            ### Mactag::Config.tags_file
         
     | 
| 
      
 75 
     | 
    
         
            +
            Name of the output tags file.  
         
     | 
| 
      
 76 
     | 
    
         
            +
            Defaults to: `TAGS`
         
     | 
| 
       100 
77 
     | 
    
         | 
| 
       101 
     | 
    
         
            -
            Then start the server that keeps track of changes
         
     | 
| 
       102 
     | 
    
         
            -
                rake mactag:server
         
     | 
| 
       103 
     | 
    
         
            -
                
         
     | 
| 
       104 
     | 
    
         
            -
            This creates a couple of tags files in **Mactag::Config.tags_dir**
         
     | 
| 
       105 
     | 
    
         
            -
            (one for each source file). This means your editor must support
         
     | 
| 
       106 
     | 
    
         
            -
            multiple tags files.
         
     | 
| 
       107 
78 
     | 
    
         | 
| 
       108 
     | 
    
         
            -
             
     | 
| 
       109 
     | 
    
         
            -
             
     | 
| 
       110 
     | 
    
         
            -
             
     | 
| 
      
 79 
     | 
    
         
            +
            # Usage
         
     | 
| 
      
 80 
     | 
    
         
            +
            To create the TAGS file, simply run:
         
     | 
| 
      
 81 
     | 
    
         
            +
                $ rake mactag
         
     | 
| 
       111 
82 
     | 
    
         | 
| 
       112 
83 
     | 
    
         | 
| 
       113 
84 
     | 
    
         
             
            # License
         
     | 
    
        data/Rakefile
    ADDED
    
    
    
        data/VERSION
    CHANGED
    
    | 
         @@ -1 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            0. 
     | 
| 
      
 1 
     | 
    
         
            +
            0.5.1
         
     | 
| 
         @@ -1,34 +1,52 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ##
         
     | 
| 
       2 
2 
     | 
    
         
             
            #
         
     | 
| 
       3 
     | 
    
         
            -
            #  
     | 
| 
       4 
     | 
    
         
            -
            # 
     | 
| 
       5 
     | 
    
         
            -
            # 
     | 
| 
      
 3 
     | 
    
         
            +
            # Rvm support or not. Mactag will automatically set path to gems.
         
     | 
| 
      
 4 
     | 
    
         
            +
            #
         
     | 
| 
      
 5 
     | 
    
         
            +
            # Defaults to: true
         
     | 
| 
      
 6 
     | 
    
         
            +
            #
         
     | 
| 
      
 7 
     | 
    
         
            +
            # Example:
         
     | 
| 
      
 8 
     | 
    
         
            +
            #   Mactag::Config.rvm = false
         
     | 
| 
       6 
9 
     | 
    
         
             
            #
         
     | 
| 
       7 
10 
     | 
    
         | 
| 
       8 
11 
     | 
    
         
             
            ##
         
     | 
| 
       9 
12 
     | 
    
         
             
            #
         
     | 
| 
       10 
     | 
    
         
            -
            # Path to gems. 
     | 
| 
       11 
     | 
    
         
            -
            # 
     | 
| 
      
 13 
     | 
    
         
            +
            # Path to gems.
         
     | 
| 
      
 14 
     | 
    
         
            +
            #
         
     | 
| 
      
 15 
     | 
    
         
            +
            # Change to whatever your system is using, if not the default. Most
         
     | 
| 
      
 16 
     | 
    
         
            +
            # GNU/Linux systems use: /usr/lib/ruby/gems/1.8/gems
         
     | 
| 
      
 17 
     | 
    
         
            +
            #
         
     | 
| 
      
 18 
     | 
    
         
            +
            # (You don't need to set this when Mactag::Config.rvm is true)
         
     | 
| 
      
 19 
     | 
    
         
            +
            #
         
     | 
| 
      
 20 
     | 
    
         
            +
            # Defaults to: '/Library/Ruby/Gems/1.8/gems'
         
     | 
| 
       12 
21 
     | 
    
         
             
            #
         
     | 
| 
       13 
     | 
    
         
            -
            #  
     | 
| 
       14 
     | 
    
         
            -
            # 
         
     | 
| 
       15 
     | 
    
         
            -
            # Change to whatever your system is using, if not the default.
         
     | 
| 
       16 
     | 
    
         
            -
            # Most GNU/Linux systems:
         
     | 
| 
      
 22 
     | 
    
         
            +
            # Example:
         
     | 
| 
       17 
23 
     | 
    
         
             
            #   Mactag::Config.gem_home = '/usr/lib/ruby/gems/1.8/gems'
         
     | 
| 
       18 
24 
     | 
    
         
             
            #
         
     | 
| 
       19 
25 
     | 
    
         | 
| 
       20 
26 
     | 
    
         
             
            ##
         
     | 
| 
       21 
27 
     | 
    
         
             
            #
         
     | 
| 
       22 
     | 
    
         
            -
            #  
     | 
| 
       23 
     | 
    
         
            -
            # 
     | 
| 
       24 
     | 
    
         
            -
            #  
     | 
| 
       25 
     | 
    
         
            -
            # 
     | 
| 
      
 28 
     | 
    
         
            +
            # Name of tags file.
         
     | 
| 
      
 29 
     | 
    
         
            +
            #
         
     | 
| 
      
 30 
     | 
    
         
            +
            # Defaults to: 'TAGS'
         
     | 
| 
      
 31 
     | 
    
         
            +
            #
         
     | 
| 
      
 32 
     | 
    
         
            +
            # Example:
         
     | 
| 
      
 33 
     | 
    
         
            +
            #   Mactag::Config.tags_file = '.tags'
         
     | 
| 
       26 
34 
     | 
    
         
             
            #
         
     | 
| 
       27 
35 
     | 
    
         | 
| 
       28 
36 
     | 
    
         
             
            ##
         
     | 
| 
       29 
37 
     | 
    
         
             
            #
         
     | 
| 
       30 
     | 
    
         
            -
            #  
     | 
| 
      
 38 
     | 
    
         
            +
            # This is the command used to create the TAGS table.
         
     | 
| 
      
 39 
     | 
    
         
            +
            #
         
     | 
| 
      
 40 
     | 
    
         
            +
            # The command must specify:
         
     | 
| 
      
 41 
     | 
    
         
            +
            #   {INPUT}  - replaced by the input files to tag
         
     | 
| 
      
 42 
     | 
    
         
            +
            #   {OUTPUT} - replaced by Mactag::Config.tags_file
         
     | 
| 
      
 43 
     | 
    
         
            +
            #
         
     | 
| 
      
 44 
     | 
    
         
            +
            # Defaults to: 'ctags -o {OUTPUT} -e {INPUT}'
         
     | 
| 
       31 
45 
     | 
    
         
             
            #
         
     | 
| 
      
 46 
     | 
    
         
            +
            # Example:
         
     | 
| 
      
 47 
     | 
    
         
            +
            #   Mactag::Config.binary = '/usr/local/Cellar/ctags/5.8/bin/ctags -e -o {OUTPUT} {INPUT}'
         
     | 
| 
      
 48 
     | 
    
         
            +
            #
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
       32 
50 
     | 
    
         
             
            Mactag do
         
     | 
| 
       33 
51 
     | 
    
         
             
              ##
         
     | 
| 
       34 
52 
     | 
    
         
             
              #
         
     | 
| 
         @@ -47,7 +65,7 @@ Mactag do 
     | 
|
| 
       47 
65 
     | 
    
         
             
              # Index the gems paperclip and authlogic.
         
     | 
| 
       48 
66 
     | 
    
         
             
              #   gems 'paperclip', 'authlogic'
         
     | 
| 
       49 
67 
     | 
    
         
             
              #
         
     | 
| 
       50 
     | 
    
         
            -
             
     | 
| 
      
 68 
     | 
    
         
            +
             
     | 
| 
       51 
69 
     | 
    
         
             
              ##
         
     | 
| 
       52 
70 
     | 
    
         
             
              #
         
     | 
| 
       53 
71 
     | 
    
         
             
              # Index the gem formtastic version 0.9.7.
         
     | 
| 
         @@ -59,16 +77,22 @@ Mactag do 
     | 
|
| 
       59 
77 
     | 
    
         
             
              # Index all rails packages, except actionmailer.
         
     | 
| 
       60 
78 
     | 
    
         
             
              #   rails :except => :actionmailer
         
     | 
| 
       61 
79 
     | 
    
         
             
              #
         
     | 
| 
       62 
     | 
    
         
            -
             
     | 
| 
      
 80 
     | 
    
         
            +
             
     | 
| 
       63 
81 
     | 
    
         
             
              ##
         
     | 
| 
       64 
82 
     | 
    
         
             
              #
         
     | 
| 
       65 
83 
     | 
    
         
             
              # Index only rails packages activerecord and activesupport.
         
     | 
| 
       66 
84 
     | 
    
         
             
              #   rails :only => [:activerecord, :active_support]
         
     | 
| 
       67 
85 
     | 
    
         
             
              #
         
     | 
| 
       68 
     | 
    
         
            -
             
     | 
| 
      
 86 
     | 
    
         
            +
             
     | 
| 
      
 87 
     | 
    
         
            +
              ##
         
     | 
| 
      
 88 
     | 
    
         
            +
              #
         
     | 
| 
      
 89 
     | 
    
         
            +
              # Index all rails packages, version 3.0.0.
         
     | 
| 
      
 90 
     | 
    
         
            +
              #   rails :version => '3.0.0'
         
     | 
| 
      
 91 
     | 
    
         
            +
              #
         
     | 
| 
      
 92 
     | 
    
         
            +
             
     | 
| 
       69 
93 
     | 
    
         
             
              ##
         
     | 
| 
       70 
94 
     | 
    
         
             
              #
         
     | 
| 
       71 
     | 
    
         
            -
              # Index all rails packages, version  
     | 
| 
       72 
     | 
    
         
            -
              #   rails 
     | 
| 
      
 95 
     | 
    
         
            +
              # Index all rails packages, same version as current application.
         
     | 
| 
      
 96 
     | 
    
         
            +
              #   rails
         
     | 
| 
       73 
97 
     | 
    
         
             
              #
         
     | 
| 
       74 
98 
     | 
    
         
             
            end
         
     | 
    
        data/lib/mactag.rb
    CHANGED
    
    | 
         @@ -4,18 +4,12 @@ require 'mactag/builder' 
     | 
|
| 
       4 
4 
     | 
    
         
             
            require 'mactag/dsl'
         
     | 
| 
       5 
5 
     | 
    
         
             
            require 'mactag/tag'
         
     | 
| 
       6 
6 
     | 
    
         
             
            require 'mactag/ctags'
         
     | 
| 
       7 
     | 
    
         
            -
            require 'mactag/ 
     | 
| 
       8 
     | 
    
         
            -
            require 'mactag/ 
     | 
| 
       9 
     | 
    
         
            -
            require 'mactag/tags_file'
         
     | 
| 
      
 7 
     | 
    
         
            +
            require 'mactag/bundler'
         
     | 
| 
      
 8 
     | 
    
         
            +
            require 'mactag/errors'
         
     | 
| 
       10 
9 
     | 
    
         | 
| 
       11 
10 
     | 
    
         
             
            module Mactag
         
     | 
| 
       12 
11 
     | 
    
         
             
              autoload :Bundler, 'bundler'
         
     | 
| 
       13 
12 
     | 
    
         
             
              autoload :Rails, 'rails'
         
     | 
| 
       14 
     | 
    
         
            -
              autoload :FSSM, 'fssm'
         
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
              def self.warn(message)
         
     | 
| 
       17 
     | 
    
         
            -
                STDERR.puts(message)
         
     | 
| 
       18 
     | 
    
         
            -
              end
         
     | 
| 
       19 
13 
     | 
    
         
             
            end
         
     | 
| 
       20 
14 
     | 
    
         | 
| 
       21 
15 
     | 
    
         
             
            def Mactag(&block)
         
     | 
    
        data/lib/mactag/builder.rb
    CHANGED
    
    | 
         @@ -29,40 +29,42 @@ module Mactag 
     | 
|
| 
       29 
29 
     | 
    
         
             
                end
         
     | 
| 
       30 
30 
     | 
    
         | 
| 
       31 
31 
     | 
    
         
             
                def all
         
     | 
| 
       32 
     | 
    
         
            -
                  @ 
     | 
| 
      
 32 
     | 
    
         
            +
                  @all ||= @tags.collect!(&:tag)
         
     | 
| 
       33 
33 
     | 
    
         
             
                end
         
     | 
| 
       34 
34 
     | 
    
         | 
| 
       35 
     | 
    
         
            -
                def  
     | 
| 
      
 35 
     | 
    
         
            +
                def has_gems?
         
     | 
| 
       36 
36 
     | 
    
         
             
                  all.flatten.compact.any?
         
     | 
| 
       37 
37 
     | 
    
         
             
                end
         
     | 
| 
       38 
38 
     | 
    
         | 
| 
       39 
     | 
    
         
            -
                 
     | 
| 
       40 
     | 
    
         
            -
                   
     | 
| 
       41 
     | 
    
         
            -
                     
     | 
| 
       42 
     | 
    
         
            -
             
     | 
| 
      
 39 
     | 
    
         
            +
                class << self
         
     | 
| 
      
 40 
     | 
    
         
            +
                  def create
         
     | 
| 
      
 41 
     | 
    
         
            +
                    unless gem_home_exists?
         
     | 
| 
      
 42 
     | 
    
         
            +
                      raise Mactag::MactagError.new("Specified gem home directory does not exist: #{Mactag::Config.gem_home}")
         
     | 
| 
      
 43 
     | 
    
         
            +
                    end
         
     | 
| 
       43 
44 
     | 
    
         | 
| 
       44 
     | 
    
         
            -
             
     | 
| 
       45 
     | 
    
         
            -
             
     | 
| 
      
 45 
     | 
    
         
            +
                    if builder.has_gems?
         
     | 
| 
      
 46 
     | 
    
         
            +
                      Mactag::Ctags.new(@builder.files, Mactag::Config.tags_file).create
         
     | 
| 
       46 
47 
     | 
    
         | 
| 
       47 
     | 
    
         
            -
             
     | 
| 
       48 
     | 
    
         
            -
             
     | 
| 
       49 
     | 
    
         
            -
             
     | 
| 
      
 48 
     | 
    
         
            +
                      puts 'Successfully generated TAGS file'
         
     | 
| 
      
 49 
     | 
    
         
            +
                    else
         
     | 
| 
      
 50 
     | 
    
         
            +
                      raise Mactag::MactagError.new('Nothing to tag')
         
     | 
| 
      
 51 
     | 
    
         
            +
                    end
         
     | 
| 
       50 
52 
     | 
    
         
             
                  end
         
     | 
| 
       51 
     | 
    
         
            -
                end
         
     | 
| 
       52 
53 
     | 
    
         | 
| 
       53 
     | 
    
         
            -
             
     | 
| 
       54 
     | 
    
         
            -
             
     | 
| 
      
 54 
     | 
    
         
            +
                  def generate(&block)
         
     | 
| 
      
 55 
     | 
    
         
            +
                    @builder = Mactag::Builder.new
         
     | 
| 
       55 
56 
     | 
    
         | 
| 
       56 
     | 
    
         
            -
             
     | 
| 
       57 
     | 
    
         
            -
             
     | 
| 
       58 
     | 
    
         
            -
             
     | 
| 
      
 57 
     | 
    
         
            +
                    dsl = Mactag::Dsl.new(@builder)
         
     | 
| 
      
 58 
     | 
    
         
            +
                    dsl.instance_eval(&block)
         
     | 
| 
      
 59 
     | 
    
         
            +
                  end
         
     | 
| 
       59 
60 
     | 
    
         | 
| 
       60 
     | 
    
         
            -
             
     | 
| 
       61 
     | 
    
         
            -
             
     | 
| 
       62 
     | 
    
         
            -
             
     | 
| 
      
 61 
     | 
    
         
            +
                  def gem_home_exists?
         
     | 
| 
      
 62 
     | 
    
         
            +
                    File.directory?(Mactag::Config.gem_home)
         
     | 
| 
      
 63 
     | 
    
         
            +
                  end
         
     | 
| 
       63 
64 
     | 
    
         | 
| 
       64 
     | 
    
         
            -
             
     | 
| 
       65 
     | 
    
         
            -
             
     | 
| 
      
 65 
     | 
    
         
            +
                  def builder
         
     | 
| 
      
 66 
     | 
    
         
            +
                    @builder
         
     | 
| 
      
 67 
     | 
    
         
            +
                  end
         
     | 
| 
       66 
68 
     | 
    
         
             
                end
         
     | 
| 
       67 
69 
     | 
    
         
             
              end
         
     | 
| 
       68 
70 
     | 
    
         
             
            end
         
     | 
| 
         @@ -0,0 +1,36 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Mactag
         
     | 
| 
      
 2 
     | 
    
         
            +
              ##
         
     | 
| 
      
 3 
     | 
    
         
            +
              #
         
     | 
| 
      
 4 
     | 
    
         
            +
              # For fetching information from Bundler regarding what gems are
         
     | 
| 
      
 5 
     | 
    
         
            +
              # used.
         
     | 
| 
      
 6 
     | 
    
         
            +
              #
         
     | 
| 
      
 7 
     | 
    
         
            +
              class Bundler
         
     | 
| 
      
 8 
     | 
    
         
            +
                def gems
         
     | 
| 
      
 9 
     | 
    
         
            +
                  dependencies.map do |dependency|
         
     | 
| 
      
 10 
     | 
    
         
            +
                    Mactag::Tag::Gem.new(dependency, specs[dependency])
         
     | 
| 
      
 11 
     | 
    
         
            +
                  end
         
     | 
| 
      
 12 
     | 
    
         
            +
                end
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                private
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
                def specs
         
     | 
| 
      
 18 
     | 
    
         
            +
                  @specs ||= runtime.specs.inject({}) do |hash, spec|
         
     | 
| 
      
 19 
     | 
    
         
            +
                    hash[spec.name] = spec.version.to_s
         
     | 
| 
      
 20 
     | 
    
         
            +
                    hash
         
     | 
| 
      
 21 
     | 
    
         
            +
                  end
         
     | 
| 
      
 22 
     | 
    
         
            +
                end
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
                def dependencies
         
     | 
| 
      
 25 
     | 
    
         
            +
                  default = runtime.dependencies.select { |dependency|
         
     | 
| 
      
 26 
     | 
    
         
            +
                    dependency.groups.include?(:default)
         
     | 
| 
      
 27 
     | 
    
         
            +
                  }.collect(&:name)
         
     | 
| 
      
 28 
     | 
    
         
            +
                  default.delete('rails')
         
     | 
| 
      
 29 
     | 
    
         
            +
                  default
         
     | 
| 
      
 30 
     | 
    
         
            +
                end
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
                def runtime
         
     | 
| 
      
 33 
     | 
    
         
            +
                  @runtime ||= ::Bundler.load
         
     | 
| 
      
 34 
     | 
    
         
            +
                end
         
     | 
| 
      
 35 
     | 
    
         
            +
              end
         
     | 
| 
      
 36 
     | 
    
         
            +
            end
         
     | 
    
        data/lib/mactag/config.rb
    CHANGED
    
    | 
         @@ -21,10 +21,13 @@ module Mactag 
     | 
|
| 
       21 
21 
     | 
    
         | 
| 
       22 
22 
     | 
    
         
             
                ##
         
     | 
| 
       23 
23 
     | 
    
         
             
                #
         
     | 
| 
       24 
     | 
    
         
            -
                #  
     | 
| 
      
 24 
     | 
    
         
            +
                # If using Ruby Version Manager (RVM), setting this option to true
         
     | 
| 
      
 25 
     | 
    
         
            +
                # will enable Mactag to find out the gem path automatically.
         
     | 
| 
      
 26 
     | 
    
         
            +
                #
         
     | 
| 
      
 27 
     | 
    
         
            +
                #   Mactag::Config.rvm = false
         
     | 
| 
       25 
28 
     | 
    
         
             
                #
         
     | 
| 
       26 
     | 
    
         
            -
                @@ 
     | 
| 
       27 
     | 
    
         
            -
                cattr_accessor : 
     | 
| 
      
 29 
     | 
    
         
            +
                @@rvm = true
         
     | 
| 
      
 30 
     | 
    
         
            +
                cattr_accessor :rvm
         
     | 
| 
       28 
31 
     | 
    
         | 
| 
       29 
32 
     | 
    
         
             
                ##
         
     | 
| 
       30 
33 
     | 
    
         
             
                #
         
     | 
| 
         @@ -42,15 +45,5 @@ module Mactag 
     | 
|
| 
       42 
45 
     | 
    
         
             
                    @@gem_home
         
     | 
| 
       43 
46 
     | 
    
         
             
                  end
         
     | 
| 
       44 
47 
     | 
    
         
             
                end
         
     | 
| 
       45 
     | 
    
         
            -
             
     | 
| 
       46 
     | 
    
         
            -
                ##
         
     | 
| 
       47 
     | 
    
         
            -
                #
         
     | 
| 
       48 
     | 
    
         
            -
                # If using Ruby Version Manager (RVM), setting this option to true
         
     | 
| 
       49 
     | 
    
         
            -
                # will enable Mactag to find out the gem path automatically.
         
     | 
| 
       50 
     | 
    
         
            -
                #
         
     | 
| 
       51 
     | 
    
         
            -
                #   Mactag::Config.rvm = false
         
     | 
| 
       52 
     | 
    
         
            -
                #
         
     | 
| 
       53 
     | 
    
         
            -
                @@rvm = true
         
     | 
| 
       54 
     | 
    
         
            -
                cattr_accessor :rvm
         
     | 
| 
       55 
48 
     | 
    
         
             
              end
         
     | 
| 
       56 
49 
     | 
    
         
             
            end
         
     | 
    
        data/lib/mactag/ctags.rb
    CHANGED
    
    | 
         @@ -15,7 +15,7 @@ module Mactag 
     | 
|
| 
       15 
15 
     | 
    
         | 
| 
       16 
16 
     | 
    
         | 
| 
       17 
17 
     | 
    
         
             
                private
         
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
       19 
19 
     | 
    
         
             
                def command
         
     | 
| 
       20 
20 
     | 
    
         
             
                  "cd #{Rails.root} && #{binary}"
         
     | 
| 
       21 
21 
     | 
    
         
             
                end
         
     | 
| 
         @@ -25,7 +25,7 @@ module Mactag 
     | 
|
| 
       25 
25 
     | 
    
         | 
| 
       26 
26 
     | 
    
         
             
                  binary.gsub!('{OUTPUT}', @output)
         
     | 
| 
       27 
27 
     | 
    
         
             
                  binary.gsub!('{INPUT}', @input.join(' '))
         
     | 
| 
       28 
     | 
    
         
            -
             
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
       29 
29 
     | 
    
         
             
                  binary
         
     | 
| 
       30 
30 
     | 
    
         
             
                end
         
     | 
| 
       31 
31 
     | 
    
         
             
              end
         
     | 
    
        data/lib/mactag/dsl.rb
    CHANGED
    
    | 
         @@ -13,6 +13,10 @@ module Mactag 
     | 
|
| 
       13 
13 
     | 
    
         
             
                # @see Mactag::Tag::App
         
     | 
| 
       14 
14 
     | 
    
         
             
                #
         
     | 
| 
       15 
15 
     | 
    
         
             
                def app(*tags)
         
     | 
| 
      
 16 
     | 
    
         
            +
                  if tags.empty?
         
     | 
| 
      
 17 
     | 
    
         
            +
                    raise ArgumentError.new('App requires at least one argument')
         
     | 
| 
      
 18 
     | 
    
         
            +
                  end
         
     | 
| 
      
 19 
     | 
    
         
            +
                  
         
     | 
| 
       16 
20 
     | 
    
         
             
                  tags.each do |tag|
         
     | 
| 
       17 
21 
     | 
    
         
             
                    @builder << Mactag::Tag::App.new(tag)
         
     | 
| 
       18 
22 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -31,7 +35,7 @@ module Mactag 
     | 
|
| 
       31 
35 
     | 
    
         
             
                    @builder << Mactag::Tag::Plugin.new(plugin)
         
     | 
| 
       32 
36 
     | 
    
         
             
                  end
         
     | 
| 
       33 
37 
     | 
    
         
             
                end
         
     | 
| 
       34 
     | 
    
         
            -
                 
     | 
| 
      
 38 
     | 
    
         
            +
                alias :plugins :plugin
         
     | 
| 
       35 
39 
     | 
    
         | 
| 
       36 
40 
     | 
    
         
             
                ##
         
     | 
| 
       37 
41 
     | 
    
         
             
                #
         
     | 
| 
         @@ -39,22 +43,30 @@ module Mactag 
     | 
|
| 
       39 
43 
     | 
    
         
             
                #
         
     | 
| 
       40 
44 
     | 
    
         
             
                def gem(*gems)
         
     | 
| 
       41 
45 
     | 
    
         
             
                  options = gems.extract_options!
         
     | 
| 
      
 46 
     | 
    
         
            +
                  
         
     | 
| 
      
 47 
     | 
    
         
            +
                  if options[:version] && gems.size > 1
         
     | 
| 
      
 48 
     | 
    
         
            +
                    raise ArgumentError.new('The :version option is not valid when specifying more than one gem')
         
     | 
| 
      
 49 
     | 
    
         
            +
                  end
         
     | 
| 
       42 
50 
     | 
    
         | 
| 
       43 
51 
     | 
    
         
             
                  if gems.empty?
         
     | 
| 
       44 
52 
     | 
    
         
             
                    @builder << Mactag::Tag::Gem.all
         
     | 
| 
       45 
53 
     | 
    
         
             
                  else
         
     | 
| 
       46 
     | 
    
         
            -
                    gems.each do | 
     | 
| 
       47 
     | 
    
         
            -
                      @builder << Mactag::Tag::Gem.new( 
     | 
| 
      
 54 
     | 
    
         
            +
                    gems.each do |gem|
         
     | 
| 
      
 55 
     | 
    
         
            +
                      @builder << Mactag::Tag::Gem.new(gem, options[:version])
         
     | 
| 
       48 
56 
     | 
    
         
             
                    end
         
     | 
| 
       49 
57 
     | 
    
         
             
                  end
         
     | 
| 
       50 
58 
     | 
    
         
             
                end
         
     | 
| 
       51 
     | 
    
         
            -
                 
     | 
| 
      
 59 
     | 
    
         
            +
                alias :gems :gem
         
     | 
| 
       52 
60 
     | 
    
         | 
| 
       53 
61 
     | 
    
         
             
                ##
         
     | 
| 
       54 
62 
     | 
    
         
             
                #
         
     | 
| 
       55 
63 
     | 
    
         
             
                # @see Mactag::Tag::Rails
         
     | 
| 
       56 
64 
     | 
    
         
             
                #
         
     | 
| 
       57 
65 
     | 
    
         
             
                def rails(options = {})
         
     | 
| 
      
 66 
     | 
    
         
            +
                  if options[:only] && options[:except]
         
     | 
| 
      
 67 
     | 
    
         
            +
                    raise ArgumentError.new('Can not specify options :only and :except at the same time')
         
     | 
| 
      
 68 
     | 
    
         
            +
                  end
         
     | 
| 
      
 69 
     | 
    
         
            +
                  
         
     | 
| 
       58 
70 
     | 
    
         
             
                  @builder << Mactag::Tag::Rails.new(options)
         
     | 
| 
       59 
71 
     | 
    
         
             
                end
         
     | 
| 
       60 
72 
     | 
    
         
             
              end
         
     |