html-proofer-mailto_awesome 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b8cac7e46331c90400b693b1c70e6bc03e3074940082f4600bcce25d0dbdcebc
4
- data.tar.gz: 60757e57485776f112fd3875e13d39aeb34757a0f2601e9be8612fa56c75d46f
3
+ metadata.gz: a5f60bc0be820e0d12043208367c5f8f81be17f59e47e1ed458d7322d81239b7
4
+ data.tar.gz: c223ddaa2d3850053804f8fa70e2ca9c5276c05e171ff81cc21e5b49240b9db7
5
5
  SHA512:
6
- metadata.gz: 1a3b51f008450efcf9084bf3a7764bbbf45c4c3c7b53f996bd250658591501c35bb61b961d3851f1206e630c382ce27c57774bf8a0a8407709bfb396cae53818
7
- data.tar.gz: 373b824619d2eedc650413a1afd223ffa648242d7cc8fc11c177b9f443c935cd193a0b019fb2fc9ff8f85e24225a91b53deb57a959208a0eb39d91bed1a0664c
6
+ metadata.gz: 405f7bb715f53680bced7ba88605289cc13567461ca4f79bdc1bc4fbe0850587e58765d8a5f41aa419ccaf6c2c54b2d6f28c9e38137e9148aee2037f94792ffa
7
+ data.tar.gz: c19f8f444ade6c723d405b102679ff68df9a0afa77de80fa01d65f0fd95946d4601750862559a86fb2c47a3242b437ad8d56ac11a53bbefa26479cb6da1118e2
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+ /vendor/*
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
@@ -0,0 +1,7 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.5.3
7
+ before_install: gem install bundler -v 2.0.2
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in html-proofer-mailto_awesome.gemspec
4
+ gemspec
@@ -0,0 +1,76 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ html-proofer-mailto_awesome (1.0.0)
5
+ html-proofer (~> 3.0, >= 3.9.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ activesupport (5.2.3)
11
+ concurrent-ruby (~> 1.0, >= 1.0.2)
12
+ i18n (>= 0.7, < 2)
13
+ minitest (~> 5.1)
14
+ tzinfo (~> 1.1)
15
+ addressable (2.6.0)
16
+ public_suffix (>= 2.0.2, < 4.0)
17
+ concurrent-ruby (1.1.5)
18
+ diff-lcs (1.3)
19
+ ethon (0.12.0)
20
+ ffi (>= 1.3.0)
21
+ ffi (1.11.1)
22
+ html-proofer (3.11.1)
23
+ activesupport (>= 4.2, < 6.0)
24
+ addressable (~> 2.3)
25
+ mercenary (~> 0.3.2)
26
+ nokogiri (~> 1.9)
27
+ parallel (~> 1.3)
28
+ rainbow (~> 3.0)
29
+ typhoeus (~> 1.3)
30
+ yell (~> 2.0)
31
+ i18n (1.6.0)
32
+ concurrent-ruby (~> 1.0)
33
+ mercenary (0.3.6)
34
+ mini_portile2 (2.4.0)
35
+ minitest (5.11.3)
36
+ nokogiri (1.10.3)
37
+ mini_portile2 (~> 2.4.0)
38
+ parallel (1.17.0)
39
+ public_suffix (3.1.1)
40
+ rainbow (3.0.0)
41
+ rake (10.5.0)
42
+ rspec (3.8.0)
43
+ rspec-core (~> 3.8.0)
44
+ rspec-expectations (~> 3.8.0)
45
+ rspec-mocks (~> 3.8.0)
46
+ rspec-core (3.8.2)
47
+ rspec-support (~> 3.8.0)
48
+ rspec-expectations (3.8.4)
49
+ diff-lcs (>= 1.2.0, < 2.0)
50
+ rspec-support (~> 3.8.0)
51
+ rspec-mocks (3.8.1)
52
+ diff-lcs (>= 1.2.0, < 2.0)
53
+ rspec-support (~> 3.8.0)
54
+ rspec-support (3.8.2)
55
+ thread_safe (0.3.6)
56
+ timecop (0.9.1)
57
+ typhoeus (1.3.1)
58
+ ethon (>= 0.9.0)
59
+ tzinfo (1.2.5)
60
+ thread_safe (~> 0.1)
61
+ vcr (3.0.3)
62
+ yell (2.2.0)
63
+
64
+ PLATFORMS
65
+ ruby
66
+
67
+ DEPENDENCIES
68
+ bundler (~> 2.0)
69
+ html-proofer-mailto_awesome!
70
+ rake (~> 10.0)
71
+ rspec (~> 3.5, >= 3.5.0)
72
+ timecop (~> 0.8, >= 0.8.1)
73
+ vcr (~> 3.0, >= 3.0.3)
74
+
75
+ BUNDLED WITH
76
+ 2.0.2
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2018 William Entriken
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,80 @@
1
+ [![Build Status](https://travis-ci.org/fulldecent/html-proofer-mailto_awesome.svg?branch=master)](https://travis-ci.org/fulldecent/html-proofer-mailto_awesome)
2
+
3
+ # html-proofer-mailto_awesome
4
+ A custom [html-proofer](https://github.com/gjtorikian/html-proofer) test that makes your `mailto:` links awesome.
5
+
6
+ ## What is an awesome `mailto` link?
7
+
8
+ We should use awesome links as psychological warfare against users. Users will send us emails with stupid or annoying content that we don't want. At big companies (like Amazon) they have abandoned email altogether because of this reason. So instead we prefill the email with the message we want to receive. It takes active cognitive effort for the user to put in their unwanted message.
9
+
10
+ For example, this is a not-awesome `mailto` link:
11
+
12
+ ```html
13
+ <a href="mailto:support@pacificmedicaltraining.com">Email us</a>
14
+ ```
15
+
16
+ This is an awesome link:
17
+
18
+ ```html
19
+ <a href="mailto:support@pacificmedicaltraining.com?subject=Signing up&amp;body=Hello,\nI'd like to sign up for your course, can you please send me more information.">Email us</a>
20
+ ```
21
+
22
+ For more reference, see http://marcwitteveen.com/mailtogenerator/
23
+
24
+ ## How do I use it
25
+
26
+ Follow the same instructions as for any [html-proofer custom class](https://github.com/gjtorikian/html-proofer/wiki/Extensions-(custom-classes)).
27
+
28
+ Our ruby gem is [html-proofer-mailto_awesome](https://rubygems.org/gems/html-proofer-mailto_awesome)
29
+
30
+ 1. Add new dependency to your Ruby project
31
+
32
+ In Gemfile:
33
+
34
+ gem 'html-proofer-mailto_awesome'
35
+
36
+ Or in your .gemspec:
37
+
38
+ Gem::Specification.new do |s|
39
+ ...
40
+ s.add_runtime_dependency 'html-proofer-mailto_awesome'
41
+ end
42
+
43
+ 2. Create a Rakefile like the following and add it to your project
44
+
45
+ task :default => [:test]
46
+
47
+ desc 'run Rspec specs'
48
+ task :test do
49
+ sh 'rspec spec'
50
+ end
51
+
52
+ 3. Run `bundle install`
53
+
54
+ 4. Run `rake`
55
+
56
+ Also if you like, you can enable your project for continuous integration testing with Travis:
57
+
58
+ 1. Set up Travis CI for your project
59
+
60
+ 2. Add a `.travis.yml` file like the following to your project and your spec will run automatically
61
+
62
+ language: ruby
63
+ rvm:
64
+ - 2.5.3
65
+ For additional tests you can run on your website, see [Lightning Sites](https://github.com/fulldecent/lightning-sites) and for a sample GitHub project that implements this testing and follows many other HTML development best practices, see [HTML Website Template](https://github.com/fulldecent/html-website-template).
66
+
67
+ For a full example of a website project that includes testing continuous integration testing for awesome mailto links and many other best practices, see our
68
+
69
+ ## Contributing
70
+
71
+ This project is released under the MIT license.
72
+
73
+ Releasing new versions:
74
+
75
+ ```sh
76
+ gem bump
77
+ rm html-proofer-mailto_awesome-*.gem
78
+ gem build html-proofer-mailto_awesome.gemspec
79
+ gem push html-proofer-mailto_awesome-*.gem
80
+ ```
@@ -0,0 +1,5 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+ task :default => :spec
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "html/proofer/mailto_awesome"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,30 @@
1
+ lib = File.expand_path("lib", __dir__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require 'html/proofer/mailto_awesome/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'html-proofer-mailto_awesome'
7
+ spec.version = MailtoAwesome::VERSION
8
+ spec.authors = ['William Entriken']
9
+ spec.email = 'github.com@phor.net'
10
+
11
+ spec.summary = 'Checker for mailto links'
12
+ spec.description = 'A custom html-proofer test that makes your mailto links awesome'
13
+ spec.homepage = 'https://github.com/fulldecent/html-proofer-mailto_awesome'
14
+ spec.license = 'MIT'
15
+ # Specify which files should be added to the gem when it is released.
16
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
17
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
18
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
19
+ end
20
+ spec.bindir = "exe"
21
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
+ spec.require_paths = ["lib"]
23
+
24
+ spec.add_development_dependency "bundler", "~> 2.0"
25
+ spec.add_development_dependency "rake", "~> 10.0"
26
+ spec.add_runtime_dependency 'html-proofer', '~> 3.0', '>= 3.9.0'
27
+ spec.add_development_dependency 'rspec', '~> 3.5', '>= 3.5.0'
28
+ spec.add_development_dependency 'vcr', '~> 3.0', '>= 3.0.3'
29
+ spec.add_development_dependency 'timecop', '~> 0.8', '>= 0.8.1'
30
+ end
@@ -0,0 +1,3 @@
1
+ module MailtoAwesome
2
+ VERSION = "1.0.1"
3
+ end
@@ -0,0 +1,32 @@
1
+ require "html/proofer/mailto_awesome/version"
2
+
3
+ module Html
4
+ module Proofer
5
+ module MailtoAwesome
6
+ class Error < StandardError; end
7
+ class MailToAwesome < ::HTMLProofer::Check
8
+ def mailto?
9
+ return false if @link.ignore? || @link.href.nil?
10
+ @link.href.match /^mailto:/i
11
+ end
12
+
13
+ def awesome?
14
+ @link.href.downcase.include? 'subject=' and @link.href.downcase.include? 'body='
15
+ end
16
+
17
+ def run
18
+ return unless @options[:check_mailto_awesome]
19
+ @html.css('a').each do |node|
20
+ @link = create_element(node)
21
+ line = node.line
22
+ content = node.to_s
23
+
24
+ if mailto? && !awesome?
25
+ add_issue("This is a not-awesome mailto link!", line: line, content: content)
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
metadata CHANGED
@@ -1,75 +1,83 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: html-proofer-mailto_awesome
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Entriken
8
8
  autorequire:
9
- bindir: bin
9
+ bindir: exe
10
10
  cert_chain: []
11
- date: 2018-12-29 00:00:00.000000000 Z
11
+ date: 2019-08-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: html-proofer
14
+ name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '3.0'
20
- - - ">="
21
- - !ruby/object:Gem::Version
22
- version: 3.9.0
23
- type: :runtime
19
+ version: '2.0'
20
+ type: :development
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
24
  - - "~>"
28
25
  - !ruby/object:Gem::Version
29
- version: '3.0'
30
- - - ">="
31
- - !ruby/object:Gem::Version
32
- version: 3.9.0
26
+ version: '2.0'
33
27
  - !ruby/object:Gem::Dependency
34
28
  name: rake
35
29
  requirement: !ruby/object:Gem::Requirement
36
30
  requirements:
37
31
  - - "~>"
38
32
  - !ruby/object:Gem::Version
39
- version: '12.0'
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: html-proofer
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
40
48
  - - ">="
41
49
  - !ruby/object:Gem::Version
42
- version: 12.0.0
50
+ version: 3.9.0
43
51
  type: :runtime
44
52
  prerelease: false
45
53
  version_requirements: !ruby/object:Gem::Requirement
46
54
  requirements:
47
55
  - - "~>"
48
56
  - !ruby/object:Gem::Version
49
- version: '12.0'
57
+ version: '3.0'
50
58
  - - ">="
51
59
  - !ruby/object:Gem::Version
52
- version: 12.0.0
60
+ version: 3.9.0
53
61
  - !ruby/object:Gem::Dependency
54
62
  name: rspec
55
63
  requirement: !ruby/object:Gem::Requirement
56
64
  requirements:
57
- - - "~>"
58
- - !ruby/object:Gem::Version
59
- version: '3.5'
60
65
  - - ">="
61
66
  - !ruby/object:Gem::Version
62
67
  version: 3.5.0
68
+ - - "~>"
69
+ - !ruby/object:Gem::Version
70
+ version: '3.5'
63
71
  type: :development
64
72
  prerelease: false
65
73
  version_requirements: !ruby/object:Gem::Requirement
66
74
  requirements:
67
- - - "~>"
68
- - !ruby/object:Gem::Version
69
- version: '3.5'
70
75
  - - ">="
71
76
  - !ruby/object:Gem::Version
72
77
  version: 3.5.0
78
+ - - "~>"
79
+ - !ruby/object:Gem::Version
80
+ version: '3.5'
73
81
  - !ruby/object:Gem::Dependency
74
82
  name: vcr
75
83
  requirement: !ruby/object:Gem::Requirement
@@ -116,7 +124,19 @@ executables: []
116
124
  extensions: []
117
125
  extra_rdoc_files: []
118
126
  files:
119
- - lib/mail_to_awesome.rb
127
+ - ".gitignore"
128
+ - ".rspec"
129
+ - ".travis.yml"
130
+ - Gemfile
131
+ - Gemfile.lock
132
+ - LICENSE
133
+ - README.md
134
+ - Rakefile
135
+ - bin/console
136
+ - bin/setup
137
+ - html-proofer-mailto_awesome.gemspec
138
+ - lib/html/proofer/mailto_awesome/version.rb
139
+ - lib/mailto_awesome.rb
120
140
  homepage: https://github.com/fulldecent/html-proofer-mailto_awesome
121
141
  licenses:
122
142
  - MIT
@@ -136,8 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
136
156
  - !ruby/object:Gem::Version
137
157
  version: '0'
138
158
  requirements: []
139
- rubyforge_project:
140
- rubygems_version: 2.7.7
159
+ rubygems_version: 3.0.3
141
160
  signing_key:
142
161
  specification_version: 4
143
162
  summary: Checker for mailto links
@@ -1,23 +0,0 @@
1
- class MailToAwesome < ::HTMLProofer::Check
2
- def mailto?
3
- return false if @link.ignore? || @link.href.nil?
4
- @link.href.match /^mailto:/i
5
- end
6
-
7
- def awesome?
8
- @link.href.downcase.include? 'subject=' and @link.href.downcase.include? 'body='
9
- end
10
-
11
- def run
12
- return unless @options[:check_mailto_awesome]
13
- @html.css('a').each do |node|
14
- @link = create_element(node)
15
- line = node.line
16
- content = node.to_s
17
-
18
- if mailto? && !awesome?
19
- add_issue("This is a not-awesome mailto link!", line: line, content: content)
20
- end
21
- end
22
- end
23
- end