riddl 0.99.246 → 0.99.248

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/examples/declaration-server-distributed/properties.xml +1 -0
  3. data/examples/declaration-server-distributed/xsls/test/properties.xsl +1 -0
  4. data/examples/declaration-server-hybrid/properties.xml +1 -0
  5. data/examples/declaration-server-local/properties.xml +1 -0
  6. data/examples/downloadify/downloadify.xml +1 -0
  7. data/examples/flickr/Exif/riddl.jpg +1 -0
  8. data/examples/flickr/Flickr/riddl.png +1 -0
  9. data/examples/flickr/riddl.jpg +1 -0
  10. data/examples/helloworld/declaration-definition_goal.xml +0 -4
  11. data/examples/notifications/producer.main.xml +1 -0
  12. data/examples/properties/properties.xml +1 -0
  13. data/examples/twitter/client.rb +7 -7
  14. data/examples/xmpp/properties.xml +1 -0
  15. data/lib/ruby/riddl/client.rb +10 -8
  16. data/lib/ruby/riddl/roles/http%3A%2F%2Foauth.net%2F1.0/base.rb +2 -2
  17. data/lib/ruby/riddl/server.rb +2 -1
  18. data/lib/ruby/riddl/wrapper.rb +18 -18
  19. data/lib/ruby/riddl/wrapper/declaration.rb +10 -10
  20. data/lib/ruby/riddl/wrapper/declaration/facade.rb +1 -2
  21. data/lib/ruby/riddl/wrapper/declaration/tile.rb +4 -4
  22. data/lib/ruby/riddl/wrapper/description.rb +6 -6
  23. data/lib/ruby/riddl/wrapper/description/access.rb +7 -6
  24. data/lib/ruby/riddl/wrapper/layerchecker.rb +2 -2
  25. data/lib/ruby/riddl/wrapper/resourcechecker.rb +6 -6
  26. data/riddl.gemspec +3 -3
  27. data/tools/riddlcheck +1 -0
  28. data/tools/riddlprocess +1 -0
  29. metadata +6 -7
  30. data/examples/declaration-server-distributed/properties.xml +0 -150
  31. data/examples/declaration-server-distributed/xsls/test/properties.xsl +0 -185
  32. data/examples/declaration-server-hybrid/properties.xml +0 -150
  33. data/examples/declaration-server-local/properties.xml +0 -150
  34. data/examples/downloadify/downloadify.xml +0 -18
  35. data/examples/flickr/Exif/riddl.jpg +0 -0
  36. data/examples/flickr/Flickr/riddl.png +0 -0
  37. data/examples/flickr/riddl.jpg +0 -0
  38. data/examples/library/server-9292.pid +0 -1
  39. data/examples/notifications/producer.main.xml +0 -206
  40. data/examples/properties/properties.xml +0 -150
  41. data/examples/xmpp/properties.xml +0 -150
  42. data/tools/riddlcheck +0 -36
  43. data/tools/riddlprocess +0 -51
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2d2c9d061ddbc2a8af946846e2dd0283b17436bd
4
- data.tar.gz: 5dd79ed2204159227425adac82b287f51c18c634
3
+ metadata.gz: 07bbdf6d9c250da6c96d3fb77f616d46d7267a2f
4
+ data.tar.gz: 18b8083e4404293da2f50d984de1758db88c9e12
5
5
  SHA512:
6
- metadata.gz: 592254242b6f4406e2648efe6c413fd08cdeaa039abe64c564d9b4914bd402658b3d4b6c13ca1ed87196b3c84b2fab0481614eec9eb5adc8182945d895cc5d2d
7
- data.tar.gz: bba2eb519a581e3eb84fa8ea47d82ebac260e405320c356f1baffedf0fe4449fc08e74cadb518ab2239f9b56e2f548dadbc0952199ee7347af0dea3a82fc647d
6
+ metadata.gz: 1d0a734f35a3e05003a3acdf0e0d821a567c58ab6dc9db8c87e0d160842c1247692b60bbe237aaf74bcc83c54fe8ccb0ea192a437680c9b1e7a87841f4cbf887
7
+ data.tar.gz: 277ba24328b04283f2c2533e90f2efdfe43af1b8855549a39a950b7648b852fe509cf02b01fdad92bfdea981702420de213b432c8b179ecec9c791854aeff5a7
@@ -0,0 +1 @@
1
+ ../../ns/common-patterns/properties/1.0/properties.xml
@@ -0,0 +1 @@
1
+ ../properties.xsl
@@ -0,0 +1 @@
1
+ ../../ns/common-patterns/properties/1.0/properties.xml
@@ -0,0 +1 @@
1
+ ../../ns/common-patterns/properties/1.0/properties.xml
@@ -0,0 +1 @@
1
+ ../../lib/ruby/riddl/ns/common-patterns/downloadify/1.0/downloadify.xml
@@ -0,0 +1 @@
1
+ ../../../contrib/riddl.jpg
@@ -0,0 +1 @@
1
+ ../../../contrib/riddl.png
@@ -0,0 +1 @@
1
+ ../../contrib/riddl.jpg
@@ -23,14 +23,10 @@
23
23
  <resource>
