mactag 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,15 +1,15 @@
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, jEdit, ...). With Ctags
5
- you can follow tags (of functions, variables, macros, whatever) to
6
- their definitions.
4
+ an editor that supports Ctags (Emacs, Vim, TextMate, jEdit, ...). With
5
+ Ctags you can follow tags (of functions, variables, macros, whatever)
6
+ to their definitions.
7
7
 
8
8
  # Exuberant Ctags
9
9
  First off you must install [Ctags](http://ctags.sourceforge.net/).
10
10
  Some systems comes with a ctags command already. If you have the ctags
11
11
  executable, but have problems creating the tags file. Then make sure
12
- that you are using *Exuberant Ctags* and not some other version.
12
+ that you are using **Exuberant Ctags** and not some other version.
13
13
 
14
14
  # Installation
15
15
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
@@ -1,3 +1,5 @@
1
+ require 'mactag/tag/versioned'
2
+
1
3
  module Mactag
2
4
  module Tag
3
5
 
@@ -19,6 +21,8 @@ module Mactag
19
21
  # do
20
22
  class Gem
21
23
 
24
+ include Versioned
25
+
22
26
  def initialize(*gems)
23
27
  @options = gems.extract_options!
24
28
  @gems = gems.blank? ? ::Rails.configuration.gems.collect(&:name) : gems
@@ -29,12 +33,7 @@ module Mactag
29
33
  if version = @options[:version]
30
34
  gem = File.join(Mactag::Config.gem_home, "#{gem}-#{version}")
31
35
  else
32
- versions = Dir.glob(File.join(Mactag::Config.gem_home, "#{gem}*"))
33
- if versions.size == 1
34
- gem = versions.first
35
- else
36
- gem = versions.sort.last
37
- end
36
+ gem = latest(gem)
38
37
  end
39
38
 
40
39
  File.join(gem, "lib", "**", "*.rb")
@@ -1,3 +1,5 @@
1
+ require 'mactag/tag/versioned'
2
+
1
3
  module Mactag
2
4
  module Tag
3
5
 
@@ -37,6 +39,8 @@ module Mactag
37
39
  # rails :except => :actionmailer, :version => "2.3.4"
38
40
  # do
39
41
  class Rails
42
+
43
+ include Versioned
40
44
 
41
45
  VENDOR = File.join("vendor", "rails")
42
46
 
@@ -101,15 +105,7 @@ module Mactag
101
105
  if version = @options[:version]
102
106
  top = "#{top}-#{version}"
103
107
  else
104
- versions = Dir.glob(File.join(Mactag::Config.gem_home, "#{top}-*"))
105
-
106
- if versions.size == 1
107
- top = versions.first
108
- else
109
- top = versions.sort.last
110
- end
111
-
112
- top = File.basename(top)
108
+ top = File.basename(latest(top))
113
109
  end
114
110
  paths[0] = top
115
111
  end
@@ -0,0 +1,22 @@
1
+ module Mactag
2
+ module Tag
3
+
4
+ # Helper module for Gems (which all have a version).
5
+ module Versioned
6
+
7
+ # Returns the latest version of +gem+. If only one gem, that is
8
+ # returned.
9
+ def latest(gem)
10
+ versions = Dir.glob(File.join(Mactag::Config.gem_home, gem) + "-*")
11
+ if versions.size == 1
12
+ gem = versions.first
13
+ else
14
+ gem = versions.sort.last
15
+ end
16
+ gem
17
+ end
18
+
19
+ end
20
+
21
+ end
22
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mactag
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Johan Andersson
@@ -35,6 +35,7 @@ files:
35
35
  - lib/mactag/tag/parser.rb
36
36
  - lib/mactag/tag/plugin.rb
37
37
  - lib/mactag/tag/rails.rb
38
+ - lib/mactag/tag/versioned.rb
38
39
  - lib/mactag/tasks.rb
39
40
  - tasks/mactag_tasks.rake
40
41
  has_rdoc: true