middleman-protect-emails 0.1.0 → 0.2.0

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
  SHA1:
3
- metadata.gz: a9092336bc246a62deb1d6a3a3c3ce38fc99fed7
4
- data.tar.gz: 5e925a8bd83b277720d3ab16f680665613dab495
3
+ metadata.gz: 6ec6e78ad8782e6973ec3d1bef178383bf63c6ce
4
+ data.tar.gz: 6cec3655ebdb89cd202e67b77ef79f71fbfd79b8
5
5
  SHA512:
6
- metadata.gz: 1c365af2cb55d34a1c4939991302f05276f809e46169e0f586f849dbd641a0fcdf196fc23c73f9f8a2ae4a8caf033bf020cf4e08083b5ba550cd4d772d3ceb64
7
- data.tar.gz: 59fb71b6185287e946ca4aa020bed464169909ccd89c77ee78b55b259a68e674714ce44fe95affc050727d2cfb77638c17ddd1826d39860b88ffddcd9bf99ff7
6
+ metadata.gz: e6538b7dc73a782f2f206172e92283159ef6d30f244a5eaf9baf29ca1c2e026ac97a9dbd1981eb22f2126ec49c23c5572ed009457c8662b16522991721edadb2
7
+ data.tar.gz: 5c4f670130356e469b670253755ccf0109ee41e7cfd886cd7713505c77d2d6ca8bb7e9876b7dad59b1c618a0d1f94325ef01750569203aedd59de9872d431ec0
data/.travis.yml CHANGED
@@ -5,5 +5,3 @@ rvm:
5
5
  - 2.1.0
6
6
  - 2.0.0
7
7
  - 1.9.3
8
-
9
- script: "bundle exec rake test"
data/Gemfile CHANGED
@@ -4,7 +4,6 @@ gemspec
4
4
 
5
5
  group :test do
6
6
  gem 'cucumber'
7
- gem 'fivemat'
8
7
  gem 'aruba'
9
8
  gem 'codeclimate-test-reporter'
10
9
  end
data/README.md CHANGED
@@ -20,23 +20,15 @@ And then run:
20
20
 
21
21
  $ bundle
22
22
 
23
- ## Configuration
23
+ ## Usage
24
24
 
25
- Implementing this gem is as simple as adding the following line to your project's `config.rb` file:
25
+ Using this gem is as simple as adding the following line to your project's `config.rb` file:
26
26
 
27
27
  ```ruby
28
- # config.rb
29
28
  activate :protect_emails
30
29
  ```
31
30
 
32
- You can also add it to your build-specific configuration:
33
-
34
- ```ruby
35
- # config.rb
36
- configure :build do
37
- activate :protect_emails
38
- end
39
- ```
31
+ And that's it! This will now protect all `mailto` links in your Middleman project.
40
32
 
41
33
  ## Contributing
42
34
 
data/Rakefile CHANGED
@@ -1,10 +1,8 @@
1
1
  require 'bundler/gem_tasks'
2
2
  require 'cucumber/rake/task'
3
- require 'rake/clean'
4
3
 
5
4
  Cucumber::Rake::Task.new(:cucumber, 'Run features that should pass') do |t|
6
- t.cucumber_opts = "--color --tags ~@wip --strict --format #{ENV['CUCUMBER_FORMAT'] || 'Fivemat'}"
5
+ t.cucumber_opts = "--color --format progress"
7
6
  end
8
7
 
9
- task test: ['cucumber']
10
- task default: :test
8
+ task default: :cucumber
@@ -24,8 +24,13 @@ Feature: Email Protection
24
24
  When I go to "/with_no_email.html"
25
25
  Then I should not see "</script>"
26
26
 
27
- Scenario: Obfuscates multiple emails
27
+ Scenario: Encrypts multiple emails
28
28
  Given the Server is running at "test-app"
29
29
  When I go to "/with_multiple_emails.html"
30
30
  Then I should see "<a href='#email-protection-rznvy1@rknzcyr.pbz'></a>"
31
31
  Then I should see "<a href='#email-protection-rznvy2@rknzcyr.pbz'></a>"
32
+
33
+ Scenario: Encrypts mailto link parameters
34
+ Given the Server is running at "test-app"
35
+ When I go to "/with_url_params.html"
36
+ Then I should see "<a href='#email-protection-rznvy@rknzcyr.pbz?fhowrpg=Grfg%20Fhowrpg&obql=Grfg%20Obql'></a>"
@@ -0,0 +1 @@
1
+ <html><head></head><body><a href='mailto:email@example.com?subject=Test%20Subject&body=Test%20Body'></a></body></html>
@@ -41,7 +41,7 @@ class Middleman::ProtectEmailsExtension < ::Middleman::Extension
41
41
 
42
42
  # Replaces mailto links with ROT13 equivalent
43
43
  # TODO: Don't replace plaintext mailto links
44
- new_content = body.gsub /mailto:([A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4})/i do
44
+ new_content = body.gsub /mailto:([A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}(\?[A-Z0-9_\-&=%# ]*)?)/i do
45
45
  replaced_email = true
46
46
  email = $1.tr 'A-Za-z','N-ZA-Mn-za-m'
47
47
  "#email-protection-#{email}"
@@ -1,5 +1,5 @@
1
1
  module Middleman
2
2
  module ProtectEmails
3
- VERSION = '0.1.0'
3
+ VERSION = '0.2.0'
4
4
  end
5
5
  end
@@ -21,5 +21,4 @@ Gem::Specification.new do |spec|
21
21
  spec.add_dependency 'middleman-core', '~> 3.2'
22
22
 
23
23
  spec.add_development_dependency 'rake', '~> 10.0'
24
- spec.add_development_dependency 'pry'
25
24
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: middleman-protect-emails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ankit Sardesai
@@ -38,20 +38,6 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10.0'
41
- - !ruby/object:Gem::Dependency
42
- name: pry
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
41
  description: Middleman extension for email link protection and obfuscation.
56
42
  email:
57
43
  - amsardesai@gmail.com
@@ -72,6 +58,7 @@ files:
72
58
  - fixtures/test-app/source/with_body.html
73
59
  - fixtures/test-app/source/with_multiple_emails.html
74
60
  - fixtures/test-app/source/with_no_email.html
61
+ - fixtures/test-app/source/with_url_params.html
75
62
  - lib/middleman-protect-emails.rb
76
63
  - lib/middleman-protect-emails/extension.rb
77
64
  - lib/middleman-protect-emails/rot13_script.html
@@ -97,7 +84,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
97
84
  version: '0'
98
85
  requirements: []
99
86
  rubyforge_project:
100
- rubygems_version: 2.4.5
87
+ rubygems_version: 2.4.3
101
88
  signing_key:
102
89
  specification_version: 4
103
90
  summary: Middleman extension for email link protection and obfuscation