crags 2.0.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock ADDED
@@ -0,0 +1,22 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ curb (0.7.9)
5
+ diff-lcs (1.1.2)
6
+ hpricot (0.8.3)
7
+ rspec (2.4.0)
8
+ rspec-core (~> 2.4.0)
9
+ rspec-expectations (~> 2.4.0)
10
+ rspec-mocks (~> 2.4.0)
11
+ rspec-core (2.4.0)
12
+ rspec-expectations (2.4.0)
13
+ diff-lcs (~> 1.1.2)
14
+ rspec-mocks (2.4.0)
15
+
16
+ PLATFORMS
17
+ ruby
18
+
19
+ DEPENDENCIES
20
+ curb
21
+ hpricot
22
+ rspec
data/README.rdoc CHANGED
@@ -25,10 +25,10 @@ Categories using:
25
25
 
26
26
  Search a single craigslist location (e.g. sfbay.craigslist.com)
27
27
  s = Search::Location.new(:keyword => 'shoes')
28
- s.keyword # this will shoes instead of the default
29
- s.location # this will the sfbay Location
30
- s.category # the for sale Category
31
- s.items # will return a set of Items
28
+ s.keyword # shoes instead of bicycle
29
+ s.location # the sfbay Location
30
+ s.category # the 'for sale' Category
31
+ s.items # a set of Items that match the search criteria
32
32
 
33
33
  Each Item has a title, url (which is the link to the item on craigslist), and
34
34
  a date, which is the date the item was posted on craigslist.
data/Rakefile CHANGED
@@ -9,29 +9,17 @@ begin
9
9
  gem.email = "gotascii@gmail.com"
10
10
  gem.homepage = "http://github.com/gotascii/crags"
11
11
  gem.authors = ["Justin Marney"]
12
- gem.add_dependency('curb')
13
- gem.add_dependency('hpricot')
14
12
  end
15
13
  Jeweler::GemcutterTasks.new
16
14
  rescue LoadError
17
15
  puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
18
16
  end
19
17
 
20
- require 'spec/rake/spectask'
21
- Spec::Rake::SpecTask.new(:spec) do |spec|
22
- spec.libs << 'lib' << 'spec'
23
- spec.spec_files = FileList['spec/**/*_spec.rb']
24
- end
25
-
26
- Spec::Rake::SpecTask.new(:rcov) do |spec|
27
- spec.libs << 'lib' << 'spec'
18
+ require 'rspec/core/rake_task'
19
+ RSpec::Core::RakeTask.new(:spec) do |spec|
28
20
  spec.pattern = 'spec/**/*_spec.rb'
29
- spec.rcov = true
30
- spec.rcov_opts = ['--exclude', 'spec,gems,crags.rb']
31
21
  end
32
22
 
33
- task :spec => :check_dependencies
34
-
35
23
  task :default => :spec
36
24
 
37
25
  require 'rake/rdoctask'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.0
1
+ 2.1.0
data/crags.gemspec CHANGED
@@ -1,76 +1,75 @@
1
1
  # Generated by jeweler
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{crags}
8
- s.version = "2.0.0"
8
+ s.version = "2.1.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Justin Marney"]
12
- s.date = %q{2010-07-26}
12
+ s.date = %q{2011-01-17}
13
13
  s.description = %q{A library to help search across multiple craigslist locations.}
14
14
  s.email = %q{gotascii@gmail.com}
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE",
17
- "README.rdoc"
17
+ "README.rdoc"
18
18
  ]
