resqovery 0.0.1

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/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2012 YOURNAME
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,3 @@
1
+ = Resqovery
2
+
3
+ This project rocks and uses MIT-LICENSE.
data/Rakefile ADDED
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env rake
2
+ begin
3
+ require 'bundler/setup'
4
+ rescue LoadError
5
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
+ end
7
+ begin
8
+ require 'rdoc/task'
9
+ rescue LoadError
10
+ require 'rdoc/rdoc'
11
+ require 'rake/rdoctask'
12
+ RDoc::Task = Rake::RDocTask
13
+ end
14
+
15
+ RDoc::Task.new(:rdoc) do |rdoc|
16
+ rdoc.rdoc_dir = 'rdoc'
17
+ rdoc.title = 'Resqovery'
18
+ rdoc.options << '--line-numbers'
19
+ rdoc.rdoc_files.include('README.rdoc')
20
+ rdoc.rdoc_files.include('lib/**/*.rb')
21
+ end
22
+
23
+
24
+
25
+
26
+ Bundler::GemHelper.install_tasks
27
+
@@ -0,0 +1,28 @@
1
+ require 'rails/generators'
2
+
3
+ module Resqovery
4
+
5
+ class InstallGenerator < Rails::Generators::Base
6
+
7
+ class_option :model , :type => :string, :desc => 'Model name to store jobs' , :default => 'resque_job' , :aliases => '-m'
8
+
9
+ desc 'Run all generators which create model file and migration'
10
+
11
+ source_root File.expand_path('../templates', __FILE__)
12
+
13
+ def generate_migration
14
+ generate "resqovery:migration #{model}"
15
+ end
16
+
17
+ def generate_app
18
+ template "models/resque_job.rb.erb", "#{Rails.root}/app/models/#{model}.rb"
19
+ end
20
+
21
+ protected
22
+ def model
23
+ options.model.downcase.singularize
24
+ end
25
+
26
+ end
27
+
28
+ end
@@ -0,0 +1,13 @@
1
+ require 'rails/generators/active_record'
2
+
3
+ module Resqovery
4
+
5
+ class MigrationGenerator < ActiveRecord::Generators::Base
6
+ source_root File.expand_path('../templates', __FILE__)
7
+
8
+ def generate_migration
9
+ migration_template "migrations/create_model.rb.erb", "db/migrate/create_#{name.downcase.underscore.pluralize}.rb"
10
+ end
11
+ end
12
+
13
+ end
@@ -0,0 +1,11 @@
1
+ class <%= migration_class_name %> < ActiveRecord::Migration
2
+ def change
3
+ create_table :<%= table_name %> do |t|
4
+ t.string :classname
5
+ t.text :args
6
+ t.boolean :is_executed, :default => false
7
+
8
+ t.timestamps
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,10 @@
1
+ class <%= model.camelcase %> < ActiveRecord::Base
2
+
3
+ serialize :args
4
+ attr_accessible :classname, :args, :is_executed
5
+
6
+ def is_executed?
7
+ is_executed
8
+ end
9
+
10
+ end
@@ -0,0 +1,16 @@
1
+ require 'resqovery'
2
+
3
+ module Resqovery
4
+
5
+ class << self; attr_accessor :defaults; end
6
+
7
+ class Railtie < Rails::Railtie
8
+ initializer 'resqovery.configure' do |app|
9
+ if app.config.respond_to?(:resqovery_defaults)
10
+ Resqovery.defaults = { :model_name => 'ResqueJob' }
11
+ Resqovery.defaults.merge!(app.config.resqovery_defaults)
12
+ end
13
+ end
14
+ end
15
+
16
+ end
@@ -0,0 +1,3 @@
1
+ module Resqovery
2
+ VERSION = "0.0.1"
3
+ end
data/lib/resqovery.rb ADDED
@@ -0,0 +1,12 @@
1
+ require 'resqovery/railtie'
2
+
3
+ module Resque
4
+
5
+ def self.safe_enqueue(*args, &block)
6
+ classname = *args[0].to_s
7
+ params = *args[1..-1]
8
+ Resqovery.defaults[:model_name].constantize.create( {:classname => classname , :args => params, :is_executed => false} ).id
9
+ self.enqueue(*args, &block)
10
+ end
11
+
12
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :resqovery do
3
+ # # Task goes here
4
+ # end
metadata ADDED
@@ -0,0 +1,105 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: resqovery
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Arash Karimzadeh
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-12-07 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rails
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: rspec-rails
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: sqlite3
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ description: DB recovery system for Resque
63
+ email:
64
+ - arash.k@yoyobutton.com
65
+ executables: []
66
+ extensions: []
67
+ extra_rdoc_files: []
68
+ files:
69
+ - lib/generators/resqovery/install_generator.rb
70
+ - lib/generators/resqovery/migration_generator.rb
71
+ - lib/generators/resqovery/templates/migrations/create_model.rb.erb
72
+ - lib/generators/resqovery/templates/models/resque_job.rb.erb
73
+ - lib/resqovery/railtie.rb
74
+ - lib/resqovery/version.rb
75
+ - lib/resqovery.rb
76
+ - lib/tasks/resqovery_tasks.rake
77
+ - MIT-LICENSE
78
+ - Rakefile
79
+ - README.rdoc
80
+ homepage: http://yoyobutton.com/
81
+ licenses: []
82
+ post_install_message:
83
+ rdoc_options: []
84
+ require_paths:
85
+ - lib
86
+ required_ruby_version: !ruby/object:Gem::Requirement
87
+ none: false
88
+ requirements:
89
+ - - ! '>='
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ required_rubygems_version: !ruby/object:Gem::Requirement
93
+ none: false
94
+ requirements:
95
+ - - ! '>='
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ requirements: []
99
+ rubyforge_project:
100
+ rubygems_version: 1.8.24
101
+ signing_key:
102
+ specification_version: 3
103
+ summary: DB recovery for Resque
104
+ test_files: []
105
+ has_rdoc: