adhearsion 2.6.0 → 2.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -0
- data/CHANGELOG.md +5 -0
- data/bin/ahn +2 -1
- data/lib/adhearsion/call.rb +15 -10
- data/lib/adhearsion/cli.rb +0 -6
- data/lib/adhearsion/cli_commands/ahn_command.rb +10 -15
- data/lib/adhearsion/generators/app/templates/README.md +1 -1
- data/lib/adhearsion/generators/app/templates/Rakefile +7 -4
- data/lib/adhearsion/script_ahn_loader.rb +16 -13
- data/lib/adhearsion/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ef70103a6c0eadf344f944bb236e74a6c1e8116
|
4
|
+
data.tar.gz: 2f0705427413a8bb1965be2dd6325287d028854c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e850ffe24ecbe3052ad61472740a94e131a36e0ba7e6d9079f54935aa147d4b4139386120a9df399aea47d1dee2369af3c0b63b06602710a4af56bbbe548d268
|
7
|
+
data.tar.gz: 1cc9eec318b364d111496940502d3027163aa22b06c286a6cfb1886c85b6b82dce96c4d26181e3ff51f3bffb9229db1a208b38a5437c193764ce2de2d2d015f9
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# [develop](https://github.com/adhearsion/adhearsion)
|
2
2
|
|
3
|
+
# [2.6.1](https://github.com/adhearsion/adhearsion/compare/v2.6.0...v2.6.1) - [2015-06-15](https://rubygems.org/gems/adhearsion/versions/2.6.1)
|
4
|
+
* Bugfix: Improve Call initialization performance. Use an ActorProxy (subclass) instead of a method_missing definition on every Call.new. This considerably improves Call.new performance; benchmarks show approximately a 30-40% improvement: https://gist.github.com/kares/3576e272250204eb66d1
|
5
|
+
* Bugfix: Executing ahn commands (such as start) won't spawn any sub-rubies underneath
|
6
|
+
* Bugfix: Allow a generated app to execute Rake tasks with only production dependencies installed
|
7
|
+
|
3
8
|
# [2.6.0](https://github.com/adhearsion/adhearsion/compare/v2.5.4...v2.6.0) - [2015-02-01](https://rubygems.org/gems/adhearsion/versions/2.6.0)
|
4
9
|
* Feature: `Call#after_hangup_lifetime` optionally overrides `Adhearsion.config.platform.after_hangup_lifetime` ([#537](https://github.com/adhearsion/adhearsion/pull/537))
|
5
10
|
* Feature: Accept a `:cleanup` parameter in Dial options, which specifies a controller to be run on each outbound call before cleanup. ([#484](https://github.com/adhearsion/adhearsion/pull/484))
|
data/bin/ahn
CHANGED
data/lib/adhearsion/call.rb
CHANGED
@@ -16,22 +16,23 @@ module Adhearsion
|
|
16
16
|
CommandTimeout = Class.new Adhearsion::Error
|
17
17
|
ExpiredError = Class.new Celluloid::DeadActorError
|
18
18
|
|
19
|
+
# @private
|
20
|
+
class ActorProxy < Celluloid::ActorProxy
|
21
|
+
def method_missing(meth, *args, &block)
|
22
|
+
super(meth, *args, &block)
|
23
|
+
rescue ::Celluloid::DeadActorError
|
24
|
+
raise ExpiredError, "This call is expired and is no longer accessible. See http://adhearsion.com/docs/calls for further details."
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
19
28
|
include Celluloid
|
20
29
|
include HasGuardedHandlers
|
21
30
|
|
31
|
+
proxy_class Call::ActorProxy
|
32
|
+
|
22
33
|
execute_block_on_receiver :register_handler, :register_tmp_handler, :register_handler_with_priority, :register_handler_with_options, :register_event_handler, :on_joined, :on_unjoined, :on_end, :execute_controller, *execute_block_on_receiver
|
23
34
|
finalizer :finalize
|
24
35
|
|
25
|
-
def self.new(*args, &block)
|
26
|
-
super.tap do |proxy|
|
27
|
-
def proxy.method_missing(*args)
|
28
|
-
super
|
29
|
-
rescue Celluloid::DeadActorError
|
30
|
-
raise ExpiredError, "This call is expired and is no longer accessible. See http://adhearsion.com/docs/calls for further details."
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
36
|
# @return [Symbol] the reason for the call ending
|
36
37
|
attr_reader :end_reason
|
37
38
|
|
@@ -518,11 +519,15 @@ module Adhearsion
|
|
518
519
|
#
|
519
520
|
# Execute a call controller asynchronously against this call.
|
520
521
|
#
|
522
|
+
# To block and wait until the controller completes, call `#join` on the result of this method.
|
523
|
+
#
|
521
524
|
# @param [Adhearsion::CallController] controller an instance of a controller initialized for this call
|
522
525
|
# @param [Proc] a callback to be executed when the controller finishes execution
|
523
526
|
#
|
524
527
|
# @yield execute the current block as the body of a controller by specifying no controller instance
|
525
528
|
#
|
529
|
+
# @return [Celluloid::ThreadHandle]
|
530
|
+
#
|
526
531
|
def execute_controller(controller = nil, completion_callback = nil, &block)
|
527
532
|
raise ArgumentError, "Cannot supply a controller and a block at the same time" if controller && block_given?
|
528
533
|
controller ||= CallController.new current_actor, &block
|
data/lib/adhearsion/cli.rb
CHANGED
@@ -1,10 +1,4 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
require 'adhearsion/script_ahn_loader'
|
4
|
-
|
5
|
-
# If we are inside an Adhearsion application this method performs an exec and thus
|
6
|
-
# the rest of this script is not run.
|
7
|
-
Adhearsion::ScriptAhnLoader.exec_script_ahn!
|
8
|
-
|
9
3
|
require 'adhearsion'
|
10
4
|
require 'adhearsion/cli_commands'
|
@@ -1,5 +1,7 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
+
require 'adhearsion/script_ahn_loader'
|
4
|
+
|
3
5
|
module Adhearsion
|
4
6
|
module CLI
|
5
7
|
class AhnCommand < Thor
|
@@ -100,32 +102,25 @@ module Adhearsion
|
|
100
102
|
|
101
103
|
def start_app(path, mode, pid_file = nil)
|
102
104
|
path = execute_from_app_dir! path
|
103
|
-
say "Starting Adhearsion server at #{
|
105
|
+
say "Starting Adhearsion server at #{path}"
|
104
106
|
Adhearsion::Initializer.start :mode => mode, :pid_file => pid_file
|
105
107
|
end
|
106
108
|
|
107
109
|
def execute_from_app_dir!(path)
|
108
|
-
if in_app?
|
109
|
-
return Dir.pwd
|
110
|
-
end
|
110
|
+
return Dir.pwd if in_app?
|
111
111
|
|
112
|
+
path = nil if path && path.empty?
|
112
113
|
path ||= Dir.pwd if in_app?
|
113
114
|
|
114
|
-
raise PathRequired, ARGV[0] if path.nil?
|
115
|
+
raise PathRequired, ARGV[0] if path.nil?
|
116
|
+
raise PathInvalid, path unless File.directory?(path)
|
115
117
|
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
args[1] = '.'
|
120
|
-
ScriptAhnLoader.exec_script_ahn! args
|
121
|
-
end
|
118
|
+
raise PathInvalid, path unless ScriptAhnLoader.in_ahn_application?(path)
|
119
|
+
# load script/ahn which than boots the Rails environment :
|
120
|
+
Dir.chdir(path) { ScriptAhnLoader.load_script_ahn(path) }
|
122
121
|
path
|
123
122
|
end
|
124
123
|
|
125
|
-
def running_script_ahn?
|
126
|
-
$0.to_s == "script/ahn"
|
127
|
-
end
|
128
|
-
|
129
124
|
def in_app?
|
130
125
|
ScriptAhnLoader.in_ahn_application? or ScriptAhnLoader.in_ahn_application_subdirectory?
|
131
126
|
end
|
@@ -4,7 +4,10 @@ require File.expand_path('../config/environment', __FILE__)
|
|
4
4
|
|
5
5
|
require 'adhearsion/tasks'
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
7
|
+
begin
|
8
|
+
require 'rspec/core/rake_task'
|
9
|
+
RSpec::Core::RakeTask.new(:spec)
|
10
|
+
task :default => :spec
|
11
|
+
rescue LoadError
|
12
|
+
task :default => :about
|
13
|
+
end
|
@@ -8,25 +8,28 @@ module Adhearsion
|
|
8
8
|
RUBY = File.join(*RbConfig::CONFIG.values_at("bindir", "ruby_install_name")) + RbConfig::CONFIG["EXEEXT"]
|
9
9
|
SCRIPT_AHN = File.join('script', 'ahn')
|
10
10
|
|
11
|
-
def self.
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
11
|
+
def self.load_script_ahn(path = Dir.pwd)
|
12
|
+
path = Pathname.new(path).expand_path
|
13
|
+
until path.root?
|
14
|
+
script = File.join(path, SCRIPT_AHN)
|
15
|
+
if File.exists?(script)
|
16
|
+
load script
|
17
|
+
return true
|
18
|
+
end
|
19
|
+
path = path.parent
|
19
20
|
end
|
20
|
-
|
21
|
-
# could not chdir, no problem just return
|
21
|
+
nil
|
22
22
|
end
|
23
23
|
|
24
|
-
def self.in_ahn_application?(path =
|
24
|
+
def self.in_ahn_application?(path = nil)
|
25
|
+
return File.exists? SCRIPT_AHN unless path
|
25
26
|
Dir.chdir(path) { File.exists? SCRIPT_AHN }
|
26
27
|
end
|
27
28
|
|
28
|
-
def self.in_ahn_application_subdirectory?(path =
|
29
|
-
|
29
|
+
def self.in_ahn_application_subdirectory?(path = nil)
|
30
|
+
path = Pathname.new(path.nil? ? Dir.pwd : path)
|
31
|
+
File.exists?(File.join(path, SCRIPT_AHN)) ||
|
32
|
+
! path.root? && in_ahn_application_subdirectory?(path.parent)
|
30
33
|
end
|
31
34
|
end
|
32
35
|
end
|
data/lib/adhearsion/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: adhearsion
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.6.
|
4
|
+
version: 2.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jay Phillips
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2015-
|
14
|
+
date: 2015-06-15 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: activesupport
|