spraypaint 1.0.1 → 1.0.2
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/Rakefile +3 -1
- data/lib/spraypaint.rb +0 -7
- data/lib/spraypaint/behaviour.rb +1 -1
- data/lib/spraypaint/behaviour/manipulation.rb +1 -1
- data/lib/spraypaint/sanitizer.rb +14 -8
- data/lib/spraypaint/sanitizer_support.rb +11 -0
- data/lib/spraypaint/version.rb +8 -0
- data/spraypaint.gemspec +7 -10
- data/test/spec/{default_sanitizer_spec.rb → sanitizer_spec.rb} +2 -2
- metadata +6 -6
- data/VERSION.yml +0 -4
- data/lib/spraypaint/default_sanitizer.rb +0 -17
data/Rakefile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
$: << File.expand_path(File.join(File.dirname(__FILE__), "lib"))
|
2
2
|
|
3
|
-
require 'spraypaint'
|
3
|
+
require 'spraypaint/version'
|
4
4
|
require 'spec/rake/spectask' rescue nil
|
5
5
|
|
6
6
|
namespace :spraypaint do
|
@@ -15,6 +15,8 @@ namespace :spraypaint do
|
|
15
15
|
gemspec.homepage = "http://github.com/tomafro/spraypaint.git"
|
16
16
|
gemspec.authors = ['Tom Ward']
|
17
17
|
end
|
18
|
+
|
19
|
+
Jeweler::GemcutterTasks.new
|
18
20
|
rescue LoadError
|
19
21
|
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
20
22
|
end
|
data/lib/spraypaint.rb
CHANGED
data/lib/spraypaint/behaviour.rb
CHANGED
data/lib/spraypaint/sanitizer.rb
CHANGED
@@ -1,11 +1,17 @@
|
|
1
|
-
|
1
|
+
class Spraypaint::Sanitizer
|
2
|
+
include Spraypaint::SanitizerSupport
|
2
3
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
4
|
+
attr_accessor :allowed_characters
|
5
|
+
|
6
|
+
def initialize(allowed_characters = /[\w -]/)
|
7
|
+
self.allowed_characters = allowed_characters
|
8
|
+
end
|
9
|
+
|
10
|
+
def sanitize_tag(tag)
|
11
|
+
return nil if tag.nil?
|
12
|
+
string = tag.strip
|
13
|
+
string = string.mb_chars.normalize(:d).gsub(/[^\0-\x80]/, '')
|
14
|
+
string = string.scan(self.allowed_characters).join
|
15
|
+
string.empty? ? nil : string.to_s
|
10
16
|
end
|
11
17
|
end
|
data/spraypaint.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{spraypaint}
|
8
|
-
s.version = "1.0.
|
8
|
+
s.version = "1.0.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Tom Ward"]
|
12
|
-
s.date = %q{2009-11-
|
12
|
+
s.date = %q{2009-11-05}
|
13
13
|
s.description = %q{Simple tagging in a can}
|
14
14
|
s.email = %q{tom@popdog.net}
|
15
15
|
s.files = [
|
@@ -18,7 +18,6 @@ Gem::Specification.new do |s|
|
|
18
18
|
"MIT-LICENSE",
|
19
19
|
"Rakefile",
|
20
20
|
"TODO",
|
21
|
-
"VERSION.yml",
|
22
21
|
"about.yml",
|
23
22
|
"generators/spraypaint_migration/spraypaint_migration_generator.rb",
|
24
23
|
"generators/spraypaint_migration/templates/spraypaint_migration.rb",
|
@@ -27,10 +26,11 @@ Gem::Specification.new do |s|
|
|
27
26
|
"lib/spraypaint/behaviour/discovery.rb",
|
28
27
|
"lib/spraypaint/behaviour/manipulation.rb",
|
29
28
|
"lib/spraypaint/behaviour/persistence.rb",
|
30
|
-
"lib/spraypaint/default_sanitizer.rb",
|
31
29
|
"lib/spraypaint/model/tag.rb",
|
32
30
|
"lib/spraypaint/model/tagging.rb",
|
33
31
|
"lib/spraypaint/sanitizer.rb",
|
32
|
+
"lib/spraypaint/sanitizer_support.rb",
|
33
|
+
"lib/spraypaint/version.rb",
|
34
34
|
"rails/init.rb",
|
35
35
|
"spraypaint.gemspec",
|
36
36
|
"test/config/boot.rb",
|
@@ -38,14 +38,11 @@ Gem::Specification.new do |s|
|
|
38
38
|
"test/config/environment.rb",
|
39
39
|
"test/config/environments/test.rb",
|
40
40
|
"test/db/schema.rb",
|
41
|
-
"test/spec/default_sanitizer_spec.rb",
|
42
41
|
"test/spec/models/tag_spec.rb",
|
43
42
|
"test/spec/models/tagging_spec.rb",
|
43
|
+
"test/spec/sanitizer_spec.rb",
|
44
44
|
"test/spec/spec_helper.rb",
|
45
|
-
"test/spec/spraypaint_spec.rb"
|
46
|
-
"vendor/penknife/lib/penknife.rb",
|
47
|
-
"vendor/penknife/lib/penknife/rake.rb",
|
48
|
-
"vendor/penknife/lib/penknife/rake/plugin_tasks.rb"
|
45
|
+
"test/spec/spraypaint_spec.rb"
|
49
46
|
]
|
50
47
|
s.homepage = %q{http://github.com/tomafro/spraypaint.git}
|
51
48
|
s.rdoc_options = ["--charset=UTF-8"]
|
@@ -57,9 +54,9 @@ Gem::Specification.new do |s|
|
|
57
54
|
"test/config/environment.rb",
|
58
55
|
"test/config/environments/test.rb",
|
59
56
|
"test/db/schema.rb",
|
60
|
-
"test/spec/default_sanitizer_spec.rb",
|
61
57
|
"test/spec/models/tag_spec.rb",
|
62
58
|
"test/spec/models/tagging_spec.rb",
|
59
|
+
"test/spec/sanitizer_spec.rb",
|
63
60
|
"test/spec/spec_helper.rb",
|
64
61
|
"test/spec/spraypaint_spec.rb"
|
65
62
|
]
|
@@ -1,9 +1,9 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/spec_helper.rb'
|
2
2
|
|
3
|
-
describe Spraypaint::
|
3
|
+
describe Spraypaint::Sanitizer do
|
4
4
|
describe '(with no arguments passed to constructor)' do
|
5
5
|
before(:each) do
|
6
|
-
@it = Spraypaint::
|
6
|
+
@it = Spraypaint::Sanitizer.new
|
7
7
|
end
|
8
8
|
|
9
9
|
it "should strip surrounding whitespace from tag" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spraypaint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Ward
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-11-
|
12
|
+
date: 2009-11-05 00:00:00 +00:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -27,7 +27,6 @@ files:
|
|
27
27
|
- MIT-LICENSE
|
28
28
|
- Rakefile
|
29
29
|
- TODO
|
30
|
-
- VERSION.yml
|
31
30
|
- about.yml
|
32
31
|
- generators/spraypaint_migration/spraypaint_migration_generator.rb
|
33
32
|
- generators/spraypaint_migration/templates/spraypaint_migration.rb
|
@@ -36,10 +35,11 @@ files:
|
|
36
35
|
- lib/spraypaint/behaviour/discovery.rb
|
37
36
|
- lib/spraypaint/behaviour/manipulation.rb
|
38
37
|
- lib/spraypaint/behaviour/persistence.rb
|
39
|
-
- lib/spraypaint/default_sanitizer.rb
|
40
38
|
- lib/spraypaint/model/tag.rb
|
41
39
|
- lib/spraypaint/model/tagging.rb
|
42
40
|
- lib/spraypaint/sanitizer.rb
|
41
|
+
- lib/spraypaint/sanitizer_support.rb
|
42
|
+
- lib/spraypaint/version.rb
|
43
43
|
- rails/init.rb
|
44
44
|
- spraypaint.gemspec
|
45
45
|
- test/config/boot.rb
|
@@ -47,9 +47,9 @@ files:
|
|
47
47
|
- test/config/environment.rb
|
48
48
|
- test/config/environments/test.rb
|
49
49
|
- test/db/schema.rb
|
50
|
-
- test/spec/default_sanitizer_spec.rb
|
51
50
|
- test/spec/models/tag_spec.rb
|
52
51
|
- test/spec/models/tagging_spec.rb
|
52
|
+
- test/spec/sanitizer_spec.rb
|
53
53
|
- test/spec/spec_helper.rb
|
54
54
|
- test/spec/spraypaint_spec.rb
|
55
55
|
has_rdoc: true
|
@@ -85,8 +85,8 @@ test_files:
|
|
85
85
|
- test/config/environment.rb
|
86
86
|
- test/config/environments/test.rb
|
87
87
|
- test/db/schema.rb
|
88
|
-
- test/spec/default_sanitizer_spec.rb
|
89
88
|
- test/spec/models/tag_spec.rb
|
90
89
|
- test/spec/models/tagging_spec.rb
|
90
|
+
- test/spec/sanitizer_spec.rb
|
91
91
|
- test/spec/spec_helper.rb
|
92
92
|
- test/spec/spraypaint_spec.rb
|
data/VERSION.yml
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
class Spraypaint::DefaultSanitizer
|
2
|
-
include Spraypaint::Sanitizer
|
3
|
-
|
4
|
-
attr_accessor :allowed_characters
|
5
|
-
|
6
|
-
def initialize(allowed_characters = /[\w -]/)
|
7
|
-
self.allowed_characters = allowed_characters
|
8
|
-
end
|
9
|
-
|
10
|
-
def sanitize_tag(tag)
|
11
|
-
return nil if tag.nil?
|
12
|
-
string = tag.strip
|
13
|
-
string = string.mb_chars.normalize(:d).gsub(/[^\0-\x80]/, '')
|
14
|
-
string = string.scan(self.allowed_characters).join
|
15
|
-
string.empty? ? nil : string.to_s
|
16
|
-
end
|
17
|
-
end
|