tagger 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/Gemfile +1 -13
- data/Gemfile.lock +68 -69
- data/Rakefile +4 -26
- data/lib/tagger/tag.rb +1 -1
- data/lib/tagger/version.rb +1 -1
- data/spec/tagger_spec.rb +5 -0
- data/tagger.gemspec +17 -68
- metadata +53 -28
- data/spec/support/log/test.log +0 -8795
data/.gitignore
ADDED
data/Gemfile
CHANGED
@@ -1,14 +1,2 @@
|
|
1
1
|
source :rubygems
|
2
|
-
|
3
|
-
gem "rails", "3.0.0"
|
4
|
-
gem "rspec-rails", "2.0.0.rc"
|
5
|
-
gem "activerecord", "3.0.0"
|
6
|
-
gem "sqlite3-ruby"
|
7
|
-
|
8
|
-
platforms :mri_19 do
|
9
|
-
gem "ruby-debug19", :require => "ruby-debug"
|
10
|
-
end
|
11
|
-
|
12
|
-
platforms :mri_18 do
|
13
|
-
gem "ruby-debug"
|
14
|
-
end
|
2
|
+
gemspec
|
data/Gemfile.lock
CHANGED
@@ -1,87 +1,88 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
tagger (0.1.2)
|
5
|
+
rails (~> 3.0.0)
|
6
|
+
|
1
7
|
GEM
|
2
8
|
remote: http://rubygems.org/
|
3
9
|
specs:
|
4
10
|
abstract (1.0.0)
|
5
|
-
actionmailer (3.0.
|
6
|
-
actionpack (= 3.0.
|
7
|
-
mail (~> 2.2.
|
8
|
-
actionpack (3.0.
|
9
|
-
activemodel (= 3.0.
|
10
|
-
activesupport (= 3.0.
|
11
|
+
actionmailer (3.0.7)
|
12
|
+
actionpack (= 3.0.7)
|
13
|
+
mail (~> 2.2.15)
|
14
|
+
actionpack (3.0.7)
|
15
|
+
activemodel (= 3.0.7)
|
16
|
+
activesupport (= 3.0.7)
|
11
17
|
builder (~> 2.1.2)
|
12
18
|
erubis (~> 2.6.6)
|
13
|
-
i18n (~> 0.
|
19
|
+
i18n (~> 0.5.0)
|
14
20
|
rack (~> 1.2.1)
|
15
|
-
rack-mount (~> 0.6.
|
16
|
-
rack-test (~> 0.5.
|
21
|
+
rack-mount (~> 0.6.14)
|
22
|
+
rack-test (~> 0.5.7)
|
17
23
|
tzinfo (~> 0.3.23)
|
18
|
-
activemodel (3.0.
|
19
|
-
activesupport (= 3.0.
|
24
|
+
activemodel (3.0.7)
|
25
|
+
activesupport (= 3.0.7)
|
20
26
|
builder (~> 2.1.2)
|
21
|
-
i18n (~> 0.
|
22
|
-
activerecord (3.0.
|
23
|
-
activemodel (= 3.0.
|
24
|
-
activesupport (= 3.0.
|
25
|
-
arel (~>
|
27
|
+
i18n (~> 0.5.0)
|
28
|
+
activerecord (3.0.7)
|
29
|
+
activemodel (= 3.0.7)
|
30
|
+
activesupport (= 3.0.7)
|
31
|
+
arel (~> 2.0.2)
|
26
32
|
tzinfo (~> 0.3.23)
|
27
|
-
activeresource (3.0.
|
28
|
-
activemodel (= 3.0.
|
29
|
-
activesupport (= 3.0.
|
30
|
-
activesupport (3.0.
|
33
|
+
activeresource (3.0.7)
|
34
|
+
activemodel (= 3.0.7)
|
35
|
+
activesupport (= 3.0.7)
|
36
|
+
activesupport (3.0.7)
|
31
37
|
archive-tar-minitar (0.5.2)
|
32
|
-
arel (
|
33
|
-
activesupport (~> 3.0.0)
|
38
|
+
arel (2.0.9)
|
34
39
|
builder (2.1.2)
|
35
40
|
columnize (0.3.1)
|
36
41
|
diff-lcs (1.1.2)
|
37
42
|
erubis (2.6.6)
|
38
43
|
abstract (>= 1.0.0)
|
39
|
-
i18n (0.
|
40
|
-
linecache (0.43)
|
44
|
+
i18n (0.5.0)
|
41
45
|
linecache19 (0.5.11)
|
42
46
|
ruby_core_source (>= 0.1.4)
|
43
|
-
mail (2.2.
|
47
|
+
mail (2.2.16)
|
44
48
|
activesupport (>= 2.3.6)
|
45
|
-
|
46
|
-
|
49
|
+
i18n (>= 0.4.0)
|
50
|
+
mime-types (~> 1.16)
|
51
|
+
treetop (~> 1.4.8)
|
47
52
|
mime-types (1.16)
|
48
53
|
polyglot (0.3.1)
|
49
|
-
rack (1.2.
|
50
|
-
rack-mount (0.6.
|
54
|
+
rack (1.2.2)
|
55
|
+
rack-mount (0.6.14)
|
51
56
|
rack (>= 1.0.0)
|
52
|
-
rack-test (0.5.
|
57
|
+
rack-test (0.5.7)
|
53
58
|
rack (>= 1.0)
|
54
|
-
rails (3.0.
|
55
|
-
actionmailer (= 3.0.
|
56
|
-
actionpack (= 3.0.
|
57
|
-
activerecord (= 3.0.
|
58
|
-
activeresource (= 3.0.
|
59
|
-
activesupport (= 3.0.
|
60
|
-
bundler (~> 1.0
|
61
|
-
railties (= 3.0.
|
62
|
-
railties (3.0.
|
63
|
-
actionpack (= 3.0.
|
64
|
-
activesupport (= 3.0.
|
65
|
-
rake (>= 0.8.
|
66
|
-
thor (~> 0.14.
|
59
|
+
rails (3.0.7)
|
60
|
+
actionmailer (= 3.0.7)
|
61
|
+
actionpack (= 3.0.7)
|
62
|
+
activerecord (= 3.0.7)
|
63
|
+
activeresource (= 3.0.7)
|
64
|
+
activesupport (= 3.0.7)
|
65
|
+
bundler (~> 1.0)
|
66
|
+
railties (= 3.0.7)
|
67
|
+
railties (3.0.7)
|
68
|
+
actionpack (= 3.0.7)
|
69
|
+
activesupport (= 3.0.7)
|
70
|
+
rake (>= 0.8.7)
|
71
|
+
thor (~> 0.14.4)
|
67
72
|
rake (0.8.7)
|
68
|
-
rspec (2.
|
69
|
-
rspec-core (
|
70
|
-
rspec-expectations (
|
71
|
-
rspec-mocks (
|
72
|
-
rspec-core (2.
|
73
|
-
rspec-expectations (2.
|
74
|
-
diff-lcs (
|
75
|
-
rspec-mocks (2.
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
columnize (>= 0.1)
|
82
|
-
ruby-debug-base (~> 0.10.3.0)
|
83
|
-
ruby-debug-base (0.10.3)
|
84
|
-
linecache (>= 0.3)
|
73
|
+
rspec (2.5.0)
|
74
|
+
rspec-core (~> 2.5.0)
|
75
|
+
rspec-expectations (~> 2.5.0)
|
76
|
+
rspec-mocks (~> 2.5.0)
|
77
|
+
rspec-core (2.5.1)
|
78
|
+
rspec-expectations (2.5.0)
|
79
|
+
diff-lcs (~> 1.1.2)
|
80
|
+
rspec-mocks (2.5.0)
|
81
|
+
rspec-rails (2.5.0)
|
82
|
+
actionpack (~> 3.0)
|
83
|
+
activesupport (~> 3.0)
|
84
|
+
railties (~> 3.0)
|
85
|
+
rspec (~> 2.5.0)
|
85
86
|
ruby-debug-base19 (0.11.24)
|
86
87
|
columnize (>= 0.3.1)
|
87
88
|
linecache19 (>= 0.5.11)
|
@@ -92,19 +93,17 @@ GEM
|
|
92
93
|
ruby-debug-base19 (>= 0.11.19)
|
93
94
|
ruby_core_source (0.1.4)
|
94
95
|
archive-tar-minitar (>= 0.5.2)
|
95
|
-
sqlite3
|
96
|
-
thor (0.14.
|
97
|
-
treetop (1.4.
|
96
|
+
sqlite3 (1.3.3)
|
97
|
+
thor (0.14.6)
|
98
|
+
treetop (1.4.9)
|
98
99
|
polyglot (>= 0.3.1)
|
99
|
-
tzinfo (0.3.
|
100
|
+
tzinfo (0.3.26)
|
100
101
|
|
101
102
|
PLATFORMS
|
102
103
|
ruby
|
103
104
|
|
104
105
|
DEPENDENCIES
|
105
|
-
|
106
|
-
rails (= 3.0.0)
|
107
|
-
rspec-rails (= 2.0.0.rc)
|
108
|
-
ruby-debug
|
106
|
+
rspec-rails (~> 2.5.0)
|
109
107
|
ruby-debug19
|
110
|
-
sqlite3
|
108
|
+
sqlite3 (~> 1.3.3)
|
109
|
+
tagger!
|
data/Rakefile
CHANGED
@@ -1,27 +1,5 @@
|
|
1
|
-
require "
|
2
|
-
|
3
|
-
|
4
|
-
RSpec::Core::RakeTask.new do |t|
|
5
|
-
t.ruby_opts = %w[-Ilib -Ispec]
|
6
|
-
end
|
7
|
-
|
8
|
-
begin
|
9
|
-
require "jeweler"
|
1
|
+
require "bundler"
|
2
|
+
Bundler::GemHelper.install_tasks
|
10
3
|
|
11
|
-
|
12
|
-
|
13
|
-
gem.version = Tagger::Version::STRING
|
14
|
-
gem.summary = "Add tagging support for Rails apps"
|
15
|
-
gem.description = "Add tagging support for Rails apps"
|
16
|
-
gem.authors = ["Nando Vieira"]
|
17
|
-
gem.email = "fnando.vieira@gmail.com"
|
18
|
-
gem.homepage = "http://github.com/fnando/tagger"
|
19
|
-
gem.has_rdoc = false
|
20
|
-
gem.add_dependency "rails", ">= 3.0.0"
|
21
|
-
gem.files = FileList["{Gemfile,Gemfile.lock,Rakefile,MIT-LICENSE,tagger.gemspec,README.rdoc}", "{lib,spec,templates}/**/*"]
|
22
|
-
end
|
23
|
-
|
24
|
-
Jeweler::GemcutterTasks.new
|
25
|
-
rescue LoadError => e
|
26
|
-
puts "You don't Jeweler installed, so you won't be able to build gems."
|
27
|
-
end
|
4
|
+
require "rspec/core/rake_task"
|
5
|
+
RSpec::Core::RakeTask.new
|
data/lib/tagger/tag.rb
CHANGED
@@ -36,7 +36,7 @@ class Tag < ActiveRecord::Base
|
|
36
36
|
separator = SEPARATORS[separator] || SEPARATORS[:comma]
|
37
37
|
tags = []
|
38
38
|
tag_list = tag_list.dup
|
39
|
-
tag_list.gsub!(/(["'])(.*?)(\1)/
|
39
|
+
tag_list.gsub!(/(["'])(.*?)(\1)/m) {|m| tags << $2; "" }
|
40
40
|
tags += tag_list.split(separator)
|
41
41
|
tags.collect(&:squish).reject(&:blank?).sort_by {|tag| tag.downcase}
|
42
42
|
end
|
data/lib/tagger/version.rb
CHANGED
data/spec/tagger_spec.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
1
2
|
require "spec_helper"
|
2
3
|
|
3
4
|
describe Tagger do
|
@@ -76,6 +77,10 @@ describe Tagger do
|
|
76
77
|
it "should recognize multiple words when using space" do
|
77
78
|
Tag.parse(%["ruby on rails" "web development" programming ruby], :space).should == ["programming", "ruby", "ruby on rails", "web development"]
|
78
79
|
end
|
80
|
+
|
81
|
+
it "normalizes accented words" do
|
82
|
+
Tag.parse("popularização", :space).should == %w[popularização]
|
83
|
+
end
|
79
84
|
end
|
80
85
|
|
81
86
|
describe "Tag.cloud" do
|
data/tagger.gemspec
CHANGED
@@ -1,75 +1,24 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
1
|
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "tagger/version"
|
5
4
|
|
6
5
|
Gem::Specification.new do |s|
|
7
|
-
s.name
|
8
|
-
s.version
|
6
|
+
s.name = "tagger"
|
7
|
+
s.version = Tagger::Version::STRING
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Nando Vieira"]
|
10
|
+
s.email = ["fnando.vieira@gmail.com"]
|
11
|
+
s.homepage = "http://rubygems.org/gems/tagger"
|
12
|
+
s.summary = "Add tagging support for ActiveRecord"
|
13
|
+
s.description = s.summary
|
9
14
|
|
10
|
-
s.
|
11
|
-
s.
|
12
|
-
s.
|
13
|
-
s.description = %q{Add tagging support for Rails apps}
|
14
|
-
s.email = %q{fnando.vieira@gmail.com}
|
15
|
-
s.extra_rdoc_files = [
|
16
|
-
"README.rdoc"
|
17
|
-
]
|
18
|
-
s.files = [
|
19
|
-
"Gemfile",
|
20
|
-
"Gemfile.lock",
|
21
|
-
"MIT-LICENSE",
|
22
|
-
"README.rdoc",
|
23
|
-
"Rakefile",
|
24
|
-
"lib/tagger.rb",
|
25
|
-
"lib/tagger/active_record.rb",
|
26
|
-
"lib/tagger/generator.rb",
|
27
|
-
"lib/tagger/helper.rb",
|
28
|
-
"lib/tagger/railtie.rb",
|
29
|
-
"lib/tagger/tag.rb",
|
30
|
-
"lib/tagger/tagging.rb",
|
31
|
-
"lib/tagger/version.rb",
|
32
|
-
"spec/fixtures/categories.yml",
|
33
|
-
"spec/fixtures/links.yml",
|
34
|
-
"spec/fixtures/posts.yml",
|
35
|
-
"spec/fixtures/tags.yml",
|
36
|
-
"spec/helpers/helper_spec.rb",
|
37
|
-
"spec/schema.rb",
|
38
|
-
"spec/spec_helper.rb",
|
39
|
-
"spec/support/config/boot.rb",
|
40
|
-
"spec/support/config/database.yml",
|
41
|
-
"spec/support/log/test.log",
|
42
|
-
"spec/support/models.rb",
|
43
|
-
"spec/tagger_spec.rb",
|
44
|
-
"tagger.gemspec",
|
45
|
-
"templates/taggings.rb",
|
46
|
-
"templates/tags.rb"
|
47
|
-
]
|
48
|
-
s.homepage = %q{http://github.com/fnando/tagger}
|
49
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
15
|
+
s.files = `git ls-files`.split("\n")
|
16
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
17
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
50
18
|
s.require_paths = ["lib"]
|
51
|
-
s.rubygems_version = %q{1.3.7}
|
52
|
-
s.summary = %q{Add tagging support for Rails apps}
|
53
|
-
s.test_files = [
|
54
|
-
"spec/helpers/helper_spec.rb",
|
55
|
-
"spec/schema.rb",
|
56
|
-
"spec/spec_helper.rb",
|
57
|
-
"spec/support/config/boot.rb",
|
58
|
-
"spec/support/models.rb",
|
59
|
-
"spec/tagger_spec.rb"
|
60
|
-
]
|
61
19
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
67
|
-
s.add_runtime_dependency(%q<rails>, [">= 3.0.0"])
|
68
|
-
else
|
69
|
-
s.add_dependency(%q<rails>, [">= 3.0.0"])
|
70
|
-
end
|
71
|
-
else
|
72
|
-
s.add_dependency(%q<rails>, [">= 3.0.0"])
|
73
|
-
end
|
20
|
+
s.add_dependency "rails", "~> 3.0.0"
|
21
|
+
s.add_development_dependency "rspec-rails", "~> 2.5.0"
|
22
|
+
s.add_development_dependency "sqlite3", "~> 1.3.3"
|
23
|
+
s.add_development_dependency "ruby-debug19" if RUBY_VERSION >= "1.9"
|
74
24
|
end
|
75
|
-
|
metadata
CHANGED
@@ -1,12 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tagger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 1
|
8
|
-
- 1
|
9
|
-
version: 0.1.1
|
4
|
+
prerelease:
|
5
|
+
version: 0.1.2
|
10
6
|
platform: ruby
|
11
7
|
authors:
|
12
8
|
- Nando Vieira
|
@@ -14,8 +10,7 @@ autorequire:
|
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
12
|
|
17
|
-
date:
|
18
|
-
default_executable:
|
13
|
+
date: 2011-04-19 00:00:00 Z
|
19
14
|
dependencies:
|
20
15
|
- !ruby/object:Gem::Dependency
|
21
16
|
name: rails
|
@@ -23,24 +18,55 @@ dependencies:
|
|
23
18
|
requirement: &id001 !ruby/object:Gem::Requirement
|
24
19
|
none: false
|
25
20
|
requirements:
|
26
|
-
- -
|
21
|
+
- - ~>
|
27
22
|
- !ruby/object:Gem::Version
|
28
|
-
segments:
|
29
|
-
- 3
|
30
|
-
- 0
|
31
|
-
- 0
|
32
23
|
version: 3.0.0
|
33
24
|
type: :runtime
|
34
25
|
version_requirements: *id001
|
35
|
-
|
36
|
-
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: rspec-rails
|
28
|
+
prerelease: false
|
29
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
30
|
+
none: false
|
31
|
+
requirements:
|
32
|
+
- - ~>
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: 2.5.0
|
35
|
+
type: :development
|
36
|
+
version_requirements: *id002
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: sqlite3
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 1.3.3
|
46
|
+
type: :development
|
47
|
+
version_requirements: *id003
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: ruby-debug19
|
50
|
+
prerelease: false
|
51
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: "0"
|
57
|
+
type: :development
|
58
|
+
version_requirements: *id004
|
59
|
+
description: Add tagging support for ActiveRecord
|
60
|
+
email:
|
61
|
+
- fnando.vieira@gmail.com
|
37
62
|
executables: []
|
38
63
|
|
39
64
|
extensions: []
|
40
65
|
|
41
|
-
extra_rdoc_files:
|
42
|
-
|
66
|
+
extra_rdoc_files: []
|
67
|
+
|
43
68
|
files:
|
69
|
+
- .gitignore
|
44
70
|
- Gemfile
|
45
71
|
- Gemfile.lock
|
46
72
|
- MIT-LICENSE
|
@@ -63,19 +89,17 @@ files:
|
|
63
89
|
- spec/spec_helper.rb
|
64
90
|
- spec/support/config/boot.rb
|
65
91
|
- spec/support/config/database.yml
|
66
|
-
- spec/support/log/test.log
|
67
92
|
- spec/support/models.rb
|
68
93
|
- spec/tagger_spec.rb
|
69
94
|
- tagger.gemspec
|
70
95
|
- templates/taggings.rb
|
71
96
|
- templates/tags.rb
|
72
|
-
|
73
|
-
homepage: http://github.com/fnando/tagger
|
97
|
+
homepage: http://rubygems.org/gems/tagger
|
74
98
|
licenses: []
|
75
99
|
|
76
100
|
post_install_message:
|
77
|
-
rdoc_options:
|
78
|
-
|
101
|
+
rdoc_options: []
|
102
|
+
|
79
103
|
require_paths:
|
80
104
|
- lib
|
81
105
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -83,28 +107,29 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
83
107
|
requirements:
|
84
108
|
- - ">="
|
85
109
|
- !ruby/object:Gem::Version
|
86
|
-
segments:
|
87
|
-
- 0
|
88
110
|
version: "0"
|
89
111
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
112
|
none: false
|
91
113
|
requirements:
|
92
114
|
- - ">="
|
93
115
|
- !ruby/object:Gem::Version
|
94
|
-
segments:
|
95
|
-
- 0
|
96
116
|
version: "0"
|
97
117
|
requirements: []
|
98
118
|
|
99
119
|
rubyforge_project:
|
100
|
-
rubygems_version: 1.
|
120
|
+
rubygems_version: 1.7.2
|
101
121
|
signing_key:
|
102
122
|
specification_version: 3
|
103
|
-
summary: Add tagging support for
|
123
|
+
summary: Add tagging support for ActiveRecord
|
104
124
|
test_files:
|
125
|
+
- spec/fixtures/categories.yml
|
126
|
+
- spec/fixtures/links.yml
|
127
|
+
- spec/fixtures/posts.yml
|
128
|
+
- spec/fixtures/tags.yml
|
105
129
|
- spec/helpers/helper_spec.rb
|
106
130
|
- spec/schema.rb
|
107
131
|
- spec/spec_helper.rb
|
108
132
|
- spec/support/config/boot.rb
|
133
|
+
- spec/support/config/database.yml
|
109
134
|
- spec/support/models.rb
|
110
135
|
- spec/tagger_spec.rb
|