adhearsion 0.7.7 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (179) hide show
  1. data/CHANGELOG +9 -42
  2. data/EVENTS +11 -0
  3. data/README.txt +5 -0
  4. data/Rakefile +94 -84
  5. data/adhearsion.gemspec +148 -0
  6. data/app_generators/ahn/USAGE +5 -0
  7. data/app_generators/ahn/ahn_generator.rb +87 -0
  8. data/app_generators/ahn/templates/.ahnrc +34 -0
  9. data/app_generators/ahn/templates/README +8 -0
  10. data/app_generators/ahn/templates/Rakefile +23 -0
  11. data/app_generators/ahn/templates/components/ami_remote/ami_remote.rb +15 -0
  12. data/app_generators/ahn/templates/components/disabled/HOW_TO_ENABLE +7 -0
  13. data/app_generators/ahn/templates/components/disabled/stomp_gateway/README.markdown +47 -0
  14. data/app_generators/ahn/templates/components/disabled/stomp_gateway/config.yml +12 -0
  15. data/app_generators/ahn/templates/components/disabled/stomp_gateway/stomp_gateway.rb +34 -0
  16. data/app_generators/ahn/templates/components/restful_rpc/README.markdown +11 -0
  17. data/app_generators/ahn/templates/components/restful_rpc/config.yml +34 -0
  18. data/app_generators/ahn/templates/components/restful_rpc/example-client.rb +48 -0
  19. data/app_generators/ahn/templates/components/restful_rpc/restful_rpc.rb +87 -0
  20. data/app_generators/ahn/templates/components/restful_rpc/spec/restful_rpc_spec.rb +263 -0
  21. data/app_generators/ahn/templates/components/simon_game/simon_game.rb +56 -0
  22. data/app_generators/ahn/templates/config/startup.rb +50 -0
  23. data/app_generators/ahn/templates/dialplan.rb +3 -0
  24. data/app_generators/ahn/templates/events.rb +32 -0
  25. data/bin/ahn +28 -0
  26. data/bin/ahnctl +68 -0
  27. data/bin/jahn +42 -0
  28. data/examples/asterisk_manager_interface/standalone.rb +51 -0
  29. data/lib/adhearsion.rb +35 -953
  30. data/lib/adhearsion/cli.rb +223 -0
  31. data/lib/adhearsion/component_manager.rb +208 -0
  32. data/lib/adhearsion/component_manager/component_tester.rb +55 -0
  33. data/lib/adhearsion/component_manager/spec_framework.rb +24 -0
  34. data/lib/adhearsion/events_support.rb +84 -0
  35. data/lib/adhearsion/foundation/all.rb +9 -0
  36. data/lib/adhearsion/foundation/blank_slate.rb +5 -0
  37. data/lib/adhearsion/foundation/custom_daemonizer.rb +45 -0
  38. data/lib/adhearsion/foundation/event_socket.rb +203 -0
  39. data/lib/adhearsion/foundation/future_resource.rb +36 -0
  40. data/lib/adhearsion/foundation/global.rb +1 -0
  41. data/lib/adhearsion/foundation/metaprogramming.rb +17 -0
  42. data/lib/adhearsion/foundation/numeric.rb +13 -0
  43. data/lib/adhearsion/foundation/pseudo_guid.rb +10 -0
  44. data/lib/adhearsion/foundation/relationship_properties.rb +42 -0
  45. data/lib/adhearsion/foundation/string.rb +26 -0
  46. data/lib/adhearsion/foundation/synchronized_hash.rb +96 -0
  47. data/lib/adhearsion/foundation/thread_safety.rb +7 -0
  48. data/lib/adhearsion/host_definitions.rb +67 -0
  49. data/lib/adhearsion/initializer.rb +373 -0
  50. data/lib/adhearsion/initializer/asterisk.rb +81 -0
  51. data/lib/adhearsion/initializer/configuration.rb +254 -0
  52. data/lib/adhearsion/initializer/database.rb +49 -0
  53. data/lib/adhearsion/initializer/drb.rb +31 -0
  54. data/lib/adhearsion/initializer/freeswitch.rb +22 -0
  55. data/lib/adhearsion/initializer/rails.rb +40 -0
  56. data/lib/adhearsion/logging.rb +92 -0
  57. data/lib/adhearsion/tasks.rb +16 -0
  58. data/lib/adhearsion/tasks/database.rb +5 -0
  59. data/lib/adhearsion/tasks/deprecations.rb +59 -0
  60. data/lib/adhearsion/tasks/generating.rb +20 -0
  61. data/lib/adhearsion/tasks/lint.rb +4 -0
  62. data/lib/adhearsion/tasks/testing.rb +37 -0
  63. data/lib/adhearsion/version.rb +9 -0
  64. data/lib/adhearsion/voip/asterisk.rb +4 -0
  65. data/lib/adhearsion/voip/asterisk/agi_server.rb +81 -0
  66. data/lib/adhearsion/voip/asterisk/commands.rb +1284 -0
  67. data/lib/adhearsion/voip/asterisk/config_generators/agents.conf.rb +140 -0
  68. data/lib/adhearsion/voip/asterisk/config_generators/config_generator.rb +101 -0
  69. data/lib/adhearsion/voip/asterisk/config_generators/queues.conf.rb +250 -0
  70. data/lib/adhearsion/voip/asterisk/config_generators/voicemail.conf.rb +240 -0
  71. data/lib/adhearsion/voip/asterisk/config_manager.rb +71 -0
  72. data/lib/adhearsion/voip/asterisk/manager_interface.rb +562 -0
  73. data/lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rb +1754 -0
  74. data/lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb +286 -0
  75. data/lib/adhearsion/voip/asterisk/manager_interface/ami_messages.rb +78 -0
  76. data/lib/adhearsion/voip/asterisk/manager_interface/ami_protocol_lexer_machine.rl +87 -0
  77. data/lib/adhearsion/voip/asterisk/special_dial_plan_managers.rb +80 -0
  78. data/lib/adhearsion/voip/asterisk/super_manager.rb +19 -0
  79. data/lib/adhearsion/voip/call.rb +440 -0
  80. data/lib/adhearsion/voip/call_routing.rb +64 -0
  81. data/lib/adhearsion/voip/commands.rb +9 -0
  82. data/lib/adhearsion/voip/constants.rb +39 -0
  83. data/lib/adhearsion/voip/conveniences.rb +18 -0
  84. data/lib/adhearsion/voip/dial_plan.rb +218 -0
  85. data/lib/adhearsion/voip/dsl/dialing_dsl.rb +151 -0
  86. data/lib/adhearsion/voip/dsl/dialing_dsl/dialing_dsl_monkey_patches.rb +37 -0
  87. data/lib/adhearsion/voip/dsl/dialplan/control_passing_exception.rb +27 -0
  88. data/lib/adhearsion/voip/dsl/dialplan/dispatcher.rb +124 -0
  89. data/lib/adhearsion/voip/dsl/dialplan/parser.rb +71 -0
  90. data/lib/adhearsion/voip/dsl/dialplan/thread_mixin.rb +16 -0
  91. data/lib/adhearsion/voip/dsl/numerical_string.rb +117 -0
  92. data/lib/adhearsion/voip/freeswitch/basic_connection_manager.rb +48 -0
  93. data/lib/adhearsion/voip/freeswitch/event_handler.rb +58 -0
  94. data/lib/adhearsion/voip/freeswitch/freeswitch_dialplan_command_factory.rb +129 -0
  95. data/lib/adhearsion/voip/freeswitch/inbound_connection_manager.rb +38 -0
  96. data/lib/adhearsion/voip/freeswitch/oes_server.rb +195 -0
  97. data/lib/adhearsion/voip/menu_state_machine/calculated_match.rb +80 -0
  98. data/lib/adhearsion/voip/menu_state_machine/matchers.rb +123 -0
  99. data/lib/adhearsion/voip/menu_state_machine/menu_builder.rb +58 -0
  100. data/lib/adhearsion/voip/menu_state_machine/menu_class.rb +149 -0
  101. data/lib/theatre.rb +151 -0
  102. data/lib/theatre/README.markdown +64 -0
  103. data/lib/theatre/callback_definition_loader.rb +84 -0
  104. data/lib/theatre/guid.rb +23 -0
  105. data/lib/theatre/invocation.rb +121 -0
  106. data/lib/theatre/namespace_manager.rb +153 -0
  107. data/lib/theatre/version.rb +2 -0
  108. metadata +160 -140
  109. data/.version +0 -1
  110. data/TODO +0 -71
  111. data/ahn +0 -223
  112. data/apps/default/Rakefile +0 -65
  113. data/apps/default/config/adhearsion.sqlite3 +0 -0
  114. data/apps/default/config/adhearsion.yml +0 -95
  115. data/apps/default/config/database.rb +0 -50
  116. data/apps/default/config/database.yml +0 -12
  117. data/apps/default/config/helpers/drb_server.yml +0 -43
  118. data/apps/default/config/helpers/factorial.alien.c.yml +0 -1
  119. data/apps/default/config/helpers/growler.yml +0 -21
  120. data/apps/default/config/helpers/lookup.yml +0 -1
  121. data/apps/default/config/helpers/manager_proxy.yml +0 -8
  122. data/apps/default/config/helpers/micromenus.yml +0 -1
  123. data/apps/default/config/helpers/micromenus/collab.rb +0 -60
  124. data/apps/default/config/helpers/micromenus/images/arrow-off.gif +0 -0
  125. data/apps/default/config/helpers/micromenus/images/arrow-on.gif +0 -0
  126. data/apps/default/config/helpers/micromenus/images/error.gif +0 -0
  127. data/apps/default/config/helpers/micromenus/images/folder-off.gif +0 -0
  128. data/apps/default/config/helpers/micromenus/images/folder-on.gif +0 -0
  129. data/apps/default/config/helpers/micromenus/images/folder.png +0 -0
  130. data/apps/default/config/helpers/micromenus/images/ggbridge.jpg +0 -0
  131. data/apps/default/config/helpers/micromenus/images/green.png +0 -0
  132. data/apps/default/config/helpers/micromenus/images/microbrowser.bg.gif +0 -0
  133. data/apps/default/config/helpers/micromenus/images/red.png +0 -0
  134. data/apps/default/config/helpers/micromenus/images/tux.bmp +0 -0
  135. data/apps/default/config/helpers/micromenus/images/url-off.gif +0 -0
  136. data/apps/default/config/helpers/micromenus/images/url-on.gif +0 -0
  137. data/apps/default/config/helpers/micromenus/images/yellow.png +0 -0
  138. data/apps/default/config/helpers/micromenus/javascripts/animation.js +0 -1341
  139. data/apps/default/config/helpers/micromenus/javascripts/carousel.js +0 -1238
  140. data/apps/default/config/helpers/micromenus/javascripts/columnav.js +0 -306
  141. data/apps/default/config/helpers/micromenus/javascripts/connection.js +0 -965
  142. data/apps/default/config/helpers/micromenus/javascripts/container.js +0 -4727
  143. data/apps/default/config/helpers/micromenus/javascripts/container_core.js +0 -2915
  144. data/apps/default/config/helpers/micromenus/javascripts/dom.js +0 -892
  145. data/apps/default/config/helpers/micromenus/javascripts/dragdrop.js +0 -2958
  146. data/apps/default/config/helpers/micromenus/javascripts/event.js +0 -1771
  147. data/apps/default/config/helpers/micromenus/javascripts/yahoo.js +0 -433
  148. data/apps/default/config/helpers/micromenus/stylesheets/carousel.css +0 -78
  149. data/apps/default/config/helpers/micromenus/stylesheets/columnav.css +0 -135
  150. data/apps/default/config/helpers/micromenus/stylesheets/microbrowsers.css +0 -42
  151. data/apps/default/config/helpers/multi_messenger.yml +0 -9
  152. data/apps/default/config/helpers/weather.yml +0 -1
  153. data/apps/default/config/helpers/xbmc.yml +0 -2
  154. data/apps/default/config/migration.rb +0 -59
  155. data/apps/default/extensions.rb +0 -41
  156. data/apps/default/helpers/factorial.alien.c +0 -32
  157. data/apps/default/helpers/growler.rb +0 -53
  158. data/apps/default/helpers/lookup.rb +0 -44
  159. data/apps/default/helpers/manager_proxy.rb +0 -112
  160. data/apps/default/helpers/micromenus.rb +0 -514
  161. data/apps/default/helpers/multi_messenger.rb +0 -53
  162. data/apps/default/helpers/oscar_wilde_quotes.rb +0 -197
  163. data/apps/default/helpers/weather.rb +0 -85
  164. data/apps/default/helpers/xbmc.rb +0 -39
  165. data/apps/default/logs/adhearsion.log +0 -0
  166. data/apps/default/logs/database.log +0 -0
  167. data/lib/constants.rb +0 -24
  168. data/lib/core_extensions.rb +0 -180
  169. data/lib/drb_server.rb +0 -101
  170. data/lib/logging.rb +0 -85
  171. data/lib/phone_number.rb +0 -85
  172. data/lib/rami.rb +0 -823
  173. data/lib/servlet_container.rb +0 -174
  174. data/lib/sexy_migrations.rb +0 -70
  175. data/test/asterisk_module_test.rb +0 -14
  176. data/test/core_extensions_test.rb +0 -26
  177. data/test/dial_test.rb +0 -43
  178. data/test/specs/numerical_string_spec.rb +0 -53
  179. data/test/test_micromenus.rb +0 -0