19
19
  s.files = [
20
- ".gitignore",
21
- "Gemfile",
22
- "LICENSE",
23
- "README.rdoc",
24
- "Rakefile",
25
- "VERSION",
26
- "crags.gemspec",
27
- "lib/crags.rb",
28
- "lib/crags/category.rb",
29
- "lib/crags/country.rb",
30
- "lib/crags/fetcher.rb",
31
- "lib/crags/item.rb",
32
- "lib/crags/location.rb",
33
- "lib/crags/search/country.rb",
34
- "lib/crags/search/location.rb",
35
- "lib/crags/search/search.rb",
36
- "lib/ext/hpricot/elem.rb",
37
- "lib/ext/string.rb",
38
- "spec/crags/category_spec.rb",
39
- "spec/crags/country_spec.rb",
40
- "spec/crags/fetcher_spec.rb",
41
- "spec/crags/item_spec.rb",
42
- "spec/crags/location_spec.rb",
43
- "spec/crags/search/country_spec.rb",
44
- "spec/crags/search/location_spec.rb",
45
- "spec/crags/search/search_spec.rb",
46
- "spec/ext/hpricot/elem_spec.rb",
47
- "spec/ext/string_spec.rb",
48
- "spec/spec_helper.rb"
20
+ "Gemfile",
21
+ "Gemfile.lock",
22
+ "LICENSE",
23
+ "README.rdoc",
24
+ "Rakefile",
25
+ "VERSION",
26
+ "crags.gemspec",
27
+ "lib/crags.rb",
28
+ "lib/crags/category.rb",
29
+ "lib/crags/country.rb",
30
+ "lib/crags/fetcher.rb",
31
+ "lib/crags/item.rb",
32
+ "lib/crags/location.rb",
33
+ "lib/crags/search/country.rb",
34
+ "lib/crags/search/location.rb",
35
+ "lib/crags/search/search.rb",
36
+ "lib/ext/hpricot/elem.rb",
37
+ "lib/ext/string.rb",
38
+ "spec/crags/category_spec.rb",
39
+ "spec/crags/country_spec.rb",
40
+ "spec/crags/fetcher_spec.rb",
41
+ "spec/crags/item_spec.rb",
42
+ "spec/crags/location_spec.rb",
43
+ "spec/crags/search/country_spec.rb",
44
+ "spec/crags/search/location_spec.rb",
45
+ "spec/crags/search/search_spec.rb",
46
+ "spec/ext/hpricot/elem_spec.rb",
47
+ "spec/ext/string_spec.rb",
48
+ "spec/spec_helper.rb"
49
49
  ]