24
24
  <post in="hello"/>
25
25
  <post in="hello-form"/>
26
- <get in="type-html"/>
27
26
  <get in="type-html" out="hello-list-html"/>
28
- <get in="*"/>
29
27
  <get in="*" out="hello-form"/>
30
28
  <resource>
31
- <put in="hello"/>
32
29
  <put in="hello" out="hello"/>
33
- <get in="*"/>
34
30
  <get in="*" out="hello"/>
35
31
  <delete in="*"/>
36
32
  <resource relative="hello">
@@ -0,0 +1 @@
1
+ ../../ns/common-patterns/notifications-producer/1.0/producer.xml
@@ -0,0 +1 @@
1
+ ../../ns/common-patterns/properties/1.0/properties.xml
@@ -15,27 +15,27 @@ file_token_secret = File.expand_path(File.dirname(__FILE__) + '/.twitter.token_s
15
15
  if !File.exists?(file_token) && !File.exists?(file_token_secret)
16
16
  ### go to request token resource and set necessary role options
17
17
  resource = twitter.resource("/oauth/request_token")
18
- params = [
18
+ params = [
19
19
  Riddl::Option.new(:consumer_key,consumer_key),
20
20
  Riddl::Option.new(:consumer_secret,consumer_secret)
21
21
  ]
22
-
22
+
23
23
  ### simulate request token
24
24
  # puts resource.simulate_post(params).read
25
-
25
+
26
26
  ### get request token and save it to variables
27
27
  status, response, headers = resource.post params
28
28
  token = response.oauth_token
29
29
  token_secret = response.oauth_token_secret
30
-
30
+
31
31
  ### send user away for authorization
32
32
  puts "Authorize at https://twitter.com/oauth/authorize?oauth_token=#{token}"
33
33
  print "Insert verifier here: "
34
34
  verifier = STDIN.gets.strip # wait for verifier
35
-
35
+
36
36
  ### exchange the token for an access token and save the results
37
37
  resource = twitter.resource("/oauth/access_token")
38
- status, response, headers = resource.post [
38
+ status, response, headers = resource.post [
39
39
  Riddl::Option.new(:consumer_key,consumer_key),
40
40
  Riddl::Option.new(:consumer_secret,consumer_secret),
41
41
  Riddl::Option.new(:token,token),
@@ -86,6 +86,6 @@ if ARGV.length >= 1
86
86
  Riddl::Option.new(:token_secret,token_secret)
87
87
  ]
88
88
  puts "something went wrong!" if status != 200
89
- else
89
+ else
90
90
  puts "Usage: #{__FILE__} [TWEET]"
91
91
  end
@@ -0,0 +1 @@
1
+ ../../ns/common-patterns/properties/1.0/properties.xml
@@ -1,11 +1,5 @@
1
- require 'rubygems'
2
- require 'net/https'
3
- require 'eventmachine'
4
- require 'em-websocket-client'
5
- require 'blather/client/client'
6
- require 'uri'
7
- require 'openssl'
8
- require 'digest/md5'
1
+ gem 'blather', '=1.1.4'
2
+
9
3
  require File.expand_path(File.dirname(__FILE__) + '/wrapper')
10
4
  require File.expand_path(File.dirname(__FILE__) + '/error')
11
5
  require File.expand_path(File.dirname(__FILE__) + '/protocols/http/generator')
@@ -16,6 +10,14 @@ require File.expand_path(File.dirname(__FILE__) + '/protocols/utils')
16
10
  require File.expand_path(File.dirname(__FILE__) + '/header')
17
11
  require File.expand_path(File.dirname(__FILE__) + '/option')
18
12
 
13
+ require 'net/https'
14
+ require 'eventmachine'
15
+ require 'em-websocket-client'
16
+ require 'blather/client/client'
17
+ require 'uri'
18
+ require 'openssl'
19
+ require 'digest/md5'
20
+
19
21
  class StringIO #{{{
20
22
  def continue_timeout; nil; end
21
23
  end #}}}
@@ -5,7 +5,7 @@ require 'base64'
5
5
  module Riddl
6
6
  module Roles
7
7
  module OAuth
8
- DIGEST = OpenSSL::Digest::Sha1.new
8
+ DIGEST = OpenSSL::Digest::SHA1.new
9
9
  VERSION_MAJOR = 1
10
10
  VERSION_MINOR = 0
11
11
 
@@ -61,7 +61,7 @@ module Riddl
61
61
  headers['Authorization'] = 'OAuth ' + oparams.map{|e|e[0]+'='+"\"#{e[1]}\""}.join(', ')
62
62
  end
63
63
 
64
- end
64
+ end
65
65
 
66
66
  end
67
67
  end
@@ -1,4 +1,5 @@
1
- #gem 'thin', '=1.5.1'
1
+ gem 'blather', '=1.1.4'
2
+
2
3
  require File.expand_path(File.dirname(__FILE__) + '/constants')
3
4
  require File.expand_path(File.dirname(__FILE__) + '/implementation')
4
5
  require File.expand_path(File.dirname(__FILE__) + '/protocols/http/parser')
@@ -34,12 +34,12 @@ module Riddl
34
34
  ret.sort!
35
35
  ret
36
36
  #}}}
37
- end
37
+ end
38
38
  protected :rpaths, :get_resource_deep
39
39
  end
40
- end
40
+ end
41
41
  end
42
-
42
+
43
43
  require File.expand_path(File.dirname(__FILE__) + '/wrapper/description')
44
44
  require File.expand_path(File.dirname(__FILE__) + '/wrapper/declaration')
45
45
  require File.expand_path(File.dirname(__FILE__) + '/wrapper/messageparser')
@@ -73,7 +73,7 @@ module Riddl
73
73
  fpath = nil
74
74
  if name.is_a?(XML::Smart::Dom)
75
75
  @doc = name
76
- else
76
+ else
77
77
  if name.is_a?(String) && name =~ /^http:\/\/(www\.)?riddl\.org(\/ns\/common-patterns\/.*)/
78
78
  name = File.expand_path(File.dirname(__FILE__)) + $2
79
79
  end
@@ -88,8 +88,8 @@ module Riddl
88
88
  rescue
89
89
  raise SpecificationError, "#{name.inspect} is no RIDDL description or declaration (neither a file, url or string)."
90
90
  end
91
- end
92
- end
91
+ end
92
+ end
93
93
 
94
94
  @doc.register_namespace 'x', XINCLUDE
95
95
  @doc.find('//x:include/@href').each do |i|
@@ -115,10 +115,10 @@ module Riddl
115
115
  @doc.root.prepend rrds.find('/des:description/des:message')
116
116
  @doc.find("/des:description/des:resource").each do |r|
117
117
  r.prepend rds.find('/des:description/des:resource/*')
118
- end
118
+ end
119
119
  @doc.find("/des:description//des:resource").each do |r|
120
120
  r.prepend rrds.find('/des:description/des:resource/*')
121
- end
121
+ end
122
122
  end
123
123
  if @is_declaration && get_description
124
124
  @doc.root.prepend("dec:interface",:name=>"riddldescription").add XML::Smart::open_unprotected(RIDDL_DESCRIPTION_SHOW).root
@@ -128,7 +128,7 @@ module Riddl
128
128
  x.append("apply-to","/")
129
129
  x.append("apply-to","/**/*")
130
130
  end
131
- end
131
+ end
132
132
 
133
133
  @declaration = @description = nil
134
134
  #}}}
@@ -170,7 +170,7 @@ module Riddl
170
170
  #{{{
171
171
  description
172
172
  declaration
173
-
173
+
174
174
  req = @description.get_resource(path).access_methods if @is_description
175
175
  req = @declaration.get_resource(path).composition if @is_declaration
176
176
 
@@ -194,7 +194,7 @@ module Riddl
194
194
  r.select{|o|o.class==Riddl::Wrapper::Description::WebSocket}.each do |o|
195
195
  return IOMessages.new(nil,nil,nil,nil)
196
196
  end
197
- end
197
+ end
198
198
  if @is_declaration
199
199
  r = req[operation]
200
200
  r.select{|o|o.result.class==Riddl::Wrapper::Description::RequestInOut}.each do |o|
@@ -213,8 +213,8 @@ module Riddl
213
213
  r.select{|o|o.result.class==Riddl::Wrapper::Description::WebSocket}.each do |o|
214
214
  return IOMessages.new(nil,nil,nil,o.result.interface)
215
215
  end
216
- end
217
- end
216
+ end
217
+ end
218
218
  return nil
219
219
  #}}}
220
220
  end
@@ -251,7 +251,7 @@ module Riddl
251
251
  def load_necessary_handlers!
252
252
  #{{{
253
253
  @doc.find("//des:parameter/@handler").map{|h|h.to_s}.uniq.each do |h|
254
- if File.exists?(File.dirname(__FILE__) + '/handlers/' + File.basename(h) + ".rb")
254
+ if File.exist?(File.dirname(__FILE__) + '/handlers/' + File.basename(h) + ".rb")
255
255
  require File.expand_path(File.dirname(__FILE__) + '/handlers/' + File.basename(h))
256
256
  end
257
257
  end
@@ -274,7 +274,7 @@ module Riddl
274
274
  declaration
275
275
  tmp = []
276
276
 
277
- tmp = @description.paths if @is_description
277
+ tmp = @description.paths if @is_description
278
278
  tmp = @declaration.paths if @is_declaration
279
279
  tmp.map do |t|
280
280
  [t[0],Regexp.new("^" + t[1].gsub(/\{\}/,"[^/]+") + (t[2] ? '\/?' : '\/?$'))]
@@ -305,15 +305,15 @@ module Riddl
305
305
  elsif m.class == Riddl::Wrapper::Description::RequestPass
306
306
  Riddl::Wrapper::IOMessages.new(Riddl::Wrapper::Description::Star.new, Riddl::Wrapper::Description::Star.new,nil,m.interface)
307
307
  end
308
- end
308
+ end
309
309
  else
310
310
  [self]
311
- end
311
+ end
312
312
  end
313
313
  attr_reader :in, :out, :route, :interface
314
314
  #}}}
315
315
  end
316
-
316
+
317
317
  def declaration?; @is_declaration; end
318
318
  def description?; @is_description; end
319
319
  end
@@ -6,14 +6,14 @@ require File.expand_path(File.dirname(__FILE__) + '/declaration/interface')
6
6
  module Riddl
7
7
  class Wrapper
8
8
  class Declaration < WrapperUtils
9
-
9
+
10
10
  def get_resource(path)
11
11
  get_resource_deep(path,@facade.resource)
12
- end
12
+ end
13
13
  def paths
14
14
  rpaths(@facade.resource)
15
15
  end
16
-
16
+
17
17
  def description_xml
18
18
  @facade.description_xml(@namespaces)
19
19
  end
@@ -69,8 +69,8 @@ module Riddl
69
69
  end
70
70
  riddl.find("/dec:declaration/dec:facade/dec:tile").each do |tile|
71
71
  @tiles << (til = Tile.new)
72
- res = til.base_path(tile.attributes['path'] || '/')
73
- # res.clean! # for overlapping tiles, each tile gets an empty path TODO
72
+ til.base_path(tile.attributes['path'] || '/')
73
+ # ^ above.clean! # for overlapping tiles, each tile gets an empty path TODO
74
74
  later = []
75
75
  tile.find("dec:layer").each_with_index do |layer,index|
76
76
  apply_to = layer.find("dec:apply-to")
@@ -88,25 +88,25 @@ module Riddl
88
88
  t = at.to_s.sub(/^\/*/,'').split(/(?<!\*\*)\//)
89
89
  if t.last == "**/*" || t.last == "*"
90
90
  later << [des,desres,lname,lpath,at.to_s.strip,index,block,t.last == "**/*" ? :descendants : :children]
91
- else
91
+ else
92
92
  int = Interface.new(lname,at.to_s,lpath,"/",des)
93
93
  til.add_description(des,desres,at.to_s,index,int,block)
94
94
  end
95
95
  end
96
96
  end
97
97
  end
98
- paths = @tiles.map do |til| # extract all currently existing paths for all tiles
99
- rpaths(til.resource).map{|a,b| a}
98
+ paths = @tiles.map do |ttil| # extract all currently existing paths for all tiles
99
+ rpaths(ttil.resource).map{|a,b| a}
100
100
  end.flatten.uniq
101
101
  later.each do |lat|
102
102
  mpath = lat[4].gsub(/\/\*\*\/\*$/,'').gsub(/\/\*$/,'')
103
103
  paths.each do |path|
104
104
  pbefore, pafter = path[0..mpath.length].chop, path[mpath.length+1..-1]
105
- if mpath == pbefore
105
+ if mpath == pbefore
106
106
  if (lat[7] == :descendants && pafter != '') || (lat[7] == :children && !pafter.nil? && pafter != '' && pafter !~ /\//)
107
107
  int = Interface.new(lat[2],path,lat[3],"/",lat[1])
108
108
  til.add_description(lat[0],lat[1],path,lat[5],int,lat[6])
109
- end
109
+ end
110
110
  end
111
111
  end
112
112
  end
@@ -46,12 +46,11 @@ module Riddl
46
46
  res.resources.each do |k,v|
47
47
  description_xml_priv(result,messages,level+1,v)
48
48
  end
49
- ""
50
49
  result << s + "</resource>\n"
51
50
  #}}}
52
51
  end
53
52
  private :description_xml_priv
54
-
53
+
55
54
  def merge_tiles(res,fac=@resource)
56
55
  #{{{
57
56
  fac.custom = fac.custom + res.custom
@@ -48,11 +48,11 @@ module Riddl
48
48
  res = add_path(path,res,rec)
49
49
  res.add_access_methods(des,desres,index,interface)
50
50
  res.add_custom(desres)
51
- desres.find("des:resource").each do |desres|
52
- cpath = desres.attributes['relative'] || "{}"
53
- rec = desres.attributes['recursive']
51
+ desres.find("des:resource").each do |tdesres|
52
+ cpath = tdesres.attributes['relative'] || "{}"
53
+ rec = tdesres.attributes['recursive']
54
54
  int = Interface.new_from_interface(interface,(interface.sub+"/"+cpath).gsub(/\/+/,'/'))
55
- add_description(des,desres,cpath,index,int,block,rec,res)
55
+ add_description(des,tdesres,cpath,index,int,block,rec,res)
56
56
  end
57
57
  block.each do |bl|
58
58
  bpath = bl.to_s.gsub(/\/+/,'/').gsub(/\/$/,'')
@@ -11,8 +11,8 @@ module Riddl
11
11
  end
12
12
  def get_resource(path)
13
13
  get_resource_deep(path,@resource)
14
- end
15
-
14
+ end
15
+
16
16
  def visualize(res=@resource,what='')
17
17
  #{{{
18
18
  what += res.path
@@ -45,10 +45,10 @@ module Riddl
45
45
  end
46
46
  res.add_access_methods(des,desres,0,nil)
47
47
  res.add_custom(desres)
48
- desres.find("des:resource").each do |desres|
49
- cpath = desres.attributes['relative'] || "{}"
50
- rec = desres.attributes['recursive']
51
- add_description(des,res,desres,cpath,rec)
48
+ desres.find("des:resource").each do |tdesres|
49
+ cpath = tdesres.attributes['relative'] || "{}"
50
+ rec = tdesres.attributes['recursive']
51
+ add_description(des,res,tdesres,cpath,rec)
52
52
  end
53
53
  nil
54
54
  #}}}
@@ -7,6 +7,7 @@ module Riddl
7
7
  @used = value
8
8
  end
9
9
  def used?
10
+ @used ||= nil
10
11
  @used || false
11
12
  end
12
13
  attr_reader :interface
@@ -41,9 +42,9 @@ module Riddl
41
42
  @interface = interface
42
43
  if des.nil?
43
44
  @trans = mtrans
44
- else
45
+ else
45
46
  @trans = Riddl::Wrapper::Description::Transformation.new(des,mtrans)
46
- end
47
+ end
47
48
  @out = nil
48
49
  end
49
50
  def self.new_from_transformation(mtrans1,mtrans2,custom)
@@ -75,7 +76,7 @@ module Riddl
75
76
  @out = mout
76
77
  else
77
78
  @out = mout.nil? ? nil : Riddl::Wrapper::Description::Message.new(des,mout)
78
- end
79
+ end
79
80
  end
80
81
  def self.new_from_message(mout,custom)
81
82
  RequestStarOut.new(nil,mout,nil,custom)
@@ -91,7 +92,7 @@ module Riddl
91
92
  def initialize(interface,custom=[])
92
93
  @custom = custom
93
94
  @interface = interface
94
- end
95
+ end
95
96
  def visualize; "pass *"; end
96
97
  def hash
97
98
  0
@@ -102,13 +103,13 @@ module Riddl
102
103
  def initialize(interface,custom=[])
103
104
  @custom = custom
104
105
  @interface = interface
105
- end
106
+ end
106
107
  def visualize; ""; end
107
108
  def hash
108
109
  0
109
110
  end
110
111
  end# }}}
111
-
112
+
112
113
  end
113
114
  end
114
115
  end