mactag 0.1.1 → 0.2.0

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.
Files changed (39) hide show
  1. data/README.markdown +19 -16
  2. data/VERSION +1 -1
  3. data/features/app.feature +82 -16
  4. data/features/gem.feature +116 -36
  5. data/features/plugin.feature +86 -21
  6. data/features/rails.feature +6 -0
  7. data/features/step_definitions/mactag_steps.rb +43 -0
  8. data/features/support/env.rb +4 -0
  9. data/features/support/rails_app.rb +20 -48
  10. data/features/support/tags_file.rb +8 -5
  11. data/lib/generators/mactag/templates/mactag.rb +50 -9
  12. data/lib/mactag.rb +1 -1
  13. data/lib/mactag/config.rb +28 -7
  14. data/lib/mactag/table.rb +22 -9
  15. data/lib/mactag/tag/app.rb +10 -10
  16. data/lib/mactag/tag/gem.rb +51 -17
  17. data/lib/mactag/tag/parser.rb +12 -2
  18. data/lib/mactag/tag/plugin.rb +15 -12
  19. data/lib/mactag/tag/rails.rb +43 -67
  20. data/test/mactag/config_test.rb +33 -3
  21. data/test/mactag/tag/app_test.rb +3 -5
  22. data/test/mactag/tag/gem_test.rb +47 -20
  23. data/test/mactag/tag/plugin_test.rb +23 -25
  24. data/test/mactag/tag/rails_test.rb +18 -123
  25. metadata +105 -27
  26. data/TODO +0 -8
  27. data/features/rails/actionmailer/lib/action_mailer/base.rb +0 -9
  28. data/features/rails/actionpack/lib/action_controller/caching/actions.rb +0 -11
  29. data/features/rails/actionpack/lib/action_view/action_view/helpers/form_tag_helper.rb +0 -9
  30. data/features/rails/activerecord/lib/active_record/associations.rb +0 -9
  31. data/features/rails/activeresource/lib/active_resource/connection.rb +0 -7
  32. data/features/rails/activesupport/lib/active_support/core_ext/hash/diff.rb +0 -5
  33. data/features/rails_gem.feature +0 -89
  34. data/features/rails_vendor.feature +0 -57
  35. data/features/step_definitions/gem_steps.rb +0 -22
  36. data/features/step_definitions/mactab_steps.rb +0 -57
  37. data/features/step_definitions/plugin_steps.rb +0 -22
  38. data/features/step_definitions/rails_steps.rb +0 -20
  39. data/lib/mactag/tag/versioned.rb +0 -22
@@ -1,32 +1,20 @@
1
1
  require 'test_helper'
2
2
 
3
3
  class RailsTest < ActiveSupport::TestCase
4
-
5
- should "have correct vendor path" do
6
- assert_equal "vendor/rails", Mactag::Tag::Rails::VENDOR
7
- end
8
-
9
4
  should "have correct packages" do
10
5
  packages = Mactag::Tag::Rails::PACKAGES
11
- keys = packages.keys
12
-
13
- assert_contains keys, :activesupport
14
- assert_contains keys, :activeresource
15
- assert_contains keys, :activerecord
16
- assert_contains keys, :actionmailer
17
- assert_contains keys, :actioncontroller
18
- assert_contains keys, :actionview
19
- end
20
-
21
- should "have the correct paths" do
22
- packages = Mactag::Tag::Rails::PACKAGES
23
6
 
24
- assert_equal ["activesupport", "active_support"] , packages[:activesupport]
25
- assert_equal ["activeresource", "active_resource"], packages[:activeresource]
26
- assert_equal ["activerecord", "active_record"] , packages[:activerecord]
27
- assert_equal ["actionmailer", "action_mailer"] , packages[:actionmailer]
28
- assert_equal ["actionpack", "action_controller"] , packages[:actioncontroller]
29
- assert_equal ["actionpack", "action_view"] , packages[:actionview]
7
+ [
8
+ :actionmailer,
9
+ :actionpack,
10
+ :activemodel,
11
+ :activerecord,
12
+ :activeresource,
13
+ :railties,
14
+ :activesupport
15
+ ].each do |package|
16
+ assert_contains packages, package
17
+ end
30
18
  end
