mactag 0.0.5 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,65 +5,39 @@ an editor that supports Ctags (Emacs, Vim, TextMate, jEdit, ...). With
5
5
  Ctags you can follow tags (of functions, variables, macros, whatever)
6
6
  to their definitions.
7
7
 
8
-
9
8
  # Exuberant Ctags
10
9
  First off you must install [Ctags](http://ctags.sourceforge.net/).
11
10
  Some systems comes with a ctags command already. If you have the ctags
12
11
  executable, but have problems creating the tags file. Then make sure
13
12
  that you are using **Exuberant Ctags** and not some other version.
14
13
 
15
-
16
14
  # Installation
17
15
 
18
- ## Rails 2.x
19
- Version 0.0.5 is the latest version supporting Rails 2.x.
16
+ ## Plugin
20
17
 
21
- ### Plugin
22
18
  Install the plugin:
23
- $ ./script/plugin install git://github.com/rejeep/mactag.git --revision 'tags/v0.0.5'
24
19
 
25
- ### Gem
26
- Install the gem:
27
- $ sudo gem install mactag --version='0.0.5'
28
-
29
- Load the gem in **config/environments/development.rb**:
30
- config.gem 'mactag'
20
+ $ ./script/plugin install git://github.com/rejeep/mactag.git
31
21
 
32
- ## Rails 3.x
33
- Version 0.1.0 is the only version supporting Rails 3.x.
22
+ ## Gem
34
23
 
35
- ### Plugin
36
- Install the plugin:
37
- $ rails plugin install git://github.com/rejeep/mactag.git --revision 'tags/v0.1.0'
38
-
39
- ### Gem
40
24
  Install the gem:
41
- $ sudo gem install mactag --version='0.1.0'
42
-
43
- Load the gem in **Gemfile**:
44
- group :development do
45
- gem 'mactag'
46
- end
47
25
 
48
- ## Note when installing as Gem
49
- When you install mactag as a gem you must also include it's rake tasks
50
- in your **Rakefile**.
26
+ $ sudo gem install mactag
27
+
28
+ If you install mactag as a gem you must also include it's rake tasks in your *Rakefile*.
29
+
51
30
  require 'mactag/tasks'
52
-
53
31
 
54
32
  # Configuration
33
+
55
34
  Generate a basic configuration file:
56
35
 
57
- ## Rails 2.x
58
36
  $ ./script/generate mactag
59
-
60
- ## Rails 3.x
61
- $ rails generate mactag
62
37
 
63
38
  This will create the file **config/mactag.rb**, which contains
64
39
  some examples of how to set it up.
65
40
 
66
-
67
41
  ## Options
68
42
 
69
43
  * **Mactag::Config.gem_home:** The path where the gems are located. Defaults to **/usr/lib/ruby/gems/1.8/gems**
@@ -84,11 +58,11 @@ some examples of how to set it up.
84
58
  rails :except => :actionmailer, :version => "2.3.5"
85
59
  end
86
60
 
87
-
88
61
  # Usage
62
+
89
63
  To create the TAGS file. Simply run:
90
64
  $ rake mactag
91
65
 
92
-
93
66
  # License
67
+
94
68
  Copyright (c) 2010 Johan Andersson, released under the MIT license
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.5
1
+ 0.1.0
@@ -0,0 +1,5 @@
1
+ class String
2
+ def quote
3
+ "\"#{self}\""
4
+ end
5
+ end
@@ -1,7 +1,6 @@
1
1
  require 'rubygems'
2
2
  require 'active_support'
3
3
  require 'active_support/test_case'
4
- require 'active_support/core_ext'
5
4
 
6
5
  $LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../lib')
7
6
 
@@ -1,9 +1,8 @@
1
1
  require 'mactag/tag/versioned'
2
2
 
3
-
4
3
  module Mactag
5
4
  module Tag
6
-
5
+
7
6
  # Tag for gems.
8
7
  #
9
8
  # ==== Examples
@@ -23,28 +22,22 @@ module Mactag
23
22
  class Gem
24
23
 
25
24
  include Versioned
26
-
25
+
27
26
  def initialize(*gems)
28
27
  @options = gems.extract_options!
29
28
  @gems = gems.blank? ? ::Rails.configuration.gems.collect(&:name) : gems
30
29
  end
31
30
 
32
31
  def files
33
- result = []
34
- @gems.each do |gem_name|
32
+ @gems.collect do |gem|
35
33
  if version = @options[:version]
36
- gem = File.join(Mactag::Config.gem_home, "#{gem_name}-#{version}")
34
+ gem = File.join(Mactag::Config.gem_home, "#{gem}-#{version}")
37
35
  else
38
- gem = latest(gem_name)
36
+ gem = latest(gem)
39
37
  end
40
38
 
41
- if gem
42
- result << File.join(gem, "lib", "**", "*.rb")
43
- else
44
- $stderr.puts "Gem #{gem_name} not found"
45
- end
39
+ File.join(gem, "lib", "**", "*.rb")
46
40
  end
47
- result
48
41
  end
49
42
 
50
43
  end
@@ -1,6 +1,6 @@
1
1
  module Mactag
2
2
  module Tag
3
-
3
+
4
4
  # Tag for the current project plugins.
5
5
  #
6
6
  # ==== Examples
@@ -12,27 +12,21 @@ module Mactag
12
12
  # plugins "thinking-sphinx", "formtastic"
13
13
  # do
14
14
  class Plugin
15
-
15
+
16
16
  PLUGIN_PATH = File.join("vendor", "plugins")
17
-
17
+
18
18
  def initialize(*plugins)
19
19
  @plugins = plugins
20
20
  end
21
-
21
+
22
22
  def files
23
23
  return File.join(PLUGIN_PATH, "*", "lib", "**", "*.rb") if @plugins.empty?
24
24
 
25
- result = []
26
- @plugins.each do |plugin|
27
- if File.exist?(File.join(PLUGIN_PATH, plugin))
28
- result << File.join(PLUGIN_PATH, plugin, "lib", "**", "*.rb")
29
- else
30
- $stderr.puts "Plugin #{plugin} not found"
31
- end
25
+ @plugins.collect do |plugin|
26
+ File.join(PLUGIN_PATH, plugin, "lib", "**", "*.rb")
32
27
  end
33
- result
34
28
  end
35
-
29
+
36
30
  end
37
31
  end
38
32
  end
@@ -1,17 +1,17 @@
1
1
  require 'test_helper'
2
2
 
3
3
  class GemTest < ActiveSupport::TestCase
4
-
4
+
5
5
  context "gem with version" do
6
6
  setup do
7
7
  @gem = Mactag::Tag::Gem.new("thinking-sphinx", :version => "1.0.0")
8
8
  end
9
-
9
+
10
10
  should "return the gem with that version" do
11
11
  assert_contains @gem.files, File.join(Mactag::Config.gem_home, "thinking-sphinx-1.0.0", "lib", "**", "*.rb")
12
12
  end
13
13
  end
14
-
14
+
15
15
  context "gem without version" do
16
16
  context "one gem" do
17
17
  setup do
@@ -19,38 +19,24 @@ class GemTest < ActiveSupport::TestCase
19
19
 
20
20
  @gem = Mactag::Tag::Gem.new("whenever")
21
21
  end
22
-
22
+
23
23
  should "return that gem" do
24
24
  assert_contains @gem.files, "whenever/lib/**/*.rb"
25
25
  end
26
26
  end
27
-
27
+
28
28
  context "multiple gems" do
29
29
  setup do
30
30
  Dir.stubs(:glob).returns(["whenever-0.3.7", "whenever-0.3.6"])
31
-
31
+
32
32
  @gem = Mactag::Tag::Gem.new("whenever")
33
33
  end
34
-
34
+
35
35
  should "return the gem with the latest version" do
36
36
  assert_contains @gem.files, "whenever-0.3.7/lib/**/*.rb"
37
37
  assert_does_not_contain @gem.files, "whenever-0.3.6/lib/**/*.rb"
38
38
  end
39
39
  end
40
40
  end
41
-
42
- context "gem that does not exist" do
43
- setup do
44
- Dir.stubs(:glob).returns([nil])
45
-
46
- @gem = Mactag::Tag::Gem.new("whenever")
47
- end
48
-
49
- should "not raise exception because no such gem" do
50
- assert_nothing_raised do
51
- assert_equal [], @gem.files
52
- end
53
- end
54
- end
55
-
41
+
56
42
  end
@@ -5,11 +5,9 @@ class PluginTest < ActiveSupport::TestCase
5
5
  should "have correct plugin path" do
6
6
  assert_equal "vendor/plugins", Mactag::Tag::Plugin::PLUGIN_PATH
7
7
  end
8
-
8
+
9
9
  context "without arguments" do
10
10
  setup do
11
- File.stubs(:exist?).returns(true)
12
-
13
11
  @plugin = Mactag::Tag::Plugin.new
14
12
  end
15
13
 
@@ -17,44 +15,26 @@ class PluginTest < ActiveSupport::TestCase
17
15
  assert_equal @plugin.files, "vendor/plugins/*/lib/**/*.rb"
18
16
  end
19
17
  end
20
-
18
+
21
19
  context "with one plugin argument" do
22
20
  setup do
23
- File.stubs(:exist?).returns(true)
24
-
25
21
  @plugin = Mactag::Tag::Plugin.new("thinking-sphinx")
26
22
  end
27
-
23
+
28
24
  should "return the path to that plugin" do
29
25
  assert_equal ["vendor/plugins/thinking-sphinx/lib/**/*.rb"], @plugin.files
30
26
  end
31
27
  end
32
-
28
+
33
29
  context "with more thatn one plugin argument" do
34
30
  setup do
35
- File.stubs(:exist?).returns(true)
36
-
37
31
  @plugin = Mactag::Tag::Plugin.new("thinking-sphinx", "formtastic")
38
32
  end
39
-
33
+
40
34
  should "return the paths to those plugins" do
41
35
  assert_contains @plugin.files, "vendor/plugins/thinking-sphinx/lib/**/*.rb"
42
36
  assert_contains @plugin.files, "vendor/plugins/formtastic/lib/**/*.rb"
43
37
  end
44
38
  end
45
-
46
- context "plugin that does not exist" do
47
- setup do
48
- File.stubs(:exist?).returns(false)
49
-
50
- @plugin = Mactag::Tag::Plugin.new("typo")
51
- end
52
-
53
- should "not raise exception because no such plugin" do
54
- assert_nothing_raised do
55
- assert_equal [], @plugin.files
56
- end
57
- end
58
- end
59
-
39
+
60
40
  end
metadata CHANGED
@@ -1,12 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mactag
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 0
8
- - 5
9
- version: 0.0.5
4
+ version: 0.1.0
10
5
  platform: ruby
11
6
  authors:
12
7
  - Johan Andersson
@@ -14,7 +9,7 @@ autorequire:
14
9
  bindir: bin
15
10
  cert_chain: []
16
11
 
17
- date: 2010-03-11 00:00:00 +00:00
12
+ date: 2010-02-13 00:00:00 +00:00
18
13
  default_executable:
19
14
  dependencies: []
20
15
 
@@ -58,20 +53,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
58
53
  requirements:
59
54
  - - ">="
60
55
  - !ruby/object:Gem::Version
61
- segments:
62
- - 0
63
56
  version: "0"
57
+ version:
64
58
  required_rubygems_version: !ruby/object:Gem::Requirement
65
59
  requirements:
66
60
  - - ">="
67
61
  - !ruby/object:Gem::Version
68
- segments:
69
- - 0
70
62
  version: "0"
63
+ version:
71
64
  requirements: []
72
65
 
73
66
  rubyforge_project:
74
- rubygems_version: 1.3.6
67
+ rubygems_version: 1.3.5
75
68
  signing_key:
76
69
  specification_version: 3
77
70
  summary: Ctags for Rails
@@ -89,6 +82,7 @@ test_files:
89
82
  - features/step_definitions/rails_steps.rb
90
83
  - features/step_definitions/gem_steps.rb
91
84
  - features/step_definitions/mactab_steps.rb
85
+ - features/support/core_ext.rb
92
86
  - features/support/tags_file.rb
93
87
  - features/support/env.rb
94
88
  - features/support/rails_app.rb