http-cookie 1.0.5 → 1.1.0
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 +4 -4
- data/CHANGELOG.md +23 -0
- data/README.md +5 -2
- data/lib/http/cookie/scanner.rb +4 -3
- data/lib/http/cookie/uri_parser.rb +36 -0
- data/lib/http/cookie/version.rb +1 -1
- data/lib/http/cookie.rb +17 -7
- data/lib/http/cookie_jar/abstract_store.rb +1 -1
- data/lib/http/cookie_jar/mozilla_store.rb +0 -2
- data/lib/http/cookie_jar.rb +1 -1
- metadata +6 -23
- data/.github/workflows/ci.yml +0 -37
- data/.gitignore +0 -17
- data/Gemfile +0 -4
- data/Rakefile +0 -20
- data/http-cookie.gemspec +0 -35
- data/test/helper.rb +0 -55
- data/test/mechanize.yml +0 -101
- data/test/simplecov_start.rb +0 -2
- data/test/test_http_cookie.rb +0 -1134
- data/test/test_http_cookie_jar.rb +0 -988
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d8164cb03f90d107b135379101cbc38ca71bfb1b850410007d739c38c3097036
|
|
4
|
+
data.tar.gz: 1171fba029df999fd8c27a1ddb42626840510cf1b9521f5d48282f0578f8c94f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b41e686acc80a67ceb08ef01ce608de1cf67790364f1dba9255ff595b30dcd361316d50d5dcca03c1f3d0d2c506c507fa707fdd1cfe4963076b7bdef0551a2f7
|
|
7
|
+
data.tar.gz: d88dc3ccf9dad9bf2ee56b27ad137e87c9ff19e29d2ef28814c6eb06038e3db8cb93fa6be17a7cc8cbfc00ad70f086409ab41d7a1ff52fdacffbedee39302013
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,26 @@
|
|
|
1
|
+
## 1.1.0 (2025-09-26)
|
|
2
|
+
|
|
3
|
+
- Implement `Cookie#to_h`. (#55) @luke-hill @flavorjones
|
|
4
|
+
- Reduce gem size by excluding test files (#54) @yuri-zubov
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
## 1.0.8 (2024-12-05)
|
|
8
|
+
|
|
9
|
+
- `Cookie#expires=` accepts `DateTime` objects. (#52) @luke-hill @flavorjones
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
## 1.0.7 (2024-06-06)
|
|
13
|
+
|
|
14
|
+
- Explicitly require "cgi" to avoid `NameError` in some applications. (#50 by @flavorjones)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## 1.0.6 (2024-06-01)
|
|
18
|
+
|
|
19
|
+
- Fix error formatting bug in HTTP::CookieJar::AbstractStore (#42 by @andrelaszlo)
|
|
20
|
+
- Allow non-RFC 3986-compliant URLs (#45 by @c960657)
|
|
21
|
+
- Add coverage for Ruby 3.2 and 3.3 (#46 by @flavorjones)
|
|
22
|
+
- Quash ruby 3.4 warnings (#47 by @flavorjones)
|
|
23
|
+
|
|
1
24
|
## 1.0.5 (2022-05-25)
|
|
2
25
|
|
|
3
26
|
- Silence SQLite3 warnings
|
data/README.md
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
[](https://badge.fury.io/rb/http-cookie)
|
|
2
|
+
|
|
1
3
|
# HTTP::Cookie
|
|
2
4
|
|
|
3
5
|
HTTP::Cookie is a ruby library to handle HTTP cookies in a way both
|
|
@@ -20,7 +22,8 @@ The following is an incomplete list of its features:
|
|
|
20
22
|
* It takes eTLD (effective TLD, also known as "Public Suffix") into
|
|
21
23
|
account just as major browsers do, to reject cookies with an eTLD
|
|
22
24
|
domain like "org", "co.jp", or "appspot.com". This feature is
|
|
23
|
-
brought to you by the
|
|
25
|
+
brought to you by the
|
|
26
|
+
[domain_name](https://github.com/knu/ruby-domain_name) gem.
|
|
24
27
|
|
|
25
28
|
* The number of cookies and the size are properly capped so that a
|
|
26
29
|
cookie store does not get flooded.
|
|
@@ -207,7 +210,7 @@ equivalent using HTTP::Cookie:
|
|
|
207
210
|
guarantee that it will remain available in the future.
|
|
208
211
|
|
|
209
212
|
|
|
210
|
-
HTTP::Cookie/CookieJar
|
|
213
|
+
HTTP::Cookie/CookieJar raises runtime errors to help migration, so
|
|
211
214
|
after replacing the class names, try running your test code once to
|
|
212
215
|
find out how to fix your code base.
|
|
213
216
|
|
data/lib/http/cookie/scanner.rb
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
1
2
|
require 'http/cookie'
|
|
2
3
|
require 'strscan'
|
|
3
4
|
require 'time'
|
|
@@ -23,7 +24,7 @@ class HTTP::Cookie::Scanner < StringScanner
|
|
|
23
24
|
class << self
|
|
24
25
|
def quote(s)
|
|
25
26
|
return s unless s.match(RE_BAD_CHAR)
|
|
26
|
-
'"' << s.gsub(/([\\"])/, "\\\\\\1") << '"'
|
|
27
|
+
(+'"') << s.gsub(/([\\"])/, "\\\\\\1") << '"'
|
|
27
28
|
end
|
|
28
29
|
end
|
|
29
30
|
|
|
@@ -32,7 +33,7 @@ class HTTP::Cookie::Scanner < StringScanner
|
|
|
32
33
|
end
|
|
33
34
|
|
|
34
35
|
def scan_dquoted
|
|
35
|
-
''.tap { |s|
|
|
36
|
+
(+'').tap { |s|
|
|
36
37
|
case
|
|
37
38
|
when skip(/"/)
|
|
38
39
|
break
|
|
@@ -51,7 +52,7 @@ class HTTP::Cookie::Scanner < StringScanner
|
|
|
51
52
|
end
|
|
52
53
|
|
|
53
54
|
def scan_value(comma_as_separator = false)
|
|
54
|
-
''.tap { |s|
|
|
55
|
+
(+'').tap { |s|
|
|
55
56
|
case
|
|
56
57
|
when scan(/[^,;"]+/)
|
|
57
58
|
s << matched
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
module HTTP::Cookie::URIParser
|
|
2
|
+
module_function
|
|
3
|
+
|
|
4
|
+
# Regular Expression taken from RFC 3986 Appendix B
|
|
5
|
+
URIREGEX = %r{
|
|
6
|
+
\A
|
|
7
|
+
(?: (?<scheme> [^:/?\#]+ ) : )?
|
|
8
|
+
(?: // (?<authority> [^/?\#]* ) )?
|
|
9
|
+
(?<path> [^?\#]* )
|
|
10
|
+
(?: \? (?<query> [^\#]* ) )?
|
|
11
|
+
(?: \# (?<fragment> .* ) )?
|
|
12
|
+
\z
|
|
13
|
+
}x
|
|
14
|
+
|
|
15
|
+
# Escape RFC 3986 "reserved" characters minus valid characters for path
|
|
16
|
+
# More specifically, gen-delims minus "/" / "?" / "#"
|
|
17
|
+
def escape_path(path)
|
|
18
|
+
path.sub(/\A[^?#]+/) { |p| p.gsub(/[:\[\]@]+/) { |r| CGI.escape(r) } }
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# Parse a URI string or object, relaxing the constraints on the path component
|
|
22
|
+
def parse(uri)
|
|
23
|
+
URI(uri)
|
|
24
|
+
rescue URI::InvalidURIError
|
|
25
|
+
str = String.try_convert(uri) or
|
|
26
|
+
raise ArgumentError, "bad argument (expected URI object or URI string)"
|
|
27
|
+
|
|
28
|
+
m = URIREGEX.match(str) or raise
|
|
29
|
+
|
|
30
|
+
path = m[:path]
|
|
31
|
+
str[m.begin(:path)...m.end(:path)] = escape_path(path)
|
|
32
|
+
uri = URI.parse(str)
|
|
33
|
+
uri.__send__(:set_path, path)
|
|
34
|
+
uri
|
|
35
|
+
end
|
|
36
|
+
end
|
data/lib/http/cookie/version.rb
CHANGED
data/lib/http/cookie.rb
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
# :markup: markdown
|
|
2
|
+
# frozen_string_literal: true
|
|
2
3
|
require 'http/cookie/version'
|
|
4
|
+
require 'http/cookie/uri_parser'
|
|
3
5
|
require 'time'
|
|
4
6
|
require 'uri'
|
|
5
7
|
require 'domain_name'
|
|
6
8
|
require 'http/cookie/ruby_compat'
|
|
9
|
+
require 'cgi'
|
|
7
10
|
|
|
8
11
|
module HTTP
|
|
9
12
|
autoload :CookieJar, 'http/cookie_jar'
|
|
@@ -86,7 +89,7 @@ class HTTP::Cookie
|
|
|
86
89
|
|
|
87
90
|
# The Expires attribute value as a Time object.
|
|
88
91
|
#
|
|
89
|
-
# The setter method accepts a Time object, a string representation
|
|
92
|
+
# The setter method accepts a Time / DateTime object, a string representation
|
|
90
93
|
# of date/time that Time.parse can understand, or `nil`.
|
|
91
94
|
#
|
|
92
95
|
# Setting this value resets #max_age to nil. When #max_age is
|
|
@@ -275,7 +278,7 @@ class HTTP::Cookie
|
|
|
275
278
|
logger = options[:logger]
|
|
276
279
|
created_at = options[:created_at]
|
|
277
280
|
end
|
|
278
|
-
origin =
|
|
281
|
+
origin = HTTP::Cookie::URIParser.parse(origin)
|
|
279
282
|
|
|
280
283
|
[].tap { |cookies|
|
|
281
284
|
Scanner.new(set_cookie, logger).scan_set_cookie { |name, value, attrs|
|
|
@@ -424,7 +427,7 @@ class HTTP::Cookie
|
|
|
424
427
|
# Returns the domain, with a dot prefixed only if the domain flag is
|
|
425
428
|
# on.
|
|
426
429
|
def dot_domain
|
|
427
|
-
@for_domain ? '.' << @domain : @domain
|
|
430
|
+
@for_domain ? (+'.') << @domain : @domain
|
|
428
431
|
end
|
|
429
432
|
|
|
430
433
|
# Returns the domain attribute value as a DomainName object.
|
|
@@ -455,7 +458,7 @@ class HTTP::Cookie
|
|
|
455
458
|
@origin.nil? or
|
|
456
459
|
raise ArgumentError, "origin cannot be changed once it is set"
|
|
457
460
|
# Delay setting @origin because #domain= or #path= may fail
|
|
458
|
-
origin =
|
|
461
|
+
origin = HTTP::Cookie::URIParser.parse(origin)
|
|
459
462
|
if URI::HTTP === origin
|
|
460
463
|
self.domain ||= origin.host
|
|
461
464
|
self.path ||= (origin + './').path
|
|
@@ -490,6 +493,8 @@ class HTTP::Cookie
|
|
|
490
493
|
def expires= t
|
|
491
494
|
case t
|
|
492
495
|
when nil, Time
|
|
496
|
+
when DateTime
|
|
497
|
+
t = t.to_time
|
|
493
498
|
else
|
|
494
499
|
t = Time.parse(t)
|
|
495
500
|
end
|
|
@@ -548,7 +553,7 @@ class HTTP::Cookie
|
|
|
548
553
|
# Tests if it is OK to accept this cookie if it is sent from a given
|
|
549
554
|
# URI/URL, `uri`.
|
|
550
555
|
def acceptable_from_uri?(uri)
|
|
551
|
-
uri =
|
|
556
|
+
uri = HTTP::Cookie::URIParser.parse(uri)
|
|
552
557
|
return false unless URI::HTTP === uri && uri.host
|
|
553
558
|
host = DomainName.new(uri.host)
|
|
554
559
|
|
|
@@ -585,7 +590,7 @@ class HTTP::Cookie
|
|
|
585
590
|
if @domain.nil?
|
|
586
591
|
raise "cannot tell if this cookie is valid because the domain is unknown"
|
|
587
592
|
end
|
|
588
|
-
uri =
|
|
593
|
+
uri = HTTP::Cookie::URIParser.parse(uri)
|
|
589
594
|
# RFC 6265 5.4
|
|
590
595
|
return false if secure? && !(URI::HTTPS === uri)
|
|
591
596
|
acceptable_from_uri?(uri) && HTTP::Cookie.path_match?(@path, uri.path)
|
|
@@ -594,7 +599,7 @@ class HTTP::Cookie
|
|
|
594
599
|
# Returns a string for use in the Cookie header, i.e. `name=value`
|
|
595
600
|
# or `name="value"`.
|
|
596
601
|
def cookie_value
|
|
597
|
-
"#{@name}=#{Scanner.quote(@value)}"
|
|
602
|
+
+"#{@name}=#{Scanner.quote(@value)}"
|
|
598
603
|
end
|
|
599
604
|
alias to_s cookie_value
|
|
600
605
|
|
|
@@ -650,6 +655,11 @@ class HTTP::Cookie
|
|
|
650
655
|
end
|
|
651
656
|
include Comparable
|
|
652
657
|
|
|
658
|
+
# Hash serialization helper for use back into other libraries (Like Selenium)
|
|
659
|
+
def to_h
|
|
660
|
+
PERSISTENT_PROPERTIES.each_with_object({}) { |property, hash| hash[property.to_sym] = instance_variable_get("@#{property}") }
|
|
661
|
+
end
|
|
662
|
+
|
|
653
663
|
# YAML serialization helper for Syck.
|
|
654
664
|
def to_yaml_properties
|
|
655
665
|
PERSISTENT_PROPERTIES.map { |name| "@#{name}" }
|
|
@@ -18,7 +18,7 @@ class HTTP::CookieJar::AbstractStore
|
|
|
18
18
|
require 'http/cookie_jar/%s_store' % symbol
|
|
19
19
|
@@class_map.fetch(symbol)
|
|
20
20
|
rescue LoadError, IndexError => e
|
|
21
|
-
raise IndexError, 'cookie store unavailable: %s, error: %s' % symbol.inspect, e.message
|
|
21
|
+
raise IndexError, 'cookie store unavailable: %s, error: %s' % [symbol.inspect, e.message]
|
|
22
22
|
end
|
|
23
23
|
end
|
|
24
24
|
|
data/lib/http/cookie_jar.rb
CHANGED
metadata
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: http-cookie
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0
|
|
4
|
+
version: 1.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Akinori MUSHA
|
|
8
8
|
- Aaron Patterson
|
|
9
9
|
- Eric Hodel
|
|
10
10
|
- Mike Dalessio
|
|
11
|
-
autorequire:
|
|
12
11
|
bindir: bin
|
|
13
12
|
cert_chain: []
|
|
14
|
-
date:
|
|
13
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
15
14
|
dependencies:
|
|
16
15
|
- !ruby/object:Gem::Dependency
|
|
17
16
|
name: domain_name
|
|
@@ -124,21 +123,17 @@ email:
|
|
|
124
123
|
executables: []
|
|
125
124
|
extensions: []
|
|
126
125
|
extra_rdoc_files:
|
|
127
|
-
- README.md
|
|
128
126
|
- LICENSE.txt
|
|
127
|
+
- README.md
|
|
129
128
|
files:
|
|
130
|
-
- ".github/workflows/ci.yml"
|
|
131
|
-
- ".gitignore"
|
|
132
129
|
- CHANGELOG.md
|
|
133
|
-
- Gemfile
|
|
134
130
|
- LICENSE.txt
|
|
135
131
|
- README.md
|
|
136
|
-
- Rakefile
|
|
137
|
-
- http-cookie.gemspec
|
|
138
132
|
- lib/http-cookie.rb
|
|
139
133
|
- lib/http/cookie.rb
|
|
140
134
|
- lib/http/cookie/ruby_compat.rb
|
|
141
135
|
- lib/http/cookie/scanner.rb
|
|
136
|
+
- lib/http/cookie/uri_parser.rb
|
|
142
137
|
- lib/http/cookie/version.rb
|
|
143
138
|
- lib/http/cookie_jar.rb
|
|
144
139
|
- lib/http/cookie_jar/abstract_saver.rb
|
|
@@ -147,16 +142,10 @@ files:
|
|
|
147
142
|
- lib/http/cookie_jar/hash_store.rb
|
|
148
143
|
- lib/http/cookie_jar/mozilla_store.rb
|
|
149
144
|
- lib/http/cookie_jar/yaml_saver.rb
|
|
150
|
-
- test/helper.rb
|
|
151
|
-
- test/mechanize.yml
|
|
152
|
-
- test/simplecov_start.rb
|
|
153
|
-
- test/test_http_cookie.rb
|
|
154
|
-
- test/test_http_cookie_jar.rb
|
|
155
145
|
homepage: https://github.com/sparklemotion/http-cookie
|
|
156
146
|
licenses:
|
|
157
147
|
- MIT
|
|
158
148
|
metadata: {}
|
|
159
|
-
post_install_message:
|
|
160
149
|
rdoc_options: []
|
|
161
150
|
require_paths:
|
|
162
151
|
- lib
|
|
@@ -171,13 +160,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
171
160
|
- !ruby/object:Gem::Version
|
|
172
161
|
version: '0'
|
|
173
162
|
requirements: []
|
|
174
|
-
rubygems_version: 3.
|
|
175
|
-
signing_key:
|
|
163
|
+
rubygems_version: 3.6.9
|
|
176
164
|
specification_version: 4
|
|
177
165
|
summary: A Ruby library to handle HTTP Cookies based on RFC 6265
|
|
178
|
-
test_files:
|
|
179
|
-
- test/helper.rb
|
|
180
|
-
- test/mechanize.yml
|
|
181
|
-
- test/simplecov_start.rb
|
|
182
|
-
- test/test_http_cookie.rb
|
|
183
|
-
- test/test_http_cookie_jar.rb
|
|
166
|
+
test_files: []
|
data/.github/workflows/ci.yml
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
name: CI
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches:
|
|
6
|
-
- master
|
|
7
|
-
pull_request:
|
|
8
|
-
branches:
|
|
9
|
-
- "*"
|
|
10
|
-
|
|
11
|
-
jobs:
|
|
12
|
-
test:
|
|
13
|
-
strategy:
|
|
14
|
-
fail-fast: false
|
|
15
|
-
matrix:
|
|
16
|
-
os: [ubuntu]
|
|
17
|
-
# We still kind of support Ruby 1.8.7
|
|
18
|
-
ruby: [2.7, "3.0", 3.1, head, jruby]
|
|
19
|
-
|
|
20
|
-
name: >-
|
|
21
|
-
${{matrix.os}}:ruby-${{matrix.ruby}}
|
|
22
|
-
runs-on: ${{matrix.os}}-latest
|
|
23
|
-
continue-on-error: ${{matrix.ruby == 'head' || matrix.ruby == 'jruby'}}
|
|
24
|
-
|
|
25
|
-
steps:
|
|
26
|
-
- name: Check out
|
|
27
|
-
uses: actions/checkout@v2
|
|
28
|
-
|
|
29
|
-
- name: Set up ruby and bundle
|
|
30
|
-
uses: ruby/setup-ruby@v1
|
|
31
|
-
with:
|
|
32
|
-
ruby-version: ${{matrix.ruby}}
|
|
33
|
-
bundler-cache: true
|
|
34
|
-
|
|
35
|
-
- name: Run rake
|
|
36
|
-
run: |
|
|
37
|
-
bundle exec rake
|
data/.gitignore
DELETED
data/Gemfile
DELETED
data/Rakefile
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
require 'bundler/gem_tasks'
|
|
2
|
-
require 'rake/testtask'
|
|
3
|
-
|
|
4
|
-
Rake::TestTask.new(:test) do |test|
|
|
5
|
-
test.ruby_opts << '-r./test/simplecov_start.rb' if RUBY_VERSION >= '1.9'
|
|
6
|
-
test.pattern = 'test/**/test_*.rb'
|
|
7
|
-
test.verbose = true
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
task :default => :test
|
|
11
|
-
|
|
12
|
-
require 'rdoc/task'
|
|
13
|
-
Rake::RDocTask.new do |rdoc|
|
|
14
|
-
version = HTTP::Cookie::VERSION
|
|
15
|
-
|
|
16
|
-
rdoc.rdoc_dir = 'rdoc'
|
|
17
|
-
rdoc.title = "http-cookie #{version}"
|
|
18
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
|
19
|
-
rdoc.rdoc_files.include(Bundler::GemHelper.gemspec.extra_rdoc_files)
|
|
20
|
-
end
|
data/http-cookie.gemspec
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
-
require 'http/cookie/version'
|
|
5
|
-
|
|
6
|
-
Gem::Specification.new do |gem|
|
|
7
|
-
gem.name = "http-cookie"
|
|
8
|
-
gem.version = HTTP::Cookie::VERSION
|
|
9
|
-
gem.authors, gem.email = {
|
|
10
|
-
'Akinori MUSHA' => 'knu@idaemons.org',
|
|
11
|
-
'Aaron Patterson' => 'aaronp@rubyforge.org',
|
|
12
|
-
'Eric Hodel' => 'drbrain@segment7.net',
|
|
13
|
-
'Mike Dalessio' => 'mike.dalessio@gmail.com',
|
|
14
|
-
}.instance_eval { [keys, values] }
|
|
15
|
-
|
|
16
|
-
gem.description = %q{HTTP::Cookie is a Ruby library to handle HTTP Cookies based on RFC 6265. It has with security, standards compliance and compatibility in mind, to behave just the same as today's major web browsers. It has builtin support for the legacy cookies.txt and the latest cookies.sqlite formats of Mozilla Firefox, and its modular API makes it easy to add support for a new backend store.}
|
|
17
|
-
gem.summary = %q{A Ruby library to handle HTTP Cookies based on RFC 6265}
|
|
18
|
-
gem.homepage = "https://github.com/sparklemotion/http-cookie"
|
|
19
|
-
gem.license = "MIT"
|
|
20
|
-
|
|
21
|
-
gem.files = `git ls-files`.split($/)
|
|
22
|
-
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
|
23
|
-
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
|
24
|
-
gem.require_paths = ["lib"]
|
|
25
|
-
gem.extra_rdoc_files = ['README.md', 'LICENSE.txt']
|
|
26
|
-
|
|
27
|
-
gem.add_runtime_dependency("domain_name", ["~> 0.5"])
|
|
28
|
-
gem.add_development_dependency("sqlite3", ["~> 1.3"]) unless defined?(JRUBY_VERSION)
|
|
29
|
-
gem.add_development_dependency("bundler", [">= 1.2.0"])
|
|
30
|
-
gem.add_development_dependency("test-unit", [">= 2.4.3", *("< 3" if RUBY_VERSION < "1.9")])
|
|
31
|
-
gem.add_development_dependency("rake", [">= 0.9.2.2", *("< 11" if RUBY_VERSION < "1.9")])
|
|
32
|
-
gem.add_development_dependency("rdoc", RUBY_VERSION > "1.9" ? "> 2.4.2" : "~> 2.4.2")
|
|
33
|
-
gem.add_development_dependency("simplecov", [">= 0"])
|
|
34
|
-
gem.add_development_dependency("json", ["< 2"]) if RUBY_VERSION < "2.0"
|
|
35
|
-
end
|
data/test/helper.rb
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
require 'rubygems'
|
|
2
|
-
require 'test-unit'
|
|
3
|
-
require 'uri'
|
|
4
|
-
require 'http/cookie'
|
|
5
|
-
|
|
6
|
-
module Test
|
|
7
|
-
module Unit
|
|
8
|
-
module Assertions
|
|
9
|
-
def assert_warn(pattern, message = nil, &block)
|
|
10
|
-
class << (output = "")
|
|
11
|
-
alias write <<
|
|
12
|
-
end
|
|
13
|
-
stderr, $stderr = $stderr, output
|
|
14
|
-
yield
|
|
15
|
-
assert_match(pattern, output, message)
|
|
16
|
-
ensure
|
|
17
|
-
$stderr = stderr
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
def assert_warning(pattern, message = nil, &block)
|
|
21
|
-
verbose, $VERBOSE = $VERBOSE, true
|
|
22
|
-
assert_warn(pattern, message, &block)
|
|
23
|
-
ensure
|
|
24
|
-
$VERBOSE = verbose
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
module Enumerable
|
|
31
|
-
def combine
|
|
32
|
-
masks = inject([[], 1]){|(ar, m), e| [ar << m, m << 1 ] }[0]
|
|
33
|
-
all = masks.inject(0){ |al, m| al|m }
|
|
34
|
-
|
|
35
|
-
result = []
|
|
36
|
-
for i in 1..all do
|
|
37
|
-
tmp = []
|
|
38
|
-
each_with_index do |e, idx|
|
|
39
|
-
tmp << e unless (masks[idx] & i) == 0
|
|
40
|
-
end
|
|
41
|
-
result << tmp
|
|
42
|
-
end
|
|
43
|
-
result
|
|
44
|
-
end
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
def test_file(filename)
|
|
48
|
-
File.expand_path(filename, File.dirname(__FILE__))
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
def sleep_until(time)
|
|
52
|
-
if (s = time - Time.now) > 0
|
|
53
|
-
sleep s
|
|
54
|
-
end
|
|
55
|
-
end
|
data/test/mechanize.yml
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
google.com:
|
|
3
|
-
/:
|
|
4
|
-
PREF: !ruby/object:Mechanize::Cookie
|
|
5
|
-
version: 0
|
|
6
|
-
port:
|
|
7
|
-
discard:
|
|
8
|
-
comment_url:
|
|
9
|
-
expires: Tue, 24 Mar 2065 08:20:15 GMT
|
|
10
|
-
max_age:
|
|
11
|
-
comment:
|
|
12
|
-
secure: false
|
|
13
|
-
path: /
|
|
14
|
-
domain: google.com
|
|
15
|
-
accessed_at: 2013-03-24 17:20:15.822619000 +09:00
|
|
16
|
-
created_at: 2013-03-24 17:20:15.822619000 +09:00
|
|
17
|
-
name: PREF
|
|
18
|
-
value: ID=7571a59c059e09db:FF=0:TM=1364199615:LM=1364199615:S=BxUqnqPrchd2cVmC
|
|
19
|
-
for_domain: true
|
|
20
|
-
domain_name: !ruby/object:DomainName
|
|
21
|
-
ipaddr:
|
|
22
|
-
hostname: google.com
|
|
23
|
-
uri_host: google.com
|
|
24
|
-
tld: com
|
|
25
|
-
canonical_tld_p: true
|
|
26
|
-
domain: google.com
|
|
27
|
-
session: false
|
|
28
|
-
NID: !ruby/object:Mechanize::Cookie
|
|
29
|
-
version: 0
|
|
30
|
-
port:
|
|
31
|
-
discard:
|
|
32
|
-
comment_url:
|
|
33
|
-
expires: Sun, 23 Sep 2063 08:20:15 GMT
|
|
34
|
-
max_age:
|
|
35
|
-
comment:
|
|
36
|
-
secure: false
|
|
37
|
-
path: /
|
|
38
|
-
domain: google.com
|
|
39
|
-
accessed_at: 2013-03-24 17:20:15.828434000 +09:00
|
|
40
|
-
created_at: 2013-03-24 17:20:15.828434000 +09:00
|
|
41
|
-
name: NID
|
|
42
|
-
value: 67=Kn2osS6wOzILpl7sCM1QIDmGg2VESBiwCyt6zx4vOVSWKOYDlwGIpgIGrpD8FpkbS9eqizo3QWFa5YkOygnCF6vRIQpbvlTxWB2Hq1Oo-qXWy0317yCqQ-B25eJLfUcC
|
|
43
|
-
for_domain: true
|
|
44
|
-
domain_name: !ruby/object:DomainName
|
|
45
|
-
ipaddr:
|
|
46
|
-
hostname: google.com
|
|
47
|
-
uri_host: google.com
|
|
48
|
-
tld: com
|
|
49
|
-
canonical_tld_p: true
|
|
50
|
-
domain: google.com
|
|
51
|
-
session: false
|
|
52
|
-
google.co.jp:
|
|
53
|
-
/:
|
|
54
|
-
PREF: !ruby/object:Mechanize::Cookie
|
|
55
|
-
version: 0
|
|
56
|
-
port:
|
|
57
|
-
discard:
|
|
58
|
-
comment_url:
|
|
59
|
-
expires: Tue, 24 Mar 2065 08:20:16 GMT
|
|
60
|
-
max_age:
|
|
61
|
-
comment:
|
|
62
|
-
secure: false
|
|
63
|
-
path: /
|
|
64
|
-
domain: google.co.jp
|
|
65
|
-
accessed_at: 2013-03-24 17:20:17.136581000 +09:00
|
|
66
|
-
created_at: 2013-03-24 17:20:17.136581000 +09:00
|
|
67
|
-
name: PREF
|
|
68
|
-
value: ID=cb25dd1567d8b5c8:FF=0:TM=1364199616:LM=1364199616:S=c3PbhRq79Wo5T_vV
|
|
69
|
-
for_domain: true
|
|
70
|
-
domain_name: !ruby/object:DomainName
|
|
71
|
-
ipaddr:
|
|
72
|
-
hostname: google.co.jp
|
|
73
|
-
uri_host: google.co.jp
|
|
74
|
-
tld: jp
|
|
75
|
-
canonical_tld_p: true
|
|
76
|
-
domain: google.co.jp
|
|
77
|
-
session: false
|
|
78
|
-
NID: !ruby/object:Mechanize::Cookie
|
|
79
|
-
version: 0
|
|
80
|
-
port:
|
|
81
|
-
discard:
|
|
82
|
-
comment_url:
|
|
83
|
-
expires: Sun, 23 Sep 2063 08:20:16 GMT
|
|
84
|
-
max_age:
|
|
85
|
-
comment:
|
|
86
|
-
secure: false
|
|
87
|
-
path: /
|
|
88
|
-
domain: google.co.jp
|
|
89
|
-
accessed_at: 2013-03-24 17:20:17.139782000 +09:00
|
|
90
|
-
created_at: 2013-03-24 17:20:17.139782000 +09:00
|
|
91
|
-
name: NID
|
|
92
|
-
value: 67=GS7P-68zgm_KRA0e0dpN_XbYpmw9uBDe56qUeoCGiSRTahsM7dtOBCKfCoIFRKlzSuOiwJQdIZNpwv3DSXQNHXDKltucgfv2qkHlGeoj8-5VlowPXLLesz2VIpLOLw-a
|
|
93
|
-
for_domain: true
|
|
94
|
-
domain_name: !ruby/object:DomainName
|
|
95
|
-
ipaddr:
|
|
96
|
-
hostname: google.co.jp
|
|
97
|
-
uri_host: google.co.jp
|
|
98
|
-
tld: jp
|
|
99
|
-
canonical_tld_p: true
|
|
100
|
-
domain: google.co.jp
|
|
101
|
-
session: false
|
data/test/simplecov_start.rb
DELETED