Skip to content

Commit

Permalink
Vendor runtime gem dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
rsanheim committed Oct 10, 2009
1 parent 01e00e4 commit cc1ca2d
Show file tree
Hide file tree
Showing 106 changed files with 5,475 additions and 4 deletions.
1 change: 1 addition & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ begin
gem.homepage = "http://github.com/rsanheim/braincron_consumer"
gem.authors = ["Rob Sanheim"]
gem.add_development_dependency "spicycode-micronaut"

end
rescue LoadError
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
Expand Down
9 changes: 5 additions & 4 deletions lib/braincron.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
require 'logger'
require 'syslog_formatter'

# TODO rip all this out with proper vendor'ed gems
braincron_vendor_gems = Pathname(__FILE__).parent.parent.parent.join("braincron", "vendor", "gems")
braincron_vendor_gems.children.each do |dir|
$LOAD_PATH << dir.join("lib")
vendor_gems = Pathname(__FILE__).join("..", "..", "vendor", "gems").expand_path
vendor_gems.children.each do |dir|
$LOAD_PATH.unshift dir.join("lib")
end

require 'active_support'
Expand All @@ -17,6 +16,8 @@
require 'chatterbox/email'
require 'braincron/queue'
require 'braincron/consumer'
require 'rosetta_queue/adapter'
require 'rosetta_queue/adapters/stomp'

module Braincron
extend self
Expand Down
2 changes: 2 additions & 0 deletions vendor/gems/chatterbox-0.4.0/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
coverage
pkg
22 changes: 22 additions & 0 deletions vendor/gems/chatterbox-0.4.0/.treasure_map.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
map_for(:chatterbox) do |map|

map.keep_a_watchful_eye_for 'lib', 'examples', 'rails'

# map.add_mapping %r%examples/(.*)_example\.rb% do |match|
# ["examples/#{match[1]}_example.rb"]
# end
#
# map.add_mapping %r%examples/example_helper\.rb% do |match|
# Dir["examples/**/*_example.rb"]
# end
#
# map.add_mapping %r%lib/(.*)\.rb% do |match|
# Dir["examples/#{match[1]}_example.rb"]
# end

map.add_mapping %r%rails/(.*)\.rb% do |match|
["examples/#{match[1]}_example.rb"]
end


end
20 changes: 20 additions & 0 deletions vendor/gems/chatterbox-0.4.0/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Copyright (c) 2009 Rob Sanheim

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.
70 changes: 70 additions & 0 deletions vendor/gems/chatterbox-0.4.0/README.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
Chatterbox
==========================================

Simple Notifications. Publishing and subscribing to notifications is decoupled by default, so bring your own message queue, web service, database, or whatever to act as an intermediary.

Installing and Running
---------------------------------------

For plain old gem install:

gem install chatterbox "source" => "http://gemcutter.org"

To install within a Rails app, add the following to your environment.rb file:

config.gem "chatterbox", :source => "http://gemcutter.org"

Then run:

rake gems:install

To enable standard Rails exception catching for your controllers, add the following to `application_controller`

class ApplicationController < ActionController::Base
include Chatterbox::RailsCatcher
# ...
end

Then, wire up a producer


Example 1
---------------------------------------

Register the email service to handle messages that get sent to Chatterbox:

Chatterbox::Publishers.register do |notice|
Chatterbox::Email.deliver(notice)
end

Then, wherever you want to send email, do this:

message = {
:config => { :to => "joe@example.com", :from => "donotreply@example.com" },
:message => { :summary => "your subject line here" }
}
Chatterbox.handle_notice(options)

Example 2
---------------------------------------

Wiring up notices to be sent to an exceptions queue, defined in RosettaQueue

Chatterbox::Publishers.register do |notice|
RosettaQueue::Producer.publish(:exceptions, notice)
end


Bugs & Patches
--------------

Links
-------------

Contributors
------------
* Rob Sanheim

