hwacha 0.3.0 → 1.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e92a5b7c5af09c2564fa63ee249a62af4d580015
4
- data.tar.gz: 70467fdde11f3e5eaed904578b8971adb49801d4
3
+ metadata.gz: 52d5b83b410ebcfca63a55dc5c6711a45e022144
4
+ data.tar.gz: ce16e24d25bfc320fb9d4906ca2566eeaa982d28
5
5
  SHA512:
6
- metadata.gz: e697c506c9bbef585cccd3cd4bf09702c724dcd93341d895f41e1ac51ba03adc3ff6b0fb731cc9893e373b10e8c0dad407ca1827210953b15445afc0f2fd10d5
7
- data.tar.gz: e5df38e7d635afbabb56acfca184b7c26b616e51367ade0e4870db6cad349834c6a70258c5451c92aa24a5293e0ab99b332b08e384b42651e6f876d46653c5bf
6
+ metadata.gz: 91aa32452ddbd2da585fe7fe92da6aeccd58182eb69801dae632bbcfee228e7e6f733016d779c5caba79826e83fd291ab77ed2781284e9faa8e979d810cfdf9a
7
+ data.tar.gz: b932e0b3754c8c32da3fca9faefcd0920b0406ed5b1072b47ea1f4da453517e23637a4655ea0a33ed8981a8de15e58444a3f466ce38b04624f57f243861f481c
@@ -1,4 +1,5 @@
1
1
  language: ruby
2
2
  rvm:
3
+ - 2.1.0
3
4
  - 2.0.0
4
5
  - 1.9.3
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- hwacha (0.3.0)
4
+ hwacha (1.0.0)
5
5
  typhoeus
6
6
 
7
7
  GEM
@@ -21,7 +21,7 @@ class Hwacha
21
21
  hydra = build_hydra
22
22
 
23
23
  Array(urls).each do |url|
24
- request = Typhoeus::Request.new(url)
24
+ request = Typhoeus::Request.new(url, config.request_options)
25
25
  request.on_complete do |response|
26
26
  yield response.effective_url, response
27
27
  end
@@ -42,6 +42,6 @@ class Hwacha
42
42
  alias :strike_true :find_existing
43
43
 
44
44
  def build_hydra
45
- Typhoeus::Hydra.new(config.options)
45
+ Typhoeus::Hydra.new(config.hydra_options)
46
46
  end
47
47
  end
@@ -2,16 +2,26 @@ require 'ostruct'
2
2
 
3
3
  class Hwacha
4
4
  class Config < OpenStruct
5
- def options
5
+ def hydra_options
6
6
  options = {}
7
7
  options.merge(concurrency_option)
8
8
  end
9
9
 
10
+ def request_options
11
+ options = {}
12
+ options.merge(follow_redirects_option)
13
+ end
14
+
10
15
  private
11
16
 
12
17
  def concurrency_option
13
18
  return {} if max_concurrent_requests.nil?
14
19
  { :max_concurrency => max_concurrent_requests }
15
20
  end
21
+
22
+ def follow_redirects_option
23
+ return { :followlocation => false } if follow_redirects.nil?
24
+ { :followlocation => !!follow_redirects }
25
+ end
16
26
  end
17
27
  end
@@ -1,3 +1,3 @@
1
1
  class Hwacha
2
- VERSION = "0.3.0"
2
+ VERSION = "1.0.0"
3
3
  end
