journeta 1.0.1 → 1.1.0

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: 361941ea5e08ddd7fcfa59e3adafd5e31666606b
4
- data.tar.gz: 02e58991533c2a50f6fca39d681add1293f0a6fe
3
+ metadata.gz: 93484934d0e2a10213416a4942854a91124688f7
4
+ data.tar.gz: 911cbf1c43161df88ea710a802ac69b6165b225b
5
5
  SHA512:
6
- metadata.gz: 13eb6ad992d707d1212756d6da29505daa045d13e650fa9292548874fc97b8c39f54e2848d4e75fe1e061423060b081caa266a68013c310709673fb5c6265c52
7
- data.tar.gz: 76eec4ec9b144dcac290b17d1a88c9e18a3de0e9c0c36c1fcac216d424692c4e046448a7dcaab9301e83cd874396d00f486ddeb8992a5880695907e7cb9c9496
6
+ metadata.gz: fb4db587ab1ac2db1f9dede36b0d82bb40cc26e4e8a814696c178b61e548f6204f4622efca26dde34fba462351cdd02027c85e699e63479763a1cf98ca356330
7
+ data.tar.gz: 477bb21b6c8922d10b95d156c4ef8085f3190791144717564f164f4184b56adab2c4a2aa5a1903ea37f334d916e5f1e8b712b19562a756561c059095c58079d6
@@ -0,0 +1,51 @@
1
+ # Journeta
2
+
3
+ ## About
4
+
5
+
6
+ Journeta is a dirt simple peer discovery and message passing library for processes on the same LAN,
7
+ requiring no advanced networking knowledge to use.
8
+
9
+ Only core Ruby libraries are required, making the library fairly light. As all data is sent across
10
+ the wire in YAML form, any arbitrary Ruby object can be sent to peers, provided they..
11
+
12
+ * Are running a compatible Journeta version.
13
+ * Have access to the same class definitions if you are sending your own custom objects.
14
+ * Do not have a firewall preventing network I/O.
15
+
16
+ Journeta uses Ruby threading to manage the asynchronous nature of peer-to-peer I/O.
17
+ Data you send from your application thread will be queued and sent asynrchonously as soon as possible.
18
+ For insight into events internal to the library, start ruby with the `--debug` options.
19
+
20
+
21
+ ## Use
22
+
23
+
24
+ ### Instant Messenger
25
+
26
+ A completely distributed, zero-configuration-required chat room script.
27
+
28
+ Fire up several instances in separate terminals. Multiple instances on the same machine is ok. Everything you type will automatically be sent to all other instances on the LAN! For detailed internal event details:
29
+
30
+ ruby --debug journeta_instant_messenger.rb
31
+
32
+ ### Network Status
33
+
34
+ Monitors the presence of all peers on the network.
35
+
36
+ journeta_network_status.rb
37
+
38
+ ### Distributed Master/Slave Job Queue
39
+
40
+ A simple queue managed by a server. Each client produces jobs to be queued, and processes jobs sent from the server(s). All nodes automatically find eachother. Try running multiples clients, and then multiple servers. Notice that when you have N servers, each job gets run N times, and not necessarilly by the same client!
41
+
42
+ journeta_queue_server.rb
43
+ journeta_queue_client.rb
44
+
45
+
46
+ ## Author
47
+
48
+ Preston Lee
49
+ * http://www.prestonlee.com
50
+ * https://www.github.com/preston
51
+ * http://twitter.com/prestonism
@@ -3,7 +3,7 @@
3
3
  banner =<<EOL
4
4
  An IRC-like, serverless instant messenger for local area networks.
5
5
  Fire up one or more of these on your local network-connected machine.
6
- Copyright 2011, Preston Lee. http://prestonlee.com
6
+ Copyright 2011-2016, Preston Lee. http://prestonlee.com
7
7
 
8
8
  Usage: #{$0}
9
9
 
@@ -90,11 +90,11 @@ begin
90
90
  m.text = input
91
91
  journeta.send_to_known_peers(m)
92
92
  end
93
- end
93
+ end
94
94
  end
95
95
 
96
96
 
97
97
 
98
98
  # The engine can be restarted and stopped as many times as you'd like.
99
99
  #journeta.start
100
- #journeta.stop
100
+ #journeta.stop
@@ -3,7 +3,7 @@
3
3
  banner =<<EOL
4
4
  Sends bogus data to all peer on the network. Test your application
5
5
  with this tool to verify it can handle these cases correctly.
6
-
6
+ EOL
7
7
  current_dir = File.dirname(File.expand_path(__FILE__))
8
8
  lib_path = File.join(current_dir, '..', 'lib')
9
9
  $LOAD_PATH.unshift lib_path
