fake-resque 0.1.0

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/CONTRIBUTORS ADDED
@@ -0,0 +1 @@
1
+ * Jacob Atzen
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 Jacob Atzen
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.markdown ADDED
@@ -0,0 +1,50 @@
1
+ FakeResque
2
+ ==========
3
+
4
+ Don't want to have the resque infrastructure in place when developing or
5
+ testing your resque dependent applications? FakeResque will replace Resque
6
+ and execute any Resque calls synchronously instead of asynchronously.
7
+
8
+ Usage
9
+ -----
10
+
11
+ require 'fakefs'
12
+
13
+ # That's it.
14
+
15
+ # To use the real Resque
16
+
17
+ FakeResque.deactivate!
18
+
19
+ # To disable the real Resque again
20
+
21
+ FakeResque.activate!
22
+
23
+ Installation
24
+ ------------
25
+
26
+ ### [Gemcutter](http://gemcutter.org/)
27
+
28
+ $ gem install fake-resque
29
+
30
+ Contributing
31
+ ------------
32
+
33
+ Once you've made your great commits:
34
+
35
+ 1. [Fork][0] FakeResque
36
+ 2. Create a topic branch - `git checkout -b my_branch`
37
+ 3. Push to your branch - `git push origin my_branch`
38
+ 4. Create an [Issue][1] with a link to your branch
39
+ 5. That's it!
40
+
41
+ Meta
42
+ ----
43
+
44
+ * Code: `git clone git://github.com/jacobat/fake-resque.git`
45
+ * Home: <http://github.com/jacobat/fake-resque>
46
+ * Bugs: <http://github.com/jacobat/fake-resque/issues>
47
+ * Gems: <http://gemcutter.org/gems/fake-resque>
48
+
49
+ [0]: http://help.github.com/forking/
50
+ [1]: http://github.com/jacobat/fake-resque/issues
data/Rakefile ADDED
@@ -0,0 +1,60 @@
1
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), 'test')
2
+
3
+ desc "Run tests"
4
+ task :test do
5
+ Dir['test/**/*_test.rb'].each { |file| require file }
6
+ end
7
+
8
+ task :default => [:test, :spec]
9
+
10
+ begin
11
+ require 'spec/rake/spectask'
12
+
13
+ desc "Run specs"
14
+ Spec::Rake::SpecTask.new(:spec) do |t|
15
+ t.spec_files = FileList["spec/**/*.rb"]
16
+ end
17
+ rescue LoadError
18
+ puts "Spec task can't be loaded. `gem install rspec`"
19
+ end
20
+
21
+ begin
22
+ require 'jeweler'
23
+
24
+ $LOAD_PATH.unshift File.dirname(__FILE__) + '/lib'
25
+ require 'fake-resque/version'
26
+
27
+ Jeweler::Tasks.new do |gemspec|
28
+ gemspec.name = "fake-resque"
29
+ gemspec.summary = "A fake resque. Use it in your tests."
30
+ gemspec.email = "jacob@incremental.dk"
31
+ gemspec.homepage = "http://github.com/jacobat/fake-resque"
32
+ gemspec.description = "A fake resque. Use it in your tests."
33
+ gemspec.authors = ["Jacob Atzen"]
34
+ gemspec.has_rdoc = false
35
+ gemspec.version = FakeResque::Version.to_s
36
+ end
37
+ rescue LoadError
38
+ puts "Jeweler not available."
39
+ puts "Install it with: gem install jeweler"
40
+ end
41
+
42
+ begin
43
+ require 'sdoc_helpers'
44
+ rescue LoadError
45
+ puts "sdoc support not enabled. Please gem install sdoc-helpers."
46
+ end
47
+
48
+ desc "Build a gem"
49
+ task :gem => [ :gemspec, :build ]
50
+
51
+ desc "Push a new version to Gemcutter"
52
+ task :publish => [ :gemspec, :build ] do
53
+ abort("Tests failed!") unless system("rake test")
54
+ system "git tag v#{FakeResque::Version}"
55
+ system "git push origin v#{FakeResque::Version}"
56
+ system "git push origin master"
57
+ system "gem push pkg/fake-resque-#{FakeResque::Version}.gem"
58
+ system "git clean -fd"
59
+ exec "rake pages"
60
+ end
@@ -0,0 +1,28 @@
1
+ RealResque = Resque
2
+
3
+ module FakeResque
4
+ def self.activate!
5
+ Object.class_eval do
6
+ remove_const(:Resque)
7
+ const_set(:Resque, FakeResque::Resque)
8
+ end
9
+ true
10
+ end
11
+
12
+ def self.deactivate!
13
+ Object.class_eval do
14
+ remove_const(:Resque)
15
+ const_set(:Resque, RealResque)
16
+ end
17
+ true
18
+ end
19
+ end
20
+
21
+ def FakeResque
22
+ return ::FakeResque unless block_given?
23
+ ::FakeResque.activate!
24
+ yield
25
+ ensure
26
+ ::FakeResque.deactivate!
27
+ end
28
+
@@ -0,0 +1,9 @@
1
+ module FakeResque
2
+ class Resque
3
+ class << self
4
+ def enqueue(klass, *args)
5
+ klass.perform(*args)
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,2 @@
1
+ require 'fake-resque/resque'
2
+ require 'fake-resque/base'
@@ -0,0 +1,9 @@
1
+ module FakeResque
2
+ module Version
3
+ VERSION = "0.1.0"
4
+
5
+ def self.to_s
6
+ VERSION
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,3 @@
1
+ require 'fake-resque/safe'
2
+
3
+ FakeResque.activate!
metadata ADDED
@@ -0,0 +1,71 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fake-resque
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ - 0
9
+ version: 0.1.0
10
+ platform: ruby
11
+ authors:
12
+ - Jacob Atzen
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-03-17 00:00:00 +01:00
18
+ default_executable:
19
+ dependencies: []
20
+
21
+ description: A fake resque. Use it in your tests.
22
+ email: jacob@incremental.dk
23
+ executables: []
24
+
25
+ extensions: []
26
+
27
+ extra_rdoc_files:
28
+ - LICENSE
29
+ - README.markdown
30
+ files:
31
+ - CONTRIBUTORS
32
+ - LICENSE
33
+ - README.markdown
34
+ - Rakefile
35
+ - lib/fake-resque.rb
36
+ - lib/fake-resque/base.rb
37
+ - lib/fake-resque/resque.rb
38
+ - lib/fake-resque/safe.rb
39
+ - lib/fake-resque/version.rb
40
+ has_rdoc: true
41
+ homepage: http://github.com/jacobat/fake-resque
42
+ licenses: []
43
+
44
+ post_install_message:
45
+ rdoc_options:
46
+ - --charset=UTF-8
47
+ require_paths:
48
+ - lib
49
+ required_ruby_version: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ segments:
54
+ - 0
55
+ version: "0"
56
+ required_rubygems_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ segments:
61
+ - 0
62
+ version: "0"
63
+ requirements: []
64
+
65
+ rubyforge_project:
66
+ rubygems_version: 1.3.6
67
+ signing_key:
68
+ specification_version: 3
69
+ summary: A fake resque. Use it in your tests.
70
+ test_files: []
71
+