journeta 0.1.7 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. data/Gemfile +8 -0
  2. data/Gemfile.lock +20 -0
  3. data/{History.txt → HISTORY} +13 -1
  4. data/LICENSE +51 -0
  5. data/License.txt +2 -2
  6. data/{README.txt → README.rdoc} +12 -17
  7. data/Rakefile +46 -112
  8. data/VERSION +1 -0
  9. data/{examples/instant_messenger.rb → bin/journeta_instant_messenger.rb} +13 -0
  10. data/bin/journeta_mock_peers.rb +32 -0
  11. data/{examples/network_status.rb → bin/journeta_network_status.rb} +0 -0
  12. data/bin/journeta_peer_fuzzer.rb +54 -0
  13. data/{examples/queue_client.rb → bin/journeta_queue_client.rb} +0 -0
  14. data/{examples/queue_server.rb → bin/journeta_queue_server.rb} +0 -0
  15. data/bin/journeta_thread_leak_check.rb +16 -0
  16. data/bin/journeta_top.rb +73 -0
  17. data/{examples/instant_messenger_gui.rb → broken/journeta_instant_messenger_gui.rb} +0 -2
  18. data/broken/journeta_instant_messenger_shoes.rb +52 -0
  19. data/lib/diff.rb +280 -0
  20. data/lib/journeta.rb +1 -0
  21. data/lib/journeta/asynchronous.rb +2 -2
  22. data/lib/journeta/exception.rb +8 -0
  23. data/lib/journeta/journeta_engine.rb +4 -5
  24. data/lib/journeta/logger.rb +1 -1
  25. data/lib/journeta/peer_connection.rb +2 -2
  26. data/lib/journeta/peer_listener.rb +2 -2
  27. data/lib/journeta/presence_broadcaster.rb +19 -5
  28. data/lib/journeta/presence_listener.rb +8 -4
  29. data/lib/journeta/version.rb +6 -4
  30. data/rdoc/Array.html +199 -0
  31. data/rdoc/Diff.html +714 -0
  32. data/rdoc/Diffable.html +409 -0
  33. data/rdoc/Journeta.html +288 -0
  34. data/rdoc/Journeta/Asynchronous.html +429 -0
  35. data/rdoc/Journeta/Common.html +205 -0
  36. data/rdoc/Journeta/Common/BasicMessage.html +228 -0
  37. data/rdoc/Journeta/Common/DummyPeerHandler.html +237 -0
  38. data/rdoc/Journeta/Common/Job.html +279 -0
  39. data/rdoc/Journeta/Common/Shutdown.html +236 -0
  40. data/rdoc/Journeta/DefaultPeerHandler.html +248 -0
  41. data/rdoc/Journeta/DefaultPeerRegisteredHandler.html +249 -0
  42. data/rdoc/Journeta/DefaultPeerUnregisteredHandler.html +249 -0
  43. data/rdoc/Journeta/DefaultPeerUpdatedHandler.html +249 -0
  44. data/rdoc/Journeta/Engine.html +953 -0
  45. data/rdoc/Journeta/Logger.html +237 -0
  46. data/rdoc/Journeta/NotImplementedException.html +188 -0
  47. data/rdoc/Journeta/PeerConnection.html +549 -0
  48. data/rdoc/Journeta/PeerListener.html +276 -0
  49. data/rdoc/Journeta/PeerRegistry.html +804 -0
  50. data/rdoc/Journeta/PresenceBroadcaster.html +306 -0
  51. data/rdoc/Journeta/PresenceListener.html +300 -0
  52. data/rdoc/Journeta/PresenceMessage.html +321 -0
  53. data/rdoc/Journeta/VERSION.html +181 -0
  54. data/rdoc/README_rdoc.html +196 -0
  55. data/rdoc/String.html +199 -0
  56. data/rdoc/created.rid +20 -0
  57. data/rdoc/index.html +212 -0
  58. data/rdoc/lib/diff_rb.html +52 -0
  59. data/rdoc/lib/journeta/asynchronous_rb.html +60 -0
  60. data/rdoc/lib/journeta/common/basic_message_rb.html +52 -0
  61. data/rdoc/lib/journeta/common/dummy_peer_handler_rb.html +52 -0
  62. data/rdoc/lib/journeta/common/job_rb.html +52 -0
  63. data/rdoc/lib/journeta/common/shutdown_rb.html +52 -0
  64. data/rdoc/lib/journeta/exception_rb.html +55 -0
  65. data/rdoc/lib/journeta/journeta_engine_rb.html +62 -0
  66. data/rdoc/lib/journeta/logger_rb.html +55 -0
  67. data/rdoc/lib/journeta/peer_connection_rb.html +58 -0
  68. data/rdoc/lib/journeta/peer_handler_rb.html +52 -0
  69. data/rdoc/lib/journeta/peer_listener_rb.html +60 -0
  70. data/rdoc/lib/journeta/peer_registry_rb.html +54 -0
  71. data/rdoc/lib/journeta/presence_broadcaster_rb.html +57 -0
  72. data/rdoc/lib/journeta/presence_listener_rb.html +62 -0
  73. data/rdoc/lib/journeta/presence_message_rb.html +52 -0
  74. data/rdoc/lib/journeta/version_rb.html +52 -0
  75. data/rdoc/lib/journeta_rb.html +91 -0
  76. data/rdoc/rdoc.css +706 -0
  77. data/test/helper.rb +19 -0
  78. data/test/test_lifecycle.rb +49 -9
  79. data/website/images/arrow.png +0 -0
  80. data/website/images/banner.jpg +0 -0
  81. data/website/images/content_shadow.png +0 -0
  82. data/website/images/content_side.png +0 -0
  83. data/website/images/header.jpg +0 -0
  84. data/website/images/header_side.jpg +0 -0
  85. data/website/index.html +1 -1
  86. data/website/index.txt +1 -1
  87. data/website/stylesheets/reset.css +30 -0
  88. data/website/stylesheets/screen.css +1 -1
  89. metadata +152 -46
  90. data/test/test_event_broadcaster.rb +0 -15
  91. data/test/test_helper.rb +0 -4
  92. data/test/test_journeta.rb +0 -11
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source "http://rubygems.org"
2
+
3
+ group :development do
4
+ gem "shoulda", ">= 2.11.3"
5
+ gem "bundler", "~> 1.0.0"
6
+ gem "jeweler", "~> 1.5.2"
7
+ gem "rcov", ">= 0.9.9"
8
+ end
@@ -0,0 +1,20 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ git (1.2.5)
5
+ jeweler (1.5.2)
6
+ bundler (~> 1.0.0)
7
+ git (>= 1.2.5)
8
+ rake
9
+ rake (0.8.7)
10
+ rcov (0.9.9)
11
+ shoulda (2.11.3)
12
+
13
+ PLATFORMS
14
+ ruby
15
+
16
+ DEPENDENCIES
17
+ bundler (~> 1.0.0)
18
+ jeweler (~> 1.5.2)
19
+ rcov (>= 0.9.9)
20
+ shoulda (>= 2.11.3)
@@ -1,4 +1,16 @@
1
-
1
+ == 0.2.0 2011.03.17
2
+
3
+ * JRuby 1.6 finally support! And with fully native threads!!!
4
+ * Ruby 1.9 support. (Also with native threads.)
5
+ * Ruby 1.8 no longer active supported. (Never worked well on the old MRI, anyway.)
6
+ * Documentation updates and fixes.
7
+ * Protocol-compatible with 0.1.x series.
8
+ * Moving to "jeweler"-style packaging.
9
+ * Refactoring versioning.
10
+ * Still no great way to write deterministic tests for threaded components. :( (Help!)
11
+
12
+ == 0.1.7 2008-10-29
13
+ * Added JournetaEngine#known_peers_in_group(group_name), which returns a hash {uuid => peer} of peers in that group.
2
14
 
3
15
  == 0.1.6 2008-10-21
4
16
 
data/LICENSE ADDED
@@ -0,0 +1,51 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
10
+
11
+ "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
12
+
13
+ "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
14
+
15
+ "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
16
+
17
+ "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
18
+
19
+ "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
20
+
21
+ "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
22
+
23
+ "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
24
+
25
+ "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
26
+
27
+ "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
28
+
29
+ 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
30
+
31
+ 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
32
+
33
+ 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
34
+
35
+ You must give any other recipients of the Work or Derivative Works a copy of this License; and
36
+
37
+ You must cause any modified files to carry prominent notices stating that You changed the files; and
38
+
39
+ You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
40
+
41
+ If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
42
+ You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
43
+ 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
44
+
45
+ 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
46
+
47
+ 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
48
+
49
+ 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
50
+
51
+ 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
@@ -1,4 +1,4 @@
1
- Copyright (c) 2007, OpenRain, LLC. All rights reserved.
1
+ Copyright (c) 2011, Preston Lee Ventures, LLC. All rights reserved.
2
2
 
3
3
  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
4
4
 
@@ -6,6 +6,6 @@ Redistribution and use in source and binary forms, with or without modification,
6
6
 
7
7
  -Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8
8
 
9
- -Neither the name of the OpenRain, LLC nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
9
+ -Neither the name of the Preston Lee Ventures, LLC nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10
10
 
11
11
  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -6,14 +6,14 @@
6
6
  Journeta is a dirt simple peer discovery and message passing library for processes on the same LAN,
7
7
  requiring no advanced networking knowledge to use.
8
8
 
9
- Only core Ruby libraries are required, making the library fairly light. As all data is sent accross
9
+ Only core Ruby libraries are required, making the library fairly light. As all data is sent across
10
10
  the wire in YAML form, any arbitrary Ruby object can be sent to peers, provided they..
11
11
 
12
12
  * Are running a compatible Journeta version.
13
13
  * Have access to the same class definitions if you are sending your own custom objects.
14
14
  * Do not have a firewall preventing network I/O.
15
15
 
16
- Journeta uses Ruby threading to manage the asynchonous nature of peer-to-peer I/O.
16
+ Journeta uses Ruby threading to manage the asynchronous nature of peer-to-peer I/O.
17
17
  Data you send from your application thread will be queued and sent asynrchonously as soon as possible.
18
18
  For insight into events internal to the library, start ruby with the `--debug` options.
19
19
 
@@ -21,36 +21,31 @@ For insight into events internal to the library, start ruby with the `--debug` o
21
21
  == Use
22
22
 
23
23
 
24
- examples/instant_messenger.rb
24
+ journeta_instant_messenger.rb
25
25
 
26
26
  A completely distributed, zero-configuration-required chat room script.
27
27
  Fire up several instances in separate terminals. Multiple instances on the same machine is ok.
28
28
  Everything you type will automatically be sent to all other instances on the LAN!
29
- Use `ruby --debug examples/instant_messenger.rb` for detailed internal event details.
29
+ Use `ruby --debug journeta_instant_messenger.rb` for detailed internal event details.
30
30
 
31
- examples/instant_messenger_gui.rb
31
+ journeta_network_status.rb
32
32
 
33
- A GUI version of the above client. Require the wxruby gem. (`sudo gem install wxruby`)
33
+ Monitors the presence of all peers on the network.
34
34
 
35
- examples/queue_server.rb
36
- examples/queue_client.rb
35
+ journeta_queue_server.rb
36
+ journeta_queue_client.rb
37
37
 
38
38
  A simple queue managed by a server. Each client produces jobs to be queued, and processes jobs
39
39
  sent from the server(s). All nodes automatically find eachother. Try running multiples clients,
40
40
  and then multiple servers. Notice that when you have N servers, each job gets run N times,
41
41
  and not necessarilly by the same client!
42
-
43
- examples/network_status.rb
44
-
45
- Monitors the presence of all peers on the network.
46
-
47
42
 
48
43
  == Author
49
44
 
50
- Preston Lee <preston.lee at openrain d0t com>
51
- http://www.prestonlee.com
52
- http://www.openrain.com
53
-
45
+ Preston Lee
46
+ * http://www.prestonlee.com
47
+ * https://www.github.com/preston
48
+ * http://twitter.com/prestonism
54
49
 
55
50
  == Links
56
51
 
data/Rakefile CHANGED
@@ -1,123 +1,57 @@
1
1
  require 'rubygems'
2
- require 'rake'
3
- require 'rake/clean'
4
- require 'rake/testtask'
5
- require 'rake/packagetask'
6
- require 'rake/gempackagetask'
7
- require 'rake/rdoctask'
8
- require 'rake/contrib/rubyforgepublisher'
9
- require 'fileutils'
10
- require 'hoe'
11
-
12
- include FileUtils
13
- require File.join(File.dirname(__FILE__), 'lib', 'journeta', 'version')
14
-
15
- AUTHOR = 'Preston Lee' # can also be an array of Authors
16
- EMAIL = "preston.lee@openrain.com"
17
- DESCRIPTION = "A zero-configuration-required peer-to-peer (P2P) discovery and communications library for closed networks."
18
- GEM_NAME = 'journeta' # what ppl will type to install your gem
19
-
20
- @config_file = "~/.rubyforge/user-config.yml"
21
- @config = nil
22
- def rubyforge_username
23
- unless @config
24
- begin
25
- @config = YAML.load(File.read(File.expand_path(@config_file)))
26
- rescue
27
- puts <<-EOS
28
- ERROR: No rubyforge config file found: #{@config_file}"
29
- Run 'rubyforge setup' to prepare your env for access to Rubyforge
30
- - See http://newgem.rubyforge.org/rubyforge.html for more details
31
- EOS
32
- exit
33
- end
34
- end
35
- @rubyforge_username ||= @config["username"]
36
- end
37
-
38
- RUBYFORGE_PROJECT = 'journeta' # The unix name for your project
39
- HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
40
- DOWNLOAD_PATH = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
41
-
42
- NAME = "journeta"
43
- REV = nil
44
- # UNCOMMENT IF REQUIRED:
45
- # REV = `svn info`.each {|line| if line =~ /^Revision:/ then k,v = line.split(': '); break v.chomp; else next; end} rescue nil
46
- VERS = Journeta::VERSION::STRING + (REV ? ".#{REV}" : "")
47
- CLEAN.include ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store']
48
- RDOC_OPTS = ['--quiet', '--title', 'journeta documentation',
49
- "--opname", "index.html",
50
- "--line-numbers",
51
- "--main", "README",
52
- "--inline-source"]
53
-
54
- class Hoe
55
- def extra_deps
56
- @extra_deps.reject { |x| Array(x).first == 'hoe' }
57
- end
2
+ require 'bundler'
3
+
4
+ begin
5
+ Bundler.setup(:default, :development)
6
+ rescue Bundler::BundlerError => e
7
+ $stderr.puts e.message
8
+ $stderr.puts "Run `bundle install` to install missing gems"
9
+ exit e.status_code
58
10
  end
11
+ require 'rake'
59
12
 
60
- # Generate all the Rake tasks
61
- # Run 'rake -T' to see list of generated tasks (from gem root directory)
62
- hoe = Hoe.new(GEM_NAME, VERS) do |p|
63
- p.author = AUTHOR
64
- p.description = DESCRIPTION
65
- p.email = EMAIL
66
- p.summary = DESCRIPTION
67
- p.url = HOMEPATH
68
- p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
69
- p.test_globs = ["test/**/test_*.rb"]
70
- p.clean_globs |= CLEAN #An array of file patterns to delete on clean.
71
-
72
- # == Optional
73
- p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
74
- #p.extra_deps = [] # An array of rubygem dependencies [name, version], e.g. [ ['active_support', '>= 1.3.1'] ]
75
- #p.spec_extras = {} # A hash of extra values to set in the gemspec.
13
+ require 'jeweler'
14
+ Jeweler::Tasks.new do |gem|
15
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
16
+ gem.name = "journeta"
17
+ gem.homepage = "http://github.com/preston/journeta"
18
+ gem.license = "Apache 2.0"
19
+ gem.summary = %Q{A zero-configuration-required peer-to-peer (P2P) discovery and communications library for closed networks.}
20
+ gem.description = %Q{Journeta is a dirt simple peer discovery and message passing library for processes on the same LAN, requiring no advanced networking knowledge to use. Only core Ruby libraries are required, making the library fairly light. As all data is sent across the wire in YAML form, so any arbitrary Ruby object can be sent to peers, written in any language.}
21
+ gem.email = "conmotto@gmail.com"
22
+ gem.authors = ["Preston Lee"]
23
+ # Include your dependencies below. Runtime dependencies are required when using your gem,
24
+ # and development dependencies are only needed for development (ie running rake tasks, tests, etc)
25
+ # gem.add_runtime_dependency 'jabber4r', '> 0.1'
26
+ # gem.add_development_dependency 'rspec', '> 1.2.3'
76
27
  end
28
+ Jeweler::RubygemsDotOrgTasks.new
77
29
 
78
- CHANGES = hoe.paragraphs_of('History.txt', 0..1).join("\n\n")
79
- PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
80
- hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
81
-
82
- desc 'Generate website files'
83
- task :website_generate do
84
- Dir['website/**/*.txt'].each do |txt|
85
- sh %{ ruby scripts/txt2html #{txt} > #{txt.gsub(/txt$/,'html')} }
86
- end
30
+ require 'rake/testtask'
31
+ Rake::TestTask.new(:test) do |test|
32
+ test.libs << 'lib' << 'test'
33
+ test.pattern = 'test/**/test_*.rb'
34
+ test.verbose = true
87
35
  end
88
36
 
89
- desc 'Upload website files to rubyforge'
90
- task :website_upload do
91
- host = "#{rubyforge_username}@rubyforge.org"
92
- remote_dir = "/var/www/gforge-projects/#{PATH}/"
93
- local_dir = 'website'
94
- sh %{rsync -aCv #{local_dir}/ #{host}:#{remote_dir}}
37
+ require 'rcov/rcovtask'
38
+ Rcov::RcovTask.new do |test|
39
+ test.libs << 'test'
40
+ test.pattern = 'test/**/test_*.rb'
41
+ test.verbose = true
95
42
  end
96
43
 
97
- desc 'Generate and upload website files'
98
- task :website => [:website_generate, :website_upload, :publish_docs]
99
-
100
- desc 'Release the website and new gem version'
101
- task :deploy => [:check_version, :website, :release] do
102
- puts "Remember to create SVN tag:"
103
- puts "svn copy svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/trunk " +
104
- "svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/tags/REL-#{VERS} "
105
- puts "Suggested comment:"
106
- puts "Tagging release #{CHANGES}"
107
- end
44
+ task :default => :test
108
45
 
109
- desc 'Runs tasks website_generate and install_gem as a local deployment of the gem'
110
- task :local_deploy => [:website_generate, :install_gem]
111
-
112
- task :check_version do
113
- unless ENV['VERSION']
114
- puts 'Must pass a VERSION=x.y.z release version'
115
- exit
116
- end
117
- unless ENV['VERSION'] == VERS
118
- puts "Please update your version.rb to match the release version, currently #{VERS}"
119
- exit
120
- end
46
+ require 'rake/rdoctask'
47
+ Rake::RDocTask.new do |rdoc|
48
+ # version = File.exist?('VERSION') ? File.read('VERSION') : ""
49
+ require File.dirname(__FILE__) + '/lib/journeta/version'
50
+ version =
51
+
52
+
53
+ rdoc.rdoc_dir = 'rdoc'
54
+ rdoc.title = "journeta #{version}"
55
+ rdoc.rdoc_files.include('README*')
56
+ rdoc.rdoc_files.include('lib/**/*.rb')
121
57
  end
122
-
123
-
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.2.0
@@ -1,4 +1,17 @@
1
1
  #!/usr/bin/env ruby
2
+
3
+ banner =<<EOL
4
+ An IRC-like, serverless instant messenger for local area networks.
5
+ Fire up one or more of these on your local network-connected machine.
6
+ Copyright 2011, Preston Lee. http://prestonlee.com
7
+
8
+ Usage: #{$0}
9
+
10
+ EOL
11
+
12
+ puts banner
13
+
14
+
2
15
  current_dir = File.dirname(File.expand_path(__FILE__))
3
16
  lib_path = File.join(current_dir, '..', 'lib')
4
17
  $LOAD_PATH.unshift lib_path
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # Creates a handful of "mock" peers on the network that are a member of all groups.
4
+ #
5
+ # Author: Preston Lee <conmotto@gmail.com>
6
+ #
7
+
8
+ current_dir = File.dirname(File.expand_path(__FILE__))
9
+ lib_path = File.join(current_dir, '..', 'lib')
10
+ $LOAD_PATH.unshift lib_path
11
+
12
+ require 'journeta'
13
+ include Journeta
14
+
15
+
16
+ COUNT = 5
17
+ puts "Creating #{COUNT} mock peers."
18
+ instances = []
19
+ for i in 1..COUNT
20
+ n = Engine.new(:peer_port => (12345 + i))
21
+ instances.push n
22
+ n.start
23
+ end
24
+
25
+
26
+ puts "Hit <ENTER> to stop all #{COUNT} peer instances exit."
27
+ gets
28
+ instances.each do |i|
29
+ i.stop
30
+ end
31
+
32
+ puts "All instances stopped. Exiting..."
@@ -0,0 +1,54 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ banner =<<EOL
4
+ Sends bogus data to all peer on the network. Test your application
5
+ with this tool to verify it can handle these cases correctly.
6
+
7
+ current_dir = File.dirname(File.expand_path(__FILE__))
8
+ lib_path = File.join(current_dir, '..', 'lib')
9
+ $LOAD_PATH.unshift lib_path
10
+
11
+ puts 'Sends a whole bunch of naughty stuff to peers to attempt to induce crashiness.'
12
+
13
+ # Load up the library!
14
+ require 'journeta'
15
+ include Journeta
16
+ include Journeta::Common
17
+
18
+ require 'pp'
19
+
20
+ # We'll join all group to invoke the maximum amount of nastiness.
21
+ # :groups => nil
22
+ @journeta = Engine.new
23
+
24
+ puts "Starting malicious peer..."
25
+ @journeta.start
26
+
27
+ puts "Finding peers..."
28
+ sleep Engine::DEFAULT_PRESENCE_PERIOD + 2
29
+
30
+ puts "Known groups.."
31
+ @journeta.known_groups.each do |g|
32
+ p g
33
+ end
34
+
35
+ def fuzz(data)
36
+ @journeta.send_to_known_peers(data)
37
+ end
38
+
39
+ class Journeta::Crap
40
+ attr_accessor :wtf
41
+ end
42
+
43
+ puts "Sending a whole bunch of bogus crap to all peers. MuahahahahHAHAHA!!!"
44
+ # fuzz(nil) # Client won't allow this :)
45
+ fuzz('wierd string!')
46
+ fuzz(Journeta::Crap.new)
47
+ #fuzz(Journeta::Crap)
48
+ fuzz(42)
49
+ fuzz(42.42)
50
+
51
+ puts "Shutting down the peer..."
52
+ @journeta.stop
53
+
54
+ puts "Exiting."