true_url 0.0.2 → 0.0.3

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
2
  SHA1:
3
- metadata.gz: bfa4b7a52e702e5a1665ab7fcddceeba5fad7548
4
- data.tar.gz: de4c238df43b8a0655c5c3a8f51b55923d41aecf
3
+ metadata.gz: bba8a863389ecda1e8c6de716c3243d68e22af78
4
+ data.tar.gz: 620de279d14cefa673b61b9024b903c1131452d4
5
5
  SHA512:
6
- metadata.gz: d5afa12c6ed53aa0be33fb080231590bbe31f4d2745844e08484de1b45ed3b342ffd0e959bb4dbbddd08a43d7437bd20a3ff114e2fc5f513b33883361ccb6428
7
- data.tar.gz: a3e5afd1bd3ff13a64a4cdb98194de7952c264635c438be8ea0f716726f8152cbc6e0fcc3f3171c7bd69030a56e97afd2052f1f5720dbc92ce04fac5a9b9fa06
6
+ metadata.gz: db04004b8be8e1071fb05cd5c6f39406f22023d1f46bb2ece6f6f9d5f01a33e056f5182e68d76148a9f6ac077c85f68ab494f1982744459cb9de57113ff85910
7
+ data.tar.gz: 54dafb4f8b4656cde6318bbff7f3f656ce869df3efe510b38b59ac96c59c7788b3bc65ed5a4293e6749c6fabaea199faa1a8ef5e60918f2e638a4453b336793b
data/.coveralls.yml ADDED
@@ -0,0 +1 @@
1
+ service_name: travis-ci
data/.gitignore CHANGED
@@ -1,15 +1,15 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
10
- *.bundle
11
- *.so
12
- *.o
13
- *.a
14
- mkmf.log
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
15
15
  build.bat
data/Gemfile CHANGED
@@ -5,3 +5,4 @@ gemspec
5
5
 
6
6
  gem 'rake'
7
7
  gem 'rspec'
