adhearsion 2.6.1 → 2.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2ef70103a6c0eadf344f944bb236e74a6c1e8116
4
- data.tar.gz: 2f0705427413a8bb1965be2dd6325287d028854c
3
+ metadata.gz: f016136353daef3f5147c6aaf41345af3b9c82ca
4
+ data.tar.gz: 24e4268df718960405ab9475c9bd4864763d78ce
5
5
  SHA512:
6
- metadata.gz: e850ffe24ecbe3052ad61472740a94e131a36e0ba7e6d9079f54935aa147d4b4139386120a9df399aea47d1dee2369af3c0b63b06602710a4af56bbbe548d268
7
- data.tar.gz: 1cc9eec318b364d111496940502d3027163aa22b06c286a6cfb1886c85b6b82dce96c4d26181e3ff51f3bffb9229db1a208b38a5437c193764ce2de2d2d015f9
6
+ metadata.gz: 809fe06dee2ee0873ace49874c852e10d2cc40b057ac2978336a826852500424a589eec77377ee2ef20060759dbf4e8864bda0b556345112e658e5c6ee22f594
7
+ data.tar.gz: 4c7ab3f38feb787c356637aadda684a45d95c038be18b8396077a3823d63a2f0a0424940414d89d9bd24dfcc53016255142f9103807a03c7bbe93034fa1f3b69
@@ -1,5 +1,8 @@
1
1
  # [develop](https://github.com/adhearsion/adhearsion)
2
2
 
3
+ # [2.6.2](https://github.com/adhearsion/adhearsion/compare/v2.6.1...v2.6.2) - [2015-06-16](https://rubygems.org/gems/adhearsion/versions/2.6.2)
4
+ * Bugfix: Properly load application bundle. This requires the spawning removed in [#534](https://github.com/adhearsion/adhearsion/pull/534).
5
+
3
6
  # [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
7
  * 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
8
  * Bugfix: Executing ahn commands (such as start) won't spawn any sub-rubies underneath
data/bin/ahn CHANGED
@@ -1,5 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'adhearsion/cli'
4
- # when script/ahn gets loaded it does AhnCommand.start
5
- Adhearsion::ScriptAhnLoader.load_script_ahn || Adhearsion::CLI::AhnCommand.start
4
+ Adhearsion::CLI::AhnCommand.start
@@ -1,4 +1,10 @@
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
+
3
9
  require 'adhearsion'
4
10
  require 'adhearsion/cli_commands'
@@ -1,7 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
- require 'adhearsion/script_ahn_loader'
4
-
5
3
  module Adhearsion
6
4
  module CLI
7
5
  class AhnCommand < Thor
@@ -102,25 +100,32 @@ module Adhearsion
102
100
 
103
101
  def start_app(path, mode, pid_file = nil)
104
102
  path = execute_from_app_dir! path
105
- say "Starting Adhearsion server at #{path}"
103
+ say "Starting Adhearsion server at #{Dir.pwd}"
106
104
  Adhearsion::Initializer.start :mode => mode, :pid_file => pid_file
107
105
  end
108
106
 
109
107
  def execute_from_app_dir!(path)
110
- return Dir.pwd if in_app?
108
+ if in_app? and running_script_ahn?
109
+ return Dir.pwd
110
+ end
111
111
 
112
- path = nil if path && path.empty?
113
112
  path ||= Dir.pwd if in_app?
114
113
 
115
- raise PathRequired, ARGV[0] if path.nil?
116
- raise PathInvalid, path unless File.directory?(path)
114
+ raise PathRequired, ARGV[0] if path.nil? or path.empty?
117
115
 
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) }
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
121
122
  path
122
123
  end
123
124
 
125
+ def running_script_ahn?
126
+ $0.to_s == "script/ahn"
127
+ end
128
+
124
129
  def in_app?
125
130
  ScriptAhnLoader.in_ahn_application? or ScriptAhnLoader.in_ahn_application_subdirectory?
126
131
  end
@@ -8,28 +8,25 @@ 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.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
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
20
19
  end
21
- nil
20
+ rescue SystemCallError
21
+ # could not chdir, no problem just return
22
22
  end
23
23
 
24
- def self.in_ahn_application?(path = nil)
25
- return File.exists? SCRIPT_AHN unless path
24
+ def self.in_ahn_application?(path = '.')
26
25
  Dir.chdir(path) { File.exists? SCRIPT_AHN }
27
26
  end
28
27
 
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)
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)
33
30
  end
34
31
  end
35
32
  end
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Adhearsion
4
- VERSION = '2.6.1'
4
+ VERSION = '2.6.2'
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.1
4
+ version: 2.6.2
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-06-15 00:00:00.000000000 Z
14
+ date: 2015-06-16 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: activesupport