gotascii-crags 1.4.6 → 1.4.9

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.
data/Manifest.txt CHANGED
@@ -13,4 +13,4 @@ test/crags/fetch_test.rb
13
13
  test/crags/proxy_test.rb
14
14
  test/crags/runner_test.rb
15
15
  test/crags/searcher_test.rb
16
- test/test_helper.rb
16
+ test/test_helper.rb
data/crags.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{crags}
5
- s.version = "1.4.6"
5
+ s.version = "1.4.9"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Justin Marney"]
data/lib/crags.rb CHANGED
@@ -4,7 +4,7 @@ require 'hpricot'
4
4
  require 'erb'
5
5
 
6
6
  module Crags
7
- VERSION = '1.4.6'
7
+ VERSION = '1.4.9'
8
8
  LIBPATH = ::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR
9
9
  PATH = ::File.dirname(LIBPATH) + ::File::SEPARATOR
10
10
 
data/lib/crags/fetch.rb CHANGED
@@ -5,7 +5,7 @@ module Crags
5
5
  end
6
6
 
7
7
  def fetch_html(url)
8
- req = Curl::Easy.perform(url)
8
+ req = fetch_request(url)
9
9
  req.body_str
10
10
  end
11
11
 
@@ -4,7 +4,7 @@ module Crags
4
4
  include ERB::Util
5
5
 
6
6
  def strip_http(url)
7
- url.gsub(/http\:\/\/(.*)(\/|(.html))/,'\1\3')
7
+ url.gsub(/^http\:\/\//,'').gsub(/\/$/,'')
8
8
  end
9
9
 
10
10
  def location_link(country)
@@ -12,9 +12,9 @@ class Crags::FetchTest < Test::Unit::TestCase
12
12
  fetch_doc("url").should == "doc"
13
13
  end
14
14
 
15
- should "fetch html should curl a url" do
15
+ should "fetch html should fetch_request a url" do
16
16
  curb = stub(:body_str => "uhh")
17
- Curl::Easy.expects(:perform).with("url").returns(curb)
17
+ expects(:fetch_request).with("url").returns(curb)
18
18
  fetch_html("url").should == "uhh"
19
19
  end
20
20
 
@@ -14,6 +14,11 @@ class Crags::SearcherTest < Test::Unit::TestCase
14
14
  strip_http(url).should == "omg"
15
15
  end
16
16
 
17
+ should "strip_http should remove http:// when there is no trailing slash" do
18
+ url = "http://omg"
19
+ strip_http(url).should == "omg"
20
+ end
21
+
17
22
  should "location doc should fetch doc at location url" do
18
23
  expects(:fetch_doc).with("http://geo.craigslist.org/iso/us").returns("doc")
19
24
  location_doc('us').should == "doc"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gotascii-crags
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.6
4
+ version: 1.4.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Marney
@@ -41,6 +41,7 @@ files:
41
41
  - test/test_helper.rb
42
42
  has_rdoc: true
43
43
  homepage: http://github.com/vigetlabs/crags
44
+ licenses:
44
45
  post_install_message:
45
46
  rdoc_options:
46
47
  - --main
@@ -62,7 +63,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
62
63
  requirements: []
63
64
 
64
65
  rubyforge_project: crags
65
- rubygems_version: 1.2.0
66
+ rubygems_version: 1.3.5
66
67
  signing_key:
67
68
  specification_version: 2
68
69
  summary: A library to help search across multiple craigslist locations