Floppy-eeml 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README +7 -1
- data/examples/simple_server.rb +30 -0
- metadata +3 -2
data/README
CHANGED
@@ -26,4 +26,10 @@ To parse EEML: call EEML::Environment#from_eeml(your_eeml_string), and you will
|
|
26
26
|
get back an EEML::Environment object containing a number of EEML::Data objects.
|
27
27
|
|
28
28
|
To create EEML: create an EEML::Environment object, add one or more EEML::Data
|
29
|
-
objects to it, and call EEML::Environment#to_eeml.
|
29
|
+
objects to it, and call EEML::Environment#to_eeml.
|
30
|
+
|
31
|
+
== EXAMPLES
|
32
|
+
|
33
|
+
The file examples/simple_server.rb contains a simple WEBrick server which serves
|
34
|
+
an EEML document. This allows a site like Pachube (http://www.pachube.com) to
|
35
|
+
get EEML data from your system.
|
@@ -0,0 +1,30 @@
|
|
1
|
+
#!/usr/local/bin/ruby
|
2
|
+
|
3
|
+
dir = File.dirname(__FILE__) + '/../lib'
|
4
|
+
$LOAD_PATH << dir unless $LOAD_PATH.include?(dir)
|
5
|
+
|
6
|
+
require 'webrick'
|
7
|
+
require 'eeml'
|
8
|
+
|
9
|
+
# Create an environment object
|
10
|
+
$environment = EEML::Environment.new
|
11
|
+
|
12
|
+
# Set dummy data in environment object
|
13
|
+
$environment << EEML::Data.new(42)
|
14
|
+
|
15
|
+
# Create WEBrick server
|
16
|
+
s = WEBrick::HTTPServer.new( :Port => 50000 )
|
17
|
+
|
18
|
+
# Create a simple webrick servlet for index.eeml
|
19
|
+
class EEMLServlet < WEBrick::HTTPServlet::AbstractServlet
|
20
|
+
def do_GET(request, response)
|
21
|
+
response.status = 200
|
22
|
+
response['Content-Type'] = "text/xml"
|
23
|
+
response.body = $environment.to_eeml
|
24
|
+
end
|
25
|
+
end
|
26
|
+
s.mount("/index.eeml", EEMLServlet)
|
27
|
+
|
28
|
+
# Go
|
29
|
+
trap("INT"){ s.shutdown }
|
30
|
+
s.start
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: Floppy-eeml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Smith
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-08-
|
12
|
+
date: 2008-08-25 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -28,6 +28,7 @@ files:
|
|
28
28
|
- lib/eeml/environment.rb
|
29
29
|
- lib/eeml/data.rb
|
30
30
|
- lib/eeml/exceptions.rb
|
31
|
+
- examples/simple_server.rb
|
31
32
|
has_rdoc: true
|
32
33
|
homepage: http://github.com/Floppy/eeml-ruby
|
33
34
|
post_install_message:
|