data/CHANGELOG CHANGED
@@ -1,43 +1,10 @@
1
- --- ADDED ---
2
- The "extension" dialplan variable is now handled with a special PhoneNumber class that resolves issues with extensions beginning with a zero.
3
- Added PBX.introduce which much more conveniently connects two endpoints.
4
- Can now use Asterisk dialplan methods like _('2XZNX32Z')
5
- Merged in the improved Micromenu GUI branch for modern browsers.
6
- Can now play() currency values. e.g.: play "$12.50"
7
- Did some preliminary work on Snom/Cisco support in Micromenus with a Snom employee at AstriDevCon.
8
- Broke up PhoneNumber into PhoneNumber and NumericalString. Wrote an RSpec for their functionality.
9
- Added the PBX.call_and_exec() method. Preliminary work on PBX.overhear()
10
- Implemented the redirection (~) unary operation to dialplan contexts. For example +just_dial in a dialplan executes the "just_dial" context and continues in the originating context. Doing ~just_dial executes "just_dial" and does not return to the originating context. What's more, the originating context is removed from the eval() context stack which could lead to some heavy memory use when used intensely.
11
- Added a super-simple dialplan method segment() which wraps code in a block so redo keywords can work for targeted dialplan segment.
12
- Added a patch by Bruce Williams of Five Runs who contributed some great code for generating Asterisk dialplan technology classes (i.e. IAX2/123 or SCCP/123123)
13
- The lookup() helper now also makes available a :name property
14
- Added default value of hangup_after_error to the config file.
15
- Adding file for making Adhearsion migrations much nicer
16
- Minor changes to speak()
17
- Minor improvement to the default migration to help people get up and running (and create new content at the end of a migration)
18
- Minor enhancement which makes dial() a little more intuitive when setting the :callerid hash key argument
19
- Other numerical variables received from Asterisk over AGI now use NumericalString instead of blowing up their thread.
20
- Added a SIP_URI constant regexp
21
- Can now give a Time object to play()
22
- Jabber events can now be handled much easier in the multi_messenger.rb helper
23
- Can now call detach!() in a dialplan to let Asterisk's extensions.conf continue executing.
24
- Can now call size() and length() on a Fixnum. Works just like num.to_s.size. Useful when working with numerical extensions.
25
- Can now give a Symbol to play(). Example -- play:beep
26
- Can now specify whether events should be captured by Adhearsion's AMI client.
27
- Can now specify whether incoming subscription requests should be automatically accepted
28
- Can now specify whether the Adhearsion AMI client should receive events or not by putting events: true or events:false in adhearsion.yml
29
- Added several new technology classes (SCCP, Local)
30
- Can now use sugary syntaxes like IAX/:foo/12
1
+ 0.8.1
31
2
 
