bivouac 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. data/README +15 -0
  2. data/bin/bivouac +45 -8
  3. data/doc/rdoc/classes/BivouacHelpers/FormView.html +157 -122
  4. data/doc/rdoc/classes/BivouacHelpers/JavaScriptView.html +1 -1
  5. data/doc/rdoc/created.rid +1 -1
  6. data/doc/rdoc/files/README.html +41 -1
  7. data/doc/rdoc/files/lib/bivouac/helpers/view/goh/form_rb.html +1 -1
  8. data/doc/rdoc/files/lib/bivouac/helpers/view/goh/javascript_rb.html +1 -1
  9. data/examples/bivouac_sample/Rakefile +20 -0
  10. data/examples/bivouac_sample/app/bivouac_sample.rb +12 -4
  11. data/examples/bivouac_sample/app/controllers/edit_in_place.rb +17 -0
  12. data/examples/bivouac_sample/app/controllers/index.rb +11 -1
  13. data/examples/bivouac_sample/app/controllers/not_found.rb +16 -0
  14. data/examples/bivouac_sample/app/helpers/_helpers.rb +5 -3
  15. data/examples/bivouac_sample/app/views/edit_in_place.rb +52 -0
  16. data/examples/bivouac_sample/app/views/index.rb +21 -11
  17. data/examples/bivouac_sample/app/views/not_found.rb +13 -0
  18. data/examples/bivouac_sample/config/database.yml +3 -0
  19. data/examples/bivouac_sample/config/environment.rb +3 -2
  20. data/examples/bivouac_sample/config/postamble.rb +104 -44
  21. data/examples/bivouac_sample/script/generate +6 -0
  22. data/examples/bivouac_sample/test/test_edit_in_place.rb +22 -0
  23. data/examples/bivouac_sample/test/test_index.rb +22 -0
  24. data/lib/bivouac/commands/generate.rb +34 -13
  25. data/lib/bivouac/commands/generate.rb_OLD +342 -0
  26. data/lib/bivouac/helpers/view/goh/form.rb +33 -9
  27. data/lib/bivouac/helpers/view/goh/javascript.rb +1 -1
  28. data/lib/bivouac/template/application/postamble.rb +3 -3
  29. data/lib/bivouac/template/application_goh.rb +21 -3
  30. data/lib/bivouac/template/environment.rb +7 -2
  31. data/lib/bivouac/template/generate/create.rb +3 -5
  32. data/lib/bivouac/template/generate/migrate.rb +1 -2
  33. data/lib/bivouac/template/generate/migrate_begin.rb +11 -0
  34. data/lib/bivouac/template/generate/migrate_column.rb +1 -0
  35. data/lib/bivouac/template/generate/migrate_end.rb +8 -0
  36. data/lib/bivouac/template/generate/migration_add.rb +1 -0
  37. data/lib/bivouac/template/generate/migration_begin.rb +10 -0
  38. data/lib/bivouac/template/generate/migration_end.rb +3 -0
  39. data/lib/bivouac/template/generate/migration_middle.rb +3 -0
  40. data/lib/bivouac/template/generate/migration_remove.rb +1 -0
  41. data/lib/bivouac/template/static/default_layout_view.rb +33 -0
  42. data/lib/bivouac/template/static/not_found_controller.rb +16 -0
  43. data/lib/bivouac/template/static/not_found_view.rb +13 -0
  44. data/lib/cookies_sessions.rb +39 -0
  45. metadata +23 -3
