mactag 0.2.0 → 0.3.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.
@@ -17,59 +17,71 @@ class RailsTest < ActiveSupport::TestCase
17
17
  end
18
18
  end
19
19
 
20
- context "packages" do
21
- context "without arguments" do
22
- setup do
23
- @rails = Mactag::Tag::Rails.new({})
24
- end
20
+ context '#tag' do
21
+ should 'return empty array if no packages' do
22
+ @rails = Mactag::Tag::Rails.new({})
23
+ @rails.stubs(:packages).returns([])
25
24
 
26
- should "return all packages" do
27
- assert_same_elements Mactag::Tag::Rails::PACKAGES, @rails.send(:packages)
28
- end
25
+ assert_equal [], @rails.tag
29
26
  end
30
27
 
31
- context "with some packages only" do
32
- setup do
33
- @rails = Mactag::Tag::Rails.new(:only => [:active_support, :activerecord])
34
- end
28
+ should 'return array with gem tags if packages' do
29
+ @rails = Mactag::Tag::Rails.new({})
30
+ @rails.stubs(:packages).returns([:activemodel, :activerecord])
35
31
 
36
- should "return only those packages" do
37
- assert_same_elements [:activesupport, :activerecord], @rails.send(:packages)
32
+ o = Object.new
33
+ def o.tag
34
+ 'tag'
38
35
  end
36
+
37
+ Mactag::Tag::Gem.stubs(:new).returns(o)
38
+
39
+ assert_equal ['tag', 'tag'], @rails.tag
39
40
  end
41
+ end
40
42
 
41
- context "except some packages" do
42
- setup do
43
- @rails = Mactag::Tag::Rails.new(:except => [:active_support, :activerecord])
44
- end
43
+ context '#packages' do
44
+ should 'return all packages if no arguments' do
45
+ @rails = Mactag::Tag::Rails.new({})
45
46
 
46
- should "return all except those packages" do
47
- assert_same_elements Mactag::Tag::Rails::PACKAGES - [:activesupport, :activerecord], @rails.send(:packages)
48
- end
47
+ assert_same_elements Mactag::Tag::Rails::PACKAGES, @rails.send(:packages)
48
+ end
49
+
50
+ should 'return some packages if only specified' do
51
+ @rails = Mactag::Tag::Rails.new(:only => [:active_support, :activerecord])
52
+
53
+ assert_same_elements [:activesupport, :activerecord], @rails.send(:packages)
54
+ end
55
+
56
+ should 'return some packages if except specified' do
57
+
58
+ @rails = Mactag::Tag::Rails.new(:except => [:active_support, :activerecord])
59
+
60
+ assert_same_elements Mactag::Tag::Rails::PACKAGES - [:activesupport, :activerecord], @rails.send(:packages)
49
61
  end
50
62
  end
51
63
 
52
- context "packagize" do
64
+ context '#packagize' do
53
65
  setup do
54
66
  @rails = Mactag::Tag::Rails.new({})
55
67
  end
56
68
 
57
- context "one package" do
69
+ context 'single package' do
58
70
  setup do
59
- @packagized = @rails.send(:packagize!, "active_record")
71
+ @packagized = @rails.send(:packagize!, 'active_record')
60
72
  end
61
73
 
62
- should "be packagized" do
74
+ should 'return a packagized package' do
63
75
  assert_equal [:activerecord], @packagized
64
76
  end
65
77
  end
66
78
 
67
- context "several packages" do
79
+ context 'multiple packages' do
68
80
  setup do
69
- @packagized = @rails.send(:packagize!, ["_active_support_", :action_view])
81
+ @packagized = @rails.send(:packagize!, ['_active_support_', :action_view])
70
82
  end
71
83
 
72
- should "be packagized" do
84
+ should 'return packagized packages' do
73
85
  assert_equal [:activesupport, :actionview], @packagized
74
86
  end
75
87
  end
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 2
7
+ - 3
8
8
  - 0
9
- version: 0.2.0
9
+ version: 0.3.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Johan Andersson
@@ -14,28 +14,12 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-07-31 00:00:00 +02:00
17
+ date: 2010-08-02 00:00:00 +02:00
18
18
  default_executable:
19
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
20
  - !ruby/object:Gem::Dependency
37
21
  name: shoulda
38
- requirement: &id002 !ruby/object:Gem::Requirement
22
+ requirement: &id001 !ruby/object:Gem::Requirement
39
23
  none: false
40
24
  requirements:
41
25
  - - "="
@@ -47,10 +31,10 @@ dependencies:
47
31
  version: 2.11.1
48
32
  type: :development
49
33
  prerelease: false
50
- version_requirements: *id002
34
+ version_requirements: *id001
51
35
  - !ruby/object:Gem::Dependency
52
36
  name: mocha
53
- requirement: &id003 !ruby/object:Gem::Requirement
37
+ requirement: &id002 !ruby/object:Gem::Requirement
54
38
  none: false
55
39
  requirements:
56
40
  - - "="
