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
@@ -7,7 +7,7 @@ to their definitions.
7
7
 
8
8
 
9
9
  # Exuberant Ctags
10
- First off you must install [Ctags](http://ctags.sourceforge.net/).
10
+ First off, you must install [Ctags](http://ctags.sourceforge.net/).
11
11
  Some systems comes with a ctags command already. If you have the ctags
12
12
  executable, but have problems creating the tags file. Then make sure
13
13
  that you are using **Exuberant Ctags** and not some other version.
@@ -24,29 +24,31 @@ Install the plugin:
24
24
 
25
25
  ### Gem
26
26
  Install the gem:
27
- $ sudo gem install mactag --version='0.0.5'
27
+ $ gem install mactag --version='0.0.5'
28
28
 
29
29
  Load the gem in **config/environments/development.rb**:
30
30
  config.gem 'mactag'
31
31
 
32
+
32
33
  ## Rails 3.x
33
- Version 0.1.1 is the only version supporting Rails 3.x.
34
+ Version 0.1.1 is the latest version supporting Rails 3.x.
34
35
 
35
36
  ### Plugin
36
37
  Install the plugin:
37
- $ rails plugin install git://github.com/rejeep/mactag.git --revision 'tags/v0.1.1'
38
+ $ rails plugin install git://github.com/rejeep/mactag.git
38
39
 
39
40
  ### Gem
40
41
  Install the gem:
41
- $ sudo gem install mactag --version='0.1.1'
42
+ $ gem install mactag
42
43
 
43
44
  Load the gem in **Gemfile**:
44
45
  group :development do
45
- gem 'mactag'
46
+ gem 'mactag', '0.1.1'
46
47
  end
47
48
 
48
- ## Note when installing as Gem
49
- When you install mactag as a gem you must also include it's rake tasks
49
+
50
+ ## When installing as Gem
51
+ When you install Mactag as a gem you must also include it's rake tasks
50
52
  in your **Rakefile**.
51
53
  require 'mactag/tasks'
52
54
 
@@ -63,25 +65,26 @@ Generate a basic configuration file:
63
65
  This will create the file **config/mactag.rb**, which contains some
64
66
  examples of how to configure Mactag.
65
67
 
66
-
67
68
  ## Options
68
69
 
70
+ * **Mactag::Config.rvm:** If true, use RVM gems. Defaults to **true**
69
71
  * **Mactag::Config.gem_home:** The path where the gems are located. Defaults to **/Library/Ruby/Gems/1.8/gems**
70
72
  * **Mactag::Config.binary:** The command to run when creating the TAGS-file. Defaults to **ctags -o TAGS -e**
71
73
 
72
74
  ## Example mactag.rb file
73
- Mactag::Config.gem_home = "/usr/lib/ruby/gems/1.8/gems"
74
- Mactag::Config.binary = "etags -o TAGS"
75
+ Mactag::Config.rvm = false
76
+ Mactag::Config.gem_home = '/usr/lib/ruby/gems/1.8/gems'
77
+ Mactag::Config.binary = 'etags -o TAGS'
75
78
 
76
79
  Mactag::Table.generate do
77
- app "app/**/*.rb", "lib/*.rb"
80
+ app 'app/**/*.rb', 'lib/*.rb'
78
81
 
79
- plugins "thinking-sphinx", "whenever"
82
+ plugins 'thinking-sphinx', 'whenever'
80
83
 
81
- gems "paperclip", "authlogic"
82
- gem "formtastic", :version => "0.9.7"
84
+ gems 'paperclip', 'authlogic'
85
+ gem 'formtastic', :version => '0.9.7'
83
86
 
84
- rails :except => :actionmailer, :version => "2.3.5"
87
+ rails :except => :actionmailer, :version => '2.3.5'
85
88
  end
86
89
 
87
90
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.2.0
@@ -8,37 +8,103 @@ Feature: Tag application files
8
8
  And mactag is installed
9
9
 
10
10
  Scenario: Tag single file
11
- Given a javascript function "show" in "whitebox"
12
- And a mactag config file with this contents:
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:
13
40
  """
14
41
  Mactag::Table.generate do
15
- app "public/javascripts/whitebox.js"
42
+ app 'public/javascripts/application.js'
43
+ app 'public/javascripts/base.js'
16
44
  end
17
45
  """
18
46
  When I create the tags file
19
- Then the tags file should contain "show"
47
+ Then "app" should be tagged
48
+ Then "base" should be tagged
20
49
 
21
- Scenario: Tag multiple files
22
- Given a javascript function "hide" in "whitebox"
23
- And a ruby method "to_s" in the "user" model
24
- And a mactag config file with this contents:
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:
25
87
  """
26
88
  Mactag::Table.generate do
27
- app "public/javascripts/whitebox.js"
28
- app "app/models/user.rb"
89
+ app 'public/javascripts/*.js'
29
90
  end
30
91
  """
31
92
  When I create the tags file
32
- Then the tags file should contain "hide"
33
- And the tags file should contain "to_s"
93
+ Then "app" should be tagged
94
+ Then "base" should be tagged
34
95
 
35
96
  Scenario: Tag files recursive
36
- Given a ruby method "kill!" in the "user" model
37
- And a mactag config file with this contents:
97
+ Given file "public/javascripts/mactag.js" with contents:
98
+ """
99
+ function mactag() {
100
+ // ...
101
+ }
102
+ """
103
+ And this mactag config file:
38
104
  """
39
105
  Mactag::Table.generate do
40
- app "app/**/*.rb"
106
+ app 'public/**/*.js'
41
107
  end
42
108
  """
43
109
  When I create the tags file
44
- Then the tags file should contain "kill!"
110
+ Then "mactag" should be tagged
@@ -9,66 +9,146 @@ Feature: Tag Gems
9
9
 
10
10
  Scenario: Tag single gem
11
11
  Given the gem "superduper" version "1.0.0" is installed
12
- And an acts as method for the "superduper-1.0.0" gem
13
- And a mactag config file with this contents:
12
+ And file "vendor/gems/superduper-1.0.0/lib/superduper.rb" with contents:
14
13
  """
15
- Mactag::Config.gem_home = File.join("vendor", "gems")
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')
16
24
  Mactag::Table.generate do
17
- gem "superduper"
25
+ gem 'superduper'
18
26
  end
19
27
  """
20
28
  When I create the tags file
21
- Then the tags file should contain "acts_as_superduper"
29
+ Then "i_really_am" should be tagged
22
30
 
23
- Scenario: Tag multiple gems
31
+ Scenario: Tag multiple gems different calls
24
32
  Given the gem "superduper" version "1.0.0" is installed
25
- And the gem "dunder" version "1.0.0" is installed
26
- And an acts as method for the "superduper-1.0.0" gem
27
- And an acts as method for the "dunder-1.0.0" gem
28
- And a mactag config file with this contents:
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:
29
51
  """
30
- Mactag::Config.gem_home = File.join("vendor", "gems")
52
+ Mactag::Config.rvm = false
53
+ Mactag::Config.gem_home = File.join('vendor', 'gems')
31
54
  Mactag::Table.generate do
32
- gems "superduper", "dunder"
55
+ gem 'superduper'
56
+ gem 'dunder'
33
57
  end
34
58
  """
35
59
  When I create the tags file
36
- Then the tags file should contain "acts_as_superduper"
37
- Then the tags file should contain "acts_as_dunder"
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
38
93
 
39
94
  Scenario: Tag specific version
40
- Given the gem "superduper" version "1.0.0" is installed
41
- And the gem "superduper" version "1.0.1" is installed
42
- And an acts as method for the "superduper-1.0.0" gem
43
- And an acts as method for the "superduper-1.0.1" gem
44
- And a mactag config file with this contents:
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:
45
98
  """
46
- Mactag::Config.gem_home = File.join("vendor", "gems")
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')
47
117
  Mactag::Table.generate do
48
- gem "superduper", :version => "1.0.0"
118
+ gem 'superduper', :version => '1.0.0'
49
119
  end
50
120
  """
51
121
  When I create the tags file
52
- Then the tags file should contain "acts_as_superduper"
53
- And the tags file should contain "1.0.0"
54
- And the tags file should not contain "1.0.1"
122
+ Then "ready_for_production" should be tagged
123
+ And "still_in_beta" should not be tagged
55
124
 
56
125
  Scenario: Tag latest version
57
- Given the gem "superduper" version "1.0.2" is installed
58
- And the gem "superduper" version "1.0.1" is installed
126
+ Given the gem "superduper" version "0.0.3" is installed
59
127
  And the gem "superduper" version "1.0.0" is installed
60
- And an acts as method for the "superduper-1.0.2" gem
61
- And an acts as method for the "superduper-1.0.1" gem
62
- And an acts as method for the "superduper-1.0.0" gem
63
- And a mactag config file with this contents:
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:
64
145
  """
65
- Mactag::Config.gem_home = File.join("vendor", "gems")
146
+ Mactag::Config.rvm = false
147
+ Mactag::Config.gem_home = File.join('vendor', 'gems')
66
148
  Mactag::Table.generate do
67
- gem "superduper"
149
+ gem 'superduper'
68
150
  end
69
151
  """
70
152
  When I create the tags file
71
- Then the tags file should contain "acts_as_superduper"
72
- And the tags file should contain "1.0.2"
73
- And the tags file should not contain "1.0.0"
74
- And the tags file should not contain "1.0.1"
153
+ Then "ready_for_production" should be tagged
154
+ And "still_in_beta" should not be tagged
@@ -1,7 +1,7 @@
1
1
  Feature: Tag Plugins
2
2
  In order to create a TAGS file
3
3
  As a user
4
- I want to tag plugins
4
+ I want to tag application plugins
5
5
 
6
6
  Background:
7
7
  Given a Rails application
@@ -9,42 +9,107 @@ Feature: Tag Plugins
9
9
 
10
10
  Scenario: Tag single plugin
11
11
  Given the plugin "superduper" is installed
12
- And an acts as method for the "superduper" plugin
13
- And a mactag config file with this contents:
12
+ And file "vendor/plugins/superduper/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:
14
21
  """
15
22
  Mactag::Table.generate do
16
- plugin "superduper"
23
+ plugin 'superduper'
17
24
  end
18
25
  """
19
26
  When I create the tags file
20
- Then the tags file should contain "acts_as_superduper"
21
-
22
- Scenario: Tag multiple plugins
27
+ Then "i_really_am" should be tagged
28
+
29
+ Scenario: Tag multiple plugins different calls
23
30
  Given the plugin "superduper" is installed
24
- And the plugin "dunder" is installed
25
- And an acts as method for the "superduper" plugin
26
- And an acts as method for the "dunder" plugin
27
- And a mactag config file with this contents:
31
+ Given the plugin "dunder" is installed
32
+ And file "vendor/plugins/superduper/lib/superduper.rb" with contents:
33
+ """
34
+ class SuperDuper
35
+ def i_really_am
36
+ # ...
37
+ end
38
+ end
39
+ """
40
+ And file "vendor/plugins/dunder/lib/dunder.rb" with contents:
41
+ """
42
+ class Dunder
43
+ def and_brak
44
+ # ...
45
+ end
46
+ end
47
+ """
48
+ And this mactag config file:
28
49
  """
29
50
  Mactag::Table.generate do
30
- plugin "superduper", "dunder"
51
+ plugin 'superduper'
52
+ plugin 'dunder'
31
53
  end
32
54
  """
33
55
  When I create the tags file
34
- Then the tags file should contain "acts_as_superduper"
35
- Then the tags file should contain "acts_as_dunder"
36
-
56
+ Then "i_really_am" should be tagged
57
+ Then "and_brak" should be tagged
58
+
59
+ Scenario: Tag multiple plugins same call
60
+ Given the plugin "superduper" is installed
61
+ Given the plugin "dunder" is installed
62
+ And file "vendor/plugins/superduper/lib/superduper.rb" with contents:
63
+ """
64
+ class SuperDuper
65
+ def i_really_am
66
+ # ...
67
+ end
68
+ end
69
+ """
70
+ And file "vendor/plugins/dunder/lib/dunder.rb" with contents:
71
+ """
72
+ class Dunder
73
+ def and_brak
74
+ # ...
75
+ end
76
+ end
77
+ """
78
+ And this mactag config file:
79
+ """
80
+ Mactag::Table.generate do
81
+ plugins 'superduper', 'dunder'
82
+ end
83
+ """
84
+ When I create the tags file
85
+ Then "i_really_am" should be tagged
86
+ Then "and_brak" should be tagged
87
+
37
88
  Scenario: Tag all plugins
38
89
  Given the plugin "superduper" is installed
39
- And the plugin "dunder" is installed
40
- And an acts as method for the "superduper" plugin
41
- And an acts as method for the "dunder" plugin
42
- And a mactag config file with this contents:
90
+ Given the plugin "dunder" is installed
91
+ And file "vendor/plugins/superduper/lib/superduper.rb" with contents:
92
+ """
93
+ class SuperDuper
94
+ def i_really_am
95
+ # ...
96
+ end
97
+ end
98
+ """
99
+ And file "vendor/plugins/dunder/lib/dunder.rb" with contents:
100
+ """
101
+ class Dunder
102
+ def and_brak
103
+ # ...
104
+ end
105
+ end
106
+ """
107
+ And this mactag config file:
43
108
  """
44
109
  Mactag::Table.generate do
45
110
  plugins
46
111
  end
47
112
  """
48
113
  When I create the tags file
49
- Then the tags file should contain "acts_as_superduper"
50
- Then the tags file should contain "acts_as_dunder"
114
+ Then "i_really_am" should be tagged
115
+ Then "and_brak" should be tagged