siringa 0.0.5 → 0.0.6
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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 56fef5bef124061ab3bac9a1beafbc3828ab62b2
|
4
|
+
data.tar.gz: b796d80e4f3d83d0fa78d01e30582ef598589bb9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ab9793288d3af7d4fcae48224c7eb406bd7249b9722b1d0914a52597e2b5206707055491e9ccf597c0e0d1c9455f0b04a4d94163073dba3c7b3475ea85cda65
|
7
|
+
data.tar.gz: 675a854c035f548366636724203e834ea781e8dfefd5b77789fe27ddef7214e75204c5bffc355573b636169a736bd2fc929f9799dc9031f5b4e175128d817210
|
@@ -2,7 +2,7 @@ module Siringa
|
|
2
2
|
class SiringaController < ApplicationController
|
3
3
|
|
4
4
|
def load
|
5
|
-
Siringa.load_definition(params['definition'].to_sym)
|
5
|
+
Siringa.load_definition(params['definition'].to_sym, options)
|
6
6
|
resp = { :text => "Definition #{params['definition']} loaded.", :status => :created }
|
7
7
|
rescue ArgumentError => exception
|
8
8
|
resp = { :text => exception.to_s, :status => :method_not_allowed }
|
@@ -45,5 +45,13 @@ module Siringa
|
|
45
45
|
render resp
|
46
46
|
end
|
47
47
|
|
48
|
+
private
|
49
|
+
|
50
|
+
# Returns the arguments to be passed to the definition
|
51
|
+
#
|
52
|
+
# @return [Hash] arguments of the definition
|
53
|
+
def options
|
54
|
+
params[:siringa_args]
|
55
|
+
end
|
48
56
|
end
|
49
57
|
end
|
data/lib/siringa/definitions.rb
CHANGED
@@ -8,9 +8,10 @@ module Siringa
|
|
8
8
|
# Load a definition and run its code
|
9
9
|
#
|
10
10
|
# @param [Symbol] name of the definition
|
11
|
-
|
11
|
+
# @param [Hash] arguments of the definition
|
12
|
+
def self.load_definition(name, options)
|
12
13
|
if exists_definition?(name)
|
13
|
-
@definitions[name].call
|
14
|
+
@definitions[name].call(options)
|
14
15
|
else
|
15
16
|
raise ArgumentError, "Definition #{name.to_s} does not exist.", caller
|
16
17
|
end
|
data/lib/siringa/version.rb
CHANGED
@@ -20,4 +20,9 @@ class SiringaControllerTest < ActionController::TestCase
|
|
20
20
|
assert_response :method_not_allowed
|
21
21
|
end
|
22
22
|
|
23
|
+
test "load action passing arguments" do
|
24
|
+
get :load, { definition: "definition_with_arguments", siringa_args: { name: 'Robb Stark' }, use_route: "siringa" }
|
25
|
+
assert_response :success
|
26
|
+
end
|
27
|
+
|
23
28
|
end
|
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: siringa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Enrico Stano
|
8
|
+
- Pau Pérez
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2015-03-13 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: sqlite3
|
@@ -28,6 +29,7 @@ description: Remotely populate DB for Rails applications for pure client accepta
|
|
28
29
|
testing
|
29
30
|
email:
|
30
31
|
- enricostn@gmail.com
|
32
|
+
- saulopefa@gmail.com
|
31
33
|
executables: []
|
32
34
|
extensions: []
|
33
35
|
extra_rdoc_files: []
|