chuckle 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: bb75c4f41beff84dd3b97784cdaff8241a146fc2
4
+ data.tar.gz: 638ddf1861e82e0982cbe8d04d8b415aa34c1d44
5
+ SHA512:
6
+ metadata.gz: 60e3caeccb0b6044f3528d9f97249c81a7786ffecff43e7875fc5cda6f1c9c763687f5b9b4c349e740d323a954b03d563ff025c7d1812038d5099f8ae5fe7878
7
+ data.tar.gz: 2a95541f81a21d3397ebf9a924bf590c716ce646499c070f65ccdf13c255d5e98989045522a1f6840700c619f6aa3d9c24e88d61103b61696c662faf6aea5d79
@@ -2,4 +2,4 @@ language: ruby
2
2
  rvm:
3
3
  - 1.9.3
4
4
  - 2.0.0
5
- - jruby-19mode
5
+ - 2.1.0
data/README.md CHANGED
@@ -45,15 +45,20 @@ Pass these `Chuckle::Client.new`:
45
45
 
46
46
  * **cache_dir** (~/.chuckle) - where chuckle should cache files. If HOME doesn't exist or isn't writable, it'll use `/tmp/chuckle` instead
47
47
  * **cache_errors** (true) - false to not cache errors on disk (timeouts, http status >= 400, etc.)
48
+ * **cacert** (nil) - cacert option to pass to curl
49
+ * **capath** (nil) - capath option to pass to curl
48
50
  * **cookies** (false) - true to turn on cookie support
49
51
  * **expires_in** (:never) - time in seconds after which cache files should expire, or `:never` to never expire
52
+ * **insecure** (false) - true to allow insecure SSL connections
50
53
  * **nretries** (2) - number of times to retry a failing request
51
54
  * **rate_limit** (1) - number of seconds between requests
52
55
  * **timeout** (30) - timeout per request. Note that if `nretries` is 2 and `timeout` is 30, a failing request could take 90 seconds to truly fail.
53
56
  * **user_agent** - the user agent. Defaults to the IE9 user agent.
54
57
  * **verbose** (false) - if true, prints each request before fetching. Only prints network requests.
55
58
 
59
+ ## Changelog
56
60
 
61
+ * 1.0.4 - added support for --cacert, --capath and --insecure (@nkriege)
57
62
 
58
63
 
59
64
  ## Limitations
data/Rakefile CHANGED
@@ -1,26 +1,8 @@
1
- require "bundler"
2
- require "bundler/setup"
1
+ require "bundler/gem_helper"
3
2
  require "rake/testtask"
4
3
  require "rdoc/task"
5
4
 
6
- #
7
- # gem
8
- #
9
-
10
- task gem: :build
11
- task :build do
12
- system "gem build --quiet chuckle.gemspec"
13
- end
14
-
15
- task install: :build do
16
- system "sudo gem install --quiet chuckle-#{Chuckle::VERSION}.gem"
17
- end
18
-
19
- task release: :build do
20
- system "git tag -a #{Chuckle::VERSION} -m 'Tagging #{Chuckle::VERSION}'"
21
- system "git push --tags"
22
- system "gem push chuckle-#{Chuckle::VERSION}.gem"
23
- end
5
+ Bundler::GemHelper.install_tasks
24
6
 
25
7
  #
26
8
  # test
@@ -53,7 +53,7 @@ module Chuckle
53
53
 
54
54
  # calculate body_path
55
55
  s = @client.cache_dir
56
- s = "#{s}/#{pathify(uri.host)}"
56
+ s = "#{s}/#{pathify(uri.host || "file")}"
57
57
  s = "#{s}/#{pathify(uri.path)}"
58
58
  if uri.query
59
59
  q = "?#{uri.query}"
@@ -79,6 +79,11 @@ module Chuckle
79
79
  command += ["--cookie-jar", cookie_jar.path]
80
80
  end
81
81
 
82
+ # SSL options
83
+ command += ["--cacert", client.cacert] if client.cacert
84
+ command += ["--capath", client.capath] if client.capath
85
+ command += ["--insecure"] if client.insecure?
86
+
82
87
  command += ["--dump-header", headers_path]
83
88
  command += ["--output", body_path]
84
89
 