31
19
 
32
20
  context "packages" do
@@ -36,7 +24,7 @@ class RailsTest < ActiveSupport::TestCase
36
24
  end
37
25
 
38
26
  should "return all packages" do
39
- assert_same_elements Mactag::Tag::Rails::PACKAGES.keys, @rails.send(:packages)
27
+ assert_same_elements Mactag::Tag::Rails::PACKAGES, @rails.send(:packages)
40
28
  end
41
29
  end
42
30
 
@@ -56,127 +44,34 @@ class RailsTest < ActiveSupport::TestCase
56
44
  end
57
45
 
58
46
  should "return all except those packages" do
59
- assert_same_elements Mactag::Tag::Rails::PACKAGES.keys - [:activesupport, :activerecord], @rails.send(:packages)
47
+ assert_same_elements Mactag::Tag::Rails::PACKAGES - [:activesupport, :activerecord], @rails.send(:packages)
60
48
  end
61
49
  end
62
50
  end
63
51
 
64
- context "rails in vendor" do
65
- setup do
66
- File.stubs(:exist?).returns(true)
67
- end
68
-
69
- should "be in vendor since file exist" do
70
- assert Mactag::Tag::Rails.send(:vendor?)
71
- end
72
- end
73
-
74
- context "rails home" do
75
- context "when rails is in vendor" do
76
- setup do
77
- Mactag::Tag::Rails.stubs(:vendor?).returns(true)
78
-
79
- @rails = Mactag::Tag::Rails.new({})
80
- end
81
-
82
- should "return vendor" do
83
- assert_equal Mactag::Tag::Rails::VENDOR, @rails.send(:rails_home)
84
- end
85
- end
86
-
87
- context "when rails is installed as a gem" do
88
- setup do
89
- Mactag::Tag::Rails.stubs(:vendor?).returns(false)
90
-
91
- @rails = Mactag::Tag::Rails.new({})
92
- end
93
-
94
- should "return gem home" do
95
- assert_equal Mactag::Config.gem_home, @rails.send(:rails_home)
96
- end
97
- end
98
- end
99
-
100
52
  context "packagize" do
101
53
  setup do
102
54
  @rails = Mactag::Tag::Rails.new({})
103
55
  end
104
-
56
+
105
57
  context "one package" do
106
58
  setup do
107
59
  @packagized = @rails.send(:packagize!, "active_record")
108
60
  end
109
-
61
+
110
62
  should "be packagized" do
111
63
  assert_equal [:activerecord], @packagized
112
64
  end
113
65
  end
114
-
66
+
115
67
  context "several packages" do
116
68
  setup do
117
- @packagized = @rails.send(:packagize!, ["_active_support_", "action_view"])
69
+ @packagized = @rails.send(:packagize!, ["_active_support_", :action_view])
118
70
  end
119
-
71
+
120
72
  should "be packagized" do
121
73
  assert_equal [:activesupport, :actionview], @packagized
122
74
  end
123
75
  end
124
76
  end