32
- --- FIXED ---
33
- Fixed wait_for_digit timeout
34
- Fixed the speak() method. Now works with Festival (which comes by default with AsteriskNOW)
35
- Fixed a variable name that blew up the interpreter
36
- Fixed a comment suggestion
37
- Fixed a small syntactical error that prevented a helper from running.
38
- Fixed syntactical issues in the test file
39
- The factorial method had a mathematical error in it.
40
- Asterisk-played error messages are more verbose
41
- Fixed the wait_for_digit bug reported by ernieboy
42
- Fixed method_missing notifier method in PBX
43
- I no longer live in Dallas so I'm changing the startup message. :)
3
+
4
+
5
+ Notes from before 0.8.0:
6
+ - (NOTE: This is obviously not a comprehensive list of pre-0.8.0 work. 0.8.0 was a complete rewrite of the previous version)
7
+ - Adding a deprecation warning about Fixnum#digit and Fixnum#digits
8
+ - Removed the AMI class and replaced it with the ManagerInterface class.
9
+ - The old AMI high-level instance methods are available in the new ManagerInterface class, but a deprecation warning will be logged each time they're used. When the SuperManager class is implemented, they'll be removed entirely.
10
+ - Moved Theatre into Adhearsion's lib folder.
data/EVENTS ADDED
@@ -0,0 +1,11 @@
1
+ # Below are a list of framework events:
2
+
3
+ - after_initialized
4
+ - shutdown
5
+ - asterisk:
6
+ - manager_interface
7
+ - before_call
8
+ - failed_call
9
+ - call_hangup
10
+
11
+ # Note: This file is valid YAML for programatic parsing.
@@ -0,0 +1,5 @@
1
+ Adhearsion
2
+ by Jay Phillips, et. al
3
+ http://adhearsion.com
4
+
5
+ Adhearsion is an open-source framework written in Ruby designed to vastly improve Voice over IP development. It rests atop established telephony platforms (such as Asterisk and Freeswitch) and abstracts their complexity with the beauty of a well-designed, high-level suite of solutions.
data/Rakefile CHANGED
@@ -1,110 +1,120 @@
1
+ # -*- ruby -*-
2
+ ENV['RUBY_FLAGS'] = "-I#{%w(lib ext bin test).join(File::PATH_SEPARATOR)}"
3
+
1
4
  require 'rubygems'
