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
root
authored and
root
committed
Aug 15, 2013
1 parent
db0d831
commit 732f384
Showing
10 changed files
with
138 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
source "http://rubygems.org" | ||
|
||
# Specify your gem's dependencies in plugin-template.gemspec | ||
gemspec |
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 |
---|---|---|
@@ -1,4 +1,2 @@ | ||
adhearsion_sinatra | ||
================== | ||
|
||
Adhearsion Sinatra Plugin | ||
AdhearsionSinatra | ||
========================== |
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 @@ | ||
require "bundler/gem_tasks" |
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,32 @@ | ||
# -*- encoding: utf-8 -*- | ||
$:.push File.expand_path("../lib", __FILE__) | ||
require "adhearsion_sinatra/version" | ||
|
||
Gem::Specification.new do |s| | ||
s.name = "adhearsion_sinatra" | ||
s.version = AdhearsionSinatra::VERSION | ||
s.authors = ["Alvaro Parres"] | ||
s.email = ["aparres@gmail.com"] | ||
s.homepage = "" | ||
s.summary = "Sinatra Integration" | ||
s.description = "" | ||
|
||
s.rubyforge_project = "adhearsion_sinatra" | ||
|
||
# Use the following if using Git | ||
# s.files = `git ls-files`.split("\n") | ||
# s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") | ||
s.files = Dir.glob("{lib}/**/*") + %w( README.md Rakefile Gemfile) | ||
s.test_files = Dir.glob("{spec}/**/*") | ||
s.require_paths = ["lib"] | ||
|
||
s.add_runtime_dependency %q<adhearsion>, ["~> 2.3"] | ||
s.add_runtime_dependency %q<activesupport>, [">= 3.0.10"] | ||
s.add_runtime_dependency %q<sinatra>, [">= 1.4.0"] | ||
|
||
s.add_development_dependency %q<bundler>, ["~> 1.0"] | ||
s.add_development_dependency %q<rspec>, ["~> 2.5"] | ||
s.add_development_dependency %q<rake>, [">= 0"] | ||
s.add_development_dependency %q<mocha>, [">= 0"] | ||
s.add_development_dependency %q<guard-rspec> | ||
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,6 @@ | ||
#AdhearsionSinatra = Module.new | ||
require "adhearsion_sinatra/version" | ||
require "adhearsion_sinatra/plugin" | ||
#require "adhearsion_sinatra/controller_methods" | ||
require "adhearsion_sinatra/service" | ||
|
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,31 @@ | ||
module AdhearsionSinatra | ||
class Plugin < Adhearsion::Plugin | ||
# Actions to perform when the plugin is loaded | ||
# | ||
init :adhearsion_sinatra do | ||
logger.info "AdhearsionSinatra has been loaded" | ||
Service.start | ||
end | ||
|
||
# Basic configuration for the plugin | ||
# | ||
config :adhearsion_sinatra do | ||
bind '0.0.0.0', desc: "WebServer Bind Address to" | ||
port 4567, desc: "Defult Port Listen on" | ||
end | ||
|
||
# Defining a Rake task is easy | ||
# The following can be invoked with: | ||
# rake plugin_demo:info | ||
# | ||
tasks do | ||
namespace :adhearsion_sinatra do | ||
desc "Prints the PluginTemplate information" | ||
task :info do | ||
STDOUT.puts "AdhearsionSinatra plugin v. #{VERSION}" | ||
end | ||
end | ||
end | ||
|
||
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,21 @@ | ||
require 'sinatra/base' | ||
|
||
module AdhearsionSinatra | ||
class Service | ||
|
||
cattr_accessor :webserver | ||
|
||
class << self | ||
def start() | ||
@@webserver = Sinatra.new do | ||
set :environment, Adhearsion.config[:platform].environment | ||
set :bind, Adhearsion.config[:adhearsion_sinatra].bind | ||
set :port, Adhearsion.config[:adhearsion_sinatra].port | ||
end | ||
|
||
Thread.new { @@webserver.run! } | ||
|
||
end | ||
end | ||
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 @@ | ||
module AdhearsionSinatra | ||
VERSION = "0.0.1" | ||
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,26 @@ | ||
require 'spec_helper' | ||
|
||
module AdhearsionSinatra | ||
describe ControllerMethods do | ||
describe "mixed in to a CallController" do | ||
|
||
class TestController < Adhearsion::CallController | ||
include AdhearsionSinatra::ControllerMethods | ||
end | ||
|
||
let(:mock_call) { mock 'Call' } | ||
|
||
subject do | ||
TestController.new mock_call | ||
end | ||
|
||
describe "#greet" do | ||
it "greets with the correct parameter" do | ||
subject.expects(:play).once.with("Hello, Luca") | ||
subject.greet "Luca" | ||
end | ||
end | ||
|
||
end | ||
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,12 @@ | ||
require 'adhearsion' | ||
require 'adhearsion_sinatra' | ||
|
||
RSpec.configure do |config| | ||
config.color_enabled = true | ||
config.tty = true | ||
|
||
config.mock_with :mocha | ||
config.filter_run :focus => true | ||
config.run_all_when_everything_filtered = true | ||
end | ||
|