wires 0.5.3 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/wires/base.rb +51 -10
- data/lib/wires/base/channel.rb +1 -1
- data/lib/wires/base/convenience.rb +1 -1
- data/lib/wires/base/event.rb +1 -1
- data/lib/wires/base/hub.rb +1 -1
- data/lib/wires/base/router.rb +1 -1
- data/lib/wires/base/time_scheduler.rb +1 -1
- data/lib/wires/base/time_scheduler_item.rb +2 -1
- data/lib/wires/base/util/build_alt.rb +5 -11
- data/lib/wires/base/util/hooks.rb +1 -1
- metadata +21 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d9d25b472a5b695894bd0ac5f39d95f637c49f2
|
4
|
+
data.tar.gz: 14409acc61b2b8dcfd68a5a69453c96eec78960b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b0f002d2346c8c0fe1e91fbedcb4ef4aa3faaef06a479154a893930614f5b7474629bc852b7bd0471ddf427b85889cf7de804a48c891a4254fa03f1304063bd
|
7
|
+
data.tar.gz: 8163af3fc07e3d2da2136adbefff6b2523729aeb97ecfec8556a19b88db011fca4d39be4ae65d9ea78abe1ecc47aaabf03cee285c3e8878cd519bf9eb9df2129
|
data/lib/wires/base.rb
CHANGED
@@ -2,13 +2,54 @@
|
|
2
2
|
require 'thread'
|
3
3
|
require 'threadlock'
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
5
|
+
|
6
|
+
module Wires
|
7
|
+
def self.network(id=:main)
|
8
|
+
@networks ||= {main:Wires}
|
9
|
+
|
10
|
+
@networks[id] = Module.new \
|
11
|
+
unless @networks.has_key? id
|
12
|
+
@networks[id].const_set :Namespace, @networks[id] \
|
13
|
+
unless @networks[id].const_defined? :Namespace
|
14
|
+
|
15
|
+
return @networks[id]
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.set_current_network(*args)
|
19
|
+
@current_network = network(*args)
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.current_network_name
|
23
|
+
@networks.each_pair.select{ |k,v| v==@current_network }.first.first
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.current_network
|
27
|
+
@current_network ||= network
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.replicate
|
31
|
+
save_name = Wires.current_network_name
|
32
|
+
other = Wires.set_current_network Object.new
|
33
|
+
|
34
|
+
load __FILE__
|
35
|
+
|
36
|
+
Wires.set_current_network save_name
|
37
|
+
return other
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
|
42
|
+
loader = Proc.new do |path|
|
43
|
+
load File.expand_path(path+'.rb', File.dirname(__FILE__))
|
44
|
+
end
|
45
|
+
|
46
|
+
loader.call 'base/util/hooks'
|
47
|
+
loader.call 'base/util/build_alt'
|
48
|
+
|
49
|
+
loader.call 'base/event'
|
50
|
+
loader.call 'base/hub'
|
51
|
+
loader.call 'base/router'
|
52
|
+
loader.call 'base/channel'
|
53
|
+
loader.call 'base/time_scheduler_item'
|
54
|
+
loader.call 'base/time_scheduler'
|
55
|
+
loader.call 'base/convenience'
|
data/lib/wires/base/channel.rb
CHANGED
data/lib/wires/base/event.rb
CHANGED
data/lib/wires/base/hub.rb
CHANGED
data/lib/wires/base/router.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
module Wires
|
2
|
+
module Wires.current_network::Namespace
|
3
3
|
|
4
4
|
class TimeSchedulerItem
|
5
5
|
|
@@ -84,6 +84,7 @@ module Wires
|
|
84
84
|
|
85
85
|
# Lock some of the methods to try to make them atomic
|
86
86
|
# Must exclude methods that get called from within the TimeScheduler lock
|
87
|
+
include Threadlock
|
87
88
|
threadlock :fire,
|
88
89
|
:count=,
|
89
90
|
:count_inc,
|
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
module Wires
|
2
|
+
module Wires.current_network::Namespace
|
3
3
|
module Util
|
4
4
|
|
5
5
|
# Build an alternate version of the Wires module that doesn't
|
@@ -8,16 +8,10 @@ module Wires
|
|
8
8
|
# >> module MyModule; end
|
9
9
|
# >> Wires::Util.build_alt "::MyModule::MyWires"
|
10
10
|
def self.build_alt(module_path)
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
.map(&:last)
|
16
|
-
.map { |file| File.expand_path("#{file}.rb", File.dirname(main_file)) }
|
17
|
-
.map { |file| File.read file }
|
18
|
-
.each { |code| eval code.gsub("Wires", "#{module_path}") }
|
19
|
-
|
20
|
-
eval "#{module_path}"
|
11
|
+
warn "DEPRECATED: Wires::Util.build_alt('::MyModule::MyWires')"\
|
12
|
+
" is deprecated, and will be removed in version 0.6."\
|
13
|
+
" Please use ::MyModule::MyWires=Wires.replicate"
|
14
|
+
eval "#{module_path} = Wires.replicate"
|
21
15
|
end
|
22
16
|
|
23
17
|
end
|
metadata
CHANGED
@@ -1,29 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wires
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joe McIlvain
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-12-
|
11
|
+
date: 2013-12-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: threadlock
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2.0'
|
20
20
|
type: :runtime
|
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: '
|
26
|
+
version: '2.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: rake
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -39,7 +53,7 @@ dependencies:
|
|
39
53
|
- !ruby/object:Gem::Version
|
40
54
|
version: '0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
56
|
+
name: rb-readline
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
59
|
- - ">="
|