diff --git a/.rvmrc b/.rvmrc deleted file mode 100644 index ac8ba5b..0000000 --- a/.rvmrc +++ /dev/null @@ -1,2 +0,0 @@ -rvm ruby-1.9.3 -rvm gemset use resque-history --create diff --git a/.travis.yml b/.travis.yml index 17dbdb8..ed4ca01 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,13 +1,8 @@ language: ruby rvm: - - ree - - 1.8.7 - - 1.9.2 - 1.9.3 - 2.0.0 - - jruby-18mode # JRuby in 1.8 mode - jruby-19mode # JRuby in 1.9 mode - - rbx-18mode - rbx-19mode services: - redis-server diff --git a/Gemfile b/Gemfile index bfa155f..3d48527 100644 --- a/Gemfile +++ b/Gemfile @@ -3,12 +3,17 @@ source "http://rubygems.org" # Specify your gem's dependencies in resque-history.gemspec # gemspec -gem "resque" +gem "resque", "~> 2.0.0.pre.1", github: "resque/resque" +gem 'resque-web', require: 'resque_web' group :development, :test do gem "rake" gem "bundler" gem "jeweler" + gem 'yajl-ruby' +end + +group :test do gem "rspec-rails" gem "rspec", ">2.12.0" gem "rack-test" diff --git a/Gemfile.lock b/Gemfile.lock index 0e74129..b11a6c4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,49 +1,147 @@ +GIT + remote: git://github.com/resque/resque.git + revision: ce435fab0067ea141160d409b52540202361d6d4 + specs: + resque (2.0.0.pre.1) + json + mono_logger (~> 1.0) + redis-namespace (>= 1.3.0) + thor (~> 0.17) + GEM remote: http://rubygems.org/ specs: - backports (3.1.1) - diff-lcs (1.2.2) + actionmailer (4.0.4) + actionpack (= 4.0.4) + mail (~> 2.5.4) + actionpack (4.0.4) + activesupport (= 4.0.4) + builder (~> 3.1.0) + erubis (~> 2.7.0) + rack (~> 1.5.2) + rack-test (~> 0.6.2) + activemodel (4.0.4) + activesupport (= 4.0.4) + builder (~> 3.1.0) + activerecord (4.0.4) + activemodel (= 4.0.4) + activerecord-deprecated_finders (~> 1.0.2) + activesupport (= 4.0.4) + arel (~> 4.0.0) + activerecord-deprecated_finders (1.0.3) + activesupport (4.0.4) + i18n (~> 0.6, >= 0.6.9) + minitest (~> 4.2) + multi_json (~> 1.3) + thread_safe (~> 0.1) + tzinfo (~> 0.3.37) + arel (4.0.2) + atomic (1.1.16) + builder (3.1.4) + coffee-rails (4.0.1) + coffee-script (>= 2.2.0) + railties (>= 4.0.0, < 5.0) + coffee-script (2.2.0) + coffee-script-source + execjs + coffee-script-source (1.7.0) + diff-lcs (1.2.5) + erubis (2.7.0) + execjs (2.0.2) git (1.2.5) + hike (1.2.3) + i18n (0.6.9) jeweler (1.8.4) bundler (~> 1.0) git (>= 1.2.5) rake rdoc + jquery-rails (3.1.0) + railties (>= 3.0, < 5.0) + thor (>= 0.14, < 2.0) json (1.7.7) - multi_json (1.7.1) - rack (1.4.5) + mail (2.5.4) + mime-types (~> 1.16) + treetop (~> 1.4.8) + mime-types (1.25.1) + minitest (4.7.5) + mono_logger (1.1.0) + multi_json (1.9.2) + polyglot (0.3.4) + rack (1.5.2) rack-test (0.6.2) rack (>= 1.0) + rails (4.0.4) + actionmailer (= 4.0.4) + actionpack (= 4.0.4) + activerecord (= 4.0.4) + activesupport (= 4.0.4) + bundler (>= 1.3.0, < 2.0) + railties (= 4.0.4) + sprockets-rails (~> 2.0.0) + railties (4.0.4) + actionpack (= 4.0.4) + activesupport (= 4.0.4) + rake (>= 0.8.7) + thor (>= 0.18.1, < 2.0) rake (10.0.4) rdoc (4.0.0) json (~> 1.4) - redis (3.0.3) - redis-namespace (1.2.1) - redis (~> 3.0.0) - resque (1.23.1) - multi_json (~> 1.0) - redis-namespace (~> 1.0) - sinatra (>= 0.9.2) - vegas (~> 0.1.2) - rspec (2.13.0) - rspec-core (~> 2.13.0) - rspec-expectations (~> 2.13.0) - rspec-mocks (~> 2.13.0) - rspec-core (2.13.1) - rspec-expectations (2.13.0) + redis (3.0.7) + redis-namespace (1.4.1) + redis (~> 3.0.4) + resque-web (0.0.5) + coffee-rails + jquery-rails + resque + sass-rails + twitter-bootstrap-rails + rspec (2.14.1) + rspec-core (~> 2.14.0) + rspec-expectations (~> 2.14.0) + rspec-mocks (~> 2.14.0) + rspec-core (2.14.8) + rspec-expectations (2.14.5) diff-lcs (>= 1.1.3, < 2.0) - rspec-mocks (2.13.0) - rspec-rails (1.3.2) - rack (>= 1.0.0) - rspec (>= 1.3.0) - sinatra (1.2.9) - backports - rack (~> 1.1, < 1.5) - tilt (>= 1.2.2, < 2.0) - tilt (1.3.6) + rspec-mocks (2.14.6) + rspec-rails (2.14.2) + actionpack (>= 3.0) + activemodel (>= 3.0) + activesupport (>= 3.0) + railties (>= 3.0) + rspec-core (~> 2.14.0) + rspec-expectations (~> 2.14.0) + rspec-mocks (~> 2.14.0) + sass (3.2.18) + sass-rails (4.0.2) + railties (>= 4.0.0, < 5.0) + sass (~> 3.2.0) + sprockets (~> 2.8, <= 2.11.0) + sprockets-rails (~> 2.0.0) + sprockets (2.11.0) + hike (~> 1.2) + multi_json (~> 1.0) + rack (~> 1.0) + tilt (~> 1.1, != 1.3.0) + sprockets-rails (2.0.1) + actionpack (>= 3.0) + activesupport (>= 3.0) + sprockets (~> 2.8) + thor (0.19.1) + thread_safe (0.3.1) + atomic (>= 1.1.7, < 2) + tilt (1.4.1) timecop (0.6.1) - vegas (0.1.11) - rack (>= 1.0.0) + treetop (1.4.15) + polyglot + polyglot (>= 0.3.1) + twitter-bootstrap-rails (2.2.8) + actionpack (>= 3.1) + execjs + rails (>= 3.1) + railties (>= 3.1) + tzinfo (0.3.39) + yajl-ruby (1.2.0) PLATFORMS ruby @@ -53,7 +151,9 @@ DEPENDENCIES jeweler rack-test rake - resque + resque (~> 2.0.0.pre.1)! + resque-web rspec (> 2.12.0) rspec-rails timecop + yajl-ruby diff --git a/lib/resque-history/engine/app/controllers/resque_web/plugins/resque_history/histories_controller.rb b/lib/resque-history/engine/app/controllers/resque_web/plugins/resque_history/histories_controller.rb index 17eea1a..930c8c1 100644 --- a/lib/resque-history/engine/app/controllers/resque_web/plugins/resque_history/histories_controller.rb +++ b/lib/resque-history/engine/app/controllers/resque_web/plugins/resque_history/histories_controller.rb @@ -1,26 +1,30 @@ -#require 'resque_web/app/controllers/resque_web/application_controller' +#require 'app/controllers/resque_web/application_controller' -module ResqueWeb::Plugins::ResqueHistory - #class HistoriesController < ActionController::Base - class HistoriesController < ResqueWeb::ApplicationController - def show +module ResqueWeb + module Plugins + module ResqueHistory + #class HistoriesController < ActionController::Base + class HistoriesController #< ResqueWeb::ApplicationController + def show - end + end - def destroy - reset_history - redirect_to :show - end + def destroy + reset_history + redirect_to :show + end - private + private - def reset_history - size = redis.llen(Resque::Plugins::History::HISTORY_SET_NAME) + def reset_history + size = redis.llen(Resque::Plugins::History::HISTORY_SET_NAME) - size.times do - redis.lpop(Resque::Plugins::History::HISTORY_SET_NAME) - end + size.times do + redis.lpop(Resque::Plugins::History::HISTORY_SET_NAME) + end + end + end end end end diff --git a/lib/resque-history/server.rb b/lib/resque-history/server.rb index c198cf4..6e9d1c3 100644 --- a/lib/resque-history/server.rb +++ b/lib/resque-history/server.rb @@ -1,5 +1,5 @@ require 'resque' -require 'resque/server' +#require 'resque/server' #require 'resque-history' # Extends Resque Web Based UI. @@ -32,7 +32,6 @@ def self.included(base) end end - Resque::Server.tabs << 'History' end # Clears all historical jobs diff --git a/spec/resque-history/plugins/history_spec.rb b/spec/resque-history/plugins/history_spec.rb index 67bef2f..bc9f602 100644 --- a/spec/resque-history/plugins/history_spec.rb +++ b/spec/resque-history/plugins/history_spec.rb @@ -31,8 +31,8 @@ def self.perform(*args) job = Resque.reserve('test') job.perform - arr = Resque.redis.lrange(Resque::Plugins::History::HISTORY_SET_NAME, 0, -1) + arr = Resque.backend.store.lrange(Resque::Plugins::History::HISTORY_SET_NAME, 0, -1) arr.count.should == 1 JSON.parse(arr.first).should == {"class"=>"HistoryJob", "args"=>[12], "time"=>"2000-09-01 12:00", "execution"=>0} end diff --git a/spec/resque-web_spec.rb b/spec/resque-web_spec.rb index 76851e0..3b07236 100644 --- a/spec/resque-web_spec.rb +++ b/spec/resque-web_spec.rb @@ -2,7 +2,7 @@ require 'timecop' -describe ResqueHistory::Server, :pending => true do +describe ResqueHistory::Server do include Rack::Test::Methods def app @@ -10,9 +10,9 @@ def app end let :queues do - Resque.redis.sadd(:queues, "queue1") - Resque.redis.sadd(:queues, "queue2") - Resque.redis.sadd(:queues, "queue3") + Resque.backend.store.sadd(:queues, "queue1") + Resque.backend.store.sadd(:queues, "queue2") + Resque.backend.store.sadd(:queues, "queue3") end before do diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index c688db0..8fd0719 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -51,7 +51,7 @@ end config.before(:each) do - Resque.redis.flushall + Resque.backend.store.flushall Kernel.stub!(:sleep) end