mactag 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -16,7 +16,6 @@ that you are using **Exuberant Ctags** and not some other version.
16
16
  # Installation
17
17
 
18
18
  ## Rails 2.x
19
- Version 0.0.5 is the latest version supporting Rails 2.x.
20
19
 
21
20
  ### Plugin
22
21
  Install the plugin:
@@ -28,10 +27,12 @@ Install the gem:
28
27
 
29
28
  Load the gem in **config/environments/development.rb**:
30
29
  config.gem 'mactag'
30
+
31
+ Load the rake tasks in **Rakefile**.
32
+ require 'mactag/tasks'
31
33
 
32
34
 
33
35
  ## Rails 3.x
34
- Version 0.2.0 is the latest version supporting Rails 3.x.
35
36
 
36
37
  ### Plugin
37
38
  Install the plugin:
@@ -43,17 +44,10 @@ Install the gem:
43
44
 
44
45
  Load the gem in **Gemfile**:
45
46
  group :development do
46
- gem 'mactag', '0.2.0'
47
+ gem 'mactag', '0.3.3'
47
48
  end
48
49
 
49
50
 
50
- ## When installing as Gem
51
- If your using Mactag as a gem in a Rails 2 project, you must also
52
- include it's rake tasks in your **Rakefile**. In Rails 3, this is done
53
- automatically.
54
- require 'mactag/tasks'
55
-
56
-
57
51
  # Configuration
58
52
  Generate a basic configuration file:
59
53
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.2
1
+ 0.3.3
@@ -3,7 +3,7 @@ require 'rails'
3
3
  require 'mactag/railtie'
4
4
  require 'mactag/config'
5
5
  require 'mactag/builder'
6
- require 'mactag/parser'
6
+ require 'mactag/dsl'
7
7
  require 'mactag/ctags'
8
8
  require 'mactag/tag'
9
9
 
@@ -1,4 +1,8 @@
1
1
  module Mactag
2
+ ##
3
+ #
4
+ # Tag builder.
5
+ #
2
6
  class Builder
3
7
  def initialize
4
8
  @tags = []
@@ -74,8 +78,8 @@ module Mactag
74
78
  def self.generate(&block)
75
79
  @builder = Mactag::Builder.new
76
80
 
77
- parser = Mactag::Parser.new(@builder)
78
- parser.instance_eval(&block)
81
+ dsl = Mactag::Dsl.new(@builder)
82
+ dsl.instance_eval(&block)
79
83
  end
80
84
 
81
85
  ##
@@ -1,9 +1,9 @@
1
1
  module Mactag
2
2
  ##
3
3
  #
4
- # Parser for builder.
4
+ # Mactag DSL.
5
5
  #
6
- class Parser
6
+ class Dsl
7
7
  def initialize(builder)
8
8
  @builder = builder
9
9
  end
@@ -42,10 +42,17 @@ module Mactag
42
42
 
43
43
  ##
44
44
  #
45
- # Returns all application gems.
45
+ # Returns all application gems in Bundler default group.
46
46
  #
47
47
  def self.all
48
- Bundler.load.specs.collect { |spec| Gem.new(spec.name, spec.version.to_s) }
48
+ gems = {}
49
+ Bundler.load.specs.each do |spec|
50
+ gems[spec.name] = spec.version.to_s
51
+ end
52
+
53
+ default = Bundler.load.dependencies.select { |dependency| dependency.groups.include?(:default) }.collect(&:name)
54
+ default.delete('rails')
55
+ default.collect { |tmp| Gem.new(tmp, gems[tmp]) }
49
56
  end
50
57
 
51
58
  ##
@@ -18,22 +18,22 @@ module Mactag
18
18
  #
19
19
  # ==== Examples
20
20
  # Mactag do
21
- # # Tag all rails packages, latest version
21
+ # # Tag all rails packages, same rails version as application
22
22
  # rails
23
23
  #
24
24
  # # Tag all rails packages, version 2.3.5
25
25
  # rails :version => '2.3.5'
26
26
  #
27
- # # Tag only activerecord, latest version
27
+ # # Tag only activerecord, same rails version as application
28
28
  # rails :only => :active_record
29
29
  #
30
- # # Tag all packages except activerecord, latest version
30
+ # # Tag all packages except activerecord, same rails version as application
31
31
  # rails :except => :activerecord
32
32
  #
33
- # # Tag only activerecord and actionview, latest version
33
+ # # Tag only activerecord and actionview, same rails version as application
34
34
  # rails :only => [:activerecord, :action_view]
35
35
  #
36
- # # Tag all packages except activerecord and actionview, latest version
36
+ # # Tag all packages except activerecord and actionview, same rails version as application
37
37
  # rails :except => ['activerecord', :action_controller]
38
38
  #
39
39
  # # Tag all packages except actionmailer, version 2.3.4
@@ -1,66 +1,66 @@
1
1
  require 'test_helper'
2
2
 
3
- class ParserTest < ActiveSupport::TestCase
3
+ class DslTest < ActiveSupport::TestCase
4
4
  setup do
5
5
  @builder = Mactag::Builder.new
6
- @parser = Mactag::Parser.new(@builder)
6
+ @dsl = Mactag::Dsl.new(@builder)
7
7
  end
