safe_target_blank 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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 07e478391e0239ab2828da2e031537f96f2178e8
4
- data.tar.gz: 4c6c4b332a62fa934ddc79ce236b0b45be4a5b52
2
+ SHA256:
3
+ metadata.gz: 2e7638db730f7b99a04a6b1faf2cdcaeb725a5b51bf2600aebeb6b1d7fdc71c9
4
+ data.tar.gz: 3005292cd91831112836e7b194162d6b979bffb97791b8d7b9accad0eaf10278
5
5
  SHA512:
6
- metadata.gz: 48a8e2f2a9549c1ee38129219e5033c619c8cfff36322d38b31cc82c8132f6c20aaa46f6ef3ed22b2ab1baf292dfd8482ab1e15056ffefa50cdfa03df8c31489
7
- data.tar.gz: b119b1329724943f95a2bf9bd8324a48bd6c40e4f2d6f2f8ac98893463539c8ad40b32b22b821965f43c57a7230f9a8eb810f2b7f4e76bfb297eb4644b71ca84
6
+ metadata.gz: 4d33a4aa5cf89570a8a0656e69b1998728264f94661424ab8a132577e6d406bf831ca648e9b41c80d61a457d1095cffa637fb23437b5e08c00e9e395e172de5a
7
+ data.tar.gz: 4ad8e6397a57671cde91afe5205eea5ba64ed51e880f5f08b18493b84e26e66676a8a452e45e8ec54e5e665811085348afc4bfdf569aec8834e4b58f9e3f3ffc
data/.gitignore CHANGED
@@ -9,4 +9,5 @@
9
9
  /tmp/
10
10
 
11
11
  *.gem
12
+ *.gemfile.lock
12
13
  .idea
@@ -1,4 +1,7 @@
1
1
  language: ruby
2
+ before_install: gem install bundler -v 1.11.2
2
3
  rvm:
3
4
  - 2.3.1
4
- before_install: gem install bundler -v 1.11.2
5
+ gemfile:
6
+ - gemfiles/rails_4.gemfile
7
+ - gemfiles/rails_5.gemfile
@@ -0,0 +1,7 @@
1
+ appraise 'rails-4' do
2
+ gem 'rails', '4.2.7.1'
3
+ end
4
+
5
+ appraise 'rails-5' do
6
+ gem 'rails', '5.0.0.1'
7
+ end
data/README.md CHANGED
@@ -20,14 +20,14 @@ Add this line to your application's Gemfile:
20
20
  Now each time you use the `link_to` helper with `target="_blank"`, `rel="noopener noreferrer"` will be added.
21
21
 
22
22
  ```ruby
23
- link_to 'Safe', 'safe.io', taget: :_blank
23
+ link_to 'Safe', 'safe.io', target: :_blank
24
24
  #=> '<a target="_blank" rel="noopener noreferrer" href="safe.io">Safe</a>'
25
25
  ```
26
26
 
27
27
  You can opt out with `opener` and `referrer` options.
28
28
 
29
29
  ```ruby
30
- link_to 'Safe', 'safe.io', taget: :_blank, referrer: true
30
+ link_to 'Safe', 'safe.io', target: :_blank, referrer: true
31
31
  #=> '<a target="_blank" rel="noopener" href="safe.io">Safe</a>'
32
32
  ```
33
33
 
@@ -35,14 +35,17 @@ Or disable it globally.
35
35
 
36
36
  ```ruby
37
37
  SafeTargetBlank.opener = true
38
- link_to 'Safe', 'safe.io', taget: :_blank
38
+ link_to 'Safe', 'safe.io', target: :_blank
39
39
  #=> '<a target="_blank" rel="noreferrer" href="safe.io">Safe</a>'
40
40
  ```
41
41
 
42
42
  ## Contributing
43
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
43
+ After checking out the repo, run `bin/setup` to install dependencies.
44
+ Then, run `rake` to run the tests.
44
45
 
45
- Bug reports and pull requests are welcome on GitHub at https://github.com/jvenezia/safe_target_blank. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
46
+ You can also run `bin/console` for an interactive prompt that will allow you to experiment.
47
+
48
+ Bug reports and pull requests are welcome on GitHub.
46
49
 
47
50
  ## License
48
51
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile CHANGED
@@ -1,6 +1,11 @@
1
1
  require 'bundler/gem_tasks'
2
2
  require 'rspec/core/rake_task'
3
+ require 'appraisal'
3
4
 
4
5
  RSpec::Core::RakeTask.new(:spec)
5
6
 
6
- task default: :spec
7
+ if !ENV['APPRAISAL_INITIALIZED'] && !ENV['TRAVIS']
8
+ task default: :appraisal
9
+ else
10
+ task default: :spec
11
+ end
data/bin/setup CHANGED
@@ -3,4 +3,5 @@ set -euo pipefail
3
3
  IFS=$'\n\t'
4
4
  set -vx
5
5
 
6
- bundle install
6
+ bundle install
7
+ appraisal install
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "appraisal"
6
+ gem "rails", "4.2.7.1"
7
+
8
+ gemspec :path => "../"
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "appraisal"
6
+ gem "rails", "5.0.0.1"
7
+
8
+ gemspec :path => "../"
@@ -19,17 +19,20 @@ module ActionView
19
19
  rel = link_to_rel_from_html_options(html_options)