2
- require 'rake/testtask'
3
- require 'rake/rdoctask'
4
5
  require 'rake/gempackagetask'
5
6
 
6
- ADHEARSION_VERSION = File.read('.version').strip
7
- Summary = %{Adhearsion is metaprogramming framework for developing collaboration software.}
8
-
9
- #task :default => [:test]
10
-
11
- #desc "Run the Adhearsion unit tests"
12
- #task :test do
13
- # Dir['test/*.rb'].each do |f| require f end
14
- #end
7
+ begin
8
+ require 'spec/rake/spectask'
9
+ rescue LoadError
10
+ abort "You must install RSpec: sudo gem install rspec"
11
+ end
15
12
 
16
- desc "Generate RDoc documentation for Adhearsion"
17
- Rake::RDocTask.new do |rdoc|
18
- rdoc.title = "Generated Adhearsion API Documentation"
19
- rdoc.rdoc_dir = File.join('docs', 'rdoc')
20
- rdoc.main = "lib/adhearsion.rb"
21
- rdoc.options << '-N' # For line numbers
13
+ begin
14
+ require 'yard'
15
+ YARD::Rake::YardocTask.new do |t|
16
+ t.files = ['lib/**/*.rb'] + %w[README.markdown TODO.markdown LICENSE]
17
+ end
18
+ rescue LoadError
19
+ STDERR.puts "\nCould not require() YARD! Install with 'gem install yard' to get the 'yardoc' task\n\n"
22
20
  end