@@ -6,11 +6,14 @@ $LOAD_PATH.unshift lib_path
6
6
  require 'journeta'
7
7
  include Journeta
8
8
 
9
- #puts "Threads before start: #{Thread.count}"
9
+ def thread_count
10
+ Thread.list.inject(0) {|i,n| n.status == 'run' ? (i+1) : i}.to_s
11
+ end
12
+
13
+ puts 'Threads before start: ' + thread_count
10
14
 
11
15
  j = Engine.new
12
16
  j.start
13
- sleep 10
17
+ sleep 1 # Let it run very briefly.
14
18
  j.stop
15
-
16
- #puts "Threads after stop: #{Thread.count}"
19
+ puts 'Threads after stop: ' + thread_count
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.licenses = ["Apache 2.0"]
19
19
  spec.version = Journeta::VERSION
20
20
 
21
- spec.add_development_dependency 'curses', '>= 1.0.1'
22
- spec.add_development_dependency 'bundler', '>= 1.7.3'
23
- spec.add_development_dependency 'rake', '10.3.2'
21
+ spec.add_development_dependency 'curses', '>= 1.0.2'
22
+ spec.add_development_dependency 'bundler', '>= 1.12.5'
23
+ spec.add_development_dependency 'rake', '>= 11.2.2'
24
24
  end
@@ -1,21 +1,21 @@
1
1
  module Journeta
2
-
2
+
3
3
  module Common
4
-
4
+
5
5
  module Shutdown
6
-
6
+
7
7
  def stop_on_shutdown(engine)
8
8
  bye = Proc.new {
9
9
  engine.stop
10
10
  exit 0
11
11
  }
12
- Signal::trap("HUP", bye)
13
- Signal::trap("INT", bye)
14
- Signal::trap("KILL", bye)
12
+ Signal.trap("HUP", bye)
13
+ Signal.trap("INT", bye)
14
+ # Signal.trap("KILL", bye)
15
15
  end
16
-
16
+
17
17
  end
18
-
18
+
19
19
  end
20
-
21
- end
20
+
21
+ end
@@ -11,6 +11,6 @@ module Journeta
11
11
  $stderr.print("DEBUG: #{message}\n") if $DEBUG
12
12
  end
13
13
 
14
- end
14
+ end
15
15
 
16
- end
16
+ end
@@ -4,13 +4,13 @@ require 'journeta/asynchronous'
4
4
 
5
5
 
6
6
  module Journeta
7
-
7
+
8
8
  # Spams the local area network with metadata about the local instance.
9
9
  # This allows peers to make direct connections back at a later time.
10
10
  class PresenceBroadcaster < Journeta::Asynchronous
11
-
11
+
12
12
  attr_accessor :thread
13
-
13
+
14
14
  def go
15
15
  address = @engine.presence_address
16
16
  port = @engine.presence_port
@@ -44,7 +44,7 @@ module Journeta
44
44
  rescue
45
45
  puts "Native socket library not supported on this platform. Please submit a patch! Exiting since this is fatal :("
46
46
  exit 1
47
- end
47
+ end
48
48
  loop do
49
49
  putsd "Sending presence event."
50
50
  note = PresenceMessage.new uuid, peer_port, groups
@@ -53,10 +53,14 @@ module Journeta
53
53
  end
54
54
  ensure
55
55
  putsd "Closing event broadcaster socket."
56
- socket.close
56
+ begin
57
+ socket.close
58
+ rescue
59
+ # Oh well!
60
+ end
57
61
  end
58
62
  end
59
-
63
+
60
64
  end
61
-
65
+
62
66
  end
@@ -1,23 +1,23 @@
1
1
  module Journeta
2
-
2
+
3
3
  # A built-in data structure which gets broadcast across the network
4
4
  # for meta-data exchange purposes. A no-frills PORO.
5
5
  class PresenceMessage
6
-
6
+
7
7
  attr_accessor :version
8
8
  attr_accessor :uuid
9
9
  attr_accessor :peer_port
10
-
10
+
11
11
  # An Array of strings. May be empty but not nil. Ex: ['quick_chat', 'Preston Demo 1']
12
12
  attr_accessor :groups
13
-
13
+
14
14
  def initialize(uuid, peer_port, groups = [])
15
- @version = Journeta::VERSION::STRING
15
+ @version = Journeta::VERSION
16
16
  @uuid = uuid
17
17
  @peer_port = peer_port
18
18
  @groups = groups
19
19
  end
20
-
20
+
21
21
  end
22
-
22
+
23
23
  end
@@ -1,3 +1,3 @@
1
1
  module Journeta
