blather 0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. data/CHANGELOG +1 -0
  2. data/LICENSE +20 -0
  3. data/Manifest +43 -0
  4. data/README.rdoc +78 -0
  5. data/Rakefile +16 -0
  6. data/blather.gemspec +41 -0
  7. data/examples/echo.rb +22 -0
  8. data/examples/shell_client.rb +28 -0
  9. data/lib/autotest/discover.rb +1 -0
  10. data/lib/autotest/spec.rb +60 -0
  11. data/lib/blather.rb +46 -0
  12. data/lib/blather/callback.rb +24 -0
  13. data/lib/blather/client.rb +81 -0
  14. data/lib/blather/core/errors.rb +24 -0
  15. data/lib/blather/core/jid.rb +101 -0
  16. data/lib/blather/core/roster.rb +84 -0
  17. data/lib/blather/core/roster_item.rb +92 -0
  18. data/lib/blather/core/stanza.rb +116 -0
  19. data/lib/blather/core/stanza/iq.rb +27 -0
  20. data/lib/blather/core/stanza/iq/query.rb +42 -0
  21. data/lib/blather/core/stanza/iq/roster.rb +96 -0
  22. data/lib/blather/core/stanza/message.rb +55 -0
  23. data/lib/blather/core/stanza/presence.rb +35 -0
  24. data/lib/blather/core/stanza/presence/status.rb +77 -0
  25. data/lib/blather/core/stanza/presence/subscription.rb +73 -0
  26. data/lib/blather/core/stream.rb +181 -0
  27. data/lib/blather/core/stream/parser.rb +74 -0
  28. data/lib/blather/core/stream/resource.rb +51 -0
  29. data/lib/blather/core/stream/sasl.rb +135 -0
  30. data/lib/blather/core/stream/session.rb +43 -0
  31. data/lib/blather/core/stream/tls.rb +29 -0
  32. data/lib/blather/core/sugar.rb +150 -0
  33. data/lib/blather/core/xmpp_node.rb +132 -0
  34. data/lib/blather/extensions.rb +4 -0
  35. data/lib/blather/extensions/last_activity.rb +55 -0
  36. data/lib/blather/extensions/version.rb +85 -0
  37. data/spec/blather/core/jid_spec.rb +78 -0
  38. data/spec/blather/core/roster_item_spec.rb +80 -0
  39. data/spec/blather/core/roster_spec.rb +79 -0
  40. data/spec/blather/core/stanza_spec.rb +95 -0
  41. data/spec/blather/core/stream_spec.rb +263 -0
  42. data/spec/blather/core/xmpp_node_spec.rb +130 -0
  43. data/spec/build_safe.rb +20 -0
  44. data/spec/spec_helper.rb +49 -0
  45. metadata +172 -0
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env ruby
2
+ require 'yaml'
3
+
4
+ if ARGV.size < 1
5
+ puts "Usage: github-test.rb my-project.gemspec"
6
+ exit
7
+ end
8
+
9
+ require 'rubygems/specification'
10
+ data = File.read(ARGV[0])
11
+ spec = nil
12
+
13
+ if data !~ %r{!ruby/object:Gem::Specification}
14
+ Thread.new { spec = eval("$SAFE = 3\n#{data}") }.join
15
+ else
16
+ spec = YAML.load(data)
17
+ end
18
+
19
+ puts spec
20
+ puts "OK"
@@ -0,0 +1,49 @@
1
+ require File.join(File.dirname(__FILE__), *%w[.. lib blather])
2
+ require 'rubygems'
3
+ require 'minitest/spec'
4
+ require 'mocha'
5
+
6
+ module MiniTest
7
+ if MINI_DIR =~ %r{^./}
8
+ require 'pathname'
9
+ path = Pathname.new(MINI_DIR).realpath
10
+ # remove_const 'MINI_DIR'
11
+ # const_set 'MINI_DIR', path.to_s
12
+ end
13
+
14
+ module Assertions
15
+ def assert_change(obj, method, args = {}, msg = nil)
16
+ msg ||= proc {
17
+ m = "Expected #{obj}.#{method} to change"
18
+ m << " by #{mu_pp args[:by]}" if args[:by]
19
+ m << (args[:from] ? " from #{mu_pp args[:from]}" : '') + " to #{mu_pp args[:to]}" if args[:to]
20
+ m
21
+ }.call
22
+
23
+ init_val = eval(obj).__send__(method)
24
+ yield
25
+ new_val = eval(obj).__send__(method)
26
+
27
+ assert_equal(args[:by], (new_val - init_val), msg) if args[:by]
28
+ assert_equal([args[:from], args[:to]], [(init_val if args[:from]), new_val], msg) if args[:to]
29
+ refute_equal(init_val, new_val, msg) if args.empty?
30
+ end
31
+ end
32
+ end
33
+
34
+ class Object
35
+ def must_change *args, &block
36
+ return MiniTest::Spec.current.assert_change(*args, &self) if Proc === self
37
+ return MiniTest::Spec.current.assert_change(args.first, self) if args.size == 1
38
+ return MiniTest::Spec.current.assert_change(self, *args)
39
+ end
40
+ end
41
+
42
+ require 'mocha/expectation_error'
43
+
44
+ include Blather
45
+ include MiniTest
46
+
47
+ LOG.level = Logger::INFO
48
+
49
+ Unit.autorun
metadata ADDED
@@ -0,0 +1,172 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: blather
3
+ version: !ruby/object:Gem::Version
4
+ version: "0.1"
5
+ platform: ruby
6
+ authors:
7
+ - Jeff Smick
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-11-27 00:00:00 -08:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: eventmachine
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: libxml
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 1.0.11
34
+ version:
35
+ - !ruby/object:Gem::Dependency
36
+ name: echoe
37
+ type: :development
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: "0"
44
+ version:
45
+ description: An evented XMPP library written on EventMachine and libxml-ruby
46
+ email: sprsquish@gmail.com
47
+ executables: []
48
+
49
+ extensions: []
50
+
51
+ extra_rdoc_files:
52
+ - CHANGELOG
53
+ - lib/autotest/discover.rb
54
+ - lib/autotest/spec.rb
55
+ - lib/blather/callback.rb
56
+ - lib/blather/client.rb
57
+ - lib/blather/core/errors.rb
58
+ - lib/blather/core/jid.rb
59
+ - lib/blather/core/roster.rb
60
+ - lib/blather/core/roster_item.rb
61
+ - lib/blather/core/stanza/iq/query.rb
62
+ - lib/blather/core/stanza/iq/roster.rb
63
+ - lib/blather/core/stanza/iq.rb
64
+ - lib/blather/core/stanza/message.rb
65
+ - lib/blather/core/stanza/presence/status.rb
66
+ - lib/blather/core/stanza/presence/subscription.rb
67
+ - lib/blather/core/stanza/presence.rb
68
+ - lib/blather/core/stanza.rb
69
+ - lib/blather/core/stream/parser.rb
70
+ - lib/blather/core/stream/resource.rb
71
+ - lib/blather/core/stream/sasl.rb
72
+ - lib/blather/core/stream/session.rb
73
+ - lib/blather/core/stream/tls.rb
74
+ - lib/blather/core/stream.rb
75
+ - lib/blather/core/sugar.rb
76
+ - lib/blather/core/xmpp_node.rb
77
+ - lib/blather/extensions/last_activity.rb
78
+ - lib/blather/extensions/version.rb
79
+ - lib/blather/extensions.rb
80
+ - lib/blather.rb
81
+ - LICENSE
82
+ - README.rdoc
83
+ files:
84
+ - CHANGELOG
85
+ - examples/echo.rb
86
+ - examples/shell_client.rb
87
+ - lib/autotest/discover.rb
88
+ - lib/autotest/spec.rb
89
+ - lib/blather/callback.rb
90
+ - lib/blather/client.rb
91
+ - lib/blather/core/errors.rb
92
+ - lib/blather/core/jid.rb
93
+ - lib/blather/core/roster.rb
94
+ - lib/blather/core/roster_item.rb
95
+ - lib/blather/core/stanza/iq/query.rb
96
+ - lib/blather/core/stanza/iq/roster.rb
97
+ - lib/blather/core/stanza/iq.rb
98
+ - lib/blather/core/stanza/message.rb
99
+ - lib/blather/core/stanza/presence/status.rb
100
+ - lib/blather/core/stanza/presence/subscription.rb
101
+ - lib/blather/core/stanza/presence.rb
102
+ - lib/blather/core/stanza.rb
103
+ - lib/blather/core/stream/parser.rb
104
+ - lib/blather/core/stream/resource.rb
105
+ - lib/blather/core/stream/sasl.rb
106
+ - lib/blather/core/stream/session.rb
107
+ - lib/blather/core/stream/tls.rb
108
+ - lib/blather/core/stream.rb
109
+ - lib/blather/core/sugar.rb
110
+ - lib/blather/core/xmpp_node.rb
111
+ - lib/blather/extensions/last_activity.rb
112
+ - lib/blather/extensions/version.rb
113
+ - lib/blather/extensions.rb
114
+ - lib/blather.rb
115
+ - LICENSE
116
+ - Rakefile
117
+ - README.rdoc
118
+ - spec/blather/core/jid_spec.rb
119
+ - spec/blather/core/roster_item_spec.rb
120
+ - spec/blather/core/roster_spec.rb
121
+ - spec/blather/core/stanza_spec.rb
122
+ - spec/blather/core/stream_spec.rb
123
+ - spec/blather/core/xmpp_node_spec.rb
124
+ - spec/build_safe.rb
125
+ - spec/spec_helper.rb
126
+ - Manifest
127
+ - blather.gemspec
128
+ has_rdoc: true
129
+ homepage: ""
130
+ post_install_message:
131
+ rdoc_options:
132
+ - --line-numbers
133
+ - --inline-source
134
+ - --title
135
+ - Blather
136
+ - --main
137
+ - README.rdoc
138
+ - -S
139
+ - -T
140
+ - hanna
141
+ - --main
142
+ - README.rdoc
143
+ - --exclude
144
+ - autotest
145
+ require_paths:
146
+ - lib
147
+ required_ruby_version: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - ">="
150
+ - !ruby/object:Gem::Version
151
+ version: "0"
152
+ version:
153
+ required_rubygems_version: !ruby/object:Gem::Requirement
154
+ requirements:
155
+ - - ">="
156
+ - !ruby/object:Gem::Version
157
+ version: "1.2"
158
+ version:
159
+ requirements: []
160
+
161
+ rubyforge_project: squishtech
162
+ rubygems_version: 1.3.1
163
+ signing_key:
164
+ specification_version: 2
165
+ summary: An evented XMPP library written on EventMachine and libxml-ruby
166
+ test_files:
167
+ - spec/blather/core/jid_spec.rb
168
+ - spec/blather/core/roster_item_spec.rb
169
+ - spec/blather/core/roster_spec.rb
170
+ - spec/blather/core/stanza_spec.rb
171
+ - spec/blather/core/stream_spec.rb
172
+ - spec/blather/core/xmpp_node_spec.rb