@@ -0,0 +1,33 @@
1
+ #
2
+ # Project <%= @conf.appname %>
3
+ #
4
+ # Created using bivouac on <%= Time.now %>.
5
+ # Copyright (c) <%= Time.now.year %> __My__. All rights reserved.
6
+ #
7
+
8
+ module <%= @conf.appname %>::Views
9
+
10
+ # Default Layout
11
+ def default_layout
12
+ html do
13
+ head do
14
+ title '<%= @conf.appname %>'
15
+ end
16
+ body do
17
+ h1.header { a '<%= @conf.appname %>', :href => R(Index) }
18
+ div.content do
19
+ self << yield
20
+ end
21
+ end
22
+ end
23
+ end
24
+
25
+ # Multiple Layout support :
26
+ # add @layout = "my_layout" in your controller else, default_layout will be used
27
+ # If you don't want to use layout, remove this file'
28
+ def layout
29
+ @layout ||= 'default'
30
+ send("#{@layout}_layout") { yield }
31
+ end
32
+
33
+ end
@@ -0,0 +1,16 @@
1
+ #
2
+ # Project <%= @conf.appname %>
3
+ #
4
+ # Created using bivouac on <%= Time.now %>.
5
+ # Copyright (c) <%= Time.now.year %> __My__. All rights reserved.
6
+ #
7
+
8
+ module <%= @conf.appname %>::Controllers
9
+ class NotFound
10
+ def get( path )
11
+ @status = 404
12
+ @path = path
13
+ render :not_found
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,13 @@
1
+ #
2
+ # Project <%= @conf.appname %>
3
+ #
4
+ # Created using bivouac on <%= Time.now %>.
5
+ # Copyright (c) <%= Time.now.year %> __My__. All rights reserved.
6
+ #
7
+
8
+ module <%= @conf.appname %>::Views
9
+ def not_found
10
+ h1.header { "<%= @conf.appname %>::Views#not_found" }
11
+ p "Sorry baby, #{@path} does nor exist !"
12
+ end
13
+ end
@@ -0,0 +1,39 @@
1
+ require 'base64'
2
+
3
+ module Camping
4
+ module CookieSessions
5
+ # this thingy wraps around the main thingy and puts sessions in like magic, ooooOOOOOooooh! Spooky!
6
+ def service(*a)
7
+ if @cookies.identity
8
+ blob, secure_hash = @cookies.identity.to_s.split(':', 2)
9
+ blob = Base64.decode64(blob)
10
+ data = Marshal.restore(blob)
11
+ data = {} unless secure_blob_hasher(blob).strip.downcase == secure_hash.strip.downcase
12
+ else
13
+ blob = ''
14
+ data = {}
15
+ end
16
+
17
+ app = self.class.name.gsub(/^(\w+)::.+$/, '\1')
18
+ @state = (data[app] ||= Camping::H[])
19
+ hash_before = blob.hash
20
+ return super(*a)
21
+ ensure
22
+ data[app] = @state
23
+ blob = Marshal.dump(data)
24
+ unless hash_before == blob.hash
25
+ secure_hash = secure_blob_hasher(blob)
26
+ @cookies.identity = Base64.encode64(blob).gsub("\n", '').strip + ':' + secure_hash
27
+ # hack to make cookies update
28
+ @headers['Set-Cookie'] = @cookies.map { |k,v| "#{k}=#{C.escape(v)}; path=#{self/"/"}" if v != @k[k] } - [nil]
29
+ end
30
+ end
31
+
32
+ # You can override this with whatever hashing function you think is awesome enough, don't use MD5 though! It stinks!
33
+ def secure_blob_hasher(data)
34
+ require 'digest'
35
+ require 'digest/sha2'
36
+ Digest::SHA512::hexdigest(self.class.module_eval('@@state_secret') + data)
37
+ end
38
+ end
39
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bivouac
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Gr\xC3\xA9goire Lejeune"
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-04-10 00:00:00 +02:00
12
+ date: 2008-06-03 00:00:00 +02:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -115,6 +115,7 @@ files:
115
115
  - lib/bivouac
116
116
  - lib/bivouac/commands
117
117
  - lib/bivouac/commands/generate.rb
118
+ - lib/bivouac/commands/generate.rb_OLD
118
119
  - lib/bivouac/commands/plugin.rb
119
120
  - lib/bivouac/helpers
120
121
  - lib/bivouac/helpers/view
@@ -136,7 +137,15 @@ files:
136
137
  - lib/bivouac/template/generate/controller.rb
137
138
  - lib/bivouac/template/generate/create.rb
138
139
  - lib/bivouac/template/generate/migrate.rb
140
+ - lib/bivouac/template/generate/migrate_begin.rb
141
+ - lib/bivouac/template/generate/migrate_column.rb
142
+ - lib/bivouac/template/generate/migrate_end.rb
139
143
  - lib/bivouac/template/generate/migration.rb