125
-
126
- context "package paths" do
127
- context "when rails is in vendor" do
128
- setup do
129
- Mactag::Tag::Rails.stubs(:vendor?).returns(true)
130
-
131
- @rails = Mactag::Tag::Rails.new({})
132
- end
133
-
134
- should "return the correct path" do
135
- assert_equal "activerecord/lib/active_record", @rails.send(:package_path, :activerecord)
136
- end
137
- end
138
-
139
- context "when rails is installed as a gem" do
140
- setup do
141
- Mactag::Tag::Rails.stubs(:vendor?).returns(false)
142
- end
143
-
144
- context "and there is a specific version" do
145
- setup do
146
- @rails = Mactag::Tag::Rails.new(:version => "3.0.0")
147
- end
148
-
149
- should "return the correct path" do
150
- assert_equal "activerecord-3.0.0/lib/active_record", @rails.send(:package_path, :activerecord)
151
- end
152
- end
153
-
154
- context "and there is no version specified" do
155
- setup do
156
- @rails = Mactag::Tag::Rails.new({})
157
- end
158
-
159
- context "and there is only one version of rails" do
160
- setup do
161
- Dir.stubs(:glob).returns("activerecord-2.3.5")
162
- end
163
-
164
- should "return the correct path" do
165
- assert_equal "activerecord-2.3.5/lib/active_record", @rails.send(:package_path, :activerecord)
166
- end
167
- end
168
-
169
- context "and there are two versions of rails" do
170
- setup do
171
- Dir.stubs(:glob).returns(["activerecord-2.3.5", "activerecord-2.3.4"])
172
- end
173
-
174
- should "return the correct path" do
175
- assert_equal "activerecord-2.3.5/lib/active_record", @rails.send(:package_path, :activerecord)
176
- end
177
- end
178
- end
179
- end
180
- end
181
-
182
77
  end
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 1
8
- - 1
9
- version: 0.1.1
7
+ - 2
8
+ - 0
9
+ version: 0.2.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Johan Andersson
@@ -14,10 +14,85 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-03-11 00:00:00 +00:00
17
+ date: 2010-07-31 00:00:00 +02:00
18
18
  default_executable:
19
- dependencies: []
20
-
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: rails
22
+ requirement: &id001 !ruby/object:Gem::Requirement
23
+ none: false
24
+ requirements:
25
+ - - "="
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 3
29
+ - 0
30
+ - 0
31
+ - rc
32
+ version: 3.0.0.rc
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: *id001
36
+ - !ruby/object:Gem::Dependency
37
+ name: shoulda
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - "="
42
+ - !ruby/object:Gem::Version
43
+ segments:
44
+ - 2
45
+ - 11
46
+ - 1
47
+ version: 2.11.1
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: *id002
51
+ - !ruby/object:Gem::Dependency
52
+ name: mocha
53
+ requirement: &id003 !ruby/object:Gem::Requirement
54
+ none: false
55
+ requirements:
56
+ - - "="
57
+ - !ruby/object:Gem::Version
58
+ segments:
59
+ - 0
60
+ - 9
61
+ - 8
62
+ version: 0.9.8
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: *id003
66
+ - !ruby/object:Gem::Dependency
67
+ name: cucumber-rails
68
+ requirement: &id004 !ruby/object:Gem::Requirement
69
+ none: false
70
+ requirements:
71
+ - - "="
72
+ - !ruby/object:Gem::Version
73
+ segments:
74
+ - 0
75
+ - 3
76
+ - 2
77
+ version: 0.3.2
78
+ type: :development
79
+ prerelease: false
80
+ version_requirements: *id004
81
+ - !ruby/object:Gem::Dependency
82
+ name: cucumber
83
+ requirement: &id005 !ruby/object:Gem::Requirement
84
+ none: false
85
+ requirements:
86
+ - - "="
87
+ - !ruby/object:Gem::Version
88
+ segments:
89
+ - 0
90
+ - 8
91
+ - 5
92
+ version: 0.8.5
93
+ type: :development
94
+ prerelease: false
95
+ version_requirements: *id005
21
96
  description: Mactag is DSL in ruby for creating a Ctags-file for Rails projects
22
97
  email: johan.rejeep@gmail.com
23
98
  executables: []
@@ -26,7 +101,6 @@ extensions: []
26
101
 
27
102
  extra_rdoc_files:
28
103
  - README.markdown
29
- - TODO
30
104
  files:
31
105
  - README.markdown
32
106
  - VERSION
@@ -41,9 +115,21 @@ files:
41
115
  - lib/mactag/tag/parser.rb
42
116
  - lib/mactag/tag/plugin.rb
43
117
  - lib/mactag/tag/rails.rb
44
- - lib/mactag/tag/versioned.rb
45
118
  - lib/tasks/mactag.rake