23
21
 
24
- GEM_SPEC = Gem::Specification.new do |s|
25
-
26
- s.name = 'adhearsion'
27
- s.rubyforge_project = 'adhearsion'
28
- s.author = 'Jay Phillips'
29
- s.email = 'jay -at- codemecca dot com'
30
- s.version = ADHEARSION_VERSION
31
- s.summary = Summary
32
- s.homepage = 'http://adhearsion.com'
22
+ require 'lib/adhearsion/version'
33
23
 
34
- s.add_dependency 'activerecord', '>= 1.14.4'
35
- s.add_dependency 'rake', '>= 0.7.1'
36
- s.add_dependency 'daemons', '>= 1.0.5'
37
-
38
- s.platform = Gem::Platform::RUBY
39
- s.require_path = 'lib'
40
- s.executables = 'ahn'
41
- s.bindir = '.'
42
- s.extra_rdoc_files = ['LICENSE']
24
+ AHN_TESTS = ['spec/**/test_*.rb']
25
+ GEMSPEC = eval File.read("adhearsion.gemspec")
26
+ RAGEL_FILES = %w[lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb]
27
+ THEATRE_TESTS = 'theatre-spec/**/*_spec.rb'
43
28
 
44
- inc = Dir['**/*'] << '.version'
45
- exc = Dir['{log,pkg}/**/*']
46
-
47
- s.files = inc - exc
48
-
49
- # test_files = Dir['tests/*.rb'] # Will be added when not so buggy
29
+ begin
30
+ require 'rcov/rcovtask'
31
+ Rcov::RcovTask.new do |t|
32
+ t.test_files = Dir[*AHN_TESTS]
33
+ t.output_dir = 'coverage'
34
+ t.verbose = true
35
+ t.rcov_opts.concat %w[--sort coverage --sort-reverse -x gems -x /var --no-validator-links]
36
+ end
37
+ rescue LoadError
38
+ STDERR.puts "Could not load rcov tasks -- rcov does not appear to be installed. Continuing anyway."
50
39
  end
51
40
 
52
- Rake::GemPackageTask.new GEM_SPEC do |pkg|
53
- pkg.need_zip = false
54
- pkg.need_tar = false
55
- end
41
+ Rake::GemPackageTask.new(GEMSPEC).define
42
+
43
+ # YARD::Rake::YardocTask.new do |t|
44
+ # t.files = ['lib/**/*.rb'] # optional
45
+ # # t.options = ['--any', '--extra', '--opts'] # optional
46
+ # end
56
47
 
57
- desc "Pulls down the entire wiki in HTML format"
58
- task :wiki => [:rm_wiki] do
59
- require 'open-uri'
60
- File.open "wiki.zip",'a' do |f|
61
- f.write open('http://adhearsion.stikipad.com/codex/export_html').read
48
+ desc "Run the unit tests for Adhearsion"
49
+ task :spec do
50
+ Dir[*AHN_TESTS].each do |file|
51
+ load file
62
52
  end
63
- Dir.mkdir 'docs' unless File.exists? 'docs'
64
- `unzip -d docs/wiki wiki.zip`
65
- File.delete 'wiki.zip'
66
- puts `find docs/wiki`
67
53
  end
68
54
 
69
- desc "Removes all cached compiled RubyInline shared objects"
70
- task :purge_objects do
71
- `rm -rf ~/.ruby_inline/*`
55
+ desc "Check Ragel version"
56
+ task :check_ragel_version do
57
+ ragel_version_match = `ragel --version`.match(/(\d)\.(\d)+/)
58
+ abort "Could not get Ragel version! Is it installed? You must have at least version 6.3" unless ragel_version_match
59
+ big, small = ragel_version_match.captures.map { |n| n.to_i }
60
+ if big < 6 || (big == 6 && small < 3)
61
+ abort "Please upgrade Ragel! You're on version #{ragel_version_match[0]} and must be on 6.3 or later"
62
+ end
72
63
  end
73
64
 
74
- desc "Removes the local copy of the wiki"
75
- task :rm_wiki do
76
- `rm -rf wiki.zip docs/wiki/`
65
+ desc "Used to regenerate the AMI source code files. Note: requires Ragel 6.3 or later be installed on your system"
66
+ task :ragel => :check_ragel_version do
67
+ RAGEL_FILES.each do |ragel_file|
68
+ ruby_file = ragel_file.sub(".rl.rb", ".rb")
69
+ puts `ragel -n -R #{ragel_file} -o #{ruby_file} 2>&1`
70
+ raise "Failed generating code from Ragel file #{ragel_file}" if $?.to_i.nonzero?
71
+ end
77
72
  end
78
73
 