Copyrights
------------
* Copyright &copy; 2008-2009 [Relevance, Inc.](http://www.thinkrelevance.com/), under the MIT license
51 changes: 51 additions & 0 deletions vendor/gems/chatterbox-0.4.0/Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
require 'rake'

begin
require 'jeweler'
Jeweler::Tasks.new do |gem|
gem.name = "chatterbox"
gem.summary = %Q{Notifications and messages}
gem.description = %W{Send messages. However you want.}
gem.email = "rsanheim@gmail.com"
gem.homepage = "http://github.com/rsanheim/chatterbox"
gem.authors = ["Rob Sanheim"]
gem.add_development_dependency "mocha"
gem.add_development_dependency "actionpack"
gem.add_development_dependency "micronaut"
gem.add_development_dependency "micronaut-rails"
end
Jeweler::GemcutterTasks.new
rescue LoadError
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
end

require 'micronaut/rake_task'
Micronaut::RakeTask.new(:examples) do |examples|
examples.pattern = 'examples/**/*_example.rb'
examples.ruby_opts << '-Ilib -Iexamples'
end

Micronaut::RakeTask.new(:rcov) do |examples|
examples.pattern = 'examples/**/*_example.rb'
examples.rcov_opts = '-Ilib -Iexamples'
examples.rcov = true
end

task :default => :examples

begin
%w{sdoc sdoc-helpers rdiscount}.each { |name| gem name }
require 'sdoc_helpers'
rescue LoadError => ex
puts "sdoc support not enabled:"
puts ex.inspect
end

require 'rake/rdoctask'
Rake::RDocTask.new do |rdoc|
version = File.exist?('VERSION') ? File.read('VERSION') : ''
rdoc.rdoc_dir = 'rdoc'
rdoc.title = "chatterbox #{version}"
rdoc.rdoc_files.include('README*')
rdoc.rdoc_files.include('lib/**/*.rb')
end
76 changes: 76 additions & 0 deletions vendor/gems/chatterbox-0.4.0/chatterbox.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Generated by jeweler
# DO NOT EDIT THIS FILE
# Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
# -*- encoding: utf-8 -*-

Gem::Specification.new do |s|
s.name = %q{chatterbox}
s.version = "0.4.0"

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Rob Sanheim"]
s.date = %q{2009-10-09}
s.description = %q{["Send", "messages.", "However", "you", "want."]}
s.email = %q{rsanheim@gmail.com}
s.extra_rdoc_files = [
"LICENSE",
"README.markdown"
]
s.files = [
".gitignore",
".treasure_map.rb",
"LICENSE",
"README.markdown",
"Rakefile",
"chatterbox.gemspec",
"examples/chatterbox_example.rb",
"examples/example_helper.rb",
"examples/lib/chatterbox/consumers/email_consumer_example.rb",
"examples/lib/chatterbox/notification_example.rb",
"examples/lib/chatterbox/rails_catcher_example.rb",
"init.rb",
"lib/chatterbox.rb",
"lib/chatterbox/notification.rb",
"lib/chatterbox/rails_catcher.rb",
"lib/consumers.rb",
"lib/consumers/email_consumer.rb",
"rails/init.rb",
"todo.markdown",
"version.yml",
"views/chatterbox/mailer/exception_notification.erb"
]
s.homepage = %q{http://github.com/rsanheim/chatterbox}
s.rdoc_options = ["--charset=UTF-8"]
s.require_paths = ["lib"]
s.rubygems_version = %q{1.3.5}
s.summary = %q{Notifications and messages}
s.test_files = [
"examples/chatterbox_example.rb",
"examples/example_helper.rb",
"examples/lib/chatterbox/consumers/email_consumer_example.rb",
"examples/lib/chatterbox/notification_example.rb",
"examples/lib/chatterbox/rails_catcher_example.rb"
]

if s.respond_to? :specification_version then
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
s.specification_version = 3

if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
s.add_development_dependency(%q<mocha>, [">= 0"])
s.add_development_dependency(%q<actionpack>, [">= 0"])
s.add_development_dependency(%q<micronaut>, [">= 0"])
s.add_development_dependency(%q<micronaut-rails>, [">= 0"])
else
s.add_dependency(%q<mocha>, [">= 0"])
s.add_dependency(%q<actionpack>, [">= 0"])
s.add_dependency(%q<micronaut>, [">= 0"])
s.add_dependency(%q<micronaut-rails>, [">= 0"])
end
else
s.add_dependency(%q<mocha>, [">= 0"])
s.add_dependency(%q<actionpack>, [">= 0"])
s.add_dependency(%q<micronaut>, [">= 0"])
s.add_dependency(%q<micronaut-rails>, [">= 0"])
end
end
65 changes: 65 additions & 0 deletions vendor/gems/chatterbox-0.4.0/examples/chatterbox_example.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
require File.join(File.dirname(__FILE__), *%w[example_helper])

describe Chatterbox do

before do
Chatterbox.logger = Logger.new(nil)
Chatterbox::Publishers.clear!
end

after do
Chatterbox.logger = nil
end

describe "handle_notice" do
include Chatterbox

it "should publish the notice" do
Chatterbox.expects(:publish_notice).with("message")
Chatterbox.handle_notice("message")
end

end

describe "logger" do

it "uses STDOUT logger if Rails not available" do
Chatterbox.logger = nil

Logger.expects(:new).with(STDOUT).returns("logger")
Chatterbox.stubs(:rails_default_logger).returns(nil)
Chatterbox.logger.should == "logger"
end
end

describe "publish" do

include Chatterbox

it "should call each publisher with the notice" do
notice = stub
publisher = Chatterbox::Publishers.register { "i'm in your block" }
publisher.expects(:call).with(notice)

publish_notice(notice)
end

end

describe "publishers" do

it "should allow clearing all publishers" do
Chatterbox::Publishers.register { "sending your messages" }
Chatterbox::Publishers.publishers.size.should == 1
Chatterbox::Publishers.clear!
Chatterbox::Publishers.publishers.size.should == 0
end

it "should allow registering with a block" do
pub1 = Chatterbox::Publishers.register { "sending your messages" }
pub2 = Chatterbox::Publishers.register { "announcing your news" }
Chatterbox::Publishers.publishers.should == [pub1, pub2]
end
end

end
23 changes: 23 additions & 0 deletions vendor/gems/chatterbox-0.4.0/examples/example_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
require 'rubygems'
require 'action_controller'
require 'micronaut'
require 'micronaut-rails'
require 'mocha'

$LOAD_PATH.unshift(File.dirname(__FILE__))
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
# $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), 'lib'))

require 'lib/chatterbox'

def not_in_editor?
!(ENV.has_key?('TM_MODE') || ENV.has_key?('EMACS') || ENV.has_key?('VIM'))
end

Micronaut.configure do |c|
c.mock_with :mocha
c.color_enabled = not_in_editor?
c.filter_run :focused => true
c.alias_example_to :fit, :focused => true
c.enable_controller_support :behaviour => { :describes => lambda { |dt| dt < ::ActionController::Base } }
end
Loading

0 comments on commit cc1ca2d

Please sign in to comment.