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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cdd9595f782bf66bc47865e7738e5da1c973d842
4
- data.tar.gz: 916b8a0a4a2a07b0a7464f281c05d9a096043acf
3
+ metadata.gz: 2ef70103a6c0eadf344f944bb236e74a6c1e8116
4
+ data.tar.gz: 2f0705427413a8bb1965be2dd6325287d028854c
5
5
  SHA512:
6
- metadata.gz: 0114fe9c93594187df01011c321e33f754cb6d438d68d6d6bf670b63d926f0cbdae3c59929974c177d37bc724e664e465f0baa0d9b77797f33291bb193a0c77f
7
- data.tar.gz: cddca9472cccaa2e7a7a526d7bdd8a57f95ab2e5fa3bc171ef26463dcd4dbcacc289ab8947a7628e349f4e345295b79f6f4d1543ed56fbea1a59560e0664860f
6
+ metadata.gz: e850ffe24ecbe3052ad61472740a94e131a36e0ba7e6d9079f54935aa147d4b4139386120a9df399aea47d1dee2369af3c0b63b06602710a4af56bbbe548d268
7
+ data.tar.gz: 1cc9eec318b364d111496940502d3027163aa22b06c286a6cfb1886c85b6b82dce96c4d26181e3ff51f3bffb9229db1a208b38a5437c193764ce2de2d2d015f9
@@ -6,6 +6,9 @@ rvm:
6
6
  - jruby
7
7
  - rbx-2.1.1
8
8
  - ruby-head
9
+ jdk:
10
+ - openjdk7 # for jruby
11
+ before_script: export JRUBY_OPTS="--server -J-Xss1024k -J-Xmx652m -J-XX:+UseConcMarkSweepGC"
9
12
  matrix:
10
13
  allow_failures:
11
14
  - rvm: rbx-2.1.1
@@ -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
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'adhearsion/cli'
4
- Adhearsion::CLI::AhnCommand.start
4
+ # when script/ahn gets loaded it does AhnCommand.start
5
+ Adhearsion::ScriptAhnLoader.load_script_ahn || Adhearsion::CLI::AhnCommand.start
@@ -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
@@ -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 #{Dir.pwd}"
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? and running_script_ahn?
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? or path.empty?
115
+ raise PathRequired, ARGV[0] if path.nil?
116
+ raise PathInvalid, path unless File.directory?(path)
115
117
 
116
- Dir.chdir path do
117
- raise PathInvalid, path unless ScriptAhnLoader.in_ahn_application?
118
- args = ARGV.dup
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
@@ -8,7 +8,7 @@ Edit `extensions.conf` to include the following:
8
8
 
9
9
  ```
10
10
  [your_context_name]
11
- exten => _.,1,AGI(agi:async)
11
+ exten => _X.,1,AGI(agi:async)
12
12
 
13
13
  [adhearsion-redirect]
14
14
  exten => 1,1,AGI(agi:async)
@@ -4,7 +4,10 @@ require File.expand_path('../config/environment', __FILE__)
4
4
 
5
5
  require 'adhearsion/tasks'
6
6
 
7
- task :default => :spec
8
-
9
- require 'rspec/core/rake_task'
10
- RSpec::Core::RakeTask.new(:spec)
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.exec_script_ahn!(args = ARGV)
12
- cwd = Dir.pwd
13
- return unless in_ahn_application? || in_ahn_application_subdirectory?
14
- exec RUBY, SCRIPT_AHN, *args if in_ahn_application?
15
- Dir.chdir("..") do
16
- # Recurse in a chdir block: if the search fails we want to be sure
17
- # the application is generated in the original working directory.
18
- exec_script_ahn! unless cwd == Dir.pwd
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
- rescue SystemCallError
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 = Pathname.new(Dir.pwd))
29
- File.exists?(File.join(path, SCRIPT_AHN)) || !path.root? && in_ahn_application_subdirectory?(path.parent)
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
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Adhearsion
4
- VERSION = '2.6.0'
4
+ VERSION = '2.6.1'
5
5
  end
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.0
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-02-01 00:00:00.000000000 Z
14
+ date: 2015-06-15 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: activesupport