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.
- data/README.markdown +19 -16
- data/VERSION +1 -1
- data/features/app.feature +82 -16
- data/features/gem.feature +116 -36
- data/features/plugin.feature +86 -21
- data/features/rails.feature +6 -0
- data/features/step_definitions/mactag_steps.rb +43 -0
- data/features/support/env.rb +4 -0
- data/features/support/rails_app.rb +20 -48
- data/features/support/tags_file.rb +8 -5
- data/lib/generators/mactag/templates/mactag.rb +50 -9
- data/lib/mactag.rb +1 -1
- data/lib/mactag/config.rb +28 -7
- data/lib/mactag/table.rb +22 -9
- data/lib/mactag/tag/app.rb +10 -10
- data/lib/mactag/tag/gem.rb +51 -17
- data/lib/mactag/tag/parser.rb +12 -2
- data/lib/mactag/tag/plugin.rb +15 -12
- data/lib/mactag/tag/rails.rb +43 -67
- data/test/mactag/config_test.rb +33 -3
- data/test/mactag/tag/app_test.rb +3 -5
- data/test/mactag/tag/gem_test.rb +47 -20
- data/test/mactag/tag/plugin_test.rb +23 -25
- data/test/mactag/tag/rails_test.rb +18 -123
- metadata +105 -27
- data/TODO +0 -8
- data/features/rails/actionmailer/lib/action_mailer/base.rb +0 -9
- data/features/rails/actionpack/lib/action_controller/caching/actions.rb +0 -11
- data/features/rails/actionpack/lib/action_view/action_view/helpers/form_tag_helper.rb +0 -9
- data/features/rails/activerecord/lib/active_record/associations.rb +0 -9
- data/features/rails/activeresource/lib/active_resource/connection.rb +0 -7
- data/features/rails/activesupport/lib/active_support/core_ext/hash/diff.rb +0 -5
- data/features/rails_gem.feature +0 -89
- data/features/rails_vendor.feature +0 -57
- data/features/step_definitions/gem_steps.rb +0 -22
- data/features/step_definitions/mactab_steps.rb +0 -57
- data/features/step_definitions/plugin_steps.rb +0 -22
- data/features/step_definitions/rails_steps.rb +0 -20
- data/lib/mactag/tag/versioned.rb +0 -22
@@ -1,57 +0,0 @@
|
|
1
|
-
Feature: Tag Rails in vendor
|
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
|
-
And rails lives in vendor
|
10
|
-
|
11
|
-
Scenario: Tag all packages
|
12
|
-
Given 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 a mactag config file with this contents:
|
29
|
-
"""
|
30
|
-
Mactag::Config.gem_home = File.join("vendor", "rails-temp")
|
31
|
-
Mactag::Table.generate do
|
32
|
-
rails :only => %w[activerecord active_support]
|
33
|
-
end
|
34
|
-
"""
|
35
|
-
When I create the tags file
|
36
|
-
Then the tags file should contain "diff"
|
37
|
-
And the tags file should contain "has_many"
|
38
|
-
And the tags file should not contain "get"
|
39
|
-
And the tags file should not contain "deliver"
|
40
|
-
And the tags file should not contain "caches_action"
|
41
|
-
And the tags file should not contain "form_tag"
|
42
|
-
|
43
|
-
Scenario: Tag all except some packages
|
44
|
-
Given a mactag config file with this contents:
|
45
|
-
"""
|
46
|
-
Mactag::Config.gem_home = File.join("vendor", "rails-temp")
|
47
|
-
Mactag::Table.generate do
|
48
|
-
rails :except => %w[action_controller actionview]
|
49
|
-
end
|
50
|
-
"""
|
51
|
-
When I create the tags file
|
52
|
-
Then the tags file should contain "diff"
|
53
|
-
And the tags file should contain "has_many"
|
54
|
-
And the tags file should contain "get"
|
55
|
-
And the tags file should contain "deliver"
|
56
|
-
And the tags file should not contain "caches_action"
|
57
|
-
And the tags file should not contain "form_tag"
|
@@ -1,22 +0,0 @@
|
|
1
|
-
Given /^the gem "([^\"]*)" version "([^\"]*)" is installed$/ do |gem, version|
|
2
|
-
@app.install_gem(gem, version)
|
3
|
-
end
|
4
|
-
|
5
|
-
Given /^an acts as method for the "([^\"]*)" gem$/ do |gem|
|
6
|
-
file = File.join("vendor", "gems", gem, "lib", "#{gem}.rb")
|
7
|
-
@app.puts file do
|
8
|
-
<<-eos
|
9
|
-
module #{gem.camelize}
|
10
|
-
def self.included(base)
|
11
|
-
base.send :extend, ClassMethods
|
12
|
-
end
|
13
|
-
|
14
|
-
module ClassMethods
|
15
|
-
def acts_as_#{gem}
|
16
|
-
# ...
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
eos
|
21
|
-
end
|
22
|
-
end
|
@@ -1,57 +0,0 @@
|
|
1
|
-
Given /^a Rails application$/ do
|
2
|
-
@app = RailsApp.new
|
3
|
-
end
|
4
|
-
|
5
|
-
Given /^mactag is installed$/ do
|
6
|
-
mactag = File.join(@app.rails_root, "vendor", "plugins", "mactag")
|
7
|
-
|
8
|
-
FileUtils.mkdir_p(mactag)
|
9
|
-
|
10
|
-
[ "lib", "Rakefile", "init.rb" ].each do |name|
|
11
|
-
file = File.join(File.dirname(__FILE__), "..", "..", name)
|
12
|
-
|
13
|
-
FileUtils.cp_r(file, mactag)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
Given /^a mactag config file with this contents:$/ do |contents|
|
18
|
-
@app.puts "config/mactag.rb", contents
|
19
|
-
end
|
20
|
-
|
21
|
-
Given /^a javascript function "([^\"]*)" in "([^\"]*)"$/ do |function, file|
|
22
|
-
@app.puts "public/javascripts/#{file}.js" do
|
23
|
-
<<-eos
|
24
|
-
function #{function}() {
|
25
|
-
// ...
|
26
|
-
}
|
27
|
-
eos
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
Given /^a ruby method "([^\"]*)" in the "([^\"]*)" model$/ do |method, model|
|
32
|
-
@app.puts "app/models/#{model}.rb" do
|
33
|
-
<<-eos
|
34
|
-
class #{model.camelize}
|
35
|
-
def #{method}
|
36
|
-
# ...
|
37
|
-
end
|
38
|
-
end
|
39
|
-
eos
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
When /^I create the tags file$/ do
|
44
|
-
@tags = TagsFile.new(@app)
|
45
|
-
end
|
46
|
-
|
47
|
-
Then /^the tags file should contain "([^\"]*)"$/ do |tag|
|
48
|
-
assert @tags.contain?(tag)
|
49
|
-
end
|
50
|
-
|
51
|
-
Then /^the tags file should not contain "([^\"]*)"$/ do |tag|
|
52
|
-
assert !@tags.contain?(tag)
|
53
|
-
end
|
54
|
-
|
55
|
-
After do
|
56
|
-
@app.destroy
|
57
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
Given /^the plugin "([^\"]*)" is installed$/ do |plugin|
|
2
|
-
@app.install_plugin(plugin)
|
3
|
-
end
|
4
|
-
|
5
|
-
Given /^an acts as method for the "([^\"]*)" plugin$/ do |plugin|
|
6
|
-
file = File.join("vendor", "plugins", plugin, "lib", "#{plugin}.rb")
|
7
|
-
@app.puts file do
|
8
|
-
<<-eos
|
9
|
-
module #{plugin.camelize}
|
10
|
-
def self.included(base)
|
11
|
-
base.send :extend, ClassMethods
|
12
|
-
end
|
13
|
-
|
14
|
-
module ClassMethods
|
15
|
-
def acts_as_#{plugin}
|
16
|
-
# ...
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
eos
|
21
|
-
end
|
22
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
Given /^rails lives in vendor$/ do
|
2
|
-
@app.install_rails_vendor
|
3
|
-
|
4
|
-
# Replaces the path to vendor rails. We can not use "rails" here
|
5
|
-
# since when running the rake task rails will try to start by using
|
6
|
-
# rails in vendor. But by renaming it to "rails-temp", this will not happen.
|
7
|
-
mactag = File.join(@app.rails_root, "vendor", "plugins", "mactag")
|
8
|
-
vendor = File.join(mactag, "lib", "mactag", "tag", "rails.rb")
|
9
|
-
from = 'VENDOR = File.join("vendor", "rails")'
|
10
|
-
to = 'VENDOR = File.join("vendor", "rails-temp")'
|
11
|
-
@app.gsub(vendor, from, to)
|
12
|
-
end
|
13
|
-
|
14
|
-
Given /^rails is installed as a gem$/ do
|
15
|
-
@app.install_rails_gem
|
16
|
-
end
|
17
|
-
|
18
|
-
Given /^rails version "([^\"]*)" is installed as a gem$/ do |version|
|
19
|
-
@app.install_rails_gem(version)
|
20
|
-
end
|
data/lib/mactag/tag/versioned.rb
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
module Mactag
|
2
|
-
module Tag
|
3
|
-
|
4
|
-
# Helper module for Gems (which all have a version).
|
5
|
-
module Versioned
|
6
|
-
|
7
|
-
# Returns the latest version of +gem+. If only one gem, that is
|
8
|
-
# returned.
|
9
|
-
def latest(gem)
|
10
|
-
versions = Dir.glob(File.join(Mactag::Config.gem_home, gem) + "-*")
|
11
|
-
if versions.size == 1
|
12
|
-
gem = versions.first
|
13
|
-
else
|
14
|
-
gem = versions.sort.last
|
15
|
-
end
|
16
|
-
gem
|
17
|
-
end
|
18
|
-
|
19
|
-
end
|
20
|
-
|
21
|
-
end
|
22
|
-
end
|