autolinks 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/autolinks.gemspec +4 -4
- data/lib/autolinks/version.rb +1 -1
- data/spec/autolinks_spec.rb +4 -1
- data/spec/regex_spec.rb +30 -30
- metadata +40 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8810ad15a433ef15d9fcf3f1a4cef05992acab3f
|
4
|
+
data.tar.gz: 7440a208785c770f30dfd7427901086e2af7d374
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: caf72c8cc8d8c561db92c1c5ff17dfb704d85d51e07a253ab3689b92dc56d117fb3399294bd1bc7038785fee6b5388954423eee99717cc60b2bde288dd3577f5
|
7
|
+
data.tar.gz: 338ee6dd1aea823c08d6645e6403eb4122408c17b119e31080de164488e3ef7919f2f891ac96ba57a5167688b32f0e5ea8b1c173928eec68dbe77d78782e21dd
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby-2.
|
1
|
+
ruby-2.1.4
|
data/autolinks.gemspec
CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |gem|
|
|
9
9
|
gem.version = Autolinks::VERSION
|
10
10
|
gem.authors = ["Jay Sanders"]
|
11
11
|
gem.email = ["mindtonic@gmail.com"]
|
12
|
-
gem.description = "Autolinks automatically replaces urls, emails, twitter handles and hashtags with html links"
|
12
|
+
gem.description = "Autolinks automatically replaces urls, emails, twitter handles and hashtags with html links within a text block"
|
13
13
|
gem.summary = "Autolinks automatically replaces urls, emails, twitter handles and hashtags with html links"
|
14
14
|
gem.homepage = "http://github.com/mindtonic/autolinks"
|
15
15
|
gem.license = "MIT"
|
@@ -19,8 +19,8 @@ Gem::Specification.new do |gem|
|
|
19
19
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
20
20
|
gem.require_paths = ["lib"]
|
21
21
|
# Development
|
22
|
-
gem.add_development_dependency "rspec",
|
23
|
-
gem.add_development_dependency "ffaker"
|
22
|
+
gem.add_development_dependency "rspec", '~> 3.1', '>= 3.1.0'
|
23
|
+
gem.add_development_dependency "ffaker", '~> 1.30', '>= 1.30.0'
|
24
24
|
# Dependencies
|
25
|
-
gem.add_dependency "sanitize"
|
25
|
+
gem.add_dependency "sanitize", '~> 3.1', '>= 3.1.0'
|
26
26
|
end
|
data/lib/autolinks/version.rb
CHANGED
data/spec/autolinks_spec.rb
CHANGED
data/spec/regex_spec.rb
CHANGED
@@ -2,82 +2,82 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
|
2
2
|
|
3
3
|
describe Autolinks::Regex do
|
4
4
|
describe "handle" do
|
5
|
-
it "
|
6
|
-
Autolinks::TEST_STRING.scan(Autolinks::Regex.handle).flatten.
|
5
|
+
it "matches the handles in the Test String" do
|
6
|
+
expect(Autolinks::TEST_STRING.scan(Autolinks::Regex.handle).flatten).to eq ["@thishandle", "@thisotherhandle"]
|
7
7
|
end
|
8
8
|
|
9
|
-
it "
|
10
|
-
"Follow @mindtonic for more info".scan(Autolinks::Regex.handle).flatten.
|
9
|
+
it "matches the handles in the Test String" do
|
10
|
+
expect("Follow @mindtonic for more info".scan(Autolinks::Regex.handle).flatten).to eq ["@mindtonic"]
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
14
|
describe "handle_name" do
|
15
|
-
it "
|
16
|
-
Autolinks::TEST_STRING.scan(Autolinks::Regex.handle_name).flatten.
|
15
|
+
it "matches the handles in the Test String without the @" do
|
16
|
+
expect(Autolinks::TEST_STRING.scan(Autolinks::Regex.handle_name).flatten).to eq ["thishandle", "thisotherhandle"]
|
17
17
|
end
|
18
18
|
|
19
|
-
it "
|
20
|
-
"Follow @mindtonic for more info".scan(Autolinks::Regex.handle_name).flatten.
|
19
|
+
it "matches the handles in the Test String without the @" do
|
20
|
+
expect("Follow @mindtonic for more info".scan(Autolinks::Regex.handle_name).flatten).to eq ["mindtonic"]
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
24
|
describe "http", focus: true do
|
25
|
-
it "
|
26
|
-
Autolinks::TEST_STRING.scan(Autolinks::Regex.http).flatten.
|
25
|
+
it "matches the complete urls in the Test String" do
|
26
|
+
expect(Autolinks::TEST_STRING.scan(Autolinks::Regex.http).flatten).to eq ["http://google.com", "http://google.com", "http://google.co.uk"]
|
27
27
|
end
|
28
28
|
|
29
29
|
Autolinks::TEST_URLS.each do |link|
|
30
|
-
it "
|
31
|
-
link.scan(Autolinks::Regex.http).flatten.
|
30
|
+
it "matches #{link}" do
|
31
|
+
expect(link.scan(Autolinks::Regex.http).flatten).to eq [link.gsub(/\W$/, '')]
|
32
32
|
end
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
36
|
describe "http_address", focus: true do
|
37
|
-
it "
|
38
|
-
Autolinks::TEST_STRING.scan(Autolinks::Regex.http_address).flatten.
|
37
|
+
it "matches the complete urls in the Test String" do
|
38
|
+
expect(Autolinks::TEST_STRING.scan(Autolinks::Regex.http_address).flatten).to eq ["google.com", "google.com", "google.co.uk"]
|
39
39
|
end
|
40
40
|
|
41
41
|
Autolinks::TEST_URLS.each do |link|
|
42
|
-
it "
|
43
|
-
link.scan(Autolinks::Regex.http_address).flatten.
|
42
|
+
it "matches #{link}" do
|
43
|
+
expect(link.scan(Autolinks::Regex.http_address).flatten).to eq [link.gsub(/https?:\/\//, '').gsub(/\W$/, '')]
|
44
44
|
end
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
48
|
describe "hashtag" do
|
49
|
-
it "
|
50
|
-
Autolinks::TEST_STRING.scan(Autolinks::Regex.hashtag).flatten.
|
49
|
+
it "matches the hashtags in the Test String" do
|
50
|
+
expect(Autolinks::TEST_STRING.scan(Autolinks::Regex.hashtag).flatten).to eq %w{#communicates #hashtags #marked #content #1}
|
51
51
|
end
|
52
52
|
|
53
|
-
it "
|
54
|
-
"Follow @mindtonic for more #info".scan(Autolinks::Regex.hashtag).flatten.
|
53
|
+
it "matches the hashtags in the Test String" do
|
54
|
+
expect("Follow @mindtonic for more #info".scan(Autolinks::Regex.hashtag).flatten).to eq ["#info"]
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
58
58
|
describe "hashtag_name" do
|
59
|
-
it "
|
60
|
-
Autolinks::TEST_STRING.scan(Autolinks::Regex.hashtag_name).flatten.
|
59
|
+
it "matches the hashtags in the Test String without the #" do
|
60
|
+
expect(Autolinks::TEST_STRING.scan(Autolinks::Regex.hashtag_name).flatten).to eq %w{communicates hashtags marked content 1}
|
61
61
|
end
|
62
62
|
|
63
|
-
it "
|
64
|
-
"Follow @mindtonic for more #info".scan(Autolinks::Regex.hashtag_name).flatten.
|
63
|
+
it "matches the hashtags in the Test String without the #" do
|
64
|
+
expect("Follow @mindtonic for more #info".scan(Autolinks::Regex.hashtag_name).flatten).to eq ["info"]
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
68
68
|
describe "email" do
|
69
|
-
it "
|
70
|
-
Autolinks::TEST_STRING.scan(Autolinks::Regex.email).flatten.
|
69
|
+
it "matches the email in the Test String" do
|
70
|
+
expect(Autolinks::TEST_STRING.scan(Autolinks::Regex.email).flatten).to eq ["email@email.com"]
|
71
71
|
end
|
72
72
|
|
73
73
|
["mindtonic@gmail.com", "testing@example.co.uk", "my.email@example.com"].each do |email|
|
74
|
-
it "
|
75
|
-
email.scan(Autolinks::Regex.email).flatten.
|
74
|
+
it "matches #{email}" do
|
75
|
+
expect(email.scan(Autolinks::Regex.email).flatten).to eq [email]
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|
79
|
-
it "
|
80
|
-
Faker::Lorem.paragraph.scan(Autolinks::Regex.handle_name).flatten.
|
79
|
+
it "does not match emails if there are not any" do
|
80
|
+
expect(Faker::Lorem.paragraph.scan(Autolinks::Regex.handle_name).flatten).to eq []
|
81
81
|
end
|
82
82
|
end
|
83
83
|
end
|
metadata
CHANGED
@@ -1,69 +1,87 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: autolinks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jay Sanders
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '3.1'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 3.1.0
|
20
23
|
type: :development
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- - ~>
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '3.1'
|
30
|
+
- - ">="
|
25
31
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
32
|
+
version: 3.1.0
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: ffaker
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
30
36
|
requirements:
|
31
|
-
- -
|
37
|
+
- - "~>"
|
32
38
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
39
|
+
version: '1.30'
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 1.30.0
|
34
43
|
type: :development
|
35
44
|
prerelease: false
|
36
45
|
version_requirements: !ruby/object:Gem::Requirement
|
37
46
|
requirements:
|
38
|
-
- -
|
47
|
+
- - "~>"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '1.30'
|
50
|
+
- - ">="
|
39
51
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
52
|
+
version: 1.30.0
|
41
53
|
- !ruby/object:Gem::Dependency
|
42
54
|
name: sanitize
|
43
55
|
requirement: !ruby/object:Gem::Requirement
|
44
56
|
requirements:
|
45
|
-
- -
|
57
|
+
- - "~>"
|
46
58
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
59
|
+
version: '3.1'
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: 3.1.0
|
48
63
|
type: :runtime
|
49
64
|
prerelease: false
|
50
65
|
version_requirements: !ruby/object:Gem::Requirement
|
51
66
|
requirements:
|
52
|
-
- -
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '3.1'
|
70
|
+
- - ">="
|
53
71
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
72
|
+
version: 3.1.0
|
55
73
|
description: Autolinks automatically replaces urls, emails, twitter handles and hashtags
|
56
|
-
with html links
|
74
|
+
with html links within a text block
|
57
75
|
email:
|
58
76
|
- mindtonic@gmail.com
|
59
77
|
executables: []
|
60
78
|
extensions: []
|
61
79
|
extra_rdoc_files: []
|
62
80
|
files:
|
63
|
-
- .gitignore
|
64
|
-
- .rspec
|
65
|
-
- .ruby-gemset
|
66
|
-
- .ruby-version
|
81
|
+
- ".gitignore"
|
82
|
+
- ".rspec"
|
83
|
+
- ".ruby-gemset"
|
84
|
+
- ".ruby-version"
|
67
85
|
- Gemfile
|
68
86
|
- LICENSE.txt
|
69
87
|
- README.rdoc
|
@@ -86,17 +104,17 @@ require_paths:
|
|
86
104
|
- lib
|
87
105
|
required_ruby_version: !ruby/object:Gem::Requirement
|
88
106
|
requirements:
|
89
|
-
- -
|
107
|
+
- - ">="
|
90
108
|
- !ruby/object:Gem::Version
|
91
109
|
version: '0'
|
92
110
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
93
111
|
requirements:
|
94
|
-
- -
|
112
|
+
- - ">="
|
95
113
|
- !ruby/object:Gem::Version
|
96
114
|
version: '0'
|
97
115
|
requirements: []
|
98
116
|
rubyforge_project:
|
99
|
-
rubygems_version: 2.
|
117
|
+
rubygems_version: 2.4.2
|
100
118
|
signing_key:
|
101
119
|
specification_version: 4
|
102
120
|
summary: Autolinks automatically replaces urls, emails, twitter handles and hashtags
|