blather 0.2.3 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. data/README.rdoc +7 -4
  2. data/Rakefile +3 -1
  3. data/examples/print_heirarchy.rb +76 -0
  4. data/lib/blather.rb +3 -3
  5. data/lib/blather/client.rb +4 -247
  6. data/lib/blather/client/client.rb +168 -0
  7. data/lib/blather/client/dsl.rb +99 -0
  8. data/lib/blather/errors.rb +5 -0
  9. data/lib/blather/errors/sasl_error.rb +6 -70
  10. data/lib/blather/errors/stanza_error.rb +12 -176
  11. data/lib/blather/errors/stream_error.rb +8 -186
  12. data/lib/blather/stanza.rb +2 -3
  13. data/lib/blather/stanza/{iq/disco.rb → disco.rb} +1 -3
  14. data/lib/blather/stanza/{iq/discos → disco}/disco_info.rb +3 -5
  15. data/lib/blather/stanza/{iq/discos → disco}/disco_items.rb +0 -2
  16. data/lib/blather/stanza/iq/query.rb +1 -1
  17. data/lib/blather/stanza/iq/roster.rb +2 -2
  18. data/lib/blather/stanza/pubsub/subscriber.rb +64 -0
  19. data/lib/blather/stream.rb +13 -7
  20. data/lib/blather/stream/component.rb +1 -1
  21. data/lib/blather/stream/parser.rb +11 -4
  22. data/lib/blather/stream/resource.rb +1 -1
  23. data/lib/blather/stream/sasl.rb +15 -9
  24. data/lib/blather/xmpp_node.rb +10 -4
  25. data/spec/blather/client/client_spec.rb +4 -0
  26. data/spec/blather/client/dsl_spec.rb +4 -0
  27. data/spec/blather/client_spec.rb +0 -0
  28. data/spec/blather/errors/sasl_error_spec.rb +2 -25
  29. data/spec/blather/errors/stanza_error_spec.rb +7 -18
  30. data/spec/blather/errors/stream_error_spec.rb +4 -15
  31. data/spec/blather/stanza/{iq/discos → discos}/disco_info_spec.rb +12 -12
  32. data/spec/blather/stanza/{iq/discos → discos}/disco_items_spec.rb +1 -1
  33. data/spec/blather/stanza/iq/query_spec.rb +7 -0
  34. data/spec/blather/stanza/iq/roster_spec.rb +21 -21
  35. data/spec/blather/stanza/pubsub/subscriber_spec.rb +70 -0
  36. data/spec/blather/stanza_spec.rb +1 -7
  37. data/spec/blather/stream/client_spec.rb +36 -7
  38. data/spec/spec_helper.rb +1 -1
  39. metadata +16 -18
  40. data/ext/Makefile +0 -149
  41. data/ext/mkmf.log +0 -30
  42. data/ext/push_parser.bundle +0 -0
  43. data/ext/push_parser.o +0 -0
  44. data/lib/autotest/discover.rb +0 -1
  45. data/lib/autotest/spec.rb +0 -60
  46. data/spec/blather/stanza/pubsub/event_spec.rb +0 -13
  47. data/spec/build_safe.rb +0 -20