79
- desc "Prepares Adhearsion for a new release"
80
- task :prepare_release do
81
- # Remove log files
82
- Dir['log/*.log'].each do |f|
83
- puts "Removing file #{f}"
84
- File.delete f
74
+ desc "Generates a GraphVis document showing the Ragel state machine"
75
+ task :visualize_ragel => :check_ragel_version do
76
+ RAGEL_FILES.each do |ragel_file|
77
+ base_name = File.basename ragel_file, ".rl.rb"
78
+ puts "ragel -V #{ragel_file} -o #{base_name}.dot 2>&1"
79
+ puts `ragel -V #{ragel_file} -o #{base_name}.dot 2>&1`
80
+ raise "Failed generating code from Ragel file #{ragel_file}" if $?.to_i.nonzero?
85
81
  end
86
-
87
- # Check for unversioned files
88
- unversioned_files = `svn st | grep '^\?' | awk '{ print $2 }'`
89
- puts "WARNING: These files are not under version control:
90
- #{unversioned_files}" unless unversioned_files.empty?
91
82
  end
92
83
 
93
- desc "Simply prints the Adhearsion version."
94
- task :version do puts ADHEARSION_VERSION end
84
+ desc "Run all RSpecs for Theatre"
85
+ Spec::Rake::SpecTask.new("theatre_specs") do |t|
86
+ t.spec_files = FileList[THEATRE_TESTS]
87
+ end
95
88
 
96
- desc 'Reinstall the gem'
97
- task :update => [:repackage] do
98
- if `whoami`.chomp != 'root'
99
- puts "Must run this as root!"
100
- exit 1
89
+ desc "Compares Adhearsion's files with those listed in adhearsion.gemspec"
90
+ task :check_gemspec_files do
91
+
92
+ files_from_gemspec = ADHEARSION_FILES
93
+ files_from_filesystem = Dir.glob(File.dirname(__FILE__) + "/**/*").map do |filename|
94
+ filename[0...Dir.pwd.length] == Dir.pwd ? filename[(Dir.pwd.length+1)..-1] : filename
101
95
  end
102
- puts `gem uninstall adhearsion`
103
- `gem install pkg/adhearsion*.gem`
104
- puts "Done."
96
+ files_from_filesystem.reject! { |f| File.directory? f }
97
+
98
+ puts
99
+ puts 'Pipe this command to "grep -v \'spec/\' | grep -v test" to ignore test files'
100
+ puts
101
+ puts '##########################################'
102
+ puts '## Files on filesystem not in the gemspec:'
103
+ puts '##########################################'
104
+ puts((files_from_filesystem - files_from_gemspec).map { |f| " " + f })
105
+
106
+
107
+ puts '##########################################'
108
+ puts '## Files in gemspec not in the filesystem:'
109
+ puts '##########################################'
110
+ puts((files_from_gemspec - files_from_filesystem).map { |f| " " + f })
105
111
  end
106
112
 
107
- desc 'Creates the Trixbox RPM.'
108
- task :trixbox => [:repackage] do
109
- # Coming soon
113
+ desc "Test that the .gemspec file executes"
114
+ task :debug_gem do
115
+ require 'rubygems/specification'
116
+ gemspec = File.read('adhearsion.gemspec')
117
+ spec = nil
118
+ Thread.new { spec = eval("$SAFE = 3\n#{gemspec}") }.join
119
+ puts "SUCCESS: Gemspec runs at the $SAFE level 3."
110
120
  end