@@ -62,37 +46,7 @@ dependencies:
62
46
  version: 0.9.8
63
47
  type: :development
64
48
  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
49
+ version_requirements: *id002
96
50
  description: Mactag is DSL in ruby for creating a Ctags-file for Rails projects
97
51
  email: johan.rejeep@gmail.com
98
52
  executables: []
@@ -107,24 +61,19 @@ files:
107
61
  - lib/generators/mactag/mactag_generator.rb
108
62
  - lib/generators/mactag/templates/mactag.rb
109
63
  - lib/mactag.rb
64
+ - lib/mactag/builder.rb
110
65
  - lib/mactag/config.rb
111
- - lib/mactag/table.rb
66
+ - lib/mactag/ctags.rb
67
+ - lib/mactag/parser.rb
112
68
  - lib/mactag/tag.rb
113
69
  - lib/mactag/tag/app.rb
114
70
  - lib/mactag/tag/gem.rb
115
- - lib/mactag/tag/parser.rb
116
71
  - lib/mactag/tag/plugin.rb
117
72
  - lib/mactag/tag/rails.rb
118
73
  - lib/tasks/mactag.rake
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
74
+ - test/mactag/builder_test.rb
127
75
  - test/mactag/config_test.rb
76
+ - test/mactag/parser_test.rb
128
77
  - test/mactag/tag/app_test.rb
129
78
  - test/mactag/tag/gem_test.rb
130
79
  - test/mactag/tag/plugin_test.rb
@@ -163,15 +112,9 @@ signing_key:
163
112
  specification_version: 3
164
113
  summary: Ctags for Rails
165
114
  test_files:
166
- - features/app.feature
167
- - features/gem.feature
168
- - features/plugin.feature
169
- - features/rails.feature
170
- - features/step_definitions/mactag_steps.rb
171
- - features/support/env.rb
172
- - features/support/rails_app.rb
173
- - features/support/tags_file.rb
115
+ - test/mactag/builder_test.rb
174
116
  - test/mactag/config_test.rb
117
+ - test/mactag/parser_test.rb
175
118
  - test/mactag/tag/app_test.rb
176
119
  - test/mactag/tag/gem_test.rb
177
120
  - test/mactag/tag/plugin_test.rb
