sass-rails-query_string_and_anchor_fix 0.1.1

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 16221dd980a8e3c1fe52fa42ea0de8810ea52482
4
+ data.tar.gz: c534015b083aa0697b85d5cc28a3adf9098a2b56
5
+ SHA512:
6
+ metadata.gz: d19d02e81965242ad3a86cf3fbeb0fb35033e3f15a5ab1b7d73b198170b0afa7f623acae1608e4620a99ebe8c7ee987cbd8a55f2de9a7e9809ded4fe80ae4822
7
+ data.tar.gz: 3d89f53ca7ad654a639dc01e912c8f3891dec27b42224d8c59ce274d5b145b7b23c9193d4e79535dddb57b7fadb6c2e025f3e4f266e716fcef681b984f1339c6
@@ -0,0 +1,10 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ Gemfile.lock
10
+ examples.txt
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --require spec_helper
@@ -0,0 +1,27 @@
1
+ AllCops:
2
+ DisplayCopNames: true
3
+ DisplayStyleGuide: true
4
+ EnabledByDefault: true
5
+ ExtraDetails: true
6
+ TargetRubyVersion: 2.3
7
+
8
+ Metrics/LineLength:
9
+ Max: 100
10
+
11
+ Style/Copyright:
12
+ Enabled: false
13
+
14
+ Style/Documentation:
15
+ Enabled: false
16
+
17
+ Style/DocumentationMethod:
18
+ Enabled: false
19
+
20
+ Style/MethodCallWithArgsParentheses:
21
+ IgnoredMethods:
22
+ - require
23
+ - to
24
+ - describe
25
+
26
+ Style/MissingElse:
27
+ Enabled: false
@@ -0,0 +1,5 @@
1
+ SimpleCov.start do
2
+ load_profile "test_frameworks"
3
+
4
+ track_files "lib/**/*.rb"
5
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ appraise 'sass-rails-3.2' do
4
+ gem 'sass-rails', '3.2.6'
5
+ end
data/Gemfile ADDED
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ source('https://rubygems.org')
4
+
5
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
6
+
7
+ # Specify your gem's dependencies in sass-rails-query_string_and_anchor_fix.gemspec
8
+ gemspec
9
+
10
+ group :test do
11
+ gem 'appraisal'
12
+ gem 'simplecov', require: false
13
+ end
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 RealPage, Inc.
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
13
+ all 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
21
+ THE SOFTWARE.
@@ -0,0 +1,35 @@
1
+ # Sass::Rails::QueryStringAndAnchorFix
2
+
3
+ sass-rails' asset helper functions (font-url, font-path, image-url, image-path, etc.) pass their full argument along to sprockets to look up in the sprockets manifest. When the argument is a URL that concludes with a query string or an anchor tag, neither sass-rails 3 nor sprockets 2 strips it before looking up the digest. This results in sprockets not finding the digest, and the non-digest URL is used instead.
4
+
5
+ This issue occurs in sass-rails < 4, and it is resolved by this gem. For later versions of sass-rails, this gem is unnecessary.
6
+
7
+ ## Installation / Usage
8
+
9
+ Add this line to your application's Gemfile, in the same group as sass-rails:
10
+
11
+ ```ruby
12
+ gem 'sass-rails-query_string_and_anchor_fix'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install sass-rails-query_string_and_anchor_fix
22
+
23
+ ## Development
24
+
25
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
26
+
27
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
28
+
29
+ ## Contributing
30
+
31
+ Bug reports and pull requests are welcome on GitHub at https://github.com/on-site/sass-rails-query_string_and_anchor_fix.
32
+
33
+ ## License
34
+
35
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ task(default: :spec)
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'bundler/setup'
5
+ require 'sass/rails/query_string_and_anchor_fix'
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require 'irb'
15
+ 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,12 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "sass-rails", "3.2.6"
6
+
7
+ group :test do
8
+ gem "appraisal"
9
+ gem "simplecov", require: false
10
+ end
11
+
12
+ gemspec path: "../"
@@ -0,0 +1,127 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ sass-rails-query_string_and_anchor_fix (0.1.0)
5
+ sass-rails (< 4)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ actionpack (3.2.22.5)
11
+ activemodel (= 3.2.22.5)
12
+ activesupport (= 3.2.22.5)
13
+ builder (~> 3.0.0)
14
+ erubis (~> 2.7.0)
15
+ journey (~> 1.0.4)
16
+ rack (~> 1.4.5)
17
+ rack-cache (~> 1.2)
18
+ rack-test (~> 0.6.1)
19
+ sprockets (~> 2.2.1)
20
+ activemodel (3.2.22.5)
21
+ activesupport (= 3.2.22.5)
22
+ builder (~> 3.0.0)
23
+ activesupport (3.2.22.5)
24
+ i18n (~> 0.6, >= 0.6.4)
25
+ multi_json (~> 1.0)
26
+ appraisal (2.2.0)
27
+ bundler
28
+ rake
29
+ thor (>= 0.14.0)
30
+ ast (2.3.0)
31
+ builder (3.0.4)
32
+ concurrent-ruby (1.0.5)
33
+ diff-lcs (1.3)
34
+ docile (1.1.5)
35
+ erubis (2.7.0)
36
+ ffi (1.9.18)
37
+ hike (1.2.3)
38
+ i18n (0.9.1)
39
+ concurrent-ruby (~> 1.0)
40
+ journey (1.0.4)
41
+ json (1.8.6)
42
+ multi_json (1.12.2)
43
+ parallel (1.12.0)
44
+ parser (2.4.0.2)
45
+ ast (~> 2.3)
46
+ powerpack (0.1.1)
47
+ rack (1.4.7)
48
+ rack-cache (1.7.1)
49
+ rack (>= 0.4)
50
+ rack-ssl (1.3.4)
51
+ rack
52
+ rack-test (0.6.3)
53
+ rack (>= 1.0)
54
+ railties (3.2.22.5)
55
+ actionpack (= 3.2.22.5)
56
+ activesupport (= 3.2.22.5)
57
+ rack-ssl (~> 1.3.2)
58
+ rake (>= 0.8.7)
59
+ rdoc (~> 3.4)
60
+ thor (>= 0.14.6, < 2.0)
61
+ rainbow (2.2.2)
62
+ rake
63
+ rake (10.5.0)
64
+ rb-fsevent (0.10.2)
65
+ rb-inotify (0.9.10)
66
+ ffi (>= 0.5.0, < 2)
67
+ rdoc (3.12.2)
68
+ json (~> 1.4)
69
+ rspec (3.7.0)
70
+ rspec-core (~> 3.7.0)
71
+ rspec-expectations (~> 3.7.0)
72
+ rspec-mocks (~> 3.7.0)
73
+ rspec-core (3.7.0)
74
+ rspec-support (~> 3.7.0)
75
+ rspec-expectations (3.7.0)
76
+ diff-lcs (>= 1.2.0, < 2.0)
77
+ rspec-support (~> 3.7.0)
78
+ rspec-mocks (3.7.0)
79
+ diff-lcs (>= 1.2.0, < 2.0)
80
+ rspec-support (~> 3.7.0)
81
+ rspec-support (3.7.0)
82
+ rubocop (0.51.0)
83
+ parallel (~> 1.10)
84
+ parser (>= 2.3.3.1, < 3.0)
85
+ powerpack (~> 0.1)
86
+ rainbow (>= 2.2.2, < 3.0)
87
+ ruby-progressbar (~> 1.7)
88
+ unicode-display_width (~> 1.0, >= 1.0.1)
89
+ ruby-progressbar (1.9.0)
90
+ sass (3.5.3)
91
+ sass-listen (~> 4.0.0)
92
+ sass-listen (4.0.0)
93
+ rb-fsevent (~> 0.9, >= 0.9.4)
94
+ rb-inotify (~> 0.9, >= 0.9.7)
95
+ sass-rails (3.2.6)
96
+ railties (~> 3.2.0)
97
+ sass (>= 3.1.10)
98
+ tilt (~> 1.3)
99
+ simplecov (0.15.1)
100
+ docile (~> 1.1.0)
101
+ json (>= 1.8, < 3)
102
+ simplecov-html (~> 0.10.0)
103
+ simplecov-html (0.10.2)
104
+ sprockets (2.2.3)
105
+ hike (~> 1.2)
106
+ multi_json (~> 1.0)
107
+ rack (~> 1.0)
108
+ tilt (~> 1.1, != 1.3.0)
109
+ thor (0.20.0)
110
+ tilt (1.4.1)
111
+ unicode-display_width (1.3.0)
112
+
113
+ PLATFORMS
114
+ ruby
115
+
116
+ DEPENDENCIES
117
+ appraisal
118
+ bundler (~> 1.16)
119
+ rake (~> 10.0)
120
+ rspec
121
+ rubocop
122
+ sass-rails (= 3.2.6)
123
+ sass-rails-query_string_and_anchor_fix!
124
+ simplecov
125
+
126
+ BUNDLED WITH
127
+ 1.16.0
@@ -0,0 +1,66 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'active_support/core_ext/module/aliasing'
4
+ require 'sass/rails'
5
+ require 'sass/rails/query_string_and_anchor_fix/version'
6
+
7
+ module Sass
8
+ module Rails
9
+ # rubocop:disable Metrics/BlockLength
10
+ Helpers.class_eval do
11
+ # rubocop:enable Metrics/BlockLength
12
+
13
+ # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
14
+ def preserving_query_strings_and_anchors(asset, closing_chars)
15
+ # rubocop:enable Metrics/AbcSize,Metrics/MethodLength
16
+ split_point = [asset.value.index('#'), asset.value.index('?')].compact.min
17
+ if split_point
18
+ suffix = asset.value[split_point..-1]
19
+ asset = asset.class.new(
20
+ asset.value[0, split_point],
21
+ asset.type,
22
+ asset.instance_variable_get('@deprecated_interp_equivalent')
23
+ )
24
+ end
25
+ asset = yield(asset)
26
+ if split_point
27
+ new_value =
28
+ if closing_chars.zero?
29
+ asset.value + suffix
30
+ else
31
+ asset.value[0..(-closing_chars - 1)] + suffix + asset.value[-closing_chars..-1]
32
+ end
33
+ asset = asset.class.new(
34
+ new_value,
35
+ asset.type,
36
+ asset.instance_variable_get('@deprecated_interp_equivalent')
37
+ )
38
+ end
39
+ asset
40
+ end
41
+
42
+ %w[image video audio javascript stylesheet font].each do |asset_class|
43
+ # rubocop:disable Style/CommentedKeyword
44
+ class_eval %{
45
+ def #{asset_class}_path_with_correct_handling_of_query_strings_and_anchors(asset)
46
+ preserving_query_strings_and_anchors(asset, 0) do |asset_without_query_string|
47
+ #{asset_class}_path_without_correct_handling_of_query_strings_and_anchors(
48
+ asset_without_query_string
49
+ )
50
+ end
51
+ end
52
+ def #{asset_class}_url_with_correct_handling_of_query_strings_and_anchors(asset)
53
+ preserving_query_strings_and_anchors(asset, 1) do |asset_without_query_string|
54
+ #{asset_class}_url_without_correct_handling_of_query_strings_and_anchors(
55
+ asset_without_query_string
56
+ )
57
+ end
58
+ end
59
+ }, __FILE__, __LINE__ - 10
60
+ # rubocop:enable Style/CommentedKeyword
61
+ alias_method_chain :"#{asset_class}_path", :correct_handling_of_query_strings_and_anchors
62
+ alias_method_chain :"#{asset_class}_url", :correct_handling_of_query_strings_and_anchors
63
+ end
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Sass
4
+ module Rails
5
+ module QueryStringAndAnchorFix
6
+ VERSION = '0.1.1'
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,33 @@
1
+
2
+ # frozen_string_literal: true
3
+
4
+ lib = File.expand_path('../lib', __FILE__)
5
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
6
+ require 'sass/rails/query_string_and_anchor_fix/version'
7
+
8
+ Gem::Specification.new do |spec|
9
+ spec.name = 'sass-rails-query_string_and_anchor_fix'
10
+ spec.version = Sass::Rails::QueryStringAndAnchorFix::VERSION
11
+ spec.authors = ['Isaac Betesh']
12
+ spec.email = ['iybetesh@gmail.com']
13
+
14
+ spec.summary = <<-SUMMARY.strip
15
+ Support sass-rails 3.x asset helper functions for URLs that contain query string and anchors.
16
+ SUMMARY
17
+ spec.homepage = "https://github.com/on-site/#{spec.name}"
18
+ spec.license = 'MIT'
19
+
20
+ spec.files =
21
+ `git ls-files -z`.split("\x0").reject do |f|
22
+ f.match(%r{^(test|spec|features)/})
23
+ end
24
+ spec.bindir = 'exe'
25
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
26
+ spec.require_paths = ['lib']
27
+ spec.add_dependency('sass-rails', '< 4')
28
+
29
+ spec.add_development_dependency('bundler', '~> 1.16')
30
+ spec.add_development_dependency('rake', '~> 10.0')
31
+ spec.add_development_dependency('rspec')
32
+ spec.add_development_dependency('rubocop')
33
+ end
metadata ADDED
@@ -0,0 +1,130 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sass-rails-query_string_and_anchor_fix
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - Isaac Betesh
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-11-14 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - <
17
+ - !ruby/object:Gem::Version
18
+ version: '4'
19
+ name: sass-rails
20
+ prerelease: false
21
+ type: :runtime
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - <
25
+ - !ruby/object:Gem::Version
26
+ version: '4'
27
+ - !ruby/object:Gem::Dependency
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ~>
31
+ - !ruby/object:Gem::Version
32
+ version: '1.16'
33
+ name: bundler
34
+ prerelease: false
35
+ type: :development
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '1.16'
41
+ - !ruby/object:Gem::Dependency
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ~>
45
+ - !ruby/object:Gem::Version
46
+ version: '10.0'
47
+ name: rake
48
+ prerelease: false
49
+ type: :development
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ - !ruby/object:Gem::Dependency
56
+ requirement: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - '>='
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ name: rspec
62
+ prerelease: false
63
+ type: :development
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ requirement: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - '>='
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ name: rubocop
76
+ prerelease: false
77
+ type: :development
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description:
84
+ email:
85
+ - iybetesh@gmail.com
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - .gitignore
91
+ - .rspec
92
+ - .rubocop.yml
93
+ - .simplecov
94
+ - Appraisals
95
+ - Gemfile
96
+ - LICENSE.txt
97
+ - README.md
98
+ - Rakefile
99
+ - bin/console
100
+ - bin/setup
101
+ - gemfiles/sass_rails_3.2.gemfile
102
+ - gemfiles/sass_rails_3.2.gemfile.lock
103
+ - lib/sass/rails/query_string_and_anchor_fix.rb
104
+ - lib/sass/rails/query_string_and_anchor_fix/version.rb
105
+ - sass-rails-query_string_and_anchor_fix.gemspec
106
+ homepage: https://github.com/on-site/sass-rails-query_string_and_anchor_fix
107
+ licenses:
108
+ - MIT
109
+ metadata: {}
110
+ post_install_message:
111
+ rdoc_options: []
112
+ require_paths:
113
+ - lib
114
+ required_ruby_version: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - '>='
117
+ - !ruby/object:Gem::Version
118
+ version: '0'
119
+ required_rubygems_version: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - '>='
122
+ - !ruby/object:Gem::Version
123
+ version: '0'
124
+ requirements: []
125
+ rubyforge_project:
126
+ rubygems_version: 2.4.8
127
+ signing_key:
128
+ specification_version: 4
129
+ summary: Support sass-rails 3.x asset helper functions for URLs that contain query string and anchors.
130
+ test_files: []