Skip to content

Commit

Permalink
Merge branch 'next'
Browse files Browse the repository at this point in the history
  • Loading branch information
chriskite committed Jan 20, 2012
2 parents 4b378d5 + 57a58bc commit 531d771
Show file tree
Hide file tree
Showing 9 changed files with 80 additions and 44 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Expand Up @@ -2,4 +2,5 @@
Gemfile.lock
test.db
test.tch
test.kch
*.kch
rdoc
10 changes: 10 additions & 0 deletions CHANGELOG.rdoc
@@ -1,3 +1,13 @@
== 0.7.1 / 2012-01-20

* Minor enhancements

* Switch from robots gem (which people reported problems with) to new robotex gem

* Bug fixes

* Fix incorrect default file extension for KyotoCabinet

== 0.7.0 / 2012-01-19

* Major enhancements
Expand Down
3 changes: 2 additions & 1 deletion README.rdoc
Expand Up @@ -30,8 +30,9 @@ To test and develop this gem, additional requirements are:
* rspec
* fakeweb
* tokyocabinet
* kyotocabinet-ruby
* mongo
* redis
* sqlite3

You will need to have {Tokyo Cabinet}[http://fallabs.com/tokyocabinet/], {MongoDB}[http://www.mongodb.org/], and {Redis}[http://code.google.com/p/redis/] installed on your system and running.
You will need to have KyotoCabinet, {Tokyo Cabinet}[http://fallabs.com/tokyocabinet/], {MongoDB}[http://www.mongodb.org/], and {Redis}[http://code.google.com/p/redis/] installed on your system and running.
6 changes: 2 additions & 4 deletions Rakefile
@@ -1,6 +1,5 @@
require 'rubygems'
require 'rake'
require 'rspec/core/rake_task'
require 'rake/rdoctask'

desc "Run all specs"
RSpec::Core::RakeTask.new(:rspec) do |spec|
Expand All @@ -14,8 +13,7 @@ end

task :default => :rspec

require 'rdoc/task'
RDoc::Task.new do |rdoc|
Rake::RDocTask.new(:rdoc) do |rdoc|
version = File.exist?('VERSION') ? File.read('VERSION') : ""

rdoc.rdoc_dir = 'rdoc'
Expand Down
2 changes: 1 addition & 1 deletion VERSION
@@ -1 +1 @@
0.7.0
0.7.1
9 changes: 5 additions & 4 deletions anemone.gemspec
@@ -1,6 +1,6 @@
spec = Gem::Specification.new do |s|
s.name = "anemone"
s.version = "0.7.0"
s.version = "0.7.1"
s.author = "Chris Kite"
s.homepage = "http://anemone.rubyforge.org"
s.rubyforge_project = "anemone"
Expand All @@ -12,10 +12,11 @@ spec = Gem::Specification.new do |s|
s.rdoc_options << '-m' << 'README.rdoc' << '-t' << 'Anemone'
s.extra_rdoc_files = ["README.rdoc"]
s.add_dependency("nokogiri", ">= 1.3.0")
s.add_dependency("robots", ">= 0.7.2")
s.add_dependency("robotex", ">= 1.0.0")

s.add_development_dependency "rake", ">=0.8.7"
s.add_development_dependency "rspec", ">=2.6.0"
s.add_development_dependency "rake", ">=0.9.2"
s.add_development_dependency "rdoc", ">=3.12"
s.add_development_dependency "rspec", ">=2.8.0"
s.add_development_dependency "fakeweb", ">=1.3.0"
s.add_development_dependency "redis", ">=2.2.0"
s.add_development_dependency "mongo", ">=1.3.1"
Expand Down
6 changes: 3 additions & 3 deletions lib/anemone/core.rb
@@ -1,5 +1,5 @@
require 'thread'
require 'robots'
require 'robotex'
require 'anemone/tentacle'
require 'anemone/page'
require 'anemone/exceptions'
Expand All @@ -9,7 +9,7 @@

module Anemone

VERSION = '0.7.0';
VERSION = '0.7.1';

#
# Convenience method to start a crawl
Expand Down Expand Up @@ -199,7 +199,7 @@ def process_options
@opts[:threads] = 1 if @opts[:delay] > 0
storage = Anemone::Storage::Base.new(@opts[:storage] || Anemone::Storage.Hash)
@pages = PageStore.new(storage)
@robots = Robots.new(@opts[:user_agent]) if @opts[:obey_robots_txt]
@robots = Robotex.new(@opts[:user_agent]) if @opts[:obey_robots_txt]

freeze_options
end
Expand Down
2 changes: 1 addition & 1 deletion lib/anemone/storage.rb
Expand Up @@ -18,7 +18,7 @@ def self.TokyoCabinet(file = 'anemone.tch')
self::TokyoCabinet.new(file)
end

def self.KyotoCabinet(file = 'anemone.tch')
def self.KyotoCabinet(file = 'anemone.kch')
require 'anemone/storage/kyoto_cabinet'
self::KyotoCabinet.new(file)
end
Expand Down
83 changes: 54 additions & 29 deletions spec/storage_spec.rb
Expand Up @@ -6,45 +6,70 @@
module Anemone
describe Storage do

it "should have a class method to produce a Hash" do
Anemone::Storage.should respond_to(:Hash)
Anemone::Storage.Hash.should be_an_instance_of(Hash)
describe ".Hash" do
it "returns a Hash adapter" do
Anemone::Storage.Hash.should be_an_instance_of(Hash)
end
end

it "should have a class method to produce a PStore" do
test_file = 'test.pstore'
Anemone::Storage.should respond_to(:PStore)
Anemone::Storage.PStore(test_file).should be_an_instance_of(Anemone::Storage::PStore)
describe ".PStore" do
it "returns a PStore adapter" do
test_file = 'test.pstore'
Anemone::Storage.PStore(test_file).should be_an_instance_of(Anemone::Storage::PStore)
end
end

it "should have a class method to produce a TokyoCabinet" do
test_file = 'test.tch'
Anemone::Storage.should respond_to(:TokyoCabinet)
store = Anemone::Storage.TokyoCabinet(test_file)
store.should be_an_instance_of(Anemone::Storage::TokyoCabinet)
store.close
describe ".TokyoCabinet" do
it "returns a TokyoCabinet adapter" do
test_file = 'test.tch'
store = Anemone::Storage.TokyoCabinet(test_file)
store.should be_an_instance_of(Anemone::Storage::TokyoCabinet)
store.close
end
end

it "should have a class method to produce a SQLite3" do
test_file = 'test.db'
Anemone::Storage.should respond_to(:SQLite3)
store = Anemone::Storage.SQLite3(test_file)
store.should be_an_instance_of(Anemone::Storage::SQLite3)
store.close
describe ".KyotoCabinet" do
context "when the file is specified" do
it "returns a KyotoCabinet adapter using that file" do
test_file = 'test.kch'
store = Anemone::Storage.KyotoCabinet(test_file)
store.should be_an_instance_of(Anemone::Storage::KyotoCabinet)
store.close
end
end

context "when no file is specified" do
it "returns a KyotoCabinet adapter using the default filename" do
store = Anemone::Storage.KyotoCabinet
store.should be_an_instance_of(Anemone::Storage::KyotoCabinet)
store.close
end
end
end

describe ".SQLite3" do
it "returns a SQLite3 adapter" do
test_file = 'test.db'
store = Anemone::Storage.SQLite3(test_file)
store.should be_an_instance_of(Anemone::Storage::SQLite3)
store.close
end
end

it "should have a class method to produce a MongoDB" do
Anemone::Storage.should respond_to(:MongoDB)
store = Anemone::Storage.MongoDB
store.should be_an_instance_of(Anemone::Storage::MongoDB)
store.close
describe ".MongoDB" do
it "returns a MongoDB adapter" do
store = Anemone::Storage.MongoDB
store.should be_an_instance_of(Anemone::Storage::MongoDB)
store.close
end
end

it "should have a class method to produce a Redis" do
Anemone::Storage.should respond_to(:Redis)
store = Anemone::Storage.Redis
store.should be_an_instance_of(Anemone::Storage::Redis)
store.close
describe ".MongoDB" do
it "returns a Redis adapter" do
store = Anemone::Storage.Redis
store.should be_an_instance_of(Anemone::Storage::Redis)
store.close
end
end

module Storage
Expand Down

0 comments on commit 531d771

Please sign in to comment.