simpleflow 0.0.1

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.
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
@@ -0,0 +1,21 @@
1
+ ## MAC OS
2
+ .DS_Store
3
+
4
+ ## TEXTMATE
5
+ *.tmproj
6
+ tmtags
7
+
8
+ ## EMACS
9
+ *~
10
+ \#*
11
+ .\#*
12
+
13
+ ## VIM
14
+ *.swp
15
+
16
+ ## PROJECT::GENERAL
17
+ coverage
18
+ rdoc
19
+ pkg
20
+
21
+ ## PROJECT::SPECIFIC
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2010 Eric Abouaf
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,83 @@
1
+ = simpleflow
2
+
3
+ * http://github.com/neyric/simpleflow
4
+
5
+ == DESCRIPTION:
6
+
7
+ Simple workflow execution
8
+
9
+ == FEATURES/PROBLEMS:
10
+
11
+
12
+ == SYNOPSIS:
13
+
14
+
15
+ result = Simpleflow::run({
16
+
17
+ "modules" => [
18
+ {
19
+ "name" => "MyCustomModule",
20
+ "value" => {
21
+ "test"=>"blabla"
22
+ }
23
+ }
24
+ ],
25
+
26
+ "wires" => []
27
+
28
+ }, {}, true, lambda { |name|
29
+ ...
30
+ }
31
+ )
32
+
33
+
34
+ == REQUIREMENTS:
35
+
36
+ * FIX (list of requirements)
37
+
38
+ == INSTALL:
39
+
40
+ sudo gem install simpleflow
41
+
42
+
43
+ == TODO
44
+
45
+ * loops not implemented
46
+ * conditional not implemented
47
+
48
+
49
+ == Note on Patches/Pull Requests
50
+
51
+ * Fork the project.
52
+ * Make your feature addition or bug fix.
53
+ * Add tests for it. This is important so I don't break it in a
54
+ future version unintentionally.
55
+ * Commit, do not mess with rakefile, version, or history.
56
+ (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
57
+ * Send me a pull request. Bonus points for topic branches.
58
+
59
+
60
+ == LICENSE:
61
+
62
+ (The MIT License)
63
+
64
+ Copyright (c) 2010 Eric Abouaf
65
+
66
+ Permission is hereby granted, free of charge, to any person obtaining
67
+ a copy of this software and associated documentation files (the
68
+ 'Software'), to deal in the Software without restriction, including
69
+ without limitation the rights to use, copy, modify, merge, publish,
70
+ distribute, sublicense, and/or sell copies of the Software, and to
71
+ permit persons to whom the Software is furnished to do so, subject to
72
+ the following conditions:
73
+
74
+ The above copyright notice and this permission notice shall be
75
+ included in all copies or substantial portions of the Software.
76
+
77
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
78
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
79
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
80
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
81
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
82
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
83
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,52 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "simpleflow"
8
+ gem.summary = %Q{Simple workflow execution}
9
+ gem.description = %Q{Simpleflow has a simple engine that executes modules in a loop. The workflows are declarative, which means that you can static-check them and safely run user workflows. Modules are created easily in ruby so you can quickly write wrappers around libraires.}
10
+ gem.email = "eric.abouaf@gmail.com"
11
+ gem.homepage = "http://github.com/neyric/simpleflow"
12
+ gem.authors = ["neyric"]
13
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
14
+ end
15
+ Jeweler::GemcutterTasks.new
16
+ rescue LoadError
17
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
18
+ end
19
+
20
+ require 'rake/testtask'
21
+ Rake::TestTask.new(:test) do |test|
22
+ test.libs << 'lib' << 'test'
23
+ test.pattern = 'test/**/test_*.rb'
24
+ test.verbose = true
25
+ end
26
+
27
+ begin
28
+ require 'rcov/rcovtask'
29
+ Rcov::RcovTask.new do |test|
30
+ test.libs << 'test'
31
+ test.pattern = 'test/**/test_*.rb'
32
+ test.verbose = true
33
+ end
34
+ rescue LoadError
35
+ task :rcov do
36
+ abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
37
+ end
38
+ end
39
+
40
+ task :test => :check_dependencies
41
+
42
+ task :default => :test
43
+
44
+ require 'rake/rdoctask'
45
+ Rake::RDocTask.new do |rdoc|
46
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
47
+
48
+ rdoc.rdoc_dir = 'rdoc'
49
+ rdoc.title = "simpleflow #{version}"
50
+ rdoc.rdoc_files.include('README*')
51
+ rdoc.rdoc_files.include('lib/**/*.rb')
52
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.1
data/init.rb ADDED
@@ -0,0 +1,2 @@
1
+ # For Rails plugin install
2
+ require 'simpleflow'
@@ -0,0 +1,175 @@
1
+ $:.unshift(File.dirname(__FILE__)) unless
2
+ $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
3
+
4
+ Dir["#{File.dirname(__FILE__)}/simpleflow/*.rb"].each { |f| load(f) }
5
+
6
+ module Simpleflow
7
+ VERSION = '0.0.1'
8
+
9
+
10
+ module Modules
11
+ # For Composed modules
12
+ def self.input(params)
13
+ inputName = params["input"]["name"]
14
+ if params.keys.include?(inputName)
15
+ {"out" => params[inputName] }
16
+ else
17
+ {"out" => params["input"]["value"] }
18
+ end
19
+ end
20
+
21
+ # For Composed modules
22
+ def self.output(params)
23
+ {"out" => params["in"] }
24
+ end
25
+
26
+ # Comment do nothing and return nothing
27
+ def self.comment(params)
28
+ {}
29
+ end
30
+ end
31
+
32
+
33
+ def self.run(config, params = {}, debug = false, find_method = nil)
34
+
35
+ wires = config["wires"] || []
36
+ modules = config["modules"] || []
37
+
38
+ # Store the results of each sub-module
39
+ execValues = {}
40
+
41
+ # list all of the modules that we can execute
42
+ moduleIdsToExecute = []
43
+
44
+ # List all already executed modules
45
+ executedModules = []
46
+
47
+
48
+ firstTimeInLoop = true
49
+ moreModulesToRun = false
50
+ while moreModulesToRun or firstTimeInLoop do
51
+ firstTimeInLoop = false
52
+
53
+ # Recalculate all modules that can be executed :
54
+ mId = 0
55
+ modules.each { |m2|
56
+ if !moduleIdsToExecute.include?(mId) and !executedModules.include?(mId) # don't re-execute modules
57
+ mayEval = true
58
+ # runnable if all wires which target is this mId have a source output evaluated.
59
+ wires.each { |w|
60
+ if w["tgt"]["moduleId"] == mId
61
+ if !execValues[ w["src"]["moduleId"] ]
62
+ mayEval = false
63
+ end
64
+ end
65
+ }
66
+ moduleIdsToExecute << mId if mayEval
67
+ end
68
+ mId += 1
69
+ }
70
+
71
+ if moduleIdsToExecute.size == 0
72
+ moreModulesToRun = false
73
+ else
74
+ moreModulesToRun = true
75
+
76
+ moduleId = moduleIdsToExecute.shift
77
+ m = modules[moduleId]
78
+
79
+ # Build the parameters for the execution
80
+ p = {}
81
+ # params passed to the run method
82
+ params.each { |k,v| p[k] = v }
83
+
84
+ # default form values
85
+ m["value"].each { |k,v| p[k] = v }
86
+
87
+
88
+ puts "Wires: "+wires.inspect
89
+
90
+ # incoming wire params
91
+ wires.each { |w|
92
+ if w["tgt"]["moduleId"] == moduleId
93
+
94
+ puts "Incoming wire: "+w.inspect
95
+
96
+ key = w["tgt"]["terminal"]
97
+ val = execValues[ w["src"]["moduleId"] ][ w["src"]["terminal"] ]
98
+
99
+ # We simply want to do p[key] = val,
100
+ # except that key might look like "myvar[1][firstname]"
101
+ # which mean we have to store this val in p["myvar"][1]["firstname"] instead
102
+ push_to = p
103
+ pathItems = key.scan(/\[([^\]]*)\]/).map { |i| i[0].match(/\d+/) ? i[0].to_i : i[0] }
104
+ if pathItems.size > 0
105
+ push_to = push_to[key.match(/^([^\[]*)/)[0]]
106
+ end
107
+ if pathItems.size > 1
108
+ 0.upto(pathItems.size-2) { |i| push_to = push_to[ pathItems[i] ] }
109
+ end
110
+ if pathItems.size > 0
111
+ key = pathItems.last
112
+ end
113
+ push_to[key] = val
114
+
115
+ end
116
+ }
117
+
118
+
119
+ puts "\n Starting "+m["name"]+" MODULE with : "+p.inspect
120
+
121
+ # Execute Ruby base modules
122
+ if !Modules.methods.index( m["name"] ).nil?
123
+ begin
124
+ execValues[moduleId] = Modules.send( m["name"].to_sym, p)
125
+ rescue Exception => e
126
+ puts "Simpleflow "+e.message
127
+ end
128
+
129
+ else
130
+ # Try to execute composed module
131
+ if find_method
132
+ w = find_method.call(m["name"])
133
+ if !w
134
+ raise "Module "+m["name"]+" not found !"
135
+ end
136
+ execValues[moduleId] = Simpleflow.run(w, p, false, find_method)
137
+ else
138
+ raise "Module "+m["name"]+" not found !"
139
+ end
140
+
141
+ end
142
+
143
+ puts "\n Finished "+m["name"]+" MODULE with : "+execValues[moduleId].inspect
144
+
145
+
146
+ # Mark this modules as executed
147
+ executedModules.push(moduleId)
148
+
149
+ end
150
+
151
+ end
152
+
153
+ # Return internal execution values if debug mode
154
+ return execValues if debug
155
+
156
+
157
+ # OUTPUTS
158
+ outputValues = {}
159
+ moduleIndex = 0
160
+ modules.each { |m|
161
+ if m["name"] == "output"
162
+ wires.each { |w|
163
+ if w["tgt"]["moduleId"] == moduleIndex and execValues[w["src"]["moduleId"]]
164
+ outputValues[m["value"]["name"]] = execValues[w["src"]["moduleId"]][ w["src"]["terminal"] ]
165
+ end
166
+ }
167
+ end
168
+ moduleIndex += 1
169
+ }
170
+ return outputValues
171
+
172
+ end
173
+
174
+
175
+ end
@@ -0,0 +1,16 @@
1
+ module Simpleflow
2
+ module Modules
3
+
4
+ def self.getIpsFromDomain(params)
5
+ require 'resolv'
6
+
7
+ hosts = []
8
+ dns = Resolv::DNS.new
9
+ dns.getresources(params["domain"], Resolv::DNS::Resource::IN::A).collect do |r|
10
+ hosts << r.address.to_s
11
+ end
12
+ { "hosts" => hosts }
13
+ end
14
+
15
+ end
16
+ end
@@ -0,0 +1,104 @@
1
+ module Simpleflow
2
+ module Modules
3
+
4
+ # HTTP
5
+
6
+ # TODO: proxy
7
+ # TODO: timeout
8
+ # TODO: additional headers
9
+ # TODO: allow cookies
10
+ # TODO: whether or not to follow redirects
11
+
12
+
13
+ def self.HTTP(params)
14
+
15
+ require 'net/http'
16
+ require 'net/https'
17
+ require 'uri'
18
+ require 'cgi'
19
+
20
+
21
+ require 'yajl'
22
+
23
+ uri = URI.parse(params["url"])
24
+ path = uri.request_uri
25
+
26
+ # Parameters / Body
27
+ body = nil
28
+
29
+ # Raw request
30
+ httpClass = case params["method"]
31
+ when "GET" then Net::HTTP::Get
32
+ when "PUT" then Net::HTTP::Put
33
+ when "POST" then Net::HTTP::Post
34
+ when "DELETE" then Net::HTTP::Delete
35
+ when "OPTIONS" then Net::HTTP::Options
36
+ end
37
+ raw_request = httpClass.new(path)
38
+
39
+ case params["method"]
40
+ when "GET" , "DELETE"
41
+ path += "?"+ params["urlparams"].map { |p| p[0].to_s+"="+CGI::escape(p[1].to_s) }.join('&')
42
+ raw_request = httpClass.new(path)
43
+ when "PUT" , "POST"
44
+ body = case params["encoding"]
45
+ when "application/json" then
46
+ raw_request["content-type"] = "application/json"
47
+ params["urlparams"].to_json
48
+ when "application/xml" then
49
+ raw_request["content-type"] = "application/xml"
50
+ params["urlparams"].to_xml
51
+ when "application/x-www-form-urlencoded" then
52
+ raw_request["content-type"] = "application/x-www-form-urlencoded"
53
+ params["urlparams"].map { |p| p[0].to_s+"="+CGI::escape(p[1].to_s) }.join('&')
54
+ end
55
+ end
56
+
57
+ raw_request.body = body if body
58
+
59
+ # Basic Auth
60
+ raw_request.basic_auth(uri.user, uri.password) if uri.user
61
+
62
+ # HTTPS
63
+ http = Net::HTTP.new(uri.host, uri.port)
64
+ http.use_ssl = true if uri.scheme == "https"
65
+
66
+
67
+ # Perform
68
+ res = http.start{ |h| h.request(raw_request) }
69
+
70
+ o = res.body
71
+
72
+ case res
73
+ when Net::HTTPSuccess then
74
+
75
+ # Parsing
76
+ puts "HTTP res content-type : "+res.content_type
77
+
78
+ if (res.content_type == "application/xml") or (res.content_type == "text/xml")
79
+ o = Hash.from_xml(res.body)
80
+ elsif res.content_type == "application/json"
81
+
82
+ parser = Yajl::Parser.new
83
+ o = parser.parse(res.body)
84
+
85
+ else
86
+ o = res.body
87
+ end
88
+
89
+ { "out" => o }
90
+
91
+ when Net::HTTPRedirection then
92
+
93
+ { "out" => res.error! }
94
+
95
+ else
96
+
97
+ { "out" => res.error! }
98
+
99
+ end
100
+
101
+ end
102
+
103
+ end
104
+ end
@@ -0,0 +1,11 @@
1
+ module Simpleflow
2
+ module Modules
3
+
4
+ def self.JSONparse(params)
5
+ require 'yajl'
6
+ parser = Yajl::Parser.new
7
+ { "out" => parser.parse(params["in"]) }
8
+ end
9
+
10
+ end
11
+ end
@@ -0,0 +1,24 @@
1
+ module Simpleflow
2
+ module Modules
3
+
4
+ # JSONPath module
5
+ # cf http://github.com/bruce/jsonpath
6
+ def self.JSONPath(params)
7
+ require 'jsonpath'
8
+
9
+ begin
10
+ out = JSONPath.lookup( params["in"], params["path"])
11
+ rescue Exception => e
12
+ out = {:error => e.message}
13
+ end
14
+
15
+ if params["firstonly"]
16
+ out = out[0]
17
+ end
18
+
19
+ { "out" => out }
20
+ end
21
+
22
+
23
+ end
24
+ end
@@ -0,0 +1,12 @@
1
+ module Simpleflow
2
+ module Modules
3
+
4
+ # Liquid Templating
5
+ def self.liquid(params)
6
+ require 'liquid'
7
+ r = Liquid::Template.parse(params["template"]).render 'params' => params["in"]
8
+ { "out" => r }
9
+ end
10
+
11
+ end
12
+ end
@@ -0,0 +1,14 @@
1
+ module Simpleflow
2
+ module Modules
3
+
4
+
5
+ def self.ObjectBuilder(params)
6
+ o = {}
7
+ params["items"].each { |v|
8
+ o[v[0]] = v[1]
9
+ }
10
+ { "out" => o }
11
+ end
12
+
13
+ end
14
+ end
@@ -0,0 +1,12 @@
1
+
2
+ module Simpleflow
3
+ module Modules
4
+
5
+ # Ping
6
+ def self.ping(params)
7
+ require 'ping'
8
+ { "out" => Ping.pingecho(params["hostname"], params["timeout"], params["service"]) }
9
+ end
10
+
11
+ end
12
+ end
@@ -0,0 +1,17 @@
1
+ module Simpleflow
2
+ module Modules
3
+
4
+
5
+ def self.StringBuilder(params)
6
+ list = params["liste"].dup
7
+ params.each { |k,v|
8
+ if !k.index('[').nil?
9
+ index = k.split('[')[1].split(']')[0].to_i
10
+ list[index]=v
11
+ end
12
+ }
13
+ { "out" => list.join() }
14
+ end
15
+
16
+ end
17
+ end
@@ -0,0 +1,10 @@
1
+ module Simpleflow
2
+ module Modules
3
+
4
+ def self.urlencode(params)
5
+ require 'cgi'
6
+ { "out" => CGI::escape(params["in"]) }
7
+ end
8
+
9
+ end
10
+ end
@@ -0,0 +1,75 @@
1
+ module Simpleflow
2
+ module Modules
3
+
4
+
5
+ ##############################
6
+ # Keep ME !!! The advantage of this version is that we can look the response of YQL to check if
7
+ # there is an error and format it to a Simpleflow error ! (like invalid YQL query...)
8
+ ##############################
9
+
10
+ # def self.YQL(params)
11
+ #
12
+ # require 'yajl'
13
+ # require 'cgi'
14
+ #
15
+ # if !params["query"].is_a?(String)
16
+ # return { "out" => "Error: expecting query as a string"}
17
+ # elsif params["query"] == ""
18
+ # return { "out" => "Error: empty query"}
19
+ # end
20
+ #
21
+ # require 'net/http'
22
+ # require 'uri'
23
+ # url = URI.parse('http://query.yahooapis.com')
24
+ # res = Net::HTTP.start(url.host, url.port) { |http|
25
+ # http.get('/v1/public/yql?q='+CGI::escape(params["query"])+'&format=json')
26
+ # }
27
+ #
28
+ # parser = Yajl::Parser.new
29
+ # hash = parser.parse(res.body)
30
+ #
31
+ # { "out" => hash }
32
+ # end
33
+
34
+ def self.YQL(params)
35
+ Simpleflow.run({
36
+ "modules" => [
37
+
38
+ {
39
+ "name" => "input",
40
+ "value" => {
41
+ "input" => { "value" => 'show tables' , "name" => "query" }
42
+ }
43
+ },
44
+
45
+ {
46
+ "name" => "HTTP",
47
+ "value" => {
48
+ "method"=>"GET",
49
+ "url"=> 'http://query.yahooapis.com/v1/public/yql',
50
+ "urlparams"=>[
51
+ ["format","json"],
52
+ ["q", ""], # the [1,1] element is wired
53
+ ["env", "store://datatables.org/alltableswithkeys"]
54
+ ]
55
+ }
56
+ },
57
+
58
+ { "name" => "output","value" => {"in" => '', "name" => "out"} }
59
+
60
+ ],
61
+ "wires" => [
62
+ {
63
+ "src" => {"moduleId" => 0 , "terminal" => "out"},
64
+ "tgt" => {"moduleId" => 1 , "terminal" => "urlparams[1][1]"}
65
+ },
66
+ {
67
+ "src" => {"moduleId" => 1 , "terminal" => "out"},
68
+ "tgt" => {"moduleId" => 2 , "terminal" => "in"}
69
+ }
70
+ ]
71
+ }, params)
72
+ end
73
+
74
+ end
75
+ end
@@ -0,0 +1,62 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{simpleflow}
8
+ s.version = "0.0.1"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["neyric"]
12
+ s.date = %q{2010-08-27}
13
+ s.description = %q{Simpleflow has a simple engine that executes modules in a loop. The workflows are declarative, which means that you can static-check them and safely run user workflows. Modules are created easily in ruby so you can quickly write wrappers around libraires.}
14
+ s.email = %q{eric.abouaf@gmail.com}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE",
17
+ "README.rdoc"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ ".gitignore",
22
+ "LICENSE",
23
+ "README.rdoc",
24
+ "Rakefile",
25
+ "VERSION",
26
+ "init.rb",
27
+ "lib/simpleflow.rb",
28
+ "lib/simpleflow/dns_resolve.rb",
29
+ "lib/simpleflow/http.rb",
30
+ "lib/simpleflow/json.rb",
31
+ "lib/simpleflow/jsonpath.rb",
32
+ "lib/simpleflow/liquid.rb",
33
+ "lib/simpleflow/object_builder.rb",
34
+ "lib/simpleflow/ping.rb",
35
+ "lib/simpleflow/string_builder.rb",
36
+ "lib/simpleflow/urlencode.rb",
37
+ "lib/simpleflow/yql.rb",
38
+ "simpleflow.gemspec",
39
+ "test/helper.rb",
40
+ "test/test_simpleflow.rb"
41
+ ]
42
+ s.homepage = %q{http://github.com/neyric/simpleflow}
43
+ s.rdoc_options = ["--charset=UTF-8"]
44
+ s.require_paths = ["lib"]
45
+ s.rubygems_version = %q{1.3.7}
46
+ s.summary = %q{Simple workflow execution}
47
+ s.test_files = [
48
+ "test/helper.rb",
49
+ "test/test_simpleflow.rb"
50
+ ]
51
+
52
+ if s.respond_to? :specification_version then
53
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
54
+ s.specification_version = 3
55
+
56
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
57
+ else
58
+ end
59
+ else
60
+ end
61
+ end
62
+
@@ -0,0 +1,9 @@
1
+ require 'rubygems'
2
+ require 'test/unit'
3
+
4
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
5
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
+ require 'simpleflow'
7
+
8
+ class Test::Unit::TestCase
9
+ end
@@ -0,0 +1,46 @@
1
+ require File.dirname(__FILE__) + '/test_helper.rb'
2
+
3
+ class TestSimpleflow < Test::Unit::TestCase
4
+
5
+ def setup
6
+ end
7
+
8
+ def test_empty_run
9
+
10
+ result = Simpleflow::run({
11
+ "modules" => [],
12
+ "wires" => []
13
+ })
14
+
15
+ assert_equal Hash, result.class
16
+ assert_equal 0, result.keys.size
17
+
18
+ end
19
+
20
+
21
+ def test_YQL_debug
22
+
23
+ result = Simpleflow::run({
24
+ "modules" => [
25
+ {
26
+ "name" => "YQL",
27
+ "value" => {
28
+ "query"=>"select * from feed where url='http://rss.news.yahoo.com/rss/topstories' limit 2"
29
+ }
30
+ }
31
+ ],
32
+ "wires" => []
33
+ }, {}, true)
34
+
35
+ #puts result.inspect
36
+ #assert result
37
+ # TODO:
38
+ #assert_equal Hash, result.class
39
+ #assert_equal 0, result.keys.size
40
+
41
+
42
+ end
43
+
44
+
45
+
46
+ end
metadata ADDED
@@ -0,0 +1,89 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: simpleflow
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - neyric
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-08-27 00:00:00 +02:00
19
+ default_executable:
20
+ dependencies: []
21
+
22
+ description: Simpleflow has a simple engine that executes modules in a loop. The workflows are declarative, which means that you can static-check them and safely run user workflows. Modules are created easily in ruby so you can quickly write wrappers around libraires.
23
+ email: eric.abouaf@gmail.com
24
+ executables: []
25
+
26
+ extensions: []
27
+
28
+ extra_rdoc_files:
29
+ - LICENSE
30
+ - README.rdoc
31
+ files:
32
+ - .document
33
+ - .gitignore
34
+ - LICENSE
35
+ - README.rdoc
36
+ - Rakefile
37
+ - VERSION
38
+ - init.rb
39
+ - lib/simpleflow.rb
40
+ - lib/simpleflow/dns_resolve.rb
41
+ - lib/simpleflow/http.rb
42
+ - lib/simpleflow/json.rb
43
+ - lib/simpleflow/jsonpath.rb
44
+ - lib/simpleflow/liquid.rb
45
+ - lib/simpleflow/object_builder.rb
46
+ - lib/simpleflow/ping.rb
47
+ - lib/simpleflow/string_builder.rb
48
+ - lib/simpleflow/urlencode.rb
49
+ - lib/simpleflow/yql.rb
50
+ - simpleflow.gemspec
51
+ - test/helper.rb
52
+ - test/test_simpleflow.rb
53
+ has_rdoc: true
54
+ homepage: http://github.com/neyric/simpleflow
55
+ licenses: []
56
+
57
+ post_install_message:
58
+ rdoc_options:
59
+ - --charset=UTF-8
60
+ require_paths:
61
+ - lib
62
+ required_ruby_version: !ruby/object:Gem::Requirement
63
+ none: false
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ hash: 3
68
+ segments:
69
+ - 0
70
+ version: "0"
71
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ hash: 3
77
+ segments:
78
+ - 0
79
+ version: "0"
80
+ requirements: []
81
+
82
+ rubyforge_project:
83
+ rubygems_version: 1.3.7
84
+ signing_key:
85
+ specification_version: 3
86
+ summary: Simple workflow execution
87
+ test_files:
88
+ - test/helper.rb
89
+ - test/test_simpleflow.rb