20
20
  rel.push('noopener') if !SafeTargetBlank.opener && !link_to_option_enabled?(html_options, 'opener')
21
21
  rel.push('noreferrer') if !SafeTargetBlank.referrer && !link_to_option_enabled?(html_options, 'referrer')
22
- rel.empty? ? nil : rel.uniq
22
+ rel.map(&:presence).compact.uniq.join(' ')
23
23
  end
24
24
 
25
25
  def convert_options_to_data_attributes(options, html_options)
26
26
  if html_options
27
27
  html_options = html_options.stringify_keys
28
- html_options['rel'] = link_to_target_blank_default_rel(html_options) if link_to_target_blank?(html_options)
28
+ if link_to_target_blank?(html_options)
29
+ rel = link_to_target_blank_default_rel(html_options).presence
30
+ html_options['rel'] = rel if rel
31
+ end
29
32
  end
30
33
 
31
34
  original_convert_options_to_data_attributes(options, html_options)
32
35
  end
33
36
  end
34
37
  end
35
- end
38
+ end
@@ -1,3 +1,3 @@
1
1
  module SafeTargetBlank
2
- VERSION = '1.0.1'
2
+ VERSION = '1.0.2'
3
3
  end
@@ -25,4 +25,5 @@ Gem::Specification.new do |spec|
25
25
  spec.add_development_dependency 'rake', '~> 10.0'
26
26
  spec.add_development_dependency 'rspec', '~> 3.0'
27
27
  spec.add_development_dependency 'coveralls', '~> 0.8'
28
+ spec.add_development_dependency 'appraisal', '~> 2.1'
28
29
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: safe_target_blank
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Venezia
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-10-12 00:00:00.000000000 Z
11
+ date: 2019-03-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0.8'
83
+ - !ruby/object:Gem::Dependency
84
+ name: appraisal
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '2.1'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '2.1'
83
97
  description: Adds noopener and noreferrer to target blank links in a Rails application.
84
98
  email:
85
99
  - veneziajeremy@gmail.com
@@ -90,13 +104,15 @@ files:
90
104
  - ".gitignore"
91
105
  - ".rspec"
92
106
  - ".travis.yml"
93
- - CODE_OF_CONDUCT.md
107
+ - Appraisals
94
108
  - Gemfile
95
109
  - LICENSE.txt
96
110
  - README.md
97
111
  - Rakefile
98
112
  - bin/console
99
113
  - bin/setup
114
+ - gemfiles/rails_4.gemfile
115
+ - gemfiles/rails_5.gemfile
100
116
  - lib/safe_target_blank.rb
101
117
  - lib/safe_target_blank/url_helper.rb
102
118
  - lib/safe_target_blank/version.rb
@@ -121,7 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
137
  version: '0'
122
138
  requirements: []
123
139
  rubyforge_project:
124
- rubygems_version: 2.5.1
140
+ rubygems_version: 2.7.9
125
141
  signing_key:
126
142
  specification_version: 4
127
143
  summary: Adds noopener and noreferrer to target blank links in a Rails application.
@@ -1,49 +0,0 @@
1
- # Contributor Code of Conduct
2
-
3
- As contributors and maintainers of this project, and in the interest of
4
- fostering an open and welcoming community, we pledge to respect all people who
5
- contribute through reporting issues, posting feature requests, updating
6
- documentation, submitting pull requests or patches, and other activities.
7
-
8
- We are committed to making participation in this project a harassment-free
9
- experience for everyone, regardless of level of experience, gender, gender
10
- identity and expression, sexual orientation, disability, personal appearance,
11
- body size, race, ethnicity, age, religion, or nationality.
12
-
13
- Examples of unacceptable behavior by participants include:
14
-
15
- * The use of sexualized language or imagery
16
- * Personal attacks
17
- * Trolling or insulting/derogatory comments
18
- * Public or private harassment
19
- * Publishing other's private information, such as physical or electronic
20
- addresses, without explicit permission
21
- * Other unethical or unprofessional conduct
22
-
23
- Project maintainers have the right and responsibility to remove, edit, or
24
- reject comments, commits, code, wiki edits, issues, and other contributions
25
- that are not aligned to this Code of Conduct, or to ban temporarily or
26
- permanently any contributor for other behaviors that they deem inappropriate,
27
- threatening, offensive, or harmful.
28
-
29
- By adopting this Code of Conduct, project maintainers commit themselves to
30
- fairly and consistently applying these principles to every aspect of managing
31
- this project. Project maintainers who do not follow or enforce the Code of
32
- Conduct may be permanently removed from the project team.
33
-
34
- This code of conduct applies both within project spaces and in public spaces
35
- when an individual is representing the project or its community.
36
-
37
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
38
- reported by contacting a project maintainer at veneziajeremy@gmail.com. All
39
- complaints will be reviewed and investigated and will result in a response that
40
- is deemed necessary and appropriate to the circumstances. Maintainers are
41
- obligated to maintain confidentiality with regard to the reporter of an
42
- incident.
43
-
44
- This Code of Conduct is adapted from the [Contributor Covenant][homepage],
45
- version 1.3.0, available at
46
- [http://contributor-covenant.org/version/1/3/0/][version]
47
-
48
- [homepage]: http://contributor-covenant.org
49
- [version]: http://contributor-covenant.org/version/1/3/0/