@@ -1,110 +0,0 @@
1
- Feature: Tag application files
2
- In order to create a TAGS file
3
- As a user
4
- I want to tag application files
5
-
6
- Background:
7
- Given a Rails application
8
- And mactag is installed
9
-
10
- Scenario: Tag single file
11
- Given file "public/javascripts/mactag.js" with contents:
12
- """
13
- function mactag() {
14
- // ...
15
- }
16
- """
17
- And this mactag config file:
18
- """
19
- Mactag::Table.generate do
20
- app 'public/javascripts/mactag.js'
21
- end
22
- """
23
- When I create the tags file
24
- Then "mactag" should be tagged
25
-
26
- Scenario: Tag multiple files different calls
27
- Given file "public/javascripts/application.js" with contents:
28
- """
29
- function app() {
30
- // ...
31
- }
32
- """
33
- Given file "public/javascripts/base.js" with contents:
34
- """
35
- function base() {
36
- // ...
37
- }
38
- """
39
- And this mactag config file:
40
- """
41
- Mactag::Table.generate do
42
- app 'public/javascripts/application.js'
43
- app 'public/javascripts/base.js'
44
- end
45
- """
46
- When I create the tags file
47
- Then "app" should be tagged
48
- Then "base" should be tagged
49
-
50
- Scenario: Tag multiple files same call
51
- Given file "public/javascripts/application.js" with contents:
52
- """
53
- function app() {
54
- // ...
55
- }
56
- """
57
- Given file "public/javascripts/base.js" with contents:
58
- """
59
- function base() {
60
- // ...
61
- }
62
- """
63
- And this mactag config file:
64
- """
65
- Mactag::Table.generate do
66
- app 'public/javascripts/application.js', 'public/javascripts/base.js'
67
- end
68
- """
69
- When I create the tags file
70
- Then "app" should be tagged
71
- Then "base" should be tagged
72
-
73
- Scenario: Tag multiple files using asterix
74
- Given file "public/javascripts/application.js" with contents:
75
- """
76
- function app() {
77
- // ...
78
- }
79
- """
80
- Given file "public/javascripts/base.js" with contents:
81
- """
82
- function base() {
83
- // ...
84
- }
85
- """
86
- And this mactag config file:
87
- """
88
- Mactag::Table.generate do
89
- app 'public/javascripts/*.js'
90
- end
91
- """
92
- When I create the tags file
93
- Then "app" should be tagged
94
- Then "base" should be tagged
95
-
96
- Scenario: Tag files recursive
97
- Given file "public/javascripts/mactag.js" with contents:
98
- """
99
- function mactag() {
100
- // ...
101
- }
102
- """
103
- And this mactag config file:
104
- """
105
- Mactag::Table.generate do
106
- app 'public/**/*.js'
107
- end
108
- """
109
- When I create the tags file
110
- Then "mactag" should be tagged
@@ -1,154 +0,0 @@
1
- Feature: Tag Gems
2
- In order to create a TAGS file
3
- As a user
4
- I want to tag gems
5
-
6
- Background:
7
- Given a Rails application
8
- And mactag is installed
9
-
10
- Scenario: Tag single gem
11
- Given the gem "superduper" version "1.0.0" is installed
12
- And file "vendor/gems/superduper-1.0.0/lib/superduper.rb" with contents:
13
- """
14
- class SuperDuper
15
- def i_really_am
16
- # ...
17
- end
18
- end
19
- """
20
- And this mactag config file:
21
- """
22
- Mactag::Config.rvm = false
23
- Mactag::Config.gem_home = File.join('vendor', 'gems')
24
- Mactag::Table.generate do
25
- gem 'superduper'
26
- end
27
- """
28
- When I create the tags file
29
- Then "i_really_am" should be tagged
30
-
31
- Scenario: Tag multiple gems different calls
32
- Given the gem "superduper" version "1.0.0" is installed
33
- Given the gem "dunder" version "0.3.2" is installed
34
- And file "vendor/gems/superduper-1.0.0/lib/superduper.rb" with contents:
35
- """
36
- class SuperDuper
37
- def i_really_am
38
- # ...
39
- end
40
- end
41
- """
42
- And file "vendor/gems/dunder-0.3.2/lib/dunder.rb" with contents:
43
- """
44
- class Dunder
45
- def and_brak
46
- # ...
47
- end
48
- end
49
- """
50
- And this mactag config file:
51
- """
52
- Mactag::Config.rvm = false
53
- Mactag::Config.gem_home = File.join('vendor', 'gems')
54
- Mactag::Table.generate do
55
- gem 'superduper'
56
- gem 'dunder'
57
- end
58
- """
59
- When I create the tags file
60
- Then "i_really_am" should be tagged
61
- Then "and_brak" should be tagged
62
-
63
- Scenario: Tag multiple gems same call
64
- Given the gem "superduper" version "1.0.0" is installed
65
- Given the gem "dunder" version "0.3.2" is installed
66
- And file "vendor/gems/superduper-1.0.0/lib/superduper.rb" with contents:
67
- """
68
- class SuperDuper
69
- def i_really_am
70
- # ...
71
- end
72
- end
73
- """
74
- And file "vendor/gems/dunder-0.3.2/lib/dunder.rb" with contents:
75
- """
76
- class Dunder
77
- def and_brak
78
- # ...
79
- end
80
- end
81
- """
82
- And this mactag config file:
83
- """
84
- Mactag::Config.rvm = false
85
- Mactag::Config.gem_home = File.join('vendor', 'gems')
86
- Mactag::Table.generate do
87
- gem 'superduper', 'dunder'
88
- end
89
- """
90
- When I create the tags file
91
- Then "i_really_am" should be tagged
92
- Then "and_brak" should be tagged
93
-
94
- Scenario: Tag specific version
95
- Given the gem "superduper" version "0.0.3" is installed
96
- And the gem "superduper" version "1.0.0" is installed
97
- And file "vendor/gems/superduper-0.0.3/lib/superduper.rb" with contents:
98
- """
99
- class SuperDuper
100
- def still_in_beta
101
- # ...
102
- end
103
- end
104
- """
105
- And file "vendor/gems/superduper-1.0.0/lib/superduper.rb" with contents:
106
- """
107
- class SuperDuper
108
- def ready_for_production
109
- # ...
110
- end
111
- end
112
- """
113
- And this mactag config file:
114
- """
115
- Mactag::Config.rvm = false
116
- Mactag::Config.gem_home = File.join('vendor', 'gems')
117
- Mactag::Table.generate do
118
- gem 'superduper', :version => '1.0.0'
119
- end
120
- """
121
- When I create the tags file
122
- Then "ready_for_production" should be tagged
123
- And "still_in_beta" should not be tagged
124
-
125
- Scenario: Tag latest version
126
- Given the gem "superduper" version "0.0.3" is installed
127
- And the gem "superduper" version "1.0.0" is installed
128
- And file "vendor/gems/superduper-0.0.3/lib/superduper.rb" with contents:
129
- """
130
- class SuperDuper
131
- def still_in_beta
132
- # ...
133
- end
134
- end
135
- """
136
- And file "vendor/gems/superduper-1.0.0/lib/superduper.rb" with contents:
137
- """
138
- class SuperDuper
139
- def ready_for_production
140
- # ...
141
- end
142
- end
143
- """
144
- And this mactag config file:
145
- """
146
- Mactag::Config.rvm = false
147
- Mactag::Config.gem_home = File.join('vendor', 'gems')
148
- Mactag::Table.generate do
149
- gem 'superduper'
150
- end
151
- """
152
- When I create the tags file
153
- Then "ready_for_production" should be tagged
154
- And "still_in_beta" should not be tagged