rumx 0.0.8 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.md +28 -0
- data/README.md +8 -6
- data/examples/bean_hash/README +2 -0
- data/examples/bean_hash/config.ru +9 -0
- data/examples/bean_hash/my_bean.rb +44 -0
- data/examples/bean_list/my_bean.rb +3 -3
- data/examples/embedded/my_bean.rb +3 -2
- data/examples/hash/README +2 -0
- data/examples/hash/config.ru +9 -0
- data/examples/hash/my_bean.rb +30 -0
- data/examples/list/my_bean.rb +5 -2
- data/examples/monitor_script/README +8 -0
- data/examples/monitor_script/rumx_attributes +67 -0
- data/examples/simple/config.ru +3 -1
- data/examples/simple/my_other_bean.rb +11 -0
- data/examples/timer/README +1 -1
- data/examples/timer/my_bean.rb +2 -1
- data/examples/timer_hash/README +2 -0
- data/examples/timer_hash/config.ru +9 -0
- data/examples/timer_hash/my_bean.rb +29 -0
- data/lib/rumx.rb +5 -0
- data/lib/rumx/attribute.rb +26 -17
- data/lib/rumx/attribute_info.rb +12 -0
- data/lib/rumx/bean.rb +146 -248
- data/lib/rumx/beans.rb +2 -0
- data/lib/rumx/beans/error.rb +1 -1
- data/lib/rumx/beans/hash.rb +34 -0
- data/lib/rumx/beans/timer.rb +2 -2
- data/lib/rumx/beans/timer_and_error.rb +1 -1
- data/lib/rumx/beans/timer_hash.rb +9 -0
- data/lib/rumx/hash_attribute.rb +39 -0
- data/lib/rumx/hash_bean.rb +55 -0
- data/lib/rumx/list_attribute.rb +65 -0
- data/lib/rumx/list_bean.rb +52 -0
- data/lib/rumx/server.rb +65 -69
- data/lib/rumx/server/views/attribute_value_tag.haml +3 -3
- data/lib/rumx/server/views/content_attributes.haml +4 -4
- data/lib/rumx/server/views/content_operations.haml +2 -2
- data/lib/rumx/server/views/tree_bean_attributes.haml +0 -4
- data/lib/rumx/server/views/tree_bean_operations.haml +2 -2
- data/lib/rumx/type.rb +15 -7
- metadata +21 -3
- data/lib/rumx/server/views/content_attribute.haml +0 -35
@@ -1,4 +1,4 @@
|
|
1
|
-
- if attribute.allow_write
|
2
|
-
%input{ :type => 'text', :name => param_name, :size => 30, :value =>
|
1
|
+
- if attribute_info.attribute.allow_write
|
2
|
+
%input{ :type => 'text', :name => param_name(attribute_info.ancestry), :size => 30, :value => attribute_info.value }
|
3
3
|
- else
|
4
|
-
%span= escape_html(value)
|
4
|
+
%span= escape_html(attribute_info.value)
|
@@ -11,15 +11,15 @@
|
|
11
11
|
%td Type
|
12
12
|
%td Value
|
13
13
|
%tbody
|
14
|
-
- bean.send(get_set_method, params) do |
|
14
|
+
- bean.send(get_set_method, params) do |attribute_info|
|
15
|
+
- attribute = attribute_info.attribute
|
15
16
|
%tr
|
16
|
-
|
17
|
-
%td= link_to_attribute(path, rel_path)
|
17
|
+
%td= rel_path(attribute_info.ancestry)
|
18
18
|
%td= attribute.description
|
19
19
|
%td= attribute.allow_read
|
20
20
|
%td= attribute.allow_write
|
21
21
|
%td= attribute.type.to_s
|
22
|
-
%td= attribute_value_tag(
|
22
|
+
%td= attribute_value_tag(attribute_info)
|
23
23
|
%input{ :type => 'submit', :value => 'Update' }
|
24
24
|
|
25
25
|
:javascript
|
@@ -17,9 +17,9 @@
|
|
17
17
|
%td Type
|
18
18
|
%td Default Value
|
19
19
|
%tbody
|
20
|
-
- bean.bean_each_operation do |operation
|
20
|
+
- bean.bean_each_operation do |operation|
|
21
21
|
%tr
|
22
|
-
%td= link_to_operation(path,
|
22
|
+
%td= link_to_operation(path, operation)
|
23
23
|
%td= operation.description
|
24
24
|
%td= operation.type.to_s
|
25
25
|
%td
|
data/lib/rumx/type.rb
CHANGED
@@ -8,12 +8,17 @@ module Rumx
|
|
8
8
|
type
|
9
9
|
end
|
10
10
|
|
11
|
-
def initialize(name, string_to_value_proc, value_to_string_proc=lambda{|v| v.to_s})
|
12
|
-
@name
|
11
|
+
def initialize(name, attribute_class, string_to_value_proc, value_to_string_proc=lambda{|v| v.to_s})
|
12
|
+
@name = name
|
13
|
+
@attribute_class = attribute_class
|
13
14
|
@string_to_value_proc = string_to_value_proc
|
14
15
|
@value_to_string_proc = value_to_string_proc
|
15
16
|
end
|
16
17
|
|
18
|
+
def create_attribute(name, description, allow_read, allow_write, options)
|
19
|
+
@attribute_class.new(name, self, description, allow_read, allow_write, options)
|
20
|
+
end
|
21
|
+
|
17
22
|
def string_to_value(string)
|
18
23
|
@string_to_value_proc.call(string)
|
19
24
|
end
|
@@ -23,11 +28,14 @@ module Rumx
|
|
23
28
|
end
|
24
29
|
|
25
30
|
@@allowed_types = {
|
26
|
-
:integer => new(:integer, lambda {|s| s.to_i}),
|
27
|
-
:float => new(:float, lambda {|s| s.to_f}),
|
28
|
-
:string => new(:string, lambda {|s| s.to_s}),
|
29
|
-
:
|
30
|
-
:
|
31
|
+
:integer => new(:integer, Attribute, lambda {|s| s.to_i}),
|
32
|
+
:float => new(:float, Attribute, lambda {|s| s.to_f}),
|
33
|
+
:string => new(:string, Attribute, lambda {|s| s.to_s}),
|
34
|
+
:symbol => new(:symbol, Attribute, lambda {|s| s.to_sym}),
|
35
|
+
:boolean => new(:boolean, Attribute, lambda {|s| s.to_s == 'true'}),
|
36
|
+
:list => new(:list, ListAttribute, nil),
|
37
|
+
:hash => new(:hash, HashAttribute, nil),
|
38
|
+
:void => new(:void, nil, lambda {|s| nil}, lambda {|v| ''})
|
31
39
|
}
|
32
40
|
|
33
41
|
# We've created all the instances we need
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: rumx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0
|
5
|
+
version: 0.1.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Brad Pardee
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-12-
|
13
|
+
date: 2011-12-21 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: sinatra
|
@@ -55,6 +55,9 @@ extensions: []
|
|
55
55
|
extra_rdoc_files: []
|
56
56
|
|
57
57
|
files:
|
58
|
+
- examples/bean_hash/config.ru
|
59
|
+
- examples/bean_hash/my_bean.rb
|
60
|
+
- examples/bean_hash/README
|
58
61
|
- examples/bean_list/config.ru
|
59
62
|
- examples/bean_list/my_bean.rb
|
60
63
|
- examples/bean_list/README
|
@@ -62,28 +65,44 @@ files:
|
|
62
65
|
- examples/embedded/my_bean.rb
|
63
66
|
- examples/embedded/my_embedded_bean.rb
|
64
67
|
- examples/embedded/README
|
68
|
+
- examples/hash/config.ru
|
69
|
+
- examples/hash/my_bean.rb
|
70
|
+
- examples/hash/README
|
65
71
|
- examples/list/config.ru
|
66
72
|
- examples/list/my_bean.rb
|
67
73
|
- examples/list/README
|
74
|
+
- examples/monitor_script/README
|
75
|
+
- examples/monitor_script/rumx_attributes
|
68
76
|
- examples/simple/config.ru
|
69
77
|
- examples/simple/my_bean.rb
|
78
|
+
- examples/simple/my_other_bean.rb
|
70
79
|
- examples/simple/README
|
71
80
|
- examples/timer/config.ru
|
72
81
|
- examples/timer/my_bean.rb
|
73
82
|
- examples/timer/README
|
83
|
+
- examples/timer_hash/config.ru
|
84
|
+
- examples/timer_hash/my_bean.rb
|
85
|
+
- examples/timer_hash/README
|
74
86
|
- lib/rumx.rb
|
75
87
|
- lib/rumx/argument.rb
|
76
88
|
- lib/rumx/attribute.rb
|
89
|
+
- lib/rumx/attribute_info.rb
|
77
90
|
- lib/rumx/bean.rb
|
78
91
|
- lib/rumx/beans.rb
|
92
|
+
- lib/rumx/hash_attribute.rb
|
93
|
+
- lib/rumx/hash_bean.rb
|
94
|
+
- lib/rumx/list_attribute.rb
|
95
|
+
- lib/rumx/list_bean.rb
|
79
96
|
- lib/rumx/operation.rb
|
80
97
|
- lib/rumx/server.rb
|
81
98
|
- lib/rumx/type.rb
|
82
99
|
- lib/rumx/beans/error.rb
|
83
100
|
- lib/rumx/beans/folder.rb
|
101
|
+
- lib/rumx/beans/hash.rb
|
84
102
|
- lib/rumx/beans/message.rb
|
85
103
|
- lib/rumx/beans/timer.rb
|
86
104
|
- lib/rumx/beans/timer_and_error.rb
|
105
|
+
- lib/rumx/beans/timer_hash.rb
|
87
106
|
- lib/rumx/server/public/attribute_test.html
|
88
107
|
- lib/rumx/server/public/jquery-ui-1.8.16.custom.min.js
|
89
108
|
- lib/rumx/server/public/jquery.jstree.js
|
@@ -111,7 +130,6 @@ files:
|
|
111
130
|
- lib/rumx/server/public/themes/default-rtl/style.css
|
112
131
|
- lib/rumx/server/public/themes/default-rtl/throbber.gif
|
113
132
|
- lib/rumx/server/views/attribute_value_tag.haml
|
114
|
-
- lib/rumx/server/views/content_attribute.haml
|
115
133
|
- lib/rumx/server/views/content_attributes.haml
|
116
134
|
- lib/rumx/server/views/content_attributes.haml.error_attempt
|
117
135
|
- lib/rumx/server/views/content_operation.haml
|
@@ -1,35 +0,0 @@
|
|
1
|
-
%h3= path[1..-1]
|
2
|
-
%h4 Attribute
|
3
|
-
%table{}
|
4
|
-
%tr
|
5
|
-
%td Name:
|
6
|
-
%td= attribute.name
|
7
|
-
%tr
|
8
|
-
%td Description:
|
9
|
-
%td= attribute.description
|
10
|
-
%tr
|
11
|
-
%td Allow Read:
|
12
|
-
%td= attribute.allow_read
|
13
|
-
%tr
|
14
|
-
%td Allow Write:
|
15
|
-
%td= attribute.allow_write
|
16
|
-
%tr
|
17
|
-
%td Type:
|
18
|
-
%td= attribute.type.to_s
|
19
|
-
%tr
|
20
|
-
%td Value:
|
21
|
-
%td
|
22
|
-
- if attribute.allow_write
|
23
|
-
%form#form{ :method =>'POST'}
|
24
|
-
= attribute_value_tag(attribute, param_name, value)
|
25
|
-
%input{ :type => 'submit', :value => attribute.allow_read ? 'Update' : 'Set' }
|
26
|
-
- else
|
27
|
-
= value
|
28
|
-
|
29
|
-
:javascript
|
30
|
-
$("#form").submit(function() {
|
31
|
-
$.post("#{attribute_path(path)}", $("#form").serialize(), function(result) {
|
32
|
-
$("#content").html(result);
|
33
|
-
});
|
34
|
-
return false;
|
35
|
-
});
|