diff options
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | Gemfile | 3 | ||||
-rw-r--r-- | Gemfile.lock | 27 | ||||
-rw-r--r-- | MIT-LICENSE | 21 | ||||
-rw-r--r-- | README.rdoc | 37 | ||||
-rw-r--r-- | activejob.gemspec | 20 | ||||
-rw-r--r-- | lib/active_job.rb | 33 | ||||
-rw-r--r-- | lib/active_job/base.rb | 4 | ||||
-rw-r--r-- | lib/active_job/gem_version.rb | 15 | ||||
-rw-r--r-- | lib/active_job/version.rb | 8 | ||||
-rw-r--r-- | test/cases/queuing_test.rb | 7 | ||||
-rw-r--r-- | test/helper.rb | 8 |
12 files changed, 184 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000000..b04883413e --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1 @@ +* Started project.
\ No newline at end of file diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000000..cd8aa9e04c --- /dev/null +++ b/Gemfile @@ -0,0 +1,3 @@ +source 'https://rubygems.org' + +gemspec
\ No newline at end of file diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000000..d4b8ae3df8 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,27 @@ +PATH + remote: . + specs: + activejob (4.2.0.alpha) + activesupport (>= 4.1.0) + +GEM + remote: https://rubygems.org/ + specs: + activesupport (4.1.1) + i18n (~> 0.6, >= 0.6.9) + json (~> 1.7, >= 1.7.7) + minitest (~> 5.1) + thread_safe (~> 0.1) + tzinfo (~> 1.1) + i18n (0.6.9) + json (1.8.1) + minitest (5.3.4) + thread_safe (0.3.3) + tzinfo (1.1.0) + thread_safe (~> 0.1) + +PLATFORMS + ruby + +DEPENDENCIES + activejob! diff --git a/MIT-LICENSE b/MIT-LICENSE new file mode 100644 index 0000000000..8b1e97b776 --- /dev/null +++ b/MIT-LICENSE @@ -0,0 +1,21 @@ +Copyright (c) 2014 David Heinemeier Hansson + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/README.rdoc b/README.rdoc new file mode 100644 index 0000000000..5137766226 --- /dev/null +++ b/README.rdoc @@ -0,0 +1,37 @@ += Active Job -- Make work happen later + +Active Job is a framework for declaring jobs and making them run on a variety +of queueing backends. These jobs can be everything from regularly scheduled +clean-ups, billing charges, or mailings. Anything that can be chopped up into +small units of work and run in parallel, really. + +It also serves as the backend for ActionMailer's #deliver_later functionality +that makes it easy to turn any mailing into a job for running later. That's +one of the most common jobs in a modern web application: Sending emails outside +of the request-response cycle, so the user doesn't have to wait on it. + + +== Under development as a gem, targeted for Rails inclusion + +Active Job is currently being developed in a separate repository until it's +ready to be merged in with Rails. The current plan is to have Active Job +be part of the Rails 4.2 release, but plans may change depending on when +this framework stabilizes and feels ready. + + +== Download and installation + +The latest version of Active Job can be installed with RubyGems: + + % [sudo] gem install activejob + +Source code can be downloaded as part of the Rails project on GitHub + +* https://github.com/rails/activejob + + +== License + +Active Job is released under the MIT license: + +* http://www.opensource.org/licenses/MIT diff --git a/activejob.gemspec b/activejob.gemspec new file mode 100644 index 0000000000..201f3efb31 --- /dev/null +++ b/activejob.gemspec @@ -0,0 +1,20 @@ +Gem::Specification.new do |s| + s.platform = Gem::Platform::RUBY + s.name = 'activejob' + s.version = '4.2.0.alpha' + s.summary = 'Job framework with pluggable queues (will be part of Rails).' + s.description = 'Declare job classes that can be run by a variety of queueing backends.' + + s.required_ruby_version = '>= 1.9.3' + + s.license = 'MIT' + + s.author = 'David Heinemeier Hansson' + s.email = 'david@loudthinking.com' + s.homepage = 'http://www.rubyonrails.org' + + s.files = Dir['CHANGELOG.md', 'MIT-LICENSE', 'README.rdoc', 'lib/**/*'] + s.require_path = 'lib' + + s.add_dependency 'activesupport', '>= 4.1.0' +end diff --git a/lib/active_job.rb b/lib/active_job.rb new file mode 100644 index 0000000000..ba18cc093a --- /dev/null +++ b/lib/active_job.rb @@ -0,0 +1,33 @@ +#-- +# Copyright (c) 2014 David Heinemeier Hansson +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +#++ + +require 'active_support' +require 'active_support/rails' + +require 'active_job/version' + +module ActiveJob + extend ActiveSupport::Autoload + + autoload :Base +end
\ No newline at end of file diff --git a/lib/active_job/base.rb b/lib/active_job/base.rb new file mode 100644 index 0000000000..f2c76c1811 --- /dev/null +++ b/lib/active_job/base.rb @@ -0,0 +1,4 @@ +module ActiveJob + class Base + end +end
\ No newline at end of file diff --git a/lib/active_job/gem_version.rb b/lib/active_job/gem_version.rb new file mode 100644 index 0000000000..c166020b28 --- /dev/null +++ b/lib/active_job/gem_version.rb @@ -0,0 +1,15 @@ +module ActiveJob + # Returns the version of the currently loaded ActiveJob as a <tt>Gem::Version</tt> + def self.gem_version + Gem::Version.new VERSION::STRING + end + + module VERSION + MAJOR = 4 + MINOR = 2 + TINY = 0 + PRE = "alpha" + + STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".") + end +end diff --git a/lib/active_job/version.rb b/lib/active_job/version.rb new file mode 100644 index 0000000000..0add9779d9 --- /dev/null +++ b/lib/active_job/version.rb @@ -0,0 +1,8 @@ +require_relative 'gem_version' + +module ActiveJob + # Returns the version of the currently loaded ActiveRecord as a <tt>Gem::Version</tt> + def self.version + gem_version + end +end diff --git a/test/cases/queuing_test.rb b/test/cases/queuing_test.rb new file mode 100644 index 0000000000..5f1b35fee5 --- /dev/null +++ b/test/cases/queuing_test.rb @@ -0,0 +1,7 @@ +require 'helper' + +class QueuingTest < ActiveSupport::TestCase + test 'the truth' do + assert true + end +end diff --git a/test/helper.rb b/test/helper.rb new file mode 100644 index 0000000000..4048ddbd3f --- /dev/null +++ b/test/helper.rb @@ -0,0 +1,8 @@ +require 'bundler' +Bundler.setup + +$LOAD_PATH << File.dirname(__FILE__ + "/../lib") + +require 'active_job' + +require 'active_support/testing/autorun' |