2
- VERSION = '1.0.1'
2
+ VERSION = '1.1.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: journeta
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Preston Lee
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-10 00:00:00.000000000 Z
11
+ date: 2016-06-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: curses
@@ -16,42 +16,42 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 1.0.1
19
+ version: 1.0.2
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 1.0.1
26
+ version: 1.0.2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 1.7.3
33
+ version: 1.12.5
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: 1.7.3
40
+ version: 1.12.5
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: 10.3.2
47
+ version: 11.2.2
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: 10.3.2
54
+ version: 11.2.2
55
55
  description: Journeta is a dirt simple peer discovery and message passing library
56
56
  for processes on the same LAN, requiring no advanced networking knowledge to use.
57
57
  Only core Ruby libraries are required, making the library fairly light. As all data
@@ -61,7 +61,6 @@ email: preston.lee@prestonlee.com
61
61
  executables:
62
62
  - journeta_instant_messenger.rb
63
63
  - journeta_mock_peers.rb
64
- - journeta_mwrc_slides.rb
65
64
  - journeta_network_status.rb
66
65
  - journeta_peer_fuzzer.rb
67
66
  - journeta_queue_client.rb
@@ -73,11 +72,10 @@ extra_rdoc_files: []
73
72
  files:
74
73
  - ".gitignore"
75
74
  - LICENSE
76
- - README.rdoc
75
+ - README.md
77
76
  - Rakefile
78
77
  - bin/journeta_instant_messenger.rb
79
78
  - bin/journeta_mock_peers.rb
80
- - bin/journeta_mwrc_slides.rb
81
79
  - bin/journeta_network_status.rb
82
80
  - bin/journeta_peer_fuzzer.rb
83
81
  - bin/journeta_queue_client.rb
@@ -186,7 +184,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
186
184
  version: '0'
187
185
  requirements: []
188
186
  rubyforge_project:
189
- rubygems_version: 2.2.2
187
+ rubygems_version: 2.6.4
190
188
  signing_key:
191
189
  specification_version: 4
192
190
  summary: A zero-configuration-required peer-to-peer (P2P) discovery and communications
@@ -1,48 +0,0 @@
1
- = Journeta
2
-
3
- == About
4
-
5
-
6
- Journeta is a dirt simple peer discovery and message passing library for processes on the same LAN,
7
- requiring no advanced networking knowledge to use.
8
-
9
- Only core Ruby libraries are required, making the library fairly light. As all data is sent across
10
- the wire in YAML form, any arbitrary Ruby object can be sent to peers, provided they..
11
-
12
- * Are running a compatible Journeta version.
13
- * Have access to the same class definitions if you are sending your own custom objects.
14
- * Do not have a firewall preventing network I/O.
15
-
16
- Journeta uses Ruby threading to manage the asynchronous nature of peer-to-peer I/O.
17
- Data you send from your application thread will be queued and sent asynrchonously as soon as possible.
18
- For insight into events internal to the library, start ruby with the `--debug` options.
19
-
20
-
21
- == Use
22
-
23
-
24
- journeta_instant_messenger.rb
25
-
26
- A completely distributed, zero-configuration-required chat room script.
27
- Fire up several instances in separate terminals. Multiple instances on the same machine is ok.
28
- Everything you type will automatically be sent to all other instances on the LAN!
29
- Use `ruby --debug journeta_instant_messenger.rb` for detailed internal event details.
30
-
31
- journeta_network_status.rb
32
-
33
- Monitors the presence of all peers on the network.
34
-
35
- journeta_queue_server.rb
36
- journeta_queue_client.rb
37
-
38
- A simple queue managed by a server. Each client produces jobs to be queued, and processes jobs
39
- sent from the server(s). All nodes automatically find eachother. Try running multiples clients,
40
- and then multiple servers. Notice that when you have N servers, each job gets run N times,
41
- and not necessarilly by the same client!
42
-
43
- == Author
44
-
45
- Preston Lee
46
- * http://www.prestonlee.com
47
- * https://www.github.com/preston
48
- * http://twitter.com/prestonism
@@ -1,24 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- puts <<EOF
4
-
5
- Slides for the Journeta P2P lightning talk given Friday, March 18th, 2011
6
- at MountainWest RubyConf in Salt Lake City, Utah, USA.
7
-
8
- Author: Preston Lee
9
- http://prestonlee.com
10
- https://github.com/preston/journeta
11
-
12
- EOF
13
-
14
-
15
-
16
- [
17
- 'rvm use (1.9.2 || jruby)',
18
- 'gem install journeta',
19
- 'get on the "XMission" wifi network"',
20
- 'run "journeta_network_status.rb" in another tab',
21
- "warning: it's a public network don't sue me k!",
22
- "let's write a distributed 'irc'-like client ('journeta_instant_messenger.rb')",
23
-
24
- ].each_with_index do |l,i| puts "#{i}: #{l}" end