8
+ gem 'coveralls', require: false
data/LICENSE.txt CHANGED
@@ -1,22 +1,22 @@
1
- Copyright (c) 2014 Jonathan Wong
2
-
3
- MIT License
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining
6
- a copy of this software and associated documentation files (the
7
- "Software"), to deal in the Software without restriction, including
8
- without limitation the rights to use, copy, modify, merge, publish,
9
- distribute, sublicense, and/or sell copies of the Software, and to
10
- permit persons to whom the Software is furnished to do so, subject to
11
- the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1
+ Copyright (c) 2014 Jonathan Wong
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  [![Gem Version](https://badge.fury.io/rb/true_url.svg)](https://badge.fury.io/rb/true_url)
2
2
  [![Code Climate](https://codeclimate.com/github/armchairtheorist/true_url/badges/gpa.svg)](https://codeclimate.com/github/armchairtheorist/true_url)
3
3
  [![Build Status](https://travis-ci.org/armchairtheorist/true_url.svg?branch=master)](https://travis-ci.org/armchairtheorist/true_url)
4
+ [![Coverage Status](https://coveralls.io/repos/github/armchairtheorist/true_url/badge.svg?branch=master)](https://coveralls.io/github/armchairtheorist/true_url?branch=master)
4
5
 
5
6
  # TrueURL
6
7
 
data/Rakefile CHANGED
@@ -1,5 +1,5 @@
1
- require 'rspec/core/rake_task'
2
-
3
- RSpec::Core::RakeTask.new :spec
4
-
5
- task default: :spec
1
+ require 'rspec/core/rake_task'
2
+
3
+ RSpec::Core::RakeTask.new :spec
4
+
5
+ task default: :spec
@@ -1,3 +1,5 @@
1
+ require 'addressable/uri'
2
+
1
3
  class TrueURL
2
4
  class Context
3
5
  attr_reader :original_url, :options, :attributes, :working_url
@@ -1,56 +1,56 @@
1
- class TrueURL
2
- module Strategy
3
- class DailyMotion
4
- def execute(context)
5
- path = context.working_url.path
6
-
7
- if context.working_url.host == 'dai.ly'
8
- video_id = path[1..-1]
9
-
10
- elsif path[0..6] == '/video/'
11
- video_id = clean_video_id(path)
12
-
13
- elsif path[0..6] == '/embed/'
14
- video_id = path[13..-1]
15
-
16
- elsif path[0..9] == '/playlist/'
17
- playlist_id = clean_playlist_id(path)
18
- end
19
-
20
- unless video_id.nil?
21
- context.set_working_url("https://www.dailymotion.com/video/#{video_id}")
22
- context.finalize
23
- context.attributes[:embed_url] = "https://www.dailymotion.com/embed/video/#{video_id}"
24
- end
25
-
26
- unless playlist_id.nil?
27
- context.set_working_url("https://www.dailymotion.com/playlist/#{playlist_id}")
28
- context.finalize
29
- end
30
-
31
- # DailyMotion supports both HTTP and HTTPS and doesn't redirect between them, so we prefer HTTPS
32
- context.working_url.scheme = 'https'
33
- end
34
-
35
- def clean_video_id(path)
36
- if path.index('_')
37
- path[7..path.index('_') - 1]
38
- else
39
- path[7..-1]
40
- end
41
- end
42
-
43
- def clean_playlist_id(path)
44
- cpath = path[10..-1]
45
-
46
- if cpath.index('_')
47
- cpath[0..cpath.index('_') - 1]
48
- elsif cpath.index('/')
49
- cpath[0..cpath.index('/') - 1]
50
- else
51
- cpath[0..-1]
52
- end
53
- end
54
- end
55
- end
56
- end
1
+ class TrueURL
2
+ module Strategy
3
+ class DailyMotion
4
+ def execute(context)
5
+ path = context.working_url.path
6
+
7
+ if context.working_url.host == 'dai.ly'
8
+ video_id = path[1..-1]
9
+
10
+ elsif path[0..6] == '/video/'
11
+ video_id = clean_video_id(path)
12
+
13
+ elsif path[0..6] == '/embed/'
14
+ video_id = path[13..-1]
15
+
16
+ elsif path[0..9] == '/playlist/'
17
+ playlist_id = clean_playlist_id(path)
18
+ end
19
+
20
+ unless video_id.nil?
21
+ context.set_working_url("https://www.dailymotion.com/video/#{video_id}")
22
+ context.finalize
23
+ context.attributes[:embed_url] = "https://www.dailymotion.com/embed/video/#{video_id}"
24
+ end
25
+
26
+ unless playlist_id.nil?
27
+ context.set_working_url("https://www.dailymotion.com/playlist/#{playlist_id}")
28
+ context.finalize
29
+ end
30
+
31
+ # DailyMotion supports both HTTP and HTTPS and doesn't redirect between them, so we prefer HTTPS
32
+ context.working_url.scheme = 'https'
33
+ end
34
+
35
+ def clean_video_id(path)
36
+ if path.index('_')
37
+ path[7..path.index('_') - 1]
38
+ else
39
+ path[7..-1]
40
+ end
41
+ end
42
+
43
+ def clean_playlist_id(path)
44
+ cpath = path[10..-1]
45
+
46
+ if cpath.index('_')
47
+ cpath[0..cpath.index('_') - 1]
48
+ elsif cpath.index('/')
49
+ cpath[0..cpath.index('/') - 1]
50
+ else
51
+ cpath[0..-1]
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
@@ -1,25 +1,25 @@
1
- class TrueURL
2
- module Strategy
3
- class NicoVideo
4
- def execute(context)
5
- path = context.working_url.path
6
-
7
- if path[0..6] == '/watch/'
8
- video_id = path.split('/')[2]
9
-
10
- elsif path[0..12] == '/thumb_watch/'
11
- video_id = path.split('/')[2]
12
- end
13
-
14
- if video_id
15
- context.set_working_url("http://www.nicovideo.jp/watch/#{video_id}")
16
- context.finalize
17
- context.attributes[:embed_url] = "http://embed.nicovideo.jp/watch/#{video_id}"
18
- end
19
-
20
- # Nico Video only supports HTTP
21
- context.working_url.scheme = 'http'
22
- end
23
- end
24
- end
25
- end
1
+ class TrueURL
2
+ module Strategy
3
+ class NicoVideo
4
+ def execute(context)
5
+ path = context.working_url.path
6
+
7
+ if path[0..6] == '/watch/'
8
+ video_id = path.split('/')[2]
9
+
10
+ elsif path[0..12] == '/thumb_watch/'
11
+ video_id = path.split('/')[2]
12
+ end
13
+
14
+ if video_id
15
+ context.set_working_url("http://www.nicovideo.jp/watch/#{video_id}")
16
+ context.finalize
17
+ context.attributes[:embed_url] = "http://embed.nicovideo.jp/watch/#{video_id}"
18
+ end
19
+
20
+ # Nico Video only supports HTTP
21
+ context.working_url.scheme = 'http'
22
+ end
23
+ end
24
+ end
25
+ end
@@ -1,25 +1,25 @@
1
- class TrueURL
2
- module Strategy
3
- class Twitter
4
- def execute(context)
5
- fragment = context.working_url.fragment
6
-
7
- # Special handling to collapse Twitter hashbang (#!) URLs
8
- unless fragment.nil?
9
- if fragment.start_with?('!/')
10
- context.working_url.path = fragment[1..-1]
11
- context.working_url.fragment = nil
12
- end
13
- end
14
-
15
- path = context.working_url.path
16
-
17
- if path =~ /^\/\w+\/status\/\d+/
18
- parts = path.split('/')
19
- context.set_working_url("https://twitter.com/#{parts[1].downcase}/status/#{parts[3]}")
20
- context.finalize
21
- end
22
- end
23
- end
24
- end
25
- end
1
+ class TrueURL
2
+ module Strategy
3
+ class Twitter
4
+ def execute(context)
5
+ fragment = context.working_url.fragment
6
+
7
+ # Special handling to collapse Twitter hashbang (#!) URLs
8
+ unless fragment.nil?
9
+ if fragment.start_with?('!/')
10
+ context.working_url.path = fragment[1..-1]
11
+ context.working_url.fragment = nil
12
+ end
13
+ end
14
+
15
+ path = context.working_url.path
16
+
17
+ if path =~ /^\/\w+\/status\/\d+/
18
+ parts = path.split('/')
19
+ context.set_working_url("https://twitter.com/#{parts[1].downcase}/status/#{parts[3]}")
20
+ context.finalize
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -1,28 +1,28 @@
1
- class TrueURL
2
- module Strategy
3
- class Vimeo
4
- def execute(context)
5
- path = context.working_url.path
6
-
7
- if context.working_url.host == 'player.vimeo.com'
8
- video_id = path[7..-1]
9
-
10
- elsif path =~ /^\/channels\/\w+\/\d+$/
11
- video_id = path.split('/').last
12
-
13
- elsif path =~ /^\/\d+$/
14
- video_id = path[1..-1]
15
- end
16
-
17
- if video_id
18
- context.set_working_url("https://vimeo.com/#{video_id}")
19
- context.finalize
20
- context.attributes[:embed_url] = "https://player.vimeo.com/video/#{video_id}"
21
- end
22
-
23
- # Vimeo supports both HTTP and HTTPS and doesn't redirect between them, so we prefer HTTPS
24
- context.working_url.scheme = 'https'
25
- end
26
- end
27
- end
28
- end
1
+ class TrueURL
2
+ module Strategy
3
+ class Vimeo
4
+ def execute(context)
5
+ path = context.working_url.path
6
+
7
+ if context.working_url.host == 'player.vimeo.com'
8
+ video_id = path[7..-1]
9
+
10
+ elsif path =~ /^\/channels\/\w+\/\d+$/
11
+ video_id = path.split('/').last
12
+
13
+ elsif path =~ /^\/\d+$/
14
+ video_id = path[1..-1]
15
+ end
16
+
17
+ if video_id
18
+ context.set_working_url("https://vimeo.com/#{video_id}")
19
+ context.finalize
20
+ context.attributes[:embed_url] = "https://player.vimeo.com/video/#{video_id}"
21
+ end
22
+
23
+ # Vimeo supports both HTTP and HTTPS and doesn't redirect between them, so we prefer HTTPS
24
+ context.working_url.scheme = 'https'
25
+ end
26
+ end
27
+ end
28
+ end
@@ -6,7 +6,9 @@ require 'true_url/strategy/youtube'
6
6
 
7
7
  class TrueURL
8
8
  module Strategy
9
- def self.default_list
9
+ extend self
10
+
11
+ def default_list
10
12
  [
11
13
  [/youtube.com$/, TrueURL::Strategy::YouTube.new],
12
14
  [/youtube-nocookie.com$/, TrueURL::Strategy::YouTube.new],
@@ -1,3 +1,3 @@
1
- class TrueURL
2
- VERSION = '0.0.2'.freeze
3
- end
1
+ class TrueURL
2
+ VERSION = '0.0.3'.freeze
3
+ end
data/lib/true_url.rb CHANGED
@@ -1,9 +1,8 @@
1
- require 'addressable/uri'
2
-
3
1
  class TrueURL
4
2
  autoload :Version, 'true_url/version'
5
3
  autoload :Context, 'true_url/context'
6
4
  autoload :Strategy, 'true_url/strategy'
5
+ autoload :Fetch, 'true_url/fetch'
7
6
 
8
7
  attr_accessor :context, :strategies
9
8
 
@@ -49,7 +48,7 @@ class TrueURL
49
48
 
50
49
  unless @context.finalized?
51
50
  if attempt_fetch?
52
- fetch
51
+ TrueURL::Fetch.execute(@context)
53
52
  execute_strategies
54
53
  end
55
54
  end
@@ -87,40 +86,6 @@ class TrueURL
87
86
  %w(http https).include?(@context.working_url.scheme)
88
87
  end
89
88
 
90
- def fetch
91
- require 'http' unless defined? HTTP
92
-
93
- starting_url = @context.working_url
94
-
95
- response = HTTP.follow
96
- .get(starting_url)
97
-
98
- canonical_url = find_canonical_header(response.headers) || find_canonical_url(response.to_s) || response.uri
99
- @context.set_working_url(canonical_url, starting_url)
100
- end
101
-
102
- def find_canonical_header(headers)
103
- return if headers['Link'].nil?
104
-
105
- links = headers['Link'].is_a?(String) ? [headers['Link']] : headers['Link']
106
- links.each { |link| return link.split(/[<>;]/)[1] if link.end_with?('rel="canonical"') }
107
- nil
108
- end
109
-
110
- def find_canonical_url(html)
111
- require 'nokogiri' unless defined? Nokogiri::HTML
112
-
113
- doc = Nokogiri::HTML(html)
114
-
115
- elem = doc.at('link[rel="canonical"]')
116
- canonical_url = elem['href'] unless elem.nil?
117
-
118
- elem = doc.at('meta[property="og:url"]')
119
- og_url = elem['content'] unless elem.nil?
120
-
121
- canonical_url || og_url
122
- end
123
-
124
89
  def scheme_override
125
90
  @context.working_url.scheme = @context.options[:scheme_override] unless @context.options[:scheme_override].nil?
126
91
  end
data/spec/spec_helper.rb CHANGED
@@ -1,96 +1,99 @@
1
- require 'true_url'
2
-
3
- # This file was generated by the `rspec --init` command. Conventionally, all
4
- # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
5
- # The generated `.rspec` file contains `--require spec_helper` which will cause
6
- # this file to always be loaded, without a need to explicitly require it in any
7
- # files.
8
- #
9
- # Given that it is always loaded, you are encouraged to keep this file as
10
- # light-weight as possible. Requiring heavyweight dependencies from this file
11
- # will add to the boot time of your test suite on EVERY test run, even for an
12
- # individual file that may not need all of that loaded. Instead, consider making
13
- # a separate helper file that requires the additional dependencies and performs
14
- # the additional setup, and require it from the spec files that actually need
15
- # it.
16
- #
17
- # The `.rspec` file also contains a few flags that are not defaults but that
18
- # users commonly want.
19
- #
20
- # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
21
- RSpec.configure do |config|
22
- # rspec-expectations config goes here. You can use an alternate
23
- # assertion/expectation library such as wrong or the stdlib/minitest
24
- # assertions if you prefer.
25
- config.expect_with :rspec do |expectations|
26
- # This option will default to `true` in RSpec 4. It makes the `description`
27
- # and `failure_message` of custom matchers include text for helper methods
28
- # defined using `chain`, e.g.:
29
- # be_bigger_than(2).and_smaller_than(4).description
30
- # # => "be bigger than 2 and smaller than 4"
31
- # ...rather than:
32
- # # => "be bigger than 2"
33
- expectations.include_chain_clauses_in_custom_matcher_descriptions = true
34
- end
35
-
36
- # rspec-mocks config goes here. You can use an alternate test double
37
- # library (such as bogus or mocha) by changing the `mock_with` option here.
38
- config.mock_with :rspec do |mocks|
39
- # Prevents you from mocking or stubbing a method that does not exist on
40
- # a real object. This is generally recommended, and will default to
41
- # `true` in RSpec 4.
42
- mocks.verify_partial_doubles = true
43
- end
44
-
45
- # The settings below are suggested to provide a good initial experience
46
- # with RSpec, but feel free to customize to your heart's content.
47
- # # These two settings work together to allow you to limit a spec run
48
- # # to individual examples or groups you care about by tagging them with
49
- # # `:focus` metadata. When nothing is tagged with `:focus`, all examples
50
- # # get run.
51
- # config.filter_run :focus
52
- # config.run_all_when_everything_filtered = true
53
- #
54
- # # Allows RSpec to persist some state between runs in order to support
55
- # # the `--only-failures` and `--next-failure` CLI options. We recommend
56
- # # you configure your source control system to ignore this file.
57
- # config.example_status_persistence_file_path = "spec/examples.txt"
58
- #
59
- # # Limits the available syntax to the non-monkey patched syntax that is
60
- # # recommended. For more details, see:
61
- # # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
62
- # # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
63
- # # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
64
- # config.disable_monkey_patching!
65
- #
66
- # # This setting enables warnings. It's recommended, but in some cases may
67
- # # be too noisy due to issues in dependencies.
68
- # config.warnings = true
69
- #
70
- # # Many RSpec users commonly either run the entire suite or an individual
71
- # # file, and it's useful to allow more verbose output when running an
72
- # # individual spec file.
73
- # if config.files_to_run.one?
74
- # # Use the documentation formatter for detailed output,
75
- # # unless a formatter has already been configured
76
- # # (e.g. via a command-line flag).
77
- # config.default_formatter = 'doc'
78
- # end
79
- #
80
- # # Print the 10 slowest examples and example groups at the
81
- # # end of the spec run, to help surface which specs are running
82
- # # particularly slow.
83
- # config.profile_examples = 10
84
- #
85
- # # Run specs in random order to surface order dependencies. If you find an
86
- # # order dependency and want to debug it, you can fix the order by providing
87
- # # the seed, which is printed after each run.
88
- # # --seed 1234
89
- # config.order = :random
90
- #
91
- # # Seed global randomization in this process using the `--seed` CLI option.
92
- # # Setting this allows you to use `--seed` to deterministically reproduce
93
- # # test failures related to randomization by passing the same `--seed` value
94
- # # as the one that triggered the failure.
95
- # Kernel.srand config.seed
96
- end
1
+ require 'coveralls'
2
+ Coveralls.wear!
3
+
4
+ require 'true_url'
5
+
6
+ # This file was generated by the `rspec --init` command. Conventionally, all
7
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
8
+ # The generated `.rspec` file contains `--require spec_helper` which will cause
9
+ # this file to always be loaded, without a need to explicitly require it in any
10
+ # files.
11
+ #
12
+ # Given that it is always loaded, you are encouraged to keep this file as
13
+ # light-weight as possible. Requiring heavyweight dependencies from this file
14
+ # will add to the boot time of your test suite on EVERY test run, even for an
15
+ # individual file that may not need all of that loaded. Instead, consider making
16
+ # a separate helper file that requires the additional dependencies and performs
17
+ # the additional setup, and require it from the spec files that actually need
18
+ # it.
19
+ #
20
+ # The `.rspec` file also contains a few flags that are not defaults but that
21
+ # users commonly want.
22
+ #
23
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
24
+ RSpec.configure do |config|
25
+ # rspec-expectations config goes here. You can use an alternate
26
+ # assertion/expectation library such as wrong or the stdlib/minitest
27
+ # assertions if you prefer.
28
+ config.expect_with :rspec do |expectations|
29
+ # This option will default to `true` in RSpec 4. It makes the `description`
30
+ # and `failure_message` of custom matchers include text for helper methods
31
+ # defined using `chain`, e.g.:
32
+ # be_bigger_than(2).and_smaller_than(4).description
33
+ # # => "be bigger than 2 and smaller than 4"
34
+ # ...rather than:
35
+ # # => "be bigger than 2"
36
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
37
+ end
38
+
39
+ # rspec-mocks config goes here. You can use an alternate test double
40
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
41
+ config.mock_with :rspec do |mocks|
42
+ # Prevents you from mocking or stubbing a method that does not exist on
43
+ # a real object. This is generally recommended, and will default to
44
+ # `true` in RSpec 4.
45
+ mocks.verify_partial_doubles = true
46
+ end
47
+
48
+ # The settings below are suggested to provide a good initial experience
49
+ # with RSpec, but feel free to customize to your heart's content.
50
+ # # These two settings work together to allow you to limit a spec run
51
+ # # to individual examples or groups you care about by tagging them with
52
+ # # `:focus` metadata. When nothing is tagged with `:focus`, all examples
53
+ # # get run.
54
+ # config.filter_run :focus
55
+ # config.run_all_when_everything_filtered = true
56
+ #
57
+ # # Allows RSpec to persist some state between runs in order to support
58
+ # # the `--only-failures` and `--next-failure` CLI options. We recommend
59
+ # # you configure your source control system to ignore this file.
60
+ # config.example_status_persistence_file_path = "spec/examples.txt"
61
+ #
62
+ # # Limits the available syntax to the non-monkey patched syntax that is
63
+ # # recommended. For more details, see:
64
+ # # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
65
+ # # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
66
+ # # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
67
+ # config.disable_monkey_patching!
68
+ #
69
+ # # This setting enables warnings. It's recommended, but in some cases may
70
+ # # be too noisy due to issues in dependencies.
71
+ # config.warnings = true
72
+ #
73
+ # # Many RSpec users commonly either run the entire suite or an individual
74
+ # # file, and it's useful to allow more verbose output when running an
75
+ # # individual spec file.
76
+ # if config.files_to_run.one?
77
+ # # Use the documentation formatter for detailed output,
78
+ # # unless a formatter has already been configured
79
+ # # (e.g. via a command-line flag).
80
+ # config.default_formatter = 'doc'
81
+ # end
82
+ #
83
+ # # Print the 10 slowest examples and example groups at the
84
+ # # end of the spec run, to help surface which specs are running
85
+ # # particularly slow.
86
+ # config.profile_examples = 10
87
+ #
88
+ # # Run specs in random order to surface order dependencies. If you find an
89
+ # # order dependency and want to debug it, you can fix the order by providing
90
+ # # the seed, which is printed after each run.
91
+ # # --seed 1234
92
+ # config.order = :random
93
+ #
94
+ # # Seed global randomization in this process using the `--seed` CLI option.
95
+ # # Setting this allows you to use `--seed` to deterministically reproduce
96
+ # # test failures related to randomization by passing the same `--seed` value
97
+ # # as the one that triggered the failure.
98
+ # Kernel.srand config.seed
99
+ end
@@ -89,7 +89,7 @@ describe TrueURL do
89
89
 
90
90
  it "supports Vimeo's relative canonical links" do
91
91
  t = 'https://vimeo.com/channels/staffpicks'
92
- expect(gc('http://vimeo.com/channels/staffpicks?some=silly&params=here')).to eq t
92
+ expect(gc('https://vimeo.com/channels/staffpicks')).to eq t
93
93
  end
94
94
 
95
95
  it 'supports retrieving embed links as attributes' do
data/true_url.gemspec CHANGED
@@ -15,8 +15,8 @@ Gem::Specification.new do |spec|
15
15
 
16
16
  spec.add_development_dependency 'rspec', '~> 0'
17
17
  spec.add_development_dependency 'rake', '~> 0'
18
- spec.add_development_dependency 'http', '~> 2.1', '>= 2.1.0'
19
- spec.add_development_dependency 'nokogiri', '~> 1.6', '>= 1.6.8'
20
18
 
21
19
  spec.add_runtime_dependency 'addressable', '~> 2.4', '>= 2.4.0'
20
+ spec.add_runtime_dependency 'http', '~> 2.1', '>= 2.1.0'
21
+ spec.add_runtime_dependency 'nokogiri', '~> 1.6', '>= 1.6.8'
22
22
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: true_url
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Wong
@@ -39,65 +39,65 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: http
42
+ name: addressable
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '2.1'
47
+ version: '2.4'
48
48
  - - ">="
49
49
  - !ruby/object:Gem::Version
50
- version: 2.1.0
51
- type: :development
50
+ version: 2.4.0
51
+ type: :runtime
52
52
  prerelease: false
53
53
  version_requirements: !ruby/object:Gem::Requirement
54
54
  requirements:
55
55
  - - "~>"
56
56
  - !ruby/object:Gem::Version
57
- version: '2.1'
57
+ version: '2.4'
58
58
  - - ">="
59
59
  - !ruby/object:Gem::Version
60
- version: 2.1.0
60
+ version: 2.4.0
61
61
  - !ruby/object:Gem::Dependency
62
- name: nokogiri
62
+ name: http
63
63
  requirement: !ruby/object:Gem::Requirement
64
64
  requirements:
65
65
  - - "~>"
66
66
  - !ruby/object:Gem::Version
67
- version: '1.6'
67
+ version: '2.1'
68
68
  - - ">="
69
69
  - !ruby/object:Gem::Version
70
- version: 1.6.8
71
- type: :development
70
+ version: 2.1.0
71
+ type: :runtime
72
72
  prerelease: false
73
73
  version_requirements: !ruby/object:Gem::Requirement
74
74
  requirements:
75
75
  - - "~>"
76
76
  - !ruby/object:Gem::Version
77
- version: '1.6'
77
+ version: '2.1'
78
78
  - - ">="
79
79
  - !ruby/object:Gem::Version
80
- version: 1.6.8
80
+ version: 2.1.0
81
81
  - !ruby/object:Gem::Dependency
82
- name: addressable
82
+ name: nokogiri
83
83
  requirement: !ruby/object:Gem::Requirement
84
84
  requirements:
85
85
  - - "~>"
86
86
  - !ruby/object:Gem::Version
87
- version: '2.4'
87
+ version: '1.6'
88
88
  - - ">="
89
89
  - !ruby/object:Gem::Version
90
- version: 2.4.0
90
+ version: 1.6.8
91
91
  type: :runtime
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
95
  - - "~>"
96
96
  - !ruby/object:Gem::Version
97
- version: '2.4'
97
+ version: '1.6'
98
98
  - - ">="
99
99
  - !ruby/object:Gem::Version
100
- version: 2.4.0
100
+ version: 1.6.8
101
101
  description:
102
102
  email:
103
103
  - jonathan@armchairtheorist.com
@@ -105,6 +105,7 @@ executables: []
105
105
  extensions: []
106
106
  extra_rdoc_files: []
107
107
  files:
108
+ - ".coveralls.yml"
108
109
  - ".gitignore"
109
110
  - ".rspec"
110
111
  - ".rubocop.yml"