-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
276 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
require 'spec' | ||
require 'spec/rake/spectask' | ||
task :spec => 'spec:all' | ||
namespace(:spec) do | ||
Spec::Rake::SpecTask.new(:all) do |t| | ||
t.spec_opts ||= [] | ||
t.spec_opts << "-rubygems" | ||
t.spec_opts << "--options" << "spec/spec.opts" | ||
t.spec_files = FileList['spec/**/*_spec.rb'] | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
with 'this is my message' do | ||
say 'well, that was fun' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/usr/bin/env ruby | ||
|
||
require 'rubygems' | ||
begin | ||
require 'messed' | ||
rescue LoadError | ||
if ENV['MESSED_HOME'] | ||
require File.join(ENV['MESSED_HOME'], 'lib', 'messed') | ||
else | ||
raise("no messed!") | ||
end | ||
end | ||
|
||
require 'thor' | ||
|
||
$root = File.expand_path(File.join(File.dirname(__FILE__), '..')) | ||
|
||
class RunnerTask < Thor | ||
|
||
method_options :detach => false | ||
method_options :environment => "development" | ||
desc "interface [NAME]", "starts an interface (#{Messed::Booter.possible_interfaces($root).join(', ')})" | ||
def interface(name) | ||
booter = Messed::Booter.new($root, options.environment) | ||
interface = booter.interface_map[name] | ||
|
||
raise("unable to find an interface with name the `#{name}'") unless interface | ||
|
||
Messed::Interface::Runner.new(interface, :detach => options.detach?).start | ||
end | ||
|
||
method_options :detach => false | ||
method_options :environment => "development" | ||
desc "application [NAME]", "start the application" | ||
def application | ||
booter = Messed::Booter.new($root, options.environment) | ||
application = booter.application | ||
Messed::Interface::Runner.new(application, :detach => options.detach?).start | ||
end | ||
|
||
end | ||
|
||
RunnerTask.start | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/usr/bin/env ruby | ||
|
||
require 'rubygems' | ||
begin | ||
require 'messed' | ||
rescue LoadError | ||
if ENV['MESSED_HOME'] | ||
require File.join(ENV['MESSED_HOME'], 'lib', 'messed') | ||
else | ||
raise("no messed!") | ||
end | ||
end | ||
|
||
require 'thor' | ||
|
||
class IncomingRunnerTask < Thor | ||
|
||
method_options :detach => false | ||
method_options :environment => "development" | ||
desc "start [NAME]", "start an incoming instance" | ||
def start(name = nil) | ||
application = Messed::Booter.new(File.expand_path(File.join(File.dirname(__FILE__), '..')), options.environment) | ||
incoming = if name.nil? and application.incoming_map.size == 1 | ||
application.incoming_map.values.first | ||
elsif application.incoming_map.key?(name) | ||
application.incoming_map[name] | ||
else | ||
raise(name ? "unable to find incoming with name #{name}" : "You have no incoming setup.") | ||
end | ||
|
||
IncomingRunner.new(incoming) | ||
end | ||
|
||
end | ||
|
||
IncomingRunnerTask.start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/usr/bin/env ruby | ||
|
||
require 'rubygems' | ||
begin | ||
require 'messed' | ||
rescue LoadError | ||
if ENV['MESSED_HOME'] | ||
require File.join(ENV['MESSED_HOME'], 'lib', 'messed') | ||
else | ||
raise("no messed!") | ||
end | ||
end | ||
|
||
require 'thor' | ||
|
||
class WebTask < Thor | ||
|
||
method_options :detach => false | ||
method_options :environment => "development" | ||
desc "start [NAME]", "start an incoming instance" | ||
def start(name = nil) | ||
|
||
|
||
|
||
end | ||
|
||
end | ||
|
||
IncomingRunnerTask.start |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
development: &default | ||
search: | ||
mode: incoming | ||
adapter: twitter_search | ||
fetch: | ||
query: | ||
q: '#sos09' | ||
host: search.twitter.com | ||
path: search.json | ||
interval: 10 | ||
|
||
twitter_sender: | ||
mode: outgoing | ||
adapter: twitter_sender | ||
username: joshbuddy | ||
password: testing | ||
|
||
production: | ||
*default |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
require 'spec/spec_helper' | ||
|
||
describe "test" do | ||
|
||
include MessedSpecHelper | ||
|
||
it "should have a test" do | ||
process('this is my message') | ||
outgoing_messages.size.should == 1 | ||
outgoing_messages.first.body.should == "well, that was fun" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--colour | ||
--format | ||
specdoc | ||
--loadby | ||
mtime | ||
--reverse | ||
--backtrace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
require 'rubygems' | ||
begin | ||
require 'messed' | ||
rescue LoadError | ||
if ENV['MESSED_HOME'] | ||
require File.join(ENV['MESSED_HOME'], 'lib', 'messed') | ||
else | ||
raise("no messed!") | ||
end | ||
end | ||
|
||
class MessedSpecHolder | ||
|
||
attr_accessor :booter, :outgoing_messages | ||
|
||
def initialize | ||
@booter = Messed::Booter.new(File.join(File.dirname(__FILE__), '..')) | ||
end | ||
|
||
def application | ||
@booter.application | ||
end | ||
|
||
def process(message) | ||
@outgoing_messages = application.process(application.message_class.new(message)) | ||
end | ||
|
||
end | ||
|
||
|
||
|
||
module MessedSpecHelper | ||
|
||
Holder = MessedSpecHolder.new | ||
|
||
def process(message) | ||
Holder.process(message) | ||
end | ||
|
||
def outgoing_messages | ||
Holder.outgoing_messages | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.