8
8
 
9
9
  context 'app' do
10
10
  should 'be able to handle single argument' do
11
- @parser.app('lib/**/*.rb')
11
+ @dsl.app('lib/**/*.rb')
12
12
  end
13
13
  end
14
14
 
15
15
  context 'plugin' do
16
16
  should 'be able to handle no arguments' do
17
- @parser.plugin
17
+ @dsl.plugin
18
18
  end
19
19
 
20
20
  should 'be able to handle single argument' do
21
- @parser.plugin('devise')
21
+ @dsl.plugin('devise')
22
22
  end
23
23
 
24
24
  should 'be able to handle multiple arguments' do
25
- @parser.plugins('devise', 'rack')
25
+ @dsl.plugins('devise', 'rack')
26
26
  end
27
27
  end
28
28
 
29
29
  context 'gem' do
30
30
  should 'be able to handle no arguments' do
31
- @parser.gem
31
+ @dsl.gem
32
32
  end
33
33
 
34
34
  context 'single argument' do
35
35
  should 'be able to handle version' do
36
- @parser.gem('devise', :version => '1.1.1')
36
+ @dsl.gem('devise', :version => '1.1.1')
37
37
  end
38
38
 
39
39
  should 'be able to handle no version' do
40
- @parser.gem('devise')
40
+ @dsl.gem('devise')
41
41
  end
42
42
  end
43
43
 
44
44
  should 'be able to handle multiple arguments' do
45
- @parser.gem('devise', 'rack')
45
+ @dsl.gem('devise', 'rack')
46
46
  end
47
47
  end
48
48
 
49
49
  context 'rails' do
50
50
  should 'be able to handle no arguments' do
51
- @parser.rails
51
+ @dsl.rails
52
52
  end
53
53
 
54
54
  should 'be able to handle only' do
55
- @parser.rails(:only => [])
55
+ @dsl.rails(:only => [])
56
56
  end
57
57
 
58
58
  should 'be able to handle except' do
59
- @parser.rails(:except => [])
59
+ @dsl.rails(:except => [])
60
60
  end
61
61
 
62
62
  should 'be able to handle version' do
63
- @parser.rails(:version => '3.0.0.rc')
63
+ @dsl.rails(:version => '3.0.0.rc')
64
64
  end
65
65
  end
66
66
  end
@@ -40,34 +40,6 @@ class GemTest < ActiveSupport::TestCase
40
40
  end
41
41
  end
42
42
 
43
- context '#all' do
44
- setup do
45
- require 'bundler'
46
-
47
- @runtime = Bundler.load
48
-
49
- devise = ::Gem::Specification.new
50
- devise.name = 'devise'
51
- devise.version = '1.1.1'
52
-
53
- rack = ::Gem::Specification.new
54
- rack.name = 'rack'
55
- rack.version = '1.2.1'
56
-
57
- @runtime.stubs(:specs).returns([devise, rack])
58
- end
59
-
60
- should 'return the correct gems' do
61
- devise = Mactag::Tag::Gem.all.first
62
- assert_equal 'devise', devise.instance_variable_get('@name')
63
- assert_equal '1.1.1', devise.instance_variable_get('@version')
64
-
65
- rack = Mactag::Tag::Gem.all.last
66
- assert_equal 'rack', rack.instance_variable_get('@name')
67
- assert_equal '1.2.1', rack.instance_variable_get('@version')
68
- end
69
- end
70
-
71
43
  context '#most_recent' do
72
44
  should 'return most recent gem if more than one version of same gem exists' do
73
45
  Dir.stubs(:glob).returns(['vendor/plugins/devise-1.1.1', 'vendor/plugins/devise-1.1.0'])
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 2
9
- version: 0.3.2
8
+ - 3
9
+ version: 0.3.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Johan Andersson
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-08-03 00:00:00 +02:00
17
+ date: 2010-08-04 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -64,7 +64,7 @@ files:
64
64
  - lib/mactag/builder.rb
65
65
  - lib/mactag/config.rb
66
66
  - lib/mactag/ctags.rb
67
- - lib/mactag/parser.rb
67
+ - lib/mactag/dsl.rb
68
68
  - lib/mactag/railtie.rb
69
69
  - lib/mactag/tag.rb
70
70
  - lib/mactag/tag/app.rb
@@ -74,7 +74,7 @@ files:
74
74
  - lib/tasks/mactag.rake
75
75
  - test/mactag/builder_test.rb
76
76
  - test/mactag/config_test.rb
77
- - test/mactag/parser_test.rb
77
+ - test/mactag/dsl_test.rb
78
78
  - test/mactag/tag/app_test.rb
79
79
  - test/mactag/tag/gem_test.rb
80
80
  - test/mactag/tag/plugin_test.rb
@@ -115,7 +115,7 @@ summary: Ctags for Rails
115
115
  test_files:
116
116
  - test/mactag/builder_test.rb
117
117
  - test/mactag/config_test.rb
118
- - test/mactag/parser_test.rb
118
+ - test/mactag/dsl_test.rb
119
119
  - test/mactag/tag/app_test.rb
120
120
  - test/mactag/tag/gem_test.rb
121
121
  - test/mactag/tag/plugin_test.rb