50
50
  s.homepage = %q{http://github.com/gotascii/crags}
51
- s.rdoc_options = ["--charset=UTF-8"]
52
51
  s.require_paths = ["lib"]
53
- s.rubygems_version = %q{1.3.6}
52
+ s.rubygems_version = %q{1.3.7}
54
53
  s.summary = %q{A library to help search across multiple craigslist locations.}
55
54
  s.test_files = [
56
55
  "spec/crags/category_spec.rb",
57
- "spec/crags/country_spec.rb",
58
- "spec/crags/fetcher_spec.rb",
59
- "spec/crags/item_spec.rb",
60
- "spec/crags/location_spec.rb",
61
- "spec/crags/search/country_spec.rb",
62
- "spec/crags/search/location_spec.rb",
63
- "spec/crags/search/search_spec.rb",
64
- "spec/ext/hpricot/elem_spec.rb",
65
- "spec/ext/string_spec.rb",
66
- "spec/spec_helper.rb"
56
+ "spec/crags/country_spec.rb",
57
+ "spec/crags/fetcher_spec.rb",
58
+ "spec/crags/item_spec.rb",
59
+ "spec/crags/location_spec.rb",
60
+ "spec/crags/search/country_spec.rb",
61
+ "spec/crags/search/location_spec.rb",
62
+ "spec/crags/search/search_spec.rb",
63
+ "spec/ext/hpricot/elem_spec.rb",
64
+ "spec/ext/string_spec.rb",
65
+ "spec/spec_helper.rb"
67
66
  ]
68
67
 
69
68
  if s.respond_to? :specification_version then
70
69
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
71
70
  s.specification_version = 3
72
71
 
73
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
72
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
74
73
  s.add_runtime_dependency(%q<curb>, [">= 0"])
75
74
  s.add_runtime_dependency(%q<hpricot>, [">= 0"])
76
75
  else
data/lib/crags/country.rb CHANGED
@@ -3,6 +3,14 @@ module Crags
3
3
  include Fetcher
4
4
  attr_reader :code
5
5
 
6
+ def self.codes
7
+ Config.country_codes
8
+ end
9
+
10
+ def self.all
11
+ codes.collect {|code| new(code)}
12
+ end
13
+
6
14
  def initialize(code)
7
15
  @code = code
8
16
  end
data/lib/crags.rb CHANGED
@@ -1,5 +1,4 @@
1
- require 'bundler'
2
- Bundler.require
1
+ require 'bundler/setup'
3
2
  require 'erb'
4
3
  require 'ostruct'
5
4
  require 'ext/string'
@@ -1,5 +1,18 @@
1
1
  require 'spec_helper'
2
2
 
3
+ describe Country, "the class" do
4
+ it "knows all of the codes store in the config" do
5
+ Crags::Config.stub(:country_codes) { ["code"] }
6
+ Country.codes.should == ["code"]
7
+ end
8
+
9
+ it "finds all countries" do
10
+ Country.stub(:codes) { ["code"] }
11
+ Country.should_receive(:new).with("code") { "country!" }
12
+ Country.all.should == ["country!"]
13
+ end
14
+ end
15
+
3
16
  describe Country do
4
17
  before do
5
18
  @country = Country.new("us")
data/spec/spec_helper.rb CHANGED
@@ -1,3 +1,4 @@
1
+ # rubygems here so 'rake spec' works
1
2
  require 'rubygems'
2
3
  require 'bundler'
3
4
  Bundler.require(:default, :test)
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crags
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 11
4
5
  prerelease: false
5
6
  segments:
6
7
  - 2
8
+ - 1
7
9
  - 0
8
- - 0
9
- version: 2.0.0
10
+ version: 2.1.0
10
11
  platform: ruby
11
12
  authors:
12
13
  - Justin Marney
@@ -14,33 +15,37 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-07-26 00:00:00 -04:00
18
+ date: 2011-01-17 00:00:00 -05:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
- name: curb
22
+ type: :runtime
22
23
  prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
+ name: curb
25
+ version_requirements: &id001 !ruby/object:Gem::Requirement
26
+ none: false
24
27
  requirements:
25
28
  - - ">="
26
29
  - !ruby/object:Gem::Version
30
+ hash: 3
27
31
  segments:
28
32
  - 0
29
33
  version: "0"
30
- type: :runtime
31
- version_requirements: *id001
34
+ requirement: *id001
32
35
  - !ruby/object:Gem::Dependency
33
- name: hpricot
36
+ type: :runtime
34
37
  prerelease: false
35
- requirement: &id002 !ruby/object:Gem::Requirement
38
+ name: hpricot
39
+ version_requirements: &id002 !ruby/object:Gem::Requirement
40
+ none: false
36
41
  requirements:
37
42
  - - ">="
38
43
  - !ruby/object:Gem::Version
44
+ hash: 3
39
45
  segments:
40
46
  - 0
41
47
  version: "0"
42
- type: :runtime
43
- version_requirements: *id002
48
+ requirement: *id002
44
49
  description: A library to help search across multiple craigslist locations.
45
50
  email: gotascii@gmail.com
46
51
  executables: []
@@ -51,8 +56,8 @@ extra_rdoc_files:
51
56
  - LICENSE
52
57
  - README.rdoc
53
58
  files:
54
- - .gitignore
55
59
  - Gemfile
60
+ - Gemfile.lock
56
61
  - LICENSE
57
62
  - README.rdoc
58
63
  - Rakefile
@@ -85,28 +90,32 @@ homepage: http://github.com/gotascii/crags
85
90
  licenses: []
86
91
 
87
92
  post_install_message:
88
- rdoc_options:
89
- - --charset=UTF-8
93
+ rdoc_options: []
94
+
90
95
  require_paths:
91
96
  - lib
92
97
  required_ruby_version: !ruby/object:Gem::Requirement
98
+ none: false
93
99
  requirements:
94
100
  - - ">="
95
101
  - !ruby/object:Gem::Version
102
+ hash: 3
96
103
  segments:
97
104
  - 0
98
105
  version: "0"
99
106
  required_rubygems_version: !ruby/object:Gem::Requirement
107
+ none: false
100
108
  requirements:
101
109
  - - ">="
102
110
  - !ruby/object:Gem::Version
111
+ hash: 3
103
112
  segments:
104
113
  - 0
105
114
  version: "0"
106
115
  requirements: []
107
116
 
108
117
  rubyforge_project:
109
- rubygems_version: 1.3.6
118
+ rubygems_version: 1.3.7
110
119
  signing_key:
111
120
  specification_version: 3
112
121
  summary: A library to help search across multiple craigslist locations.
data/.gitignore DELETED
@@ -1,4 +0,0 @@
1
- pkg/
2
- .DS_Store
3
- .bundle
4
- coverage