46
- - TODO
119
+ - features/app.feature
120
+ - features/gem.feature
121
+ - features/plugin.feature
122
+ - features/rails.feature
123
+ - features/step_definitions/mactag_steps.rb
124
+ - features/support/env.rb
125
+ - features/support/rails_app.rb
126
+ - features/support/tags_file.rb
127
+ - test/mactag/config_test.rb
128
+ - test/mactag/tag/app_test.rb
129
+ - test/mactag/tag/gem_test.rb
130
+ - test/mactag/tag/plugin_test.rb
131
+ - test/mactag/tag/rails_test.rb
132
+ - test/mactag_test.rb
47
133
  has_rdoc: true
48
134
  homepage: http://github.com/rejeep/mactag
49
135
  licenses: []
@@ -54,6 +140,7 @@ rdoc_options:
54
140
  require_paths:
55
141
  - lib
56
142
  required_ruby_version: !ruby/object:Gem::Requirement
143
+ none: false
57
144
  requirements:
58
145
  - - ">="
59
146
  - !ruby/object:Gem::Version
@@ -61,6 +148,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
61
148
  - 0
62
149
  version: "0"
63
150
  required_rubygems_version: !ruby/object:Gem::Requirement
151
+ none: false
64
152
  requirements:
65
153
  - - ">="
66
154
  - !ruby/object:Gem::Version
@@ -70,32 +158,22 @@ required_rubygems_version: !ruby/object:Gem::Requirement
70
158
  requirements: []
71
159
 
72
160
  rubyforge_project:
73
- rubygems_version: 1.3.6
161
+ rubygems_version: 1.3.7
74
162
  signing_key:
75
163
  specification_version: 3
76
164
  summary: Ctags for Rails
77
165
  test_files:
78
166
  - features/app.feature
79
- - features/plugin.feature
80
167
  - features/gem.feature
81
- - features/rails/activesupport/lib/active_support/core_ext/hash/diff.rb
82
- - features/rails/actionmailer/lib/action_mailer/base.rb
83
- - features/rails/activerecord/lib/active_record/associations.rb
84
- - features/rails/actionpack/lib/action_controller/caching/actions.rb
85
- - features/rails/actionpack/lib/action_view/action_view/helpers/form_tag_helper.rb
86
- - features/rails/activeresource/lib/active_resource/connection.rb
87
- - features/step_definitions/plugin_steps.rb
88
- - features/step_definitions/rails_steps.rb
89
- - features/step_definitions/gem_steps.rb
90
- - features/step_definitions/mactab_steps.rb
91
- - features/support/tags_file.rb
168
+ - features/plugin.feature
169
+ - features/rails.feature
170
+ - features/step_definitions/mactag_steps.rb
92
171
  - features/support/env.rb
93
172
  - features/support/rails_app.rb
94
- - features/rails_vendor.feature
95
- - features/rails_gem.feature
96
- - test/mactag_test.rb
173
+ - features/support/tags_file.rb
174
+ - test/mactag/config_test.rb
97
175
  - test/mactag/tag/app_test.rb
98
- - test/mactag/tag/plugin_test.rb
99
176
  - test/mactag/tag/gem_test.rb
177
+ - test/mactag/tag/plugin_test.rb
100
178
  - test/mactag/tag/rails_test.rb