data/ext/Makefile DELETED
@@ -1,149 +0,0 @@
1
-
2
- SHELL = /bin/sh
3
-
4
- #### Start of system configuration section. ####
5
-
6
- srcdir = .
7
- topdir = /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin9.0
8
- hdrdir = $(topdir)
9
- VPATH = $(srcdir):$(topdir):$(hdrdir)
10
- prefix = $(DESTDIR)/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr
11
- exec_prefix = $(prefix)
12
- sitedir = $(DESTDIR)/Library/Ruby/Site
13
- rubylibdir = $(libdir)/ruby/$(ruby_version)
14
- docdir = $(datarootdir)/doc/$(PACKAGE)
15
- dvidir = $(docdir)
16
- datarootdir = $(prefix)/share
17
- archdir = $(rubylibdir)/$(arch)
18
- sbindir = $(exec_prefix)/sbin
19
- psdir = $(docdir)
20
- localedir = $(datarootdir)/locale
21
- htmldir = $(docdir)
22
- datadir = $(datarootdir)
23
- includedir = $(prefix)/include
24
- infodir = $(DESTDIR)/usr/share/info
25
- sysconfdir = $(prefix)/etc
26
- mandir = $(DESTDIR)/usr/share/man
27
- libdir = $(exec_prefix)/lib
28
- sharedstatedir = $(prefix)/com
29
- oldincludedir = $(DESTDIR)/usr/include
30
- pdfdir = $(docdir)
31
- sitearchdir = $(sitelibdir)/$(sitearch)
32
- bindir = $(exec_prefix)/bin
33
- localstatedir = $(prefix)/var
34
- sitelibdir = $(sitedir)/$(ruby_version)
35
- libexecdir = $(exec_prefix)/libexec
36
-
37
- CC = gcc
38
- LIBRUBY = $(LIBRUBY_SO)
39
- LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
40
- LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME)
41
- LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)
42
-
43
- RUBY_EXTCONF_H =
44
- CFLAGS = -fno-common -arch ppc -arch i386 -Os -pipe -fno-common -DOS_UNIX -DBUILD_FOR_RUBY
45
- INCFLAGS = -I. -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin9.0 -I. -I/usr/include/libxml2
46
- CPPFLAGS =
47
- CXXFLAGS = $(CFLAGS)
48
- DLDFLAGS = -L. -arch ppc -arch i386
49
- LDSHARED = cc -arch ppc -arch i386 -pipe -bundle -undefined dynamic_lookup
50
- AR = ar
51
- EXEEXT =
52
-
53
- RUBY_INSTALL_NAME = ruby
54
- RUBY_SO_NAME = ruby
55
- arch = universal-darwin9.0
56
- sitearch = universal-darwin9.0
57
- ruby_version = 1.8
58
- ruby = /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
59
- RUBY = $(ruby)
60
- RM = rm -f
61
- MAKEDIRS = mkdir -p
62
- INSTALL = /usr/bin/install -c
63
- INSTALL_PROG = $(INSTALL) -m 0755
64
- INSTALL_DATA = $(INSTALL) -m 644
65
- COPY = cp
66
-
67
- #### End of system configuration section. ####
68
-
69
- preload =
70
-
71
- libpath = . $(libdir)
72
- LIBPATH = -L"." -L"$(libdir)"
73
- DEFFILE =
74
-
75
- CLEANFILES = mkmf.log
76
- DISTCLEANFILES =
77
-
78
- extout =
79
- extout_prefix =
80
- target_prefix =
81
- LOCAL_LIBS =
82
- LIBS = $(LIBRUBYARG_SHARED) -lxml2 -lpthread -ldl -lm
83
- SRCS = push_parser.c
84
- OBJS = push_parser.o
85
- TARGET = push_parser
86
- DLLIB = $(TARGET).bundle
87
- EXTSTATIC =
88
- STATIC_LIB =
89
-
90
- RUBYCOMMONDIR = $(sitedir)$(target_prefix)
91
- RUBYLIBDIR = $(sitelibdir)$(target_prefix)
92
- RUBYARCHDIR = $(sitearchdir)$(target_prefix)
93
-
94
- TARGET_SO = $(DLLIB)
95
- CLEANLIBS = $(TARGET).bundle $(TARGET).il? $(TARGET).tds $(TARGET).map
96
- CLEANOBJS = *.o *.a *.s[ol] *.pdb *.exp *.bak
97
-
98
- all: $(DLLIB)
99
- static: $(STATIC_LIB)
100
-
101
- clean:
102
- @-$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES)
103
-
104
- distclean: clean
105
- @-$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
106
- @-$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
107
-
108
- realclean: distclean
109
- install: install-so install-rb
110
-
111
- install-so: $(RUBYARCHDIR)
112
- install-so: $(RUBYARCHDIR)/$(DLLIB)
113
- $(RUBYARCHDIR)/$(DLLIB): $(DLLIB)
114
- $(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
115
- install-rb: pre-install-rb install-rb-default
116
- install-rb-default: pre-install-rb-default
117
- pre-install-rb: Makefile
118
- pre-install-rb-default: Makefile
119
- $(RUBYARCHDIR):
120
- $(MAKEDIRS) $@
121
-
122
- site-install: site-install-so site-install-rb
123
- site-install-so: install-so
124
- site-install-rb: install-rb
125
-
126
- .SUFFIXES: .c .m .cc .cxx .cpp .C .o
127
-
128
- .cc.o:
129
- $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
130
-
131
- .cxx.o:
132
- $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
133
-
134
- .cpp.o:
135
- $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
136
-
137
- .C.o:
138
- $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
139
-
140
- .c.o:
141
- $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) -c $<
142
-
143
- $(DLLIB): $(OBJS)
144
- @-$(RM) $@
145
- $(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
146
-
147
-
148
-
149
- $(OBJS): ruby.h defines.h
data/ext/mkmf.log DELETED
@@ -1,30 +0,0 @@
1
- have_library: checking for main() in -lxml2... -------------------- yes
2
-
3
- "gcc -o conftest -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin9.0 -I. -arch ppc -arch i386 -Os -pipe -fno-common conftest.c -L"." -L"/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib" -L. -arch ppc -arch i386 -lruby -lxml2 -lpthread -ldl -lm "
4
- checked program was:
5
- /* begin */
6
- 1: /*top*/
7
- 2: int main() { return 0; }
8
- 3: int t() { void ((*volatile p)()); p = (void ((*)()))main; return 0; }
9
- /* end */
10
-
11
- --------------------
12
-
13
- find_header: checking for #include <libxml/parser.h>
14
- ... -------------------- yes
15
-
16
- "gcc -E -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin9.0 -I. -Os -pipe -fno-common conftest.c -o conftest.i"
17
- conftest.c:1:27: error: libxml/parser.h: No such file or directory
18
- checked program was:
19
- /* begin */
20
- 1: #include <libxml/parser.h>
21
- /* end */
22
-
23
- "gcc -E -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin9.0 -I. -Os -pipe -fno-common -I/usr/include/libxml2 conftest.c -o conftest.i"
24
- checked program was:
25
- /* begin */
26
- 1: #include <libxml/parser.h>
27
- /* end */
28
-
29
- --------------------
30
-
Binary file
data/ext/push_parser.o DELETED
Binary file
@@ -1 +0,0 @@
1
- Autotest.add_discovery { 'spec' }
data/lib/autotest/spec.rb DELETED
@@ -1,60 +0,0 @@
1
- require 'autotest'
2
-
3
- Autotest.add_hook :initialize do |at|
4
- at.clear_mappings
5
- # watch out: Ruby bug (1.8.6):
6
- # %r(/) != /\//
7
- at.add_mapping(%r%^spec/.*_spec.rb$%) { |filename, _|
8
- filename
9
- }
10
- at.add_mapping(%r%^lib/(.*)\.rb$%) { |_, m|
11
- ["spec/#{m[1]}_spec.rb"]
12
- }
13
- at.add_mapping(%r%^spec/(spec_helper|shared/.*)\.rb$%) {
14
- at.files_matching %r%^spec/.*_spec\.rb$%
15
- }
16
- end
17
-
18
- BAR = "=" * 78
19
- REDCODE = 31
20
- GREENCODE = 32
21
-
22
- Autotest.add_hook :ran_command do |at|
23
- at.results.last =~ /^.* (\d+) failures, (\d+) errors/
24
-
25
- code = ($1 == "0" and $2 == "0") ? GREENCODE : REDCODE
26
- puts "\e[#{ code }m#{ BAR }\e[0m\n\n"
27
- end
28
-
29
- class Autotest::Spec < Autotest
30
- def path_to_classname(s)
31
- sep = File::SEPARATOR
32
- f = s.sub(/spec#{sep}/, '').sub(/(spec)?\.rb$/, '').split(sep)
33
- f = f.map { |path| path.split(/_|(\d+)/).map { |seg| seg.capitalize }.join }
34
- f = f.delete_if { |path| path == 'Core' }
35
- f.join
36
- end
37
-
38
- ##
39
- # Returns a hash mapping a file name to the known failures for that
40
- # file.
41
-
42
- def consolidate_failures(failed)
43
- filters = new_hash_of_arrays
44
-
45
- class_map = Hash[*self.find_order.grep(/^spec/).map { |f| # TODO: ugly
46
- [path_to_classname(f), f]
47
- }.flatten]
48
- class_map.merge!(self.extra_class_map)
49
-
50
- failed.each do |method, klass|
51
- if class_map.has_key? klass then
52
- filters[class_map[klass]] << method
53
- else
54
- output.puts "Unable to map class #{klass} to a file"
55
- end
56
- end
57
-
58
- return filters
59
- end
60
- end
@@ -1,13 +0,0 @@
1
- require File.join(File.dirname(__FILE__), *%w[.. .. .. spec_helper])
2
- require File.join(File.dirname(__FILE__), *%w[.. .. .. fixtures pubsub])
3
-
4
- describe 'Blather::Stanza::PubSub::Event' do
5
- it 'registers itself' do
6
- XMPPNode.class_from_registration(:pubsub_subscriptions, 'http://jabber.org/protocol/pubsub').must_equal Stanza::PubSub::Subscriptions
7
- end
8
-
9
- it 'ensures an subscriptions node is present on create' do
10
- subscriptions = Stanza::PubSub::Subscriptions.new
11
- subscriptions.pubsub.children.detect { |n| n.element_name == 'subscriptions' }.wont_be_nil
12
- end
13
- end
data/spec/build_safe.rb DELETED
@@ -1,20 +0,0 @@
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"