resty-generators 0.7.2 → 0.7.3
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.
- data/features/generators.feature +10 -10
- data/lib/generators/resty/model/model_generator.rb +7 -1
- data/lib/generators/resty/scaffold/scaffold_generator.rb +1 -1
- data/lib/generators/resty/setup/setup_generator.rb +61 -46
- data/lib/generators/resty/setup/templates/ActivityPlaceActivityMapper.java +1 -1
- data/lib/generators/resty/setup/templates/Application.java +31 -0
- data/lib/generators/resty/setup/templates/Application.java~ +95 -0
- data/lib/generators/resty/setup/templates/ApplicationLinksPanel.java +29 -0
- data/lib/generators/resty/setup/templates/ApplicationLinksPanel.java~ +29 -0
- data/lib/generators/resty/setup/templates/BreadCrumbsPanel.java +2 -2
- data/lib/generators/resty/setup/templates/EntryPoint.java +14 -4
- data/lib/generators/resty/setup/templates/LoginActivity.java +2 -2
- data/lib/generators/resty/setup/templates/Mavenfile +10 -2
- data/lib/generators/resty/setup/templates/SessionActivityPlaceActivityMapper.java +3 -3
- data/lib/generators/resty/setup/templates/User.java +14 -1
- data/lib/generators/resty/setup/templates/application.rb +15 -0
- data/lib/generators/resty/setup/templates/authentication.rb +2 -2
- data/lib/generators/resty/setup/templates/gwt.css +13 -1
- data/lib/generators/resty/setup/templates/remote_user.rb +1 -1
- data/lib/generators/resty/setup/templates/remote_user.rb~ +1 -1
- data/lib/generators/resty/setup/templates/session.rb +7 -0
- data/lib/generators/resty/setup/templates/sessions_controller.rb +2 -2
- data/lib/generators/resty/setup/templates/user.rb +23 -5
- data/lib/generators/resty/templates/Activity.java +22 -5
- data/lib/generators/resty/templates/Editor.java +1 -0
- data/lib/generators/resty/templates/Model.java +8 -2
- data/lib/generators/resty/templates/RestService.java +0 -1
- data/lib/ixtlan/core/heartbeat.rb~ +8 -2
- data/lib/rails_gwt/dsl.rb +210 -0
- data/lib/rails_gwt/dsl.rb~ +210 -0
- data/lib/rails_gwt/user_config.rb +80 -0
- data/lib/rails_gwt/user_config.rb~ +76 -0
- metadata +11 -3
- data/lib/ixtlan/core/heartbeat.rb +0 -59
@@ -0,0 +1,76 @@
|
|
1
|
+
module RailsGwt
|
2
|
+
class UserConfigFactory
|
3
|
+
|
4
|
+
@config = {}
|
5
|
+
|
6
|
+
def [](login)
|
7
|
+
UserConfig.new(login.to_sym, @config[login.to_sym])
|
8
|
+
end
|
9
|
+
|
10
|
+
def add(login, config)
|
11
|
+
@config[login.to_sym] = config
|
12
|
+
end
|
13
|
+
|
14
|
+
def logins
|
15
|
+
@config.keys
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
class UserConfig
|
20
|
+
|
21
|
+
attr_reader :login, :name, :menu, :resource, :action
|
22
|
+
|
23
|
+
def initialize(login, config)
|
24
|
+
@user_config = config
|
25
|
+
raise "unknown login #{login}" unless @user_config
|
26
|
+
@login = login.to_s
|
27
|
+
@name = @user_config[:name]
|
28
|
+
@menu = @user_config[:menu]
|
29
|
+
end
|
30
|
+
|
31
|
+
def resources
|
32
|
+
@user_config.collect { |k,v| k.to_s if v.is_a? Hash }.delete_if { |i| i.nil? }.sort!.collect { |i| i.to_sym }
|
33
|
+
end
|
34
|
+
|
35
|
+
def resource=(resource)
|
36
|
+
@resource = resource.to_s.pluralize
|
37
|
+
@config = @user_config[resource]
|
38
|
+
end
|
39
|
+
|
40
|
+
def content
|
41
|
+
c = @config[@action][:content] || []
|
42
|
+
c = [c] unless c.is_a? Array
|
43
|
+
c
|
44
|
+
end
|
45
|
+
|
46
|
+
def buttons
|
47
|
+
c = @config[@action][:buttons] || []
|
48
|
+
c = [c] unless c.is_a? Array
|
49
|
+
c
|
50
|
+
end
|
51
|
+
|
52
|
+
def action_buttons
|
53
|
+
c = @config[@action][:action_buttons] || []
|
54
|
+
c = [c] unless c.is_a? Array
|
55
|
+
c
|
56
|
+
end
|
57
|
+
|
58
|
+
def action=(action)
|
59
|
+
@action = @config[action] ? action : nil
|
60
|
+
@action
|
61
|
+
end
|
62
|
+
|
63
|
+
def mode
|
64
|
+
@config[:mode] || :page
|
65
|
+
end
|
66
|
+
|
67
|
+
def resource_id
|
68
|
+
if id = @config[:resource_id]
|
69
|
+
self.class_eval(id)
|
70
|
+
else
|
71
|
+
1
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
76
|
+
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: resty-generators
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.7.
|
5
|
+
version: 0.7.3
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- mkristian
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date:
|
13
|
+
date: 2012-01-30 00:00:00 +05:30
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -91,6 +91,10 @@ extra_rdoc_files: []
|
|
91
91
|
files:
|
92
92
|
- MIT-LICENSE
|
93
93
|
- lib/resty-generators.rb
|
94
|
+
- lib/rails_gwt/dsl.rb~
|
95
|
+
- lib/rails_gwt/user_config.rb~
|
96
|
+
- lib/rails_gwt/user_config.rb
|
97
|
+
- lib/rails_gwt/dsl.rb
|
94
98
|
- lib/resty/resty_railtie.rb
|
95
99
|
- lib/resty/abstract_session.rb~
|
96
100
|
- lib/resty/child_path.rb~
|
@@ -107,6 +111,7 @@ files:
|
|
107
111
|
- lib/generators/resty/setup/templates/Mavenfile~
|
108
112
|
- lib/generators/resty/setup/templates/gwt.css
|
109
113
|
- lib/generators/resty/setup/templates/user.rb
|
114
|
+
- lib/generators/resty/setup/templates/ApplicationLinksPanel.java
|
110
115
|
- lib/generators/resty/setup/templates/seeds.rb
|
111
116
|
- lib/generators/resty/setup/templates/heartbeat.rb~
|
112
117
|
- lib/generators/resty/setup/templates/module.gwt.xml
|
@@ -125,12 +130,14 @@ files:
|
|
125
130
|
- lib/generators/resty/setup/templates/BreadCrumbsPanel.java
|
126
131
|
- lib/generators/resty/setup/templates/User.java
|
127
132
|
- lib/generators/resty/setup/templates/LoginViewImpl.java~
|
133
|
+
- lib/generators/resty/setup/templates/Application.java~
|
128
134
|
- lib/generators/resty/setup/templates/ActivityPlace.java~
|
129
135
|
- lib/generators/resty/setup/templates/authentication.rb
|
130
136
|
- lib/generators/resty/setup/templates/create_users.rb
|
131
137
|
- lib/generators/resty/setup/templates/remote_user.rb
|
132
138
|
- lib/generators/resty/setup/templates/ActivityFactory.java~
|
133
139
|
- lib/generators/resty/setup/templates/seeds.rb~
|
140
|
+
- lib/generators/resty/setup/templates/application.rb
|
134
141
|
- lib/generators/resty/setup/templates/session.rb~
|
135
142
|
- lib/generators/resty/setup/templates/LoginActivity.java~
|
136
143
|
- lib/generators/resty/setup/templates/ActivityPlace.java
|
@@ -152,9 +159,11 @@ files:
|
|
152
159
|
- lib/generators/resty/setup/templates/SessionRestService.java
|
153
160
|
- lib/generators/resty/setup/templates/initializer.rb~
|
154
161
|
- lib/generators/resty/setup/templates/Mavenfile
|
162
|
+
- lib/generators/resty/setup/templates/ApplicationLinksPanel.java~
|
155
163
|
- lib/generators/resty/setup/templates/authentication.rb~
|
156
164
|
- lib/generators/resty/setup/templates/PlaceHistoryMapper.java
|
157
165
|
- lib/generators/resty/setup/templates/MenuPanel.java
|
166
|
+
- lib/generators/resty/setup/templates/Application.java
|
158
167
|
- lib/generators/resty/setup/templates/empty.css~
|
159
168
|
- lib/generators/resty/scaffold/scaffold_generator.rb
|
160
169
|
- lib/generators/resty/templates/PlaceTokenizer.java
|
@@ -188,7 +197,6 @@ files:
|
|
188
197
|
- lib/generators/resty/templates/Editor.java~
|
189
198
|
- lib/generators/resty/templates/Activity.java~
|
190
199
|
- lib/ixtlan/core/heartbeat.rb~
|
191
|
-
- lib/ixtlan/core/heartbeat.rb
|
192
200
|
- features/step_definitions/simple_steps.rb
|
193
201
|
- features/generators.feature
|
194
202
|
has_rdoc: true
|
@@ -1,59 +0,0 @@
|
|
1
|
-
class Ixtlan::Core::Heartbeat
|
2
|
-
|
3
|
-
class Resource
|
4
|
-
|
5
|
-
attr_reader :local, :remote
|
6
|
-
attr_accessor :count, :failure
|
7
|
-
|
8
|
-
def initialize(local, remote)
|
9
|
-
@count = 0
|
10
|
-
@failures = 0
|
11
|
-
@local = local
|
12
|
-
@remote = remote
|
13
|
-
end
|
14
|
-
|
15
|
-
def to_log
|
16
|
-
"update #{@local} - total: #{@count + @failures} success: #{@count} failures: #{@failures}"
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
def initialize
|
21
|
-
@count = 0
|
22
|
-
@failures = 0
|
23
|
-
end
|
24
|
-
|
25
|
-
def reg
|
26
|
-
@reg ||= {}
|
27
|
-
end
|
28
|
-
|
29
|
-
def register(local, remote)
|
30
|
-
reg[local] = Resource.new(local, remote)
|
31
|
-
end
|
32
|
-
|
33
|
-
def beat(resource = nil)
|
34
|
-
resources = resource.nil? ? reg.values : [reg[resource]]
|
35
|
-
resources.each do |res|
|
36
|
-
last_update = res.local.maximum(:updated_at) || 2000.years.ago
|
37
|
-
last_update = last_update.strftime('%Y-%m-%d %H:%M:%S.') + ("%06d" % last_update.usec)
|
38
|
-
res.remote.get(:last_changes, :updated_at => last_update).each do |remote|
|
39
|
-
id = remote.delete('id')
|
40
|
-
u = res.local.find_by_id(id)
|
41
|
-
if u
|
42
|
-
u.update_attributes(remote)
|
43
|
-
else
|
44
|
-
u = res.local.new(remote)
|
45
|
-
u.id = id
|
46
|
-
end
|
47
|
-
if u.save
|
48
|
-
res.count = res.count + 1
|
49
|
-
else
|
50
|
-
res.failures = res.failures + 1
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
def to_log
|
56
|
-
reg.collect { |r| r.to_log }.join('\n')
|
57
|
-
end
|
58
|
-
alias :to_s :to_log
|
59
|
-
end
|