@@ -3,8 +3,11 @@ module Chuckle
3
3
  DEFAULT_OPTIONS = {
4
4
  cache_dir: nil,
5
5
  cache_errors: true,
6
+ cacert: nil,
7
+ capath: nil,
6
8
  cookies: false,
7
9
  expires_in: :never,
10
+ insecure: false,
8
11
  nretries: 2,
9
12
  rate_limit: 1,
10
13
  timeout: 30,
@@ -33,6 +36,16 @@ module Chuckle
33
36
  options[:cache_errors]
34
37
  end
35
38
 
39
+ # cacert to pass to curl
40
+ def cacert
41
+ options[:cacert]
42
+ end
43
+
44
+ # capath to pass to curl
45
+ def capath
46
+ options[:capath]
47
+ end
48
+
36
49
  # are cookies enabled?
37
50
  def cookies?
38
51
  options[:cookies]
@@ -43,6 +56,11 @@ module Chuckle
43
56
  options[:expires_in]
44
57
  end
45
58
 
59
+ # allow insecure SSL connections?
60
+ def insecure?
61
+ options[:insecure]
62
+ end
63
+
46
64
  # number of retries to attempt
47
65
  def nretries
48
66
  options[:nretries]
@@ -1,4 +1,4 @@
1
1
  module Chuckle
2
2
  # Gem version
3
- VERSION = "1.0.3"
3
+ VERSION = "1.0.4"
4
4
  end
@@ -54,6 +54,16 @@ class TestNetwork < Minitest::Test
54
54
  assert !File.exists?(cookie_jar), "cookie jar should've expired"
55
55
  end
56
56
 
57
+ def test_https
58
+ response = client.get("https://httpbin.org/get")
59
+ assert_equal 200, response.code
60
+ end
61
+
62
+ def test_https_insecure
63
+ response = client(insecure: true).get("https://httpbin.org/get")
64
+ assert_equal 200, response.code
65
+ end
66
+
57
67
  def test_bin
58
68
  Dir.chdir(File.expand_path("../", __FILE__))
59
69
  assert_command("../bin/chuckle url_file.txt")
@@ -59,4 +59,18 @@ class TestRequests < Minitest::Test
59
59
  assert_equal URI.parse(URL), response.uri
60
60
  assert_equal "hello\n", response.body
61
61
  end
62
+
63
+ def test_strange_urls
64
+ [
65
+ "gub",
66
+ "file://gub",
67
+ "file://gub/gub",
68
+ "file:///gub",
69
+ ].each do |url|
70
+ response = mcurl(HTTP_200) { client.get(url) }
71
+ assert_equal 200, response.code
72
+ assert_equal URI.parse(url), response.uri
73
+ assert_equal "hello\n", response.body
74
+ end
75
+ end
62
76
  end
metadata CHANGED
@@ -1,110 +1,97 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chuckle
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
5
- prerelease:
4
+ version: 1.0.4
6
5
  platform: ruby
7
6
  authors:
8
7
  - Adam Doppelt
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-05-21 00:00:00.000000000 Z
11
+ date: 2014-12-06 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: trollop
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - ">="
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: awesome_print
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - ">="
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - ">="
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: json
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - ">="
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - ">="
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: minitest
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ~>
59
+ - - "~>"
68
60
  - !ruby/object:Gem::Version
69
61
  version: '5.0'
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ~>
66
+ - - "~>"
76
67
  - !ruby/object:Gem::Version
77
68
  version: '5.0'
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: rake
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
- - - ! '>='
73
+ - - ">="
84
74
  - !ruby/object:Gem::Version
85
75
  version: '0'
86
76
  type: :development
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
- - - ! '>='
80
+ - - ">="
92
81
  - !ruby/object:Gem::Version
93
82
  version: '0'
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: rdoc
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
- - - ! '>='
87
+ - - ">="
100
88
  - !ruby/object:Gem::Version
101
89
  version: '0'
102
90
  type: :development
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
- - - ! '>='
94
+ - - ">="
108
95
  - !ruby/object:Gem::Version
109
96
  version: '0'
110
97
  description: An http client that caches on disk.
@@ -115,8 +102,8 @@ executables:
115
102
  extensions: []
116
103
  extra_rdoc_files: []
117
104
  files:
118
- - .gitignore
119
- - .travis.yml
105
+ - ".gitignore"
106
+ - ".travis.yml"
120
107
  - Gemfile
121
108
  - LICENSE
122
109
  - README.md
@@ -141,30 +128,26 @@ files:
141
128
  - test/url_file.txt
142
129
  homepage: http://github.com/gurgeous/chuckle
143
130
  licenses: []
131
+ metadata: {}
144
132
  post_install_message:
145
133
  rdoc_options: []
146
134
  require_paths:
147
135
  - lib
148
136
  required_ruby_version: !ruby/object:Gem::Requirement
149
- none: false
150
137
  requirements:
151
- - - ! '>='
138
+ - - ">="
152
139
  - !ruby/object:Gem::Version
153
140
  version: 1.9.0
154
141
  required_rubygems_version: !ruby/object:Gem::Requirement
155
- none: false
156
142
  requirements:
157
- - - ! '>='
143
+ - - ">="
158
144
  - !ruby/object:Gem::Version
159
145
  version: '0'
160
- segments:
161
- - 0
162
- hash: -1861235699163653682
163
146
  requirements: []
164
147
  rubyforge_project: chuckle
165
- rubygems_version: 1.8.24
148
+ rubygems_version: 2.2.2
166
149
  signing_key:
167
- specification_version: 3
150
+ specification_version: 4
168
151
  summary: Chuckle - an http client that caches on disk.
169
152
  test_files:
170
153
  - test/helper.rb