144
+ - lib/bivouac/template/generate/migration_add.rb
145
+ - lib/bivouac/template/generate/migration_begin.rb
146
+ - lib/bivouac/template/generate/migration_end.rb
147
+ - lib/bivouac/template/generate/migration_middle.rb
148
+ - lib/bivouac/template/generate/migration_remove.rb
140
149
  - lib/bivouac/template/generate/model.rb
141
150
  - lib/bivouac/template/generate/test_begin.rb
142
151
  - lib/bivouac/template/generate/test_end.rb
@@ -151,10 +160,13 @@ files:
151
160
  - lib/bivouac/template/static/builder.js
152
161
  - lib/bivouac/template/static/camping.png
153
162
  - lib/bivouac/template/static/controls.js
163
+ - lib/bivouac/template/static/default_layout_view.rb
154
164
  - lib/bivouac/template/static/dragdrop.js
155
165
  - lib/bivouac/template/static/effects.js
156
166
  - lib/bivouac/template/static/index.html
157
167
  - lib/bivouac/template/static/index.rb
168
+ - lib/bivouac/template/static/not_found_controller.rb
169
+ - lib/bivouac/template/static/not_found_view.rb
158
170
  - lib/bivouac/template/static/prototype.js
159
171
  - lib/bivouac/template/static/README
160
172
  - lib/bivouac/template/static/scriptaculous.js
@@ -164,13 +176,16 @@ files:
164
176
  - lib/bivouac/template.rb
165
177
  - lib/bivouac/utils.rb
166
178
  - lib/bivouac.rb
179
+ - lib/cookies_sessions.rb
167
180
  - examples/bivouac_sample
168
181
  - examples/bivouac_sample/app
169
182
  - examples/bivouac_sample/app/bivouac_sample.rb
170
183
  - examples/bivouac_sample/app/controllers
171
184
  - examples/bivouac_sample/app/controllers/autocomplete.rb
172
185
  - examples/bivouac_sample/app/controllers/drag_and_drop.rb
186
+ - examples/bivouac_sample/app/controllers/edit_in_place.rb
173
187
  - examples/bivouac_sample/app/controllers/index.rb
188
+ - examples/bivouac_sample/app/controllers/not_found.rb
174
189
  - examples/bivouac_sample/app/controllers/observe.rb
175
190
  - examples/bivouac_sample/app/controllers/periodically_call.rb
176
191
  - examples/bivouac_sample/app/controllers/remote_form.rb
@@ -193,7 +208,9 @@ files:
193
208
  - examples/bivouac_sample/app/views/_submit_remote_result.rb
194
209
  - examples/bivouac_sample/app/views/autocomplete.rb
195
210
  - examples/bivouac_sample/app/views/drag_and_drop.rb
211
+ - examples/bivouac_sample/app/views/edit_in_place.rb
196
212
  - examples/bivouac_sample/app/views/index.rb
213
+ - examples/bivouac_sample/app/views/not_found.rb
197
214
  - examples/bivouac_sample/app/views/observe.rb
198
215
  - examples/bivouac_sample/app/views/periodically_call.rb
199
216
  - examples/bivouac_sample/app/views/remote_form.rb
@@ -203,6 +220,7 @@ files:
203
220
  - examples/bivouac_sample/app/views/toggle.rb
204
221
  - examples/bivouac_sample/app/views/toggle_sortable.rb
205
222
  - examples/bivouac_sample/config
223
+ - examples/bivouac_sample/config/database.yml
206
224
  - examples/bivouac_sample/config/environment.rb
207
225
  - examples/bivouac_sample/config/postamble.rb
208
226
  - examples/bivouac_sample/db
@@ -238,6 +256,8 @@ files:
238
256
  - examples/bivouac_sample/script/plugin
239
257
  - examples/bivouac_sample/script/server
240
258
  - examples/bivouac_sample/test
259
+ - examples/bivouac_sample/test/test_edit_in_place.rb
260
+ - examples/bivouac_sample/test/test_index.rb
241
261
  - examples/bivouac_sample/test/test_sound.rb
242
262
  - examples/blog_goh
243
263
  - examples/blog_goh/app
@@ -321,7 +341,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
321
341
  requirements: []
322
342
 
323
343
  rubyforge_project: bivouac
324
- rubygems_version: 1.1.0
344
+ rubygems_version: 1.1.1
325
345
  signing_key:
326
346
  specification_version: 2
327
347
  summary: Developpe with Camping like you do with Rails