101
- - test/mactag/config_test.rb
179
+ - test/mactag_test.rb
data/TODO DELETED
@@ -1,8 +0,0 @@
1
- -*- mode: Org -*-
2
-
3
- * Bugs [0/1]
4
- - [ ] Using config.gem 'mactag' only works in environment.rb file, not in environments/*.rb
5
- * Feedback [0/1]
6
- - [ ] Give user feedback if a plugin or gem does not exist
7
- * Other [0/1]
8
- - [ ] In generator script, add binary and gem_home examples
@@ -1,9 +0,0 @@
1
- module ActionMailer #:nodoc:
2
- class Base
3
- class << self
4
- def deliver(mail)
5
- # ...
6
- end
7
- end
8
- end
9
- end
@@ -1,11 +0,0 @@
1
- module ActionController
2
- module Caching
3
- module Actions
4
- module ClassMethods
5
- def caches_action(*actions)
6
- # ...
7
- end
8
- end
9
- end
10
- end
11
- end
@@ -1,9 +0,0 @@
1
- module ActionView
2
- module Helpers
3
- module FormTagHelper
4
- def form_tag(url_for_options = {}, options = {}, *parameters_for_url, &block)
5
- # ...
6
- end
7
- end
8
- end
9
- end
@@ -1,9 +0,0 @@
1
- module ActiveRecord
2
- module Association
3
- module ClassMethods
4
- def has_many(association_id, options = {}, &extension)
5
- # ...
6
- end
7
- end
8
- end
9
- end
@@ -1,7 +0,0 @@
1
- module ActiveResource
2
- class Connection
3
- def get(path, headers = {})
4
- # ...
5
- end
6
- end
7
- end
@@ -1,5 +0,0 @@
1
- class Hash
2
- def diff(h2)
3
- # ...
4
- end
5
- end
@@ -1,89 +0,0 @@
1
- Feature: Tag Rails as a Gem
2
- In order to create a TAGS file
3
- As a user
4
- I want to tag Rails
5
-
6
- Background:
7
- Given a Rails application
8
- And mactag is installed
9
-
10
- Scenario: Tag all packages
11
- Given rails is installed as a gem
12
- And a mactag config file with this contents:
13
- """
14
- Mactag::Config.gem_home = File.join("vendor", "rails-temp")
15
- Mactag::Table.generate do
16
- rails
17
- end
18
- """
19
- When I create the tags file
20
- Then the tags file should contain "diff"
21
- And the tags file should contain "get"
22
- And the tags file should contain "has_many"
23
- And the tags file should contain "deliver"
24
- And the tags file should contain "caches_action"
25
- And the tags file should contain "form_tag"
26
-
27
- Scenario: Tag only some packages
28
- Given rails is installed as a gem
29
- And a mactag config file with this contents:
30
- """
31
- Mactag::Config.gem_home = File.join("vendor", "rails-temp")
32
- Mactag::Table.generate do
33
- rails :only => %w[activerecord activesupport]
34
- end
35
- """
36
- When I create the tags file
37
- Then the tags file should contain "diff"
38
- And the tags file should contain "has_many"
39
- And the tags file should not contain "get"
40
- And the tags file should not contain "deliver"
41
- And the tags file should not contain "caches_action"
42
- And the tags file should not contain "form_tag"
43
-
44
- Scenario: Tag all except some packages
45
- Given rails is installed as a gem
46
- And a mactag config file with this contents:
47
- """
48
- Mactag::Config.gem_home = File.join("vendor", "rails-temp")
49
- Mactag::Table.generate do
50
- rails :except => %w[actioncontroller actionview]
51
- end
52
- """
53
- When I create the tags file
54
- Then the tags file should contain "diff"
55
- And the tags file should contain "has_many"
56
- And the tags file should contain "get"
57
- And the tags file should contain "deliver"
58
- And the tags file should not contain "caches_action"
59
- And the tags file should not contain "form_tag"
60
-
61
- Scenario: Tag specific version
62
- Given rails version "3.0.0" is installed as a gem
63
- And rails version "2.3.5" is installed as a gem
64
- And a mactag config file with this contents:
65
- """
66
- Mactag::Config.gem_home = File.join("vendor", "rails-temp")
67
- Mactag::Table.generate do
68
- rails :version => "3.0.0"
69
- end
70
- """
71
- When I create the tags file
72
- Then the tags file should contain "3.0.0"
73
- And the tags file should not contain "2.3.5"
74
-
75
- Scenario: Tag latest version
76
- Given rails version "3.0.0" is installed as a gem
77
- And rails version "2.3.5" is installed as a gem
78
- And rails version "2.3.2" is installed as a gem
79
- And a mactag config file with this contents:
80
- """
81
- Mactag::Config.gem_home = File.join("vendor", "rails-temp")
82
- Mactag::Table.generate do
83
- rails
84
- end
85
- """
86
- When I create the tags file
87
- Then the tags file should contain "3.0.0"
88
- And the tags file should not contain "2.3.2"
89
- And the tags file should not contain "2.3.5"