eric-adhearsion 0.7.999 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +8 -2
- data/EVENTS +11 -0
- data/Rakefile +96 -24
- data/adhearsion.gemspec +148 -0
- data/app_generators/ahn/ahn_generator.rb +24 -9
- data/app_generators/ahn/templates/.ahnrc +25 -3
- data/app_generators/ahn/templates/Rakefile +22 -2
- data/app_generators/ahn/templates/components/ami_remote/ami_remote.rb +15 -0
- data/app_generators/ahn/templates/components/disabled/HOW_TO_ENABLE +7 -0
- data/app_generators/ahn/templates/components/disabled/stomp_gateway/README.markdown +47 -0
- data/app_generators/ahn/templates/components/disabled/stomp_gateway/config.yml +12 -0
- data/app_generators/ahn/templates/components/disabled/stomp_gateway/stomp_gateway.rb +34 -0
- data/app_generators/ahn/templates/components/simon_game/{lib/simon_game.rb → simon_game.rb} +14 -19
- data/app_generators/ahn/templates/config/startup.rb +3 -6
- data/app_generators/ahn/templates/dialplan.rb +2 -3
- data/app_generators/ahn/templates/events.rb +32 -0
- data/bin/jahn +10 -0
- data/examples/asterisk_manager_interface/standalone.rb +51 -0
- data/lib/adhearsion.rb +17 -11
- data/lib/adhearsion/cli.rb +141 -24
- data/lib/adhearsion/component_manager.rb +169 -238
- data/lib/adhearsion/component_manager/component_tester.rb +55 -0
- data/lib/adhearsion/component_manager/spec_framework.rb +24 -0
- data/lib/adhearsion/events_support.rb +84 -0
- data/lib/adhearsion/{core_extensions → foundation}/all.rb +0 -0
- data/lib/adhearsion/{blank_slate.rb → foundation/blank_slate.rb} +0 -0
- data/lib/adhearsion/{core_extensions → foundation}/custom_daemonizer.rb +0 -0
- data/lib/adhearsion/foundation/event_socket.rb +203 -0
- data/lib/adhearsion/foundation/future_resource.rb +36 -0
- data/lib/adhearsion/{core_extensions → foundation}/global.rb +0 -0
- data/lib/adhearsion/{core_extensions → foundation}/metaprogramming.rb +0 -0
- data/lib/adhearsion/foundation/numeric.rb +13 -0
- data/lib/adhearsion/foundation/pseudo_guid.rb +10 -0
- data/lib/adhearsion/{core_extensions → foundation}/relationship_properties.rb +2 -0
- data/lib/adhearsion/foundation/string.rb +26 -0
- data/lib/adhearsion/foundation/synchronized_hash.rb +96 -0
- data/lib/adhearsion/{core_extensions → foundation}/thread_safety.rb +0 -0
- data/lib/adhearsion/host_definitions.rb +5 -1
- data/lib/adhearsion/initializer.rb +229 -73
- data/lib/adhearsion/initializer/asterisk.rb +33 -11
- data/lib/adhearsion/initializer/configuration.rb +58 -6
- data/lib/adhearsion/initializer/database.rb +3 -46
- data/lib/adhearsion/initializer/drb.rb +9 -3
- data/lib/adhearsion/initializer/freeswitch.rb +3 -3
- data/lib/adhearsion/initializer/rails.rb +1 -1
- data/lib/adhearsion/tasks.rb +2 -1
- data/lib/adhearsion/tasks/deprecations.rb +59 -0
- data/lib/adhearsion/version.rb +3 -3
- data/lib/adhearsion/voip/asterisk.rb +2 -2
- data/lib/adhearsion/voip/asterisk/agi_server.rb +9 -6
- data/lib/adhearsion/voip/asterisk/commands.rb +106 -4
- data/lib/adhearsion/voip/asterisk/manager_interface.rb +562 -0
- data/lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rb +1754 -0
- data/lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb +286 -0
- data/lib/adhearsion/voip/asterisk/manager_interface/ami_messages.rb +78 -0
- data/lib/adhearsion/voip/asterisk/manager_interface/ami_protocol_lexer_machine.rl +87 -0
- data/lib/adhearsion/voip/asterisk/super_manager.rb +19 -0
- data/lib/adhearsion/voip/call.rb +51 -2
- data/lib/adhearsion/voip/dial_plan.rb +74 -61
- data/lib/adhearsion/voip/dsl/dialing_dsl.rb +1 -1
- data/lib/adhearsion/voip/dsl/dialplan/parser.rb +2 -6
- data/lib/adhearsion/voip/dsl/numerical_string.rb +2 -2
- data/lib/adhearsion/voip/freeswitch/oes_server.rb +2 -2
- data/lib/theatre.rb +151 -0
- data/lib/theatre/README.markdown +64 -0
- data/lib/theatre/callback_definition_loader.rb +84 -0
- data/lib/theatre/guid.rb +23 -0
- data/lib/theatre/invocation.rb +121 -0
- data/lib/theatre/namespace_manager.rb +153 -0
- data/lib/theatre/version.rb +2 -0
- metadata +63 -138
- data/Manifest.txt +0 -149
- data/README.txt +0 -6
- data/ahn_generators/component/USAGE +0 -5
- data/ahn_generators/component/component_generator.rb +0 -57
- data/ahn_generators/component/templates/configuration.rb +0 -0
- data/ahn_generators/component/templates/lib/lib.rb.erb +0 -3
- data/ahn_generators/component/templates/test/test.rb.erb +0 -12
- data/ahn_generators/component/templates/test/test_helper.rb +0 -14
- data/app_generators/ahn/templates/components/simon_game/configuration.rb +0 -0
- data/app_generators/ahn/templates/components/simon_game/test/test_helper.rb +0 -14
- data/app_generators/ahn/templates/components/simon_game/test/test_simon_game.rb +0 -31
- data/lib/adhearsion/core_extensions/array.rb +0 -0
- data/lib/adhearsion/core_extensions/guid.rb +0 -5
- data/lib/adhearsion/core_extensions/hash.rb +0 -0
- data/lib/adhearsion/core_extensions/numeric.rb +0 -4
- data/lib/adhearsion/core_extensions/proc.rb +0 -0
- data/lib/adhearsion/core_extensions/pseudo_uuid.rb +0 -11
- data/lib/adhearsion/core_extensions/publishable.rb +0 -73
- data/lib/adhearsion/core_extensions/string.rb +0 -26
- data/lib/adhearsion/core_extensions/thread.rb +0 -13
- data/lib/adhearsion/core_extensions/time.rb +0 -0
- data/lib/adhearsion/distributed/gateways/dbus_gateway.rb +0 -0
- data/lib/adhearsion/distributed/gateways/osa_gateway.rb +0 -0
- data/lib/adhearsion/distributed/gateways/rest_gateway.rb +0 -9
- data/lib/adhearsion/distributed/gateways/soap_gateway.rb +0 -9
- data/lib/adhearsion/distributed/gateways/xmlrpc_gateway.rb +0 -9
- data/lib/adhearsion/distributed/peer_finder.rb +0 -0
- data/lib/adhearsion/distributed/remote_cli.rb +0 -0
- data/lib/adhearsion/hooks.rb +0 -57
- data/lib/adhearsion/initializer/paths.rb +0 -55
- data/lib/adhearsion/services/scheduler.rb +0 -5
- data/lib/adhearsion/voip/asterisk/ami.rb +0 -147
- data/lib/adhearsion/voip/asterisk/ami/actions.rb +0 -238
- data/lib/adhearsion/voip/asterisk/ami/machine.rb +0 -871
- data/lib/adhearsion/voip/asterisk/ami/machine.rl +0 -109
- data/lib/adhearsion/voip/asterisk/ami/parser.rb +0 -262
- data/script/destroy +0 -14
- data/script/generate +0 -14
- data/spec/fixtures/dialplan.rb +0 -3
- data/spec/initializer/test_configuration.rb +0 -267
- data/spec/initializer/test_loading.rb +0 -162
- data/spec/initializer/test_paths.rb +0 -43
- data/spec/silence.rb +0 -10
- data/spec/test_ahn_command.rb +0 -149
- data/spec/test_code_quality.rb +0 -87
- data/spec/test_component_manager.rb +0 -97
- data/spec/test_constants.rb +0 -8
- data/spec/test_drb.rb +0 -104
- data/spec/test_helper.rb +0 -94
- data/spec/test_hooks.rb +0 -37
- data/spec/test_host_definitions.rb +0 -79
- data/spec/test_initialization.rb +0 -105
- data/spec/test_logging.rb +0 -80
- data/spec/test_relationship_properties.rb +0 -54
- data/spec/voip/asterisk/ami_response_definitions.rb +0 -23
- data/spec/voip/asterisk/config_file_generators/test_agents.rb +0 -253
- data/spec/voip/asterisk/config_file_generators/test_queues.rb +0 -325
- data/spec/voip/asterisk/config_file_generators/test_voicemail.rb +0 -306
- data/spec/voip/asterisk/menu_command/test_calculated_match.rb +0 -111
- data/spec/voip/asterisk/menu_command/test_matchers.rb +0 -98
- data/spec/voip/asterisk/mock_ami_server.rb +0 -176
- data/spec/voip/asterisk/test_agi_server.rb +0 -451
- data/spec/voip/asterisk/test_ami.rb +0 -227
- data/spec/voip/asterisk/test_commands.rb +0 -2006
- data/spec/voip/asterisk/test_config_manager.rb +0 -129
- data/spec/voip/dsl/dispatcher_spec_helper.rb +0 -45
- data/spec/voip/dsl/test_dialing_dsl.rb +0 -268
- data/spec/voip/dsl/test_dispatcher.rb +0 -82
- data/spec/voip/dsl/test_parser.rb +0 -87
- data/spec/voip/freeswitch/test_basic_connection_manager.rb +0 -39
- data/spec/voip/freeswitch/test_inbound_connection_manager.rb +0 -39
- data/spec/voip/freeswitch/test_oes_server.rb +0 -9
- data/spec/voip/test_call_routing.rb +0 -127
- data/spec/voip/test_dialplan_manager.rb +0 -372
- data/spec/voip/test_numerical_string.rb +0 -48
- data/spec/voip/test_phone_number.rb +0 -36
- data/test/test_ahn_generator.rb +0 -59
- data/test/test_component_generator.rb +0 -52
- data/test/test_generator_helper.rb +0 -20
@@ -1,48 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + "/../test_helper"
|
2
|
-
|
3
|
-
require 'adhearsion/voip/dsl/numerical_string'
|
4
|
-
require 'adhearsion/voip/constants'
|
5
|
-
|
6
|
-
context "A NumericalString" do
|
7
|
-
test "NumericalString should appear to be behave like a Fixnum in a case statement" do
|
8
|
-
assert 123 === numerical_string_for("123")
|
9
|
-
assert 987 === numerical_string_for("0987")
|
10
|
-
end
|
11
|
-
|
12
|
-
test "NumericalString should appear to behave like a String in a case statement" do
|
13
|
-
assert "123" === numerical_string_for("123")
|
14
|
-
assert "0987" === numerical_string_for("0987")
|
15
|
-
end
|
16
|
-
|
17
|
-
test "when compared against a Range that contains the numeric equivalent, the NumericalString is seen as a member" do
|
18
|
-
assert((100..200) === numerical_string_for("150"))
|
19
|
-
assert((100..200) === numerical_string_for("0150"))
|
20
|
-
assert !((100..200) === numerical_string_for("1000000"))
|
21
|
-
end
|
22
|
-
|
23
|
-
test "comparing against a regular expression works" do
|
24
|
-
assert %r|^\d+$| === numerical_string_for("027316287")
|
25
|
-
end
|
26
|
-
|
27
|
-
test "checking if a string representation of a number starts with a leading zero" do
|
28
|
-
with_leading_zeros = %w(01 01234 01.23 01.2)
|
29
|
-
without_leading_zeros = %w(1 1.2 0 0.0)
|
30
|
-
|
31
|
-
with_leading_zeros.each do |number|
|
32
|
-
assert numerical_string.starts_with_leading_zero?(number), number
|
33
|
-
end
|
34
|
-
|
35
|
-
without_leading_zeros.each do |number|
|
36
|
-
assert !numerical_string.starts_with_leading_zero?(number), number
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
private
|
41
|
-
def numerical_string
|
42
|
-
Adhearsion::VoIP::DSL::NumericalString
|
43
|
-
end
|
44
|
-
|
45
|
-
def numerical_string_for(string)
|
46
|
-
numerical_string.new(string)
|
47
|
-
end
|
48
|
-
end
|
@@ -1,36 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + "/../test_helper"
|
2
|
-
require 'adhearsion/voip/constants'
|
3
|
-
require 'adhearsion/voip/dsl/numerical_string'
|
4
|
-
|
5
|
-
|
6
|
-
# Use cases...
|
7
|
-
# case extension
|
8
|
-
# when US_NUMBER
|
9
|
-
# when (100..200)
|
10
|
-
# when _('12Z')
|
11
|
-
# when 123
|
12
|
-
# when "123"
|
13
|
-
# end
|
14
|
-
|
15
|
-
describe "A PhoneNumber" do
|
16
|
-
|
17
|
-
it "should have an ISN pattern-matching method" do
|
18
|
-
!! Adhearsion::VoIP::DSL::PhoneNumber.new("0115544332211").isn?.should == false
|
19
|
-
!! Adhearsion::VoIP::DSL::PhoneNumber.new("1*548").isn?.should == false
|
20
|
-
end
|
21
|
-
|
22
|
-
it "should have a US local number pattern-matching method" do
|
23
|
-
!! Adhearsion::VoIP::DSL::PhoneNumber.new("18887776665555").local_number?.should == false
|
24
|
-
!! Adhearsion::VoIP::DSL::PhoneNumber.new("18887776665555").national_number?.should == false
|
25
|
-
|
26
|
-
!! Adhearsion::VoIP::DSL::PhoneNumber.new("8887776665555").local_number?.should == false
|
27
|
-
!! Adhearsion::VoIP::DSL::PhoneNumber.new("8887776665555").national_number?.should == true
|
28
|
-
|
29
|
-
!! Adhearsion::VoIP::DSL::PhoneNumber.new("4445555").local_number?.should == true
|
30
|
-
!! Adhearsion::VoIP::DSL::PhoneNumber.new("4445555").national_number?.should == false
|
31
|
-
end
|
32
|
-
|
33
|
-
it "should convert from vanity numbers properly" do
|
34
|
-
Adhearsion::VoIP::DSL::PhoneNumber.from_vanity("1-800-FUDGEME").should == "18003834363"
|
35
|
-
end
|
36
|
-
end
|
data/test/test_ahn_generator.rb
DELETED
@@ -1,59 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), "test_generator_helper.rb")
|
2
|
-
|
3
|
-
class TestAhnGenerator < Test::Unit::TestCase
|
4
|
-
include RubiGen::GeneratorTestHelper
|
5
|
-
|
6
|
-
def setup
|
7
|
-
bare_setup
|
8
|
-
end
|
9
|
-
|
10
|
-
def teardown
|
11
|
-
bare_teardown
|
12
|
-
end
|
13
|
-
|
14
|
-
# Some generator-related assertions:
|
15
|
-
# assert_generated_file(name, &block) # block passed the file contents
|
16
|
-
# assert_directory_exists(name)
|
17
|
-
# assert_generated_class(name, &block)
|
18
|
-
# assert_generated_module(name, &block)
|
19
|
-
# assert_generated_test_for(name, &block)
|
20
|
-
# The assert_generated_(class|module|test_for) &block is passed the body of the class/module within the file
|
21
|
-
# assert_has_method(body, *methods) # check that the body has a list of methods (methods with parentheses not supported yet)
|
22
|
-
#
|
23
|
-
# Other helper methods are:
|
24
|
-
# app_root_files - put this in teardown to show files generated by the test method (e.g. p app_root_files)
|
25
|
-
# bare_setup - place this in setup method to create the APP_ROOT folder for each test
|
26
|
-
# bare_teardown - place this in teardown method to destroy the TMP_ROOT or APP_ROOT folder after each test
|
27
|
-
|
28
|
-
def test_generator_without_options
|
29
|
-
run_generator('ahn', [APP_ROOT], sources)
|
30
|
-
assert_directory_exists "components/simon_game/lib"
|
31
|
-
assert_directory_exists "components/simon_game/test"
|
32
|
-
assert_directory_exists "config"
|
33
|
-
|
34
|
-
assert_generated_file "components/simon_game/configuration.rb"
|
35
|
-
assert_generated_file "components/simon_game/lib/simon_game.rb"
|
36
|
-
assert_generated_file "components/simon_game/test/test_helper.rb"
|
37
|
-
assert_generated_file "components/simon_game/test/test_simon_game.rb"
|
38
|
-
assert_generated_file "config/startup.rb"
|
39
|
-
assert_generated_file "dialplan.rb"
|
40
|
-
assert_generated_file "README"
|
41
|
-
assert_generated_file "Rakefile"
|
42
|
-
|
43
|
-
assert_generated_class "components/simon_game/lib/simon_game" do |body|
|
44
|
-
assert_has_method body, "initialize"
|
45
|
-
assert_has_method body, "start"
|
46
|
-
assert_has_method body, "random_number"
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
private
|
51
|
-
def sources
|
52
|
-
[RubiGen::PathSource.new(:test, File.join(File.dirname(__FILE__),"..", generator_path))
|
53
|
-
]
|
54
|
-
end
|
55
|
-
|
56
|
-
def generator_path
|
57
|
-
"app_generators"
|
58
|
-
end
|
59
|
-
end
|
@@ -1,52 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), "test_generator_helper.rb")
|
2
|
-
|
3
|
-
class TestComponentGenerator < Test::Unit::TestCase
|
4
|
-
include RubiGen::GeneratorTestHelper
|
5
|
-
|
6
|
-
def setup
|
7
|
-
bare_setup
|
8
|
-
end
|
9
|
-
|
10
|
-
def teardown
|
11
|
-
bare_teardown
|
12
|
-
end
|
13
|
-
|
14
|
-
# Some generator-related assertions:
|
15
|
-
# assert_generated_file(name, &block) # block passed the file contents
|
16
|
-
# assert_directory_exists(name)
|
17
|
-
# assert_generated_class(name, &block)
|
18
|
-
# assert_generated_module(name, &block)
|
19
|
-
# assert_generated_test_for(name, &block)
|
20
|
-
# The assert_generated_(class|module|test_for) &block is passed the body of the class/module within the file
|
21
|
-
# assert_has_method(body, *methods) # check that the body has a list of methods (methods with parentheses not supported yet)
|
22
|
-
#
|
23
|
-
# Other helper methods are:
|
24
|
-
# app_root_files - put this in teardown to show files generated by the test method (e.g. p app_root_files)
|
25
|
-
# bare_setup - place this in setup method to create the APP_ROOT folder for each test
|
26
|
-
# bare_teardown - place this in teardown method to destroy the TMP_ROOT or APP_ROOT folder after each test
|
27
|
-
|
28
|
-
def test_generator_without_options
|
29
|
-
name = "bobs_game"
|
30
|
-
run_generator('component', [name], sources)
|
31
|
-
assert_directory_exists "components/bobs_game/lib"
|
32
|
-
assert_directory_exists "components/bobs_game/test"
|
33
|
-
assert_generated_file "components/bobs_game/configuration.rb"
|
34
|
-
|
35
|
-
assert_generated_file "components/bobs_game/lib/bobs_game.rb"
|
36
|
-
assert_generated_class "components/bobs_game/lib/bobs_game"
|
37
|
-
|
38
|
-
assert_generated_file "components/bobs_game/test/test_bobs_game.rb"
|
39
|
-
assert_generated_file "components/bobs_game/test/test_helper.rb"
|
40
|
-
|
41
|
-
end
|
42
|
-
|
43
|
-
private
|
44
|
-
def sources
|
45
|
-
[RubiGen::PathSource.new(:test, File.join(File.dirname(__FILE__),"..", generator_path))
|
46
|
-
]
|
47
|
-
end
|
48
|
-
|
49
|
-
def generator_path
|
50
|
-
"ahn_generators"
|
51
|
-
end
|
52
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
require 'test/unit'
|
2
|
-
require 'fileutils'
|
3
|
-
|
4
|
-
# Must set before requiring generator libs.
|
5
|
-
TMP_ROOT = File.dirname(__FILE__) + "/tmp" unless defined?(TMP_ROOT)
|
6
|
-
PROJECT_NAME = "myproject" unless defined?(PROJECT_NAME)
|
7
|
-
app_root = File.join(TMP_ROOT, PROJECT_NAME)
|
8
|
-
if defined?(APP_ROOT)
|
9
|
-
APP_ROOT.replace(app_root)
|
10
|
-
else
|
11
|
-
APP_ROOT = app_root
|
12
|
-
end
|
13
|
-
|
14
|
-
begin
|
15
|
-
require 'rubigen'
|
16
|
-
rescue LoadError
|
17
|
-
require 'rubygems'
|
18
|
-
require 'rubigen'
|
19
|
-
end
|
20
|
-
require 'rubigen/helpers/generator_test_helper'
|