@@ -0,0 +1,148 @@
1
+ ADHEARSION_FILES = %w{
2
+ adhearsion.gemspec
3
+ app_generators/ahn/ahn_generator.rb
4
+ app_generators/ahn/templates/.ahnrc
5
+ app_generators/ahn/templates/components/ami_remote/ami_remote.rb
6
+ app_generators/ahn/templates/components/disabled/HOW_TO_ENABLE
7
+ app_generators/ahn/templates/components/disabled/stomp_gateway/config.yml
8
+ app_generators/ahn/templates/components/disabled/stomp_gateway/README.markdown
9
+ app_generators/ahn/templates/components/disabled/stomp_gateway/stomp_gateway.rb
10
+ app_generators/ahn/templates/components/restful_rpc/config.yml
11
+ app_generators/ahn/templates/components/restful_rpc/example-client.rb
12
+ app_generators/ahn/templates/components/restful_rpc/README.markdown
13
+ app_generators/ahn/templates/components/restful_rpc/restful_rpc.rb
14
+ app_generators/ahn/templates/components/restful_rpc/spec/restful_rpc_spec.rb
15
+ app_generators/ahn/templates/components/simon_game/simon_game.rb
16
+ app_generators/ahn/templates/config/startup.rb
17
+ app_generators/ahn/templates/dialplan.rb
18
+ app_generators/ahn/templates/events.rb
19
+ app_generators/ahn/templates/Rakefile
20
+ app_generators/ahn/templates/README
21
+ app_generators/ahn/USAGE
22
+ bin/ahn
23
+ bin/ahnctl
24
+ bin/jahn
25
+ CHANGELOG
26
+ EVENTS
27
+ examples/asterisk_manager_interface/standalone.rb
28
+ lib/adhearsion.rb
29
+ lib/adhearsion/cli.rb
30
+ lib/adhearsion/component_manager.rb
31
+ lib/adhearsion/component_manager/component_tester.rb
32
+ lib/adhearsion/component_manager/spec_framework.rb
33
+ lib/adhearsion/events_support.rb
34
+ lib/adhearsion/foundation/all.rb
35
+ lib/adhearsion/foundation/blank_slate.rb
36
+ lib/adhearsion/foundation/custom_daemonizer.rb
37
+ lib/adhearsion/foundation/event_socket.rb
38
+ lib/adhearsion/foundation/future_resource.rb
39
+ lib/adhearsion/foundation/global.rb
40
+ lib/adhearsion/foundation/metaprogramming.rb
41
+ lib/adhearsion/foundation/numeric.rb
42
+ lib/adhearsion/foundation/pseudo_guid.rb
43
+ lib/adhearsion/foundation/relationship_properties.rb
44
+ lib/adhearsion/foundation/string.rb
45
+ lib/adhearsion/foundation/synchronized_hash.rb
46
+ lib/adhearsion/foundation/thread_safety.rb
47
+ lib/adhearsion/host_definitions.rb
48
+ lib/adhearsion/initializer.rb
49
+ lib/adhearsion/initializer/asterisk.rb
50
+ lib/adhearsion/initializer/configuration.rb
51
+ lib/adhearsion/initializer/database.rb
52
+ lib/adhearsion/initializer/drb.rb
53
+ lib/adhearsion/initializer/freeswitch.rb
54
+ lib/adhearsion/initializer/rails.rb
55
+ lib/adhearsion/logging.rb
56
+ lib/adhearsion/tasks.rb
57
+ lib/adhearsion/tasks/database.rb
58
+ lib/adhearsion/tasks/deprecations.rb
59
+ lib/adhearsion/tasks/generating.rb
60
+ lib/adhearsion/tasks/lint.rb
61
+ lib/adhearsion/tasks/testing.rb
62
+ lib/adhearsion/version.rb
63
+ lib/adhearsion/voip/asterisk.rb
64
+ lib/adhearsion/voip/asterisk/agi_server.rb
65
+ lib/adhearsion/voip/asterisk/commands.rb
66
+ lib/adhearsion/voip/asterisk/config_generators/agents.conf.rb
67
+ lib/adhearsion/voip/asterisk/config_generators/config_generator.rb
68
+ lib/adhearsion/voip/asterisk/config_generators/queues.conf.rb
69
+ lib/adhearsion/voip/asterisk/config_generators/voicemail.conf.rb
70
+ lib/adhearsion/voip/asterisk/config_manager.rb
71
+ lib/adhearsion/voip/asterisk/manager_interface.rb
72
+ lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rb
73
+ lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb
74
+ lib/adhearsion/voip/asterisk/manager_interface/ami_messages.rb
75
+ lib/adhearsion/voip/asterisk/manager_interface/ami_protocol_lexer_machine.rl
76
+ lib/adhearsion/voip/asterisk/special_dial_plan_managers.rb
77
+ lib/adhearsion/voip/asterisk/super_manager.rb
78
+ lib/adhearsion/voip/call.rb
79
+ lib/adhearsion/voip/call_routing.rb
80
+ lib/adhearsion/voip/commands.rb
81
+ lib/adhearsion/voip/constants.rb
82
+ lib/adhearsion/voip/conveniences.rb
83
+ lib/adhearsion/voip/dial_plan.rb
84
+ lib/adhearsion/voip/dsl/dialing_dsl.rb
85
+ lib/adhearsion/voip/dsl/dialing_dsl/dialing_dsl_monkey_patches.rb
86
+ lib/adhearsion/voip/dsl/dialplan/control_passing_exception.rb
87
+ lib/adhearsion/voip/dsl/dialplan/dispatcher.rb
88
+ lib/adhearsion/voip/dsl/dialplan/parser.rb
89
+ lib/adhearsion/voip/dsl/dialplan/thread_mixin.rb
90
+ lib/adhearsion/voip/dsl/numerical_string.rb
91
+ lib/adhearsion/voip/freeswitch/basic_connection_manager.rb
92
+ lib/adhearsion/voip/freeswitch/event_handler.rb
93
+ lib/adhearsion/voip/freeswitch/freeswitch_dialplan_command_factory.rb
94
+ lib/adhearsion/voip/freeswitch/inbound_connection_manager.rb
95
+ lib/adhearsion/voip/freeswitch/oes_server.rb
96
+ lib/adhearsion/voip/menu_state_machine/calculated_match.rb
97
+ lib/adhearsion/voip/menu_state_machine/matchers.rb
98
+ lib/adhearsion/voip/menu_state_machine/menu_builder.rb
99
+ lib/adhearsion/voip/menu_state_machine/menu_class.rb
100
+ lib/theatre.rb
101
+ lib/theatre/callback_definition_loader.rb
102
+ lib/theatre/guid.rb
103
+ lib/theatre/invocation.rb
104
+ lib/theatre/namespace_manager.rb
105
+ lib/theatre/README.markdown
106
+ lib/theatre/version.rb
107
+ LICENSE
108
+ Rakefile
109
+ README.txt
110
+ }
111
+
112
+ Gem::Specification.new do |s|
113
+ s.name = "adhearsion"
114
+ s.version = "0.8.0"
115
+
116
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
117
+ s.authors = ["Jay Phillips"]
118
+
119
+ s.date = "2008-08-21"
120
+ s.description = "Adhearsion is an open-source telephony development framework"
121
+ s.email = "Jay -at- Codemecca.com"
122
+ s.executables = ["ahn", "ahnctl", "jahn"]
123
+
124
+ s.files = ADHEARSION_FILES
125
+
126
+ s.has_rdoc = false
127
+ s.homepage = "http://adhearsion.com"
128
+ s.require_paths = ["lib"]
129
+ s.rubyforge_project = "adhearsion"
130
+ s.rubygems_version = "1.2.0"
131
+ s.summary = "Adhearsion, open-source telephony development framework"
132
+
133
+ if s.respond_to? :specification_version then
134
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
135
+ s.specification_version = 2
136
+
137
+ if current_version >= 3 then
138
+ s.add_runtime_dependency("rubigen", [">= 1.0.6"])
139
+ s.add_runtime_dependency("log4r", [">= 1.0.5"])
140
+ else
141
+ s.add_dependency("rubigen", [">= 1.0.6"])
142
+ s.add_dependency("log4r", [">= 1.0.5"])
143
+ end
144
+ else
145
+ s.add_dependency("rubigen", [">= 1.0.6"])
146
+ s.add_dependency("log4r", [">= 1.0.5"])
147
+ end
148
+ end
@@ -0,0 +1,5 @@
1
+ Description:
2
+
3
+
4
+ Usage:
5
+
@@ -0,0 +1,87 @@
1
+ class AhnGenerator < RubiGen::Base
2
+
3
+ DEFAULT_SHEBANG = File.join(Config::CONFIG['bindir'],
4
+ Config::CONFIG['ruby_install_name'])
5
+
6
+ default_options :author => nil
7
+
8
+ attr_reader :name, :component
9
+
10
+ def initialize(runtime_args, runtime_options = {})
11
+ super
12
+ usage if args.empty?
13
+ @destination_root = File.expand_path(args.shift)
14
+ @name = base_name
15
+ @component = 'simon_game'
16
+ extract_options
17
+ end
18
+
19
+ def manifest
20
+ record do |m|
21
+ # Ensure appropriate folder(s) exists
22
+ m.directory ''
23
+ BASEDIRS.each { |path| m.directory path }
24
+
25
+ m.file *[".ahnrc"]*2
26
+
27
+ m.file *["components/simon_game/simon_game.rb"]*2
28
+ m.file *["components/ami_remote/ami_remote.rb"]*2
29
+
30
+ m.file *["components/disabled/stomp_gateway/stomp_gateway.rb"]*2
31
+ m.file *["components/disabled/stomp_gateway/config.yml"]*2
32
+ m.file *["components/disabled/stomp_gateway/README.markdown"]*2
33
+
34
+ m.file *["components/restful_rpc/restful_rpc.rb"]*2
35
+ m.file *["components/restful_rpc/config.yml"]*2
36
+ m.file *["components/restful_rpc/README.markdown"]*2
37
+ m.file *["components/restful_rpc/example-client.rb"]*2
38
+ m.file *["components/restful_rpc/spec/restful_rpc_spec.rb"]*2
39
+
40
+ m.file *["config/startup.rb"]*2
41
+ m.file *["dialplan.rb"]*2
42
+ m.file *["events.rb"]*2
43
+ m.file *["README"]*2
44
+ m.file *["Rakefile"]*2
45
+
46
+ # m.dependency "install_rubigen_scripts", [destination_root, 'ahn', 'adhearsion', 'test_spec'],
47
+ # :shebang => options[:shebang], :collision => :force
48
+ end
49
+ end
50
+
51
+ protected
52
+ def banner
53
+ <<-EOS
54
+ Creates a ...
55
+
56
+ USAGE: #{spec.name} name"
57
+ EOS
58
+ end
59
+
60
+ def add_options!(opts)
61
+ opts.separator ''
62
+ opts.separator 'Options:'
63
+ # For each option below, place the default
64
+ # at the top of the file next to "default_options"
65
+ # opts.on("-a", "--author=\"Your Name\"", String,
66
+ # "Some comment about this option",
67
+ # "Default: none") { |options[:author]| }
68
+ opts.on("-v", "--version", "Show the #{File.basename($0)} version number and quit.")
69
+ end
70
+
71
+ def extract_options
72
+ # for each option, extract it into a local variable (and create an "attr_reader :author" at the top)
73
+ # Templates can access these value via the attr_reader-generated methods, but not the
74
+ # raw instance variable value.
75
+ # @author = options[:author]
76
+ end
77
+
78
+ # Installation skeleton. Intermediate directories are automatically
79
+ # created so don't sweat their absence here.
80
+ BASEDIRS = %w(
81
+ components/simon_game
82
+ components/disabled/stomp_gateway
83
+ components/ami_remote
84
+ components/restful_rpc/spec
85
+ config
86
+ )
87
+ end