@@ -0,0 +1,51 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://www.rakeroutes.com/
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Typhoeus - https://github.com/typhoeus/typhoeus
12
+ response:
13
+ status:
14
+ code: 301
15
+ message: Moved Permanently
16
+ headers:
17
+ Date:
18
+ - Tue, 14 Jan 2014 03:03:38 GMT
19
+ Server:
20
+ - Apache
21
+ Location:
22
+ - http://rakeroutes.com/
23
+ Vary:
24
+ - Accept-Encoding
25
+ Content-Length:
26
+ - '230'
27
+ Content-Type:
28
+ - text/html; charset=iso-8859-1
29
+ body:
30
+ encoding: US-ASCII
31
+ string: ! '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
32
+
33
+ <html><head>
34
+
35
+ <title>301 Moved Permanently</title>
36
+
37
+ </head><body>
38
+
39
+ <h1>Moved Permanently</h1>
40
+
41
+ <p>The document has moved <a href="http://rakeroutes.com/">here</a>.</p>
42
+
43
+ </body></html>
44
+
45
+ '
46
+ http_version: '1.1'
47
+ adapter_metadata:
48
+ effective_url: !binary |-
49
+ aHR0cDovL3d3dy5yYWtlcm91dGVzLmNvbS8=
50
+ recorded_at: Tue, 14 Jan 2014 03:03:37 GMT
51
+ recorded_with: VCR 2.8.0
@@ -0,0 +1,651 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://www.rakeroutes.com/
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Typhoeus - https://github.com/typhoeus/typhoeus
12
+ response:
13
+ status:
14
+ code: 200
15
+ message: OK
16
+ headers:
17
+ Date:
18
+ - Tue, 14 Jan 2014 03:03:38 GMT
19
+ Server:
20
+ - Apache
21
+ Accept-Ranges:
22
+ - bytes
23
+ X-Mod-Pagespeed:
24
+ - 1.4.26.5-3533
25
+ Cache-Control:
26
+ - max-age=0, no-cache, must-revalidate
27
+ Vary:
28
+ - Accept-Encoding,User-Agent
29
+ Content-Length:
30
+ - '14856'
31
+ Content-Type:
32
+ - text/html
33
+ body:
34
+ encoding: US-ASCII
35
+ string: ! '
36
+
37
+ <!DOCTYPE html>
38
+
39
+ <!--[if IEMobile 7 ]><html class="no-js iem7"><![endif]-->
40
+
41
+ <!--[if lt IE 9]><html class="no-js lte-ie8"><![endif]-->
42
+
43
+ <!--[if (gt IE 8)|(gt IEMobile 7)|!(IEMobile)|!(IE)]><!--><html class="no-js"
44
+ lang="en"><!--<![endif]-->
45
+
46
+ <head>
47
+
48
+ <meta charset="utf-8">
49
+
50
+ <title>Rake Routes</title>
51
+
52
+ <meta name="author" content="Stephen Ball">
53
+
54
+ <meta name="description" content="A blog focused on the new Ruby/Rails developer.
55
+ From the basics to the advanced; we try to write every article to be completely
56
+ accessible.">
57
+
58
+ <!-- http://t.co/dKP3o1e -->
59
+
60
+ <meta name="HandheldFriendly" content="True">
61
+
62
+ <meta name="MobileOptimized" content="320">
63
+
64
+ <meta name="viewport" content="width=device-width, initial-scale=1">
65
+
66
+ <link rel="canonical" href="http://rakeroutes.com">
67
+
68
+ <link href="http://rakeroutes.com/xfavicon.png.pagespeed.ic.9sqLog9_Yb.png"
69
+ rel="icon">
70
+
71
+ <link href="http://rakeroutes.com/stylesheets/A.screen.css.pagespeed.cf.B_lQ_FV7Zb.css"
72
+ media="screen, projection" rel="stylesheet" type="text/css">
73
+
74
+ <script src="http://rakeroutes.com/javascripts/modernizr-2.0.js.pagespeed.jm.tWJiHFCbtH.js"></script>
75
+
76
+ <script src="http://rakeroutes.com/javascripts/ender.js.pagespeed.jm.RrToSBMcQ6.js"></script>
77
+
78
+ <script src="http://rakeroutes.com/javascripts/octopress.js.pagespeed.jm.1C8AxdO_gr.js"
79
+ type="text/javascript"></script>
80
+
81
+ <link href="http://feeds.feedburner.com/RakeRoutes" rel="alternate" title="Rake
82
+ Routes" type="application/atom+xml">
83
+
84
+ <!--Fonts from Google"s Web font directory at http://google.com/webfonts -->
85
+
86
+ <link href="http://fonts.googleapis.com/css?family=PT+Serif:regular,italic,bold,bolditalic"
87
+ rel="stylesheet" type="text/css">
88
+
89
+ <link href="http://fonts.googleapis.com/css?family=PT+Sans:regular,italic,bold,bolditalic"
90
+ rel="stylesheet" type="text/css">
91
+
92
+ <meta name="readability-verification" content="AK9Dcwz9jtUc56rWDsh5HXSfVARa3Z7GDjCdBtk9"/>
93
+
94
+ <meta name="readability-verification" content="EAL7Vhv7W4KCBkyHjGZBxndkzqZfmbTVGRRVRFre"/>
95
+
96
+ </head>
97
+
98
+ <body>
99
+
100
+ <header role="banner"><hgroup>
101
+
102
+ <h1><a href="/">Rake Routes</a></h1>
103
+
104
+ <h2>Rails, Ruby, and other programming.</h2>
105
+
106
+ </hgroup>
107
+
108
+ </header>
109
+
110
+ <nav role="navigation"><ul class="subscription" data-subscription="rss email">
111
+
112
+ <li><a onclick="clicky.goal( ''6111'' ); clicky.pause( 500 );" href="http://feeds.feedburner.com/RakeRoutes"
113
+ rel="subscribe-rss" title="subscribe via RSS">RSS</a></li>
114
+
115
+ <li><a onclick="clicky.goal(''6117''); clicky.pause( 500 );" href="http://feedburner.google.com/fb/a/mailverify?uri=RakeRoutes&amp;loc=en_US"
116
+ rel="subscribe-email" title="subscribe via email">Email</a></li>
117
+
118
+ </ul>
119
+
120
+ <form action="http://google.com/search" method="get">
121
+
122
+ <fieldset role="search">
123
+
124
+ <input type="hidden" name="q" value="site:rakeroutes.com"/>
125
+
126
+ <input class="search" type="text" name="q" results="0" placeholder="Search"/>
127
+
128
+ </fieldset>
129
+
130
+ </form>
131
+
132
+ <ul class="main-navigation">
133
+
134
+ <li><a href="/">Blog</a></li>
135
+
136
+ <li><a href="/blog/archives">Archives</a></li>
137
+
138
+ </ul>
139
+
140
+ </nav>
141
+
142
+ <div id="main">
143
+
144
+ <div id="content">
145
+
146
+ <div class="blog-index">
147
+
148
+ <article>
149
+
150
+ <header>
151
+
152
+ <h1 class="entry-title"><a href="/blog/lets-use-hwacha-to-scan-urls/">Let&#8217;s
153
+ Use Hwacha to Scan URLs</a></h1>
154
+
155
+ <p class="meta">
156
+
157
+ <time datetime="2013-12-18T23:43:00-05:00" pubdate data-updated="true">Dec
158
+ 18<span>th</span>, 2013</time>
159
+
160
+ </p>
161
+
162
+ </header>
163
+
164
+ <div class="entry-content"><p>I&#8217;ve written a gem, <a href="https://github.com/sdball/hwacha">Hwacha</a>,
165
+ as a wrapper
166
+
167
+ around Typhoeus to allow for quick and easy response checking for multiple
168
+
169
+ URLs. Let&#8217;s go through some simple use cases!</p>
170
+
171
+ </div>
172
+
173
+ <footer>
174
+
175
+ <a rel="full-article" href="/blog/lets-use-hwacha-to-scan-urls/">Read on &rarr;</a>
176
+
177
+ </footer>
178
+
179
+ </article>
180
+
181
+ <article>
182
+
183
+ <header>
184
+
185
+ <h1 class="entry-title"><a href="/blog/deliberate-git/">Deliberate Git</a></h1>
186
+
187
+ <p class="meta">
188
+
189
+ <time datetime="2013-08-19T19:35:00-04:00" pubdate data-updated="true">Aug
190
+ 19<span>th</span>, 2013</time>
191
+
192
+ </p>
193
+
194
+ </header>
195
+
196
+ <div class="entry-content"><p>Hello Internet! Here&#8217;s my talk &#8220;Deliberate
197
+ Git&#8221; in blog post form.</p>
198
+
199
+ <p>There&#8217;s also video of my presentation of <a href="http://steelcityruby.confbots.com/video/72762735">Deliberate
200
+ Git at Steel City Ruby 2013</a>.</p>
201
+
202
+ <p>If you&#8217;d like to just read the slides they&#8217;re up on Speaker
203
+ Deck: <a href="https://speakerdeck.com/sdball/deliberate-git">Deliberate
204
+
205
+ Git - Slides</a>. Although I highly
206
+
207
+ recommend just pointing people to this blog post if they want to read the
208
+ talk
209
+
210
+ instead of watching it online.</p>
211
+
212
+ <p>Special thanks to PhishMe for sending me to Steel City Ruby to give this
213
+ talk!</p>
214
+
215
+ </div>
216
+
217
+ <footer>
218
+
219
+ <a rel="full-article" href="/blog/deliberate-git/">Read on &rarr;</a>
220
+
221
+ </footer>
222
+
223
+ </article>
224
+
225
+ <article>
226
+
227
+ <header>
228
+
229
+ <h1 class="entry-title"><a href="/blog/customize-your-irb/">Customize Your
230
+ IRB</a></h1>
231
+
232
+ <p class="meta">
233
+
234
+ <time datetime="2013-03-19T09:00:00-04:00" pubdate data-updated="true">Mar
235
+ 19<span>th</span>, 2013</time>
236
+
237
+ </p>
238
+
239
+ </header>
240
+
241
+ <div class="entry-content"><p>You probably spend a lot of time in IRB (or
242
+ the Rails console) but have you
243
+
244
+ taken the time to customize it? Today we&#8217;ll take a look at the things
245
+ I&#8217;ve
246
+
247
+ added to mine, and I&#8217;ll show you how to hack in a .irbrc_rails that&#8217;s
248
+ only loaded
249
+
250
+ in the Rails console.</p>
251
+
252
+ </div>
253
+
254
+ <footer>
255
+
256
+ <a rel="full-article" href="/blog/customize-your-irb/">Read on &rarr;</a>
257
+
258
+ </footer>
259
+
260
+ </article>
261
+
262
+ <article>
263
+
264
+ <header>
265
+
266
+ <h1 class="entry-title"><a href="/blog/program-like-a-videogamer/">Program
267
+ Like a Videogamer</a></h1>
268
+
269
+ <p class="meta">
270
+
271
+ <time datetime="2013-02-06T09:01:00-05:00" pubdate data-updated="true">Feb
272
+ 6<span>th</span>, 2013</time>
273
+
274
+ </p>
275
+
276
+ </header>
277
+
278
+ <div class="entry-content"><p>I see a lot of you out there worried about the
279
+ next step in your programming
280
+
281
+ career. Or even worried about the next step when learning a new framework
282
+ or
283
+
284
+ language. Today let me try to assuage some of that fear by describing my approach.</p>
285
+
286
+ </div>
287
+
288
+ <footer>
289
+
290
+ <a rel="full-article" href="/blog/program-like-a-videogamer/">Read on &rarr;</a>
291
+
292
+ </footer>
293
+
294
+ </article>
295
+
296
+ <article>
297
+
298
+ <header>
299
+
300
+ <h1 class="entry-title"><a href="/blog/gem-spotlight-interactive-editor/">Gem
301
+ Spotlight: Interactive_editor</a></h1>
302
+
303
+ <p class="meta">
304
+
305
+ <time datetime="2013-01-04T12:13:00-05:00" pubdate data-updated="true">Jan
306
+ 4<span>th</span>, 2013</time>
307
+
308
+ </p>
309
+
310
+ </header>
311
+
312
+ <div class="entry-content"><p>Today we&#8217;ll take a quick look at one of
313
+ my favorite gems: interactive_editor.
314
+
315
+ Have you ever been in a REPL session (rails console, irb, pry, etc.) and wished
316
+
317
+ that you could pop open a full editor to write out some code? (Ok, maybe not
318
+
319
+ you pry users.) Well interactive_editor is a gem that gives you just that,
320
+ as
321
+
322
+ well as some really nice object inspection and manipulation.</p>
323
+
324
+ </div>
325
+
326
+ <footer>
327
+
328
+ <a rel="full-article" href="/blog/gem-spotlight-interactive-editor/">Read
329
+ on &rarr;</a>
330
+
331
+ </footer>
332
+
333
+ </article>
334
+
335
+ <article>
336
+
337
+ <header>
338
+
339
+ <h1 class="entry-title"><a href="/blog/subscribing-to-rubytapas-using-downcast/">Subscribing
340
+ to RubyTapas Using Downcast</a></h1>
341
+
342
+ <p class="meta">
343
+
344
+ <time datetime="2012-10-19T23:17:00-04:00" pubdate data-updated="true">Oct
345
+ 19<span>th</span>, 2012</time>
346
+
347
+ </p>
348
+
349
+ </header>
350
+
351
+ <div class="entry-content"><p>Avdi&#8217;s <a href="http://devblog.avdi.org/rubytapas/">Ruby
352
+ Tapas</a> are a fantastic
353
+
354
+ resource for learning pieces of Ruby. Now that he and DPD have enabled
355
+
356
+ iTunes-compatible RSS feeds of the videos it&#8217;s easier than ever to stay
357
+ current
358
+
359
+ with the videos.</p>
360
+
361
+ <p>Today I&#8217;m just going to share the steps required to add Ruby Tapas
362
+ to Downcast
363
+
364
+ on your iPhone or iPad. It&#8217;s very easy, but it&#8217;s handy to have
365
+ all the steps
366
+
367
+ in one place.</p>
368
+
369
+ </div>
370
+
371
+ <footer>
372
+
373
+ <a rel="full-article" href="/blog/subscribing-to-rubytapas-using-downcast/">Read
374
+ on &rarr;</a>
375
+
376
+ </footer>
377
+
378
+ </article>
379
+
380
+ <article>
381
+
382
+ <header>
383
+
384
+ <h1 class="entry-title"><a href="/blog/things-most-interviewees-fail-to-discover/">Things
385
+ Most Interviewees Fail to Discover</a></h1>
386
+
387
+ <p class="meta">
388
+
389
+ <time datetime="2012-08-17T08:53:00-04:00" pubdate data-updated="true">Aug
390
+ 17<span>th</span>, 2012</time>
391
+
392
+ </p>
393
+
394
+ </header>
395
+
396
+ <div class="entry-content"><p>It&#8217;s a great time to be a Rails developer.
397
+ Companies left and right are turning to Rails or using it already for efficient
398
+ web development. If you know Rails and the web stack well then you have the
399
+ luxury of choice: let&#8217;s make sure you make a good pick!</p>
400
+
401
+ </div>
402
+
403
+ <footer>
404
+
405
+ <a rel="full-article" href="/blog/things-most-interviewees-fail-to-discover/">Read
406
+ on &rarr;</a>
407
+
408
+ </footer>
409
+
410
+ </article>
411
+
412
+ <article>
413
+
414
+ <header>
415
+
416
+ <h1 class="entry-title"><a href="/blog/10-things-i-love-about-git/">10 Things
417
+ I Love About Git</a></h1>
418
+
419
+ <p class="meta">
420
+
421
+ <time datetime="2012-08-07T09:29:00-04:00" pubdate data-updated="true">Aug
422
+ 7<span>th</span>, 2012</time>
423
+
424
+ </p>
425
+
426
+ </header>
427
+
428
+ <div class="entry-content"><p>Not everyone loves git. It&#8217;s true! But
429
+ I do, and here are some reasons why.</p>
430
+
431
+ </div>
432
+
433
+ <footer>
434
+
435
+ <a rel="full-article" href="/blog/10-things-i-love-about-git/">Read on &rarr;</a>
436
+
437
+ </footer>
438
+
439
+ </article>
440
+
441
+ <article>
442
+
443
+ <header>
444
+
445
+ <h1 class="entry-title"><a href="/blog/effective-window-management-by-dividing-your-monitor-into-zones/">Effective
446
+ Window Management by Dividing Your Monitor Into Zones</a></h1>
447
+
448
+ <p class="meta">
449
+
450
+ <time datetime="2012-06-22T09:21:00-04:00" pubdate data-updated="true">Jun
451
+ 22<span>nd</span>, 2012</time>
452
+
453
+ </p>
454
+
455
+ </header>
456
+
457
+ <div class="entry-content"><p>I love my 27 inch Apple Thunderbolt display,
458
+ but after some amount of neck strain I had to conclude that it&#8217;s just
459
+ too big to use it like a laptop monitor and fullscreen everything.</p>
460
+
461
+ <p>Instead, I&#8217;ve come up with a great window management solution that
462
+ capitalizes on the monitor&#8217;s strengths and gives me an awesome work
463
+ environment.</p>
464
+
465
+ </div>
466
+
467
+ <footer>
468
+
469
+ <a rel="full-article" href="/blog/effective-window-management-by-dividing-your-monitor-into-zones/">Read
470
+ on &rarr;</a>
471
+
472
+ </footer>
473
+
474
+ </article>
475
+
476
+ <article>
477
+
478
+ <header>
479
+
480
+ <h1 class="entry-title"><a href="/blog/getting-up-to-speed-on-a-new-git-repo/">Getting
481
+ Up to Speed on a New Git Repo</a></h1>
482
+
483
+ <p class="meta">
484
+
485
+ <time datetime="2012-05-11T12:44:00-04:00" pubdate data-updated="true">May
486
+ 11<span>th</span>, 2012</time>
487
+
488
+ </p>
489
+
490
+ </header>
491
+
492
+ <div class="entry-content"><p>Alright! You want to get up to speed with a
493
+ new git repository? You got it. Here are some quick reference notes and tools
494
+ to use to see what&#8217;s been going on.</p>
495
+
496
+ </div>
497
+
498
+ <footer>
499
+
500
+ <a rel="full-article" href="/blog/getting-up-to-speed-on-a-new-git-repo/">Read
501
+ on &rarr;</a>
502
+
503
+ </footer>
504
+
505
+ </article>
506
+
507
+ <div class="pagination">
508
+
509
+ <a class="prev" href="/blog/page/2/">&larr; Older</a>
510
+
511
+ <a href="/blog/archives">Blog Archives</a>
512
+
513
+ </div>
514
+
515
+ </div>
516
+
517
+ <aside class="sidebar">
518
+
519
+ <section>
520
+
521
+ <h1>Recent Posts</h1>
522
+
523
+ <ul id="recent_posts">
524
+
525
+ <li class="post">
526
+
527
+ <a href="/blog/lets-use-hwacha-to-scan-urls/">Let&#8217;s Use Hwacha to Scan
528
+ URLs</a>
529
+
530
+ </li>
531
+
532
+ <li class="post">
533
+
534
+ <a href="/blog/deliberate-git/">Deliberate Git</a>
535
+
536
+ </li>
537
+
538
+ <li class="post">
539
+
540
+ <a href="/blog/customize-your-irb/">Customize your IRB</a>
541
+
542
+ </li>
543
+
544
+ <li class="post">
545
+
546
+ <a href="/blog/program-like-a-videogamer/">Program like a Videogamer</a>
547
+
548
+ </li>
549
+
550
+ <li class="post">
551
+
552
+ <a href="/blog/gem-spotlight-interactive-editor/">Gem spotlight: interactive_editor</a>
553
+
554
+ </li>
555
+
556
+ </ul>
557
+
558
+ </section>
559
+
560
+ <section>
561
+
562
+ <h1>About Me</h1>
563
+
564
+ <img class="right" src="http://gravatar.com/avatar/aaa2b1f12b65d33422e8cdc48d70c0f9">
565
+
566
+ <p>My name is Stephen Ball. I started programming computers back in the 80s
567
+
568
+ by copying BASIC programs from 3-2-1 Contact into our Atari 800. Now I
569
+
570
+ program web applications using Ruby on Rails and CoffeeScript. I love every
571
+
572
+ minute of it.</p>
573
+
574
+ <p><a href="https://twitter.com/StephenBallNC" class="twitter-follow-button"
575
+ data-show-count="false" data-size="large">Follow @StephenBallNC</a>
576
+
577
+ <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script></p>
578
+
579
+ </section>
580
+
581
+ <section>
582
+
583
+ <h1>Tweets for Rake Routes</h1>
584
+
585
+ <a class="twitter-timeline" href="https://twitter.com/search?q=rakeroutes"
586
+ data-widget-id="395243196042579970">Tweets about &#8220;rakeroutes&#8221;</a>
587
+
588
+ <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?''http'':''https'';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
589
+
590
+ </section>
591
+
592
+ <section>
593
+
594
+ <h1>My Pinboard</h1>
595
+
596
+ <ul id="pinboard_linkroll">Fetching linkroll&#8230;</ul>
597
+
598
+ <p><a href="http://pinboard.in/u:xyzzyb">My Pinboard Bookmarks &raquo;</a></p>
599
+
600
+ </section>
601
+
602
+ <script type="text/javascript">var linkroll=''pinboard_linkroll'';var pinboard_user="xyzzyb";var
603
+ pinboard_count=3;(function(){var pinboardInit=document.createElement(''script'');pinboardInit.type=''text/javascript'';pinboardInit.async=true;pinboardInit.src=''/javascripts/pinboard.js'';document.getElementsByTagName(''head'')[0].appendChild(pinboardInit);})();</script>
604
+
605
+ </aside>
606
+
607
+ </div>
608
+
609
+ </div>
610
+
611
+ <footer role="contentinfo"><p>
612
+
613
+ Copyright &copy; 2013 - Stephen Ball -
614
+
615
+ <span class="credit">Powered by <a href="http://octopress.org">Octopress</a></span>
616
+
617
+ </p>
618
+
619
+ </footer>
620
+
621
+ <script type="text/javascript">var disqus_shortname=''xyzzyb'';var disqus_script=''count.js'';(function(){var
622
+ dsq=document.createElement(''script'');dsq.type=''text/javascript'';dsq.async=true;dsq.src=''http://''+disqus_shortname+''.disqus.com/''+disqus_script;(document.getElementsByTagName(''head'')[0]||document.getElementsByTagName(''body'')[0]).appendChild(dsq);}());</script>
623
+
624
+ <div id="fb-root"></div>
625
+
626
+ <script>(function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(d.getElementById(id)){return;}
627
+
628
+ js=d.createElement(s);js.id=id;js.src="//connect.facebook.net/en_US/all.js#appId=212934732101925&xfbml=1";fjs.parentNode.insertBefore(js,fjs);}(document,''script'',''facebook-jssdk''));</script>
629
+
630
+ <script type="text/javascript">(function(){var script=document.createElement(''script'');script.type=''text/javascript'';script.async=true;script.src=''https://apis.google.com/js/plusone.js'';var
631
+ s=document.getElementsByTagName(''script'')[0];s.parentNode.insertBefore(script,s);})();</script>
632
+
633
+ <script type="text/javascript">(function(){var twitterWidgets=document.createElement(''script'');twitterWidgets.type=''text/javascript'';twitterWidgets.async=true;twitterWidgets.src=''http://platform.twitter.com/widgets.js'';document.getElementsByTagName(''head'')[0].appendChild(twitterWidgets);})();</script>
634
+
635
+ <a title="Real Time Analytics" href="http://getclicky.com/66509312"><img alt="Real
636
+ Time Analytics" src="//static.getclicky.com/media/links/badge.gif" border="0"/></a>
637
+
638
+ <script type="text/javascript">var clicky_site_ids=clicky_site_ids||[];clicky_site_ids.push(66536397);(function(){var
639
+ s=document.createElement(''script'');s.type=''text/javascript'';s.async=true;s.src=''//static.getclicky.com/js'';(document.getElementsByTagName(''head'')[0]||document.getElementsByTagName(''body'')[0]).appendChild(s);})();</script>
640
+
641
+ </body>
642
+
643
+ </html>
644
+
645
+ '
646
+ http_version: '1.1'
647
+ adapter_metadata:
648
+ effective_url: !binary |-
649
+ aHR0cDovL3Jha2Vyb3V0ZXMuY29tLw==
650
+ recorded_at: Tue, 14 Jan 2014 03:03:38 GMT
651
+ recorded_with: VCR 2.8.0
@@ -10,6 +10,8 @@ end
10
10
 
11
11
  success_url_vcr_options = { :cassette_name => 'success_url' }
12
12
  not_found_url_vcr_options = { :cassette_name => '404_url' }
13
+ follow_redirects_false_vcr = { :cassette_name => 'follow_redirects_false' }
14
+ follow_redirects_true_vcr = { :cassette_name => 'follow_redirects_true' }
13
15
 
14
16
  describe Hwacha do
15
17
  describe "checking a site that returns HTTP 200", :vcr => success_url_vcr_options do
@@ -33,4 +35,38 @@ describe Hwacha do
33
35
  end
34
36
  end
35
37
  end
38
+
39
+ describe "checking a site that redirects" do
40
+ let(:url) { 'http://www.rakeroutes.com/' }
41
+
42
+ context "when follow_redirects is not set to true", :vcr => follow_redirects_false_vcr do
43
+ subject do
44
+ Hwacha.new do |config|
45
+ config.follow_redirects = false
46
+ end
47
+ end
48
+
49
+ it "stops at the redirect" do
50
+ subject.check(url) do |url, response|
51
+ expect(url.downcase).to eq url
52
+ expect(response.code).to eq 301
53
+ end
54
+ end
55
+ end
56
+
57
+ context "when follow_redirects is set to true", :vcr => follow_redirects_true_vcr do
58
+ subject do
59
+ Hwacha.new do |config|
60
+ config.follow_redirects = true
61
+ end
62
+ end
63
+
64
+ it "follows the redirect" do
65
+ subject.check(url) do |url, response|
66
+ expect(url.downcase).to eq 'http://rakeroutes.com/'
67
+ expect(response.code).to eq 200
68
+ end
69
+ end
70
+ end
71
+ end
36
72
  end
@@ -1,10 +1,10 @@
1
1
  require_relative '../../../lib/hwacha'
2
2
 
3
3
  describe Hwacha::Config do
4
- describe "#options" do
4
+ describe "#hydra_options" do
5
5
  context "when no options are set" do
6
6
  it "is an empty hash" do
7
- expect(subject.options).to be == {}
7
+ expect(subject.hydra_options).to be == {}
8
8
  end
9
9
  end
10
10
 
@@ -19,7 +19,24 @@ describe Hwacha::Config do
19
19
  end
20
20
 
21
21
  it "exports as max_concurrency in a hash" do
22
- expect(subject.options).to include concurrency_option
22
+ expect(subject.hydra_options).to include concurrency_option
23
+ end
24
+ end
25
+ end
26
+
27
+ describe "#request_options" do
28
+ context "when follow_redirects option is set" do
29
+ let(:follow_redirects) { true }
30
+ let(:follow_redirects_option) do
31
+ { :followlocation => follow_redirects }
32
+ end
33
+
34
+ before do
35
+ subject.follow_redirects = follow_redirects
36
+ end
37
+
38
+ it "exports as followlocation in a hash" do
39
+ expect(subject.request_options).to include follow_redirects_option
23
40
  end
24
41
  end
25
42
  end
metadata CHANGED
@@ -1,83 +1,83 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hwacha
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen Ball
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-13 00:00:00.000000000 Z
11
+ date: 2014-01-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '1.3'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.3'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: vcr
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  description: Harness the power of Typhoeus to quickly check webpage responses.
@@ -87,8 +87,8 @@ executables: []
87
87
  extensions: []
88
88
  extra_rdoc_files: []
89
89
  files:
90
- - .gitignore
91
- - .travis.yml
90
+ - ".gitignore"
91
+ - ".travis.yml"
92
92
  - Gemfile
93
93
  - Gemfile.lock
94
94
  - LICENSE
@@ -99,6 +99,8 @@ files:
99
99
  - lib/hwacha/config.rb
100
100
  - lib/hwacha/version.rb
101
101
  - spec/fixtures/cassettes/404_url.yml
102
+ - spec/fixtures/cassettes/follow_redirects_false.yml
103
+ - spec/fixtures/cassettes/follow_redirects_true.yml
102
104
  - spec/fixtures/cassettes/success_url.yml
103
105
  - spec/integration/hwacha_spec.rb
104
106
  - spec/lib/hwacha/config_spec.rb
@@ -113,22 +115,24 @@ require_paths:
113
115
  - lib
114
116
  required_ruby_version: !ruby/object:Gem::Requirement
115
117
  requirements:
116
- - - '>='
118
+ - - ">="
117
119
  - !ruby/object:Gem::Version
118
120
  version: '0'
119
121
  required_rubygems_version: !ruby/object:Gem::Requirement
120
122
  requirements:
121
- - - '>='
123
+ - - ">="
122
124
  - !ruby/object:Gem::Version
123
125
  version: '0'
124
126
  requirements: []
125
127
  rubyforge_project:
126
- rubygems_version: 2.0.14
128
+ rubygems_version: 2.2.0
127
129
  signing_key:
128
130
  specification_version: 4
129
131
  summary: Sometimes you just want to check a bunch of webpages. Hwacha makes it easy.
130
132
  test_files:
131
133
  - spec/fixtures/cassettes/404_url.yml
134
+ - spec/fixtures/cassettes/follow_redirects_false.yml
135
+ - spec/fixtures/cassettes/follow_redirects_true.yml
132
136
  - spec/fixtures/cassettes/success_url.yml
133
137
  - spec/integration/hwacha_spec.rb
134
138
  - spec/lib/hwacha/config_spec.rb