eventmachine-distributed-notification 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,7 @@
1
+ if RUBY_VERSION < '1.9.0'
2
+ $LOAD_PATH.unshift(File.dirname(__FILE__) + '/../lib')
3
+ end
4
+
1
5
  require "mkmf"
2
6
 
3
7
  # Name your extension
@@ -88,7 +88,7 @@ VALUE getRubyValueFromId(id thing) {
88
88
  result = rb_float_new([thing doubleValue]);
89
89
  else
90
90
  result = INT2NUM([thing longLongValue]);
91
- } else if([thing isKindOfClass:[NSNumber class]]) {
91
+ } else if([thing isKindOfClass:[NSString class]]) {
92
92
  result = rb_str_new2([thing UTF8String]);
93
93
  } else {
94
94
  result = rb_str_new2([[thing description] UTF8String]);
@@ -131,7 +131,7 @@ static VALUE cObserverNative_new(int argc, VALUE *argv, VALUE klass)
131
131
 
132
132
  static VALUE cObserverNative_run(int argc, VALUE *argv, VALUE self)
133
133
  {
134
- [[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:1]];
134
+ [[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0]];
135
135
 
136
136
  return Qnil;
137
137
  }
@@ -1,3 +1,7 @@
1
+ if RUBY_VERSION < '1.9.0'
2
+ $LOAD_PATH.unshift(File.dirname(__FILE__) + '/../lib')
3
+ end
4
+
1
5
  require "mkmf"
2
6
 
3
7
  # Name your extension
@@ -40,6 +40,7 @@ module EventMachine
40
40
  args = [name, *args]
41
41
  klass = klass_from_handler(EventMachine::DistributedNotificationWatch, handler, *args);
42
42
  c = klass.new(*args, &block)
43
+ block_given? and yield c
43
44
  c.start
44
45
  c
45
46
  end
@@ -78,5 +78,30 @@ describe EventMachine::DistributedNotificationWatch do
78
78
  watcher.value.should_not be_nil
79
79
  end
80
80
  end
81
+
82
+ context 'with block' do
83
+ it 'should watch distributed notifications' do
84
+ value = nil
85
+
86
+ EM.run {
87
+ watcher = EM.watch_distributed_notification(nil) do |c|
88
+ (class << c; self; end).send(:define_method, :notify) do |name, info|
89
+ value = info
90
+ end
91
+ end
92
+
93
+ itunes.playlists["Music"].tracks[1].play
94
+
95
+ EM::add_timer(1) {
96
+ itunes.stop
97
+ EM.stop
98
+ watcher.stop
99
+ }
100
+ }
101
+
102
+ value.should_not be_nil
103
+ value['Total Time'].should be_kind_of(Fixnum)
104
+ end
105
+ end
81
106
  end
82
107
  end
metadata CHANGED
@@ -1,93 +1,125 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: eventmachine-distributed-notification
3
- version: !ruby/object:Gem::Version
4
- version: 0.1.4
5
- prerelease:
3
+ version: !ruby/object:Gem::Version
4
+ hash: 17
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 5
10
+ version: 0.1.5
6
11
  platform: ruby
7
- authors:
12
+ authors:
8
13
  - youpy
9
14
  autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
- date: 2012-03-24 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: eventmachine
16
- requirement: &70178503276700 !ruby/object:Gem::Requirement
17
+
18
+ date: 2012-03-29 00:00:00 +09:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ version_requirements: &id001 !ruby/object:Gem::Requirement
17
23
  none: false
18
- requirements:
19
- - - ! '>='
20
- - !ruby/object:Gem::Version
21
- version: '0'
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ hash: 3
28
+ segments:
29
+ - 0
30
+ version: "0"
31
+ requirement: *id001
22
32
  type: :runtime
33
+ name: eventmachine
23
34
  prerelease: false
24
- version_requirements: *70178503276700
25
- - !ruby/object:Gem::Dependency
26
- name: rspec
27
- requirement: &70178503273500 !ruby/object:Gem::Requirement
35
+ - !ruby/object:Gem::Dependency
36
+ version_requirements: &id002 !ruby/object:Gem::Requirement
28
37
  none: false
29
- requirements:
38
+ requirements:
30
39
  - - ~>
31
- - !ruby/object:Gem::Version
40
+ - !ruby/object:Gem::Version
41
+ hash: 47
42
+ segments:
43
+ - 2
44
+ - 8
45
+ - 0
32
46
  version: 2.8.0
47
+ requirement: *id002
33
48
  type: :development
49
+ name: rspec
34
50
  prerelease: false
35
- version_requirements: *70178503273500
36
- - !ruby/object:Gem::Dependency
37
- name: rdoc
38
- requirement: &70178503287000 !ruby/object:Gem::Requirement
51
+ - !ruby/object:Gem::Dependency
52
+ version_requirements: &id003 !ruby/object:Gem::Requirement
39
53
  none: false
40
- requirements:
54
+ requirements:
41
55
  - - ~>
42
- - !ruby/object:Gem::Version
43
- version: '3.12'
56
+ - !ruby/object:Gem::Version
57
+ hash: 31
58
+ segments:
59
+ - 3
60
+ - 12
61
+ version: "3.12"
62
+ requirement: *id003
44
63
  type: :development
64
+ name: rdoc
45
65
  prerelease: false
46
- version_requirements: *70178503287000
47
- - !ruby/object:Gem::Dependency
48
- name: bundler
49
- requirement: &70178503284120 !ruby/object:Gem::Requirement
66
+ - !ruby/object:Gem::Dependency
67
+ version_requirements: &id004 !ruby/object:Gem::Requirement
50
68
  none: false
51
- requirements:
69
+ requirements:
52
70
  - - ~>
53
- - !ruby/object:Gem::Version
71
+ - !ruby/object:Gem::Version
72
+ hash: 19
73
+ segments:
74
+ - 1
75
+ - 1
76
+ - 0
54
77
  version: 1.1.0
78
+ requirement: *id004
55
79
  type: :development
80
+ name: bundler
56
81
  prerelease: false
57
- version_requirements: *70178503284120
58
- - !ruby/object:Gem::Dependency
59
- name: jeweler
60
- requirement: &70178503280260 !ruby/object:Gem::Requirement
82
+ - !ruby/object:Gem::Dependency
83
+ version_requirements: &id005 !ruby/object:Gem::Requirement
61
84
  none: false
62
- requirements:
85
+ requirements:
63
86
  - - ~>
64
- - !ruby/object:Gem::Version
87
+ - !ruby/object:Gem::Version
88
+ hash: 49
89
+ segments:
90
+ - 1
91
+ - 8
92
+ - 3
65
93
  version: 1.8.3
94
+ requirement: *id005
66
95
  type: :development
96
+ name: jeweler
67
97
  prerelease: false
68
- version_requirements: *70178503280260
69
- - !ruby/object:Gem::Dependency
70
- name: rb-appscript
71
- requirement: &70178503295420 !ruby/object:Gem::Requirement
98
+ - !ruby/object:Gem::Dependency
99
+ version_requirements: &id006 !ruby/object:Gem::Requirement
72
100
  none: false
73
- requirements:
74
- - - ! '>='
75
- - !ruby/object:Gem::Version
76
- version: '0'
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ hash: 3
105
+ segments:
106
+ - 0
107
+ version: "0"
108
+ requirement: *id006
77
109
  type: :development
110
+ name: rb-appscript
78
111
  prerelease: false
79
- version_requirements: *70178503295420
80
- description: An EventMachine extension to watch OSX's Distributed Notification, posted
81
- by iTunes etc.
112
+ description: An EventMachine extension to watch OSX's Distributed Notification, posted by iTunes etc.
82
113
  email: youpy@buycheapviagraonlinenow.com
83
114
  executables: []
84
- extensions:
115
+
116
+ extensions:
85
117
  - ext/observer_native/extconf.rb
86
118
  - ext/poster_native/extconf.rb
87
- extra_rdoc_files:
119
+ extra_rdoc_files:
88
120
  - LICENSE.txt
89
121
  - README.rdoc
90
- files:
122
+ files:
91
123
  - .document
92
124
  - .rspec
93
125
  - Gemfile
@@ -98,6 +130,7 @@ files:
98
130
  - VERSION
99
131
  - examples/client.rb
100
132
  - examples/server.rb
133
+ - ext/lib/mkmf.rb
101
134
  - ext/observer_native/compat.h
102
135
  - ext/observer_native/extconf.rb
103
136
  - ext/observer_native/observer_native.h
@@ -108,32 +141,39 @@ files:
108
141
  - lib/eventmachine-distributed-notification.rb
109
142
  - spec/eventmachine-distributed-notification_spec.rb
110
143
  - spec/spec_helper.rb
144
+ has_rdoc: true
111
145
  homepage: http://github.com/youpy/eventmachine-distributed-notification
112
- licenses:
146
+ licenses:
113
147
  - MIT
114
148
  post_install_message:
115
149
  rdoc_options: []
116
- require_paths:
150
+
151
+ require_paths:
117
152
  - lib
118
- required_ruby_version: !ruby/object:Gem::Requirement
153
+ required_ruby_version: !ruby/object:Gem::Requirement
119
154
  none: false
120
- requirements:
121
- - - ! '>='
122
- - !ruby/object:Gem::Version
123
- version: '0'
124
- segments:
155
+ requirements:
156
+ - - ">="
157
+ - !ruby/object:Gem::Version
158
+ hash: 3
159
+ segments:
125
160
  - 0
126
- hash: -1517368430001229274
127
- required_rubygems_version: !ruby/object:Gem::Requirement
161
+ version: "0"
162
+ required_rubygems_version: !ruby/object:Gem::Requirement
128
163
  none: false
129
- requirements:
130
- - - ! '>='
131
- - !ruby/object:Gem::Version
132
- version: '0'
164
+ requirements:
165
+ - - ">="
166
+ - !ruby/object:Gem::Version
167
+ hash: 3
168
+ segments:
169
+ - 0
170
+ version: "0"
133
171
  requirements: []
172
+
134
173
  rubyforge_project:
135
- rubygems_version: 1.8.10
174
+ rubygems_version: 1.3.7
136
175
  signing_key:
137
176
  specification_version: 3
138
177
  summary: An EventMachine extension to watch OSX's Distributed Notification
139
178
  test_files: []
179
+