spiderfw 0.6.23 → 0.6.24

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. data/CHANGELOG +10 -1
  2. data/README.rdoc +1 -1
  3. data/VERSION +1 -1
  4. data/apps/config_editor/_init.rb +1 -2
  5. data/apps/config_editor/controllers/config_editor_controller.rb +1 -7
  6. data/apps/core/admin/controllers/admin_controller.rb +1 -1
  7. data/apps/core/admin/public/css/sass/admin.css +35 -31
  8. data/apps/core/admin/public/sass/admin.scss +6 -1
  9. data/apps/core/components/widgets/crud/crud.shtml +2 -2
  10. data/apps/core/components/widgets/table/table.rb +5 -5
  11. data/apps/core/forms/tags/element_row.erb +15 -10
  12. data/apps/core/forms/widgets/form/form.rb +35 -22
  13. data/apps/core/forms/widgets/inputs/checkbox/checkbox.shtml +2 -2
  14. data/apps/core/forms/widgets/inputs/date_time/date_time.shtml +2 -2
  15. data/apps/core/forms/widgets/inputs/file_input/file_input.shtml +2 -2
  16. data/apps/core/forms/widgets/inputs/html_area/html_area.shtml +2 -2
  17. data/apps/core/forms/widgets/inputs/input/input.shtml +2 -2
  18. data/apps/core/forms/widgets/inputs/password/password.shtml +2 -2
  19. data/apps/core/forms/widgets/inputs/search_select/search_select.shtml +1 -1
  20. data/apps/core/forms/widgets/inputs/select/select.shtml +2 -2
  21. data/apps/core/forms/widgets/inputs/text/text.shtml +2 -2
  22. data/apps/core/forms/widgets/inputs/text_area/text_area.shtml +2 -2
  23. data/apps/core/forms/widgets/inputs/time_span/time_span.shtml +1 -1
  24. data/blueprints/home/config.ru +8 -0
  25. data/lib/spiderfw/app.rb +416 -224
  26. data/lib/spiderfw/cmd/commands/app.rb +243 -239
  27. data/lib/spiderfw/cmd/commands/cert.rb +421 -417
  28. data/lib/spiderfw/cmd/commands/config.rb +85 -82
  29. data/lib/spiderfw/cmd/commands/console.rb +64 -40
  30. data/lib/spiderfw/cmd/commands/content.rb +29 -25
  31. data/lib/spiderfw/cmd/commands/create.rb +58 -54
  32. data/lib/spiderfw/cmd/commands/model.rb +118 -114
  33. data/lib/spiderfw/cmd/commands/setup.rb +55 -51
  34. data/lib/spiderfw/cmd/commands/test.rb +63 -59
  35. data/lib/spiderfw/cmd/commands/webserver.rb +56 -51
  36. data/lib/spiderfw/config/options/spider.rb +4 -3
  37. data/lib/spiderfw/controller/controller.rb +2 -0
  38. data/lib/spiderfw/controller/http_controller.rb +1 -2
  39. data/lib/spiderfw/controller/mixins/static_content.rb +3 -3
  40. data/lib/spiderfw/controller/mixins/visual.rb +30 -15
  41. data/lib/spiderfw/controller/response.rb +84 -0
  42. data/lib/spiderfw/controller/session/file_session.rb +2 -2
  43. data/lib/spiderfw/http/adapters/rack.rb +12 -13
  44. data/lib/spiderfw/http/server.rb +80 -46
  45. data/lib/spiderfw/i18n/cldr.rb +6 -9
  46. data/lib/spiderfw/model/base_model.rb +103 -23
  47. data/lib/spiderfw/model/condition.rb +110 -25
  48. data/lib/spiderfw/model/mappers/db_mapper.rb +14 -6
  49. data/lib/spiderfw/model/mappers/mapper.rb +440 -197
  50. data/lib/spiderfw/model/model.rb +105 -21
  51. data/lib/spiderfw/model/model_hash.rb +9 -1
  52. data/lib/spiderfw/model/query.rb +50 -9
  53. data/lib/spiderfw/model/query_set.rb +211 -44
  54. data/lib/spiderfw/model/request.rb +28 -21
  55. data/lib/spiderfw/model/storage/base_storage.rb +125 -10
  56. data/lib/spiderfw/model/storage/db/db_storage.rb +7 -4
  57. data/lib/spiderfw/model/storage.rb +8 -1
  58. data/lib/spiderfw/setup/spider_setup_wizard.rb +9 -7
  59. data/lib/spiderfw/spider.rb +270 -43
  60. data/lib/spiderfw/templates/layout.rb +9 -4
  61. data/lib/spiderfw/templates/resources/sass.rb +3 -2
  62. data/lib/spiderfw/templates/template.rb +1 -0
  63. data/lib/spiderfw/utils/annotations.rb +3 -1
  64. data/lib/spiderfw/utils/logger.rb +1 -1
  65. data/lib/spiderfw/utils/monkey/symbol.rb +4 -2
  66. data/lib/spiderfw/utils/shared_store/file_shared_store.rb +2 -2
  67. data/lib/spiderfw/utils/thread_out.rb +3 -1
  68. data/public/css/error_page.css +83 -0
  69. data/public/js/error_page.js +5 -0
  70. data/spider.gemspec +4 -1
  71. data/templates/email/error.erb +9 -0
  72. metadata +28 -12
  73. data/apps/config_editor/widgets/edit_bool/edit_bool.rb +0 -8
  74. data/apps/config_editor/widgets/edit_bool/edit_bool.shtml +0 -5
@@ -111,7 +111,7 @@ module Spider
111
111
  'css.compress'
112
112
  end
113
113
  no_compress = @scene.__is_error_page || !Spider.conf.get(compress_config) || \
114
- ass[:runtime] || ass[:if_ie_lte] || ass[:media] || (use_cdn && ass[:cdn])
114
+ ass[:no_compress] || ass[:runtime] || ass[:if_ie_lte] || ass[:media] || (use_cdn && ass[:cdn])
115
115
 
116
116
  if no_compress
117
117
  if ass[:runtime]
@@ -351,8 +351,13 @@ module Spider
351
351
  src_dir = File.dirname(path)
352
352
  app = a[:app]
353
353
  if app
354
- app_relative_path = a[:app].relative_path
355
- app_path = app.path
354
+ if app.is_a?(Spider::Home)
355
+ app_relative_path = nil
356
+ app_path = app.path
357
+ else
358
+ app_relative_path = a[:app].relative_path
359
+ app_path = app.path
360
+ end
356
361
  elsif path.index(Spider::SpiderController.pub_path) == 0
357
362
  app_relative_path = 'spider'
358
363
  app_path = Spider::SpiderController.pub_path
@@ -386,7 +391,7 @@ module Spider
386
391
 
387
392
  FileUtils.mkdir_p(File.dirname(url_dest))
388
393
  cachebuster = Spider.conf.get('css.cachebuster')
389
- new_url = "#{app_relative_path}/#{src_rel}"
394
+ new_url = app_relative_path ? "#{app_relative_path}/#{src_rel}" : src_rel
390
395
  if File.exist?(url_src)
391
396
  mtime = File.mtime(url_src).to_i
392
397
  if cachebuster && File.exist?(url_dest) && mtime > File.mtime(url_dest).to_i
@@ -6,7 +6,7 @@ module Sass::Plugin::Configuration
6
6
  @default_options ||= {
7
7
  :css_location => './public/stylesheets',
8
8
  :always_update => false,
9
- :always_check => true,
9
+ :always_check => false,
10
10
  :full_exception => true,
11
11
  :cache_location => File.join(Spider.paths[:tmp], 'sass', '.sass_cache')
12
12
  }.freeze
@@ -62,7 +62,8 @@ module Spider
62
62
  config = Compass::Configuration::Data.new(:spider, options)
63
63
  Compass.add_project_configuration(config)
64
64
  compiler = Compass::Compiler.new(work_dir, File.dirname(src), File.dirname(dest), options)
65
- compiler.compile(src, dest)
65
+
66
+ compiler.compile(src, dest) if compiler.out_of_date?
66
67
  else
67
68
  engine = Sass::Engine.for_file(src, {})
68
69
  output = engine.render
@@ -452,6 +452,7 @@ module Spider
452
452
  ass[:compressed] = base_url+cpr
453
453
  end
454
454
  end
455
+ ass[:no_compress] = attributes[:"no-compress"]
455
456
  ass[:copy_dir] = attributes[:copy_dir]
456
457
  ass[:copy_dir] = ass[:copy_dir] =~ /\d+/ ? ass[:copy_dir].to_i : true
457
458
  [:gettext, :media, :if_ie_lte, :cdn].each do |key|
@@ -50,6 +50,7 @@ module Annotations
50
50
  kl.define_annotation(name, &proc)
51
51
  end
52
52
  end
53
+ @annotations ||= {}
53
54
  @annotations.each do |method, vals|
54
55
  vals.each do |k, args|
55
56
  args = [args] unless args.is_a?(Array)
@@ -63,7 +64,8 @@ module Annotations
63
64
  super
64
65
  end
65
66
 
66
- class Annotator #:nodoc:
67
+ # @private
68
+ class Annotator
67
69
 
68
70
  def initialize(owner)
69
71
  @owner = owner
@@ -224,7 +224,7 @@ module Spider
224
224
  end
225
225
  end
226
226
 
227
- class LogDevice < Logger::LogDevice
227
+ class LogDevice < ::Logger::LogDevice
228
228
 
229
229
  def shift_log_period(now)
230
230
  super
@@ -1,7 +1,9 @@
1
1
  # Symbol monkey patch.
2
2
 
3
3
  class Symbol
4
- def to_proc
5
- proc { |obj, *args| obj.send(self, *args) }
4
+ unless self.method_defined?(:to_proc)
5
+ def to_proc
6
+ proc { |obj, *args| obj.send(self, *args) }
7
+ end
6
8
  end
7
9
  end
@@ -25,7 +25,7 @@ module Spider; module Utils
25
25
  path = map_path(key)
26
26
  if (File.exist?(path))
27
27
  @sync.lock(Sync::SH)
28
- f = File.new(path, 'r')
28
+ f = File.new(path, 'rb')
29
29
  f.flock(File::LOCK_SH)
30
30
  data = Marshal.restore(f.read)
31
31
  f.flock(File::LOCK_UN)
@@ -38,7 +38,7 @@ module Spider; module Utils
38
38
  def []=(key, value)
39
39
  path = map_path(key)
40
40
  @sync.lock(Sync::EX)
41
- f = File.new(path, 'w')
41
+ f = File.new(path, 'wb')
42
42
  f.flock(File::LOCK_EX)
43
43
  f.puts(Marshal.dump(value))
44
44
  f.flush
@@ -22,13 +22,15 @@ module ThreadOut #:nodoc:
22
22
  end
23
23
 
24
24
  def self.output_to(io)
25
+ prev_out = Thread.current[:stdout]
25
26
  if block_given?
26
- prev_out = Thread.current[:stdout]
27
27
  Thread.current[:stdout] = io
28
28
  yield
29
29
  Thread.current[:stdout] = prev_out
30
+ io.rewind
30
31
  else
31
32
  Thread.current[:stdout] = io
33
+ return prev_out
32
34
  end
33
35
  end
34
36
 
@@ -0,0 +1,83 @@
1
+ /* @override http://localhost:8989/spider/public/css/error_page.css */
2
+
3
+ body{
4
+ background-color: white;
5
+ padding-left: 15px;
6
+ padding-right: 15px;
7
+ font-family:"Lucida Grande","Bitstream Vera Sans",Helvetica,Verdana,Arial,sans-serif;
8
+ }
9
+
10
+ #header{
11
+ background-color: #b2b3a7;
12
+ }
13
+
14
+ h3.error_message{
15
+ font-size: 1.5em;
16
+ }
17
+
18
+ .error_description{
19
+ }
20
+
21
+ #footer{
22
+ margin-top: 25px;
23
+ background-color: #e6e6e6;
24
+ padding: 8px;
25
+ font-size: 0.8em;
26
+ }
27
+
28
+ #bottom_break{
29
+ margin-top: 20px;
30
+ border-top: 1px solid #cecece;
31
+ border-bottom: 0;
32
+ }
33
+
34
+ #debug{
35
+ margin-top: 20px;
36
+ }
37
+
38
+ #debug h4{
39
+ background-color: #fccc83;
40
+ padding: 3px;
41
+ }
42
+
43
+ #debug div{
44
+ margin-bottom: 10px;
45
+ }
46
+
47
+ #exception_message{
48
+ border: 1px solid #cacaca;
49
+ padding: 3px;
50
+ background-color: #f9f9dc;
51
+ }
52
+
53
+
54
+ #exception_backtrace ul{
55
+ padding-top: 15px;
56
+ padding-bottom: 15px;
57
+ padding-left: 45px;
58
+ border: 1px solid #cacaca;
59
+ font-size: .9em;
60
+ background-color: #f9f9dc;
61
+ }
62
+
63
+ #exception_backtrace li{
64
+ margin-bottom: 2px;
65
+ }
66
+
67
+ #exception_backtrace ul a{
68
+ color: #3b2122;
69
+ }
70
+
71
+ .var-name{
72
+ cursor: pointer;
73
+ text-decoration: underline;
74
+ color: #0f007f;
75
+ }
76
+
77
+ .var-value{
78
+ display: none;
79
+ background-color: #e3e3e3;
80
+ border: 1px solid #cecece;
81
+ padding: 4px;
82
+ margin-right: 25px;
83
+ }
@@ -0,0 +1,5 @@
1
+ $(document).ready(function(){
2
+ $('.local-name, .iv-name').click(function(){
3
+ $('pre', $(this).parent()).toggle();
4
+ });
5
+ });
data/spider.gemspec CHANGED
@@ -21,7 +21,9 @@ Gem::Specification.new do |s|
21
21
  + Dir.glob('blueprints/**/*', File::FNM_DOTMATCH) \
22
22
  + Dir.glob('data/**/*') \
23
23
  + Dir.glob('lib/**/*.rb') \
24
- + Dir.glob('views/**/*')
24
+ + Dir.glob('views/**/*') \
25
+ + Dir.glob('public/**/*') \
26
+ + Dir.glob('templates/**/*')
25
27
  # s.test_files = []
26
28
  # s.rdoc_options = ["--main", "README.rdoc"]
27
29
  # s.extra_rdoc_files = ["CHANGELOG", "LICENSE", "README.rdoc"]
@@ -40,6 +42,7 @@ Gem::Specification.new do |s|
40
42
  s.add_dependency("bundler")
41
43
  s.add_dependency("mail")
42
44
  s.add_dependency("backports")
45
+ s.add_dependency("rack")
43
46
  s.add_development_dependency("rake", ["> 0.7.3"])
44
47
  s.add_development_dependency("gettext", ['>= 2.1.0'])
45
48
  s.add_development_dependency("fssm")
@@ -0,0 +1,9 @@
1
+ Request: <%= request.inspect %>
2
+
3
+ Error: <%= exception.message %>
4
+
5
+ Backtrace:
6
+ <% exception.backtrace.each do |bt| %>
7
+ <%= bt %>
8
+ <% end %>
9
+
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spiderfw
3
3
  version: !ruby/object:Gem::Version
4
- hash: 41
4
+ hash: 55
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 6
9
- - 23
10
- version: 0.6.23
9
+ - 24
10
+ version: 0.6.24
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ivan Pirlik
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-02-06 00:00:00 +01:00
18
+ date: 2012-02-24 00:00:00 +01:00
19
19
  default_executable: spider
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -214,9 +214,23 @@ dependencies:
214
214
  type: :runtime
215
215
  version_requirements: *id013
216
216
  - !ruby/object:Gem::Dependency
217
- name: rake
217
+ name: rack
218
218
  prerelease: false
219
219
  requirement: &id014 !ruby/object:Gem::Requirement
220
+ none: false
221
+ requirements:
222
+ - - ">="
223
+ - !ruby/object:Gem::Version
224
+ hash: 3
225
+ segments:
226
+ - 0
227
+ version: "0"
228
+ type: :runtime
229
+ version_requirements: *id014
230
+ - !ruby/object:Gem::Dependency
231
+ name: rake
232
+ prerelease: false
233
+ requirement: &id015 !ruby/object:Gem::Requirement
220
234
  none: false
221
235
  requirements:
222
236
  - - ">"
@@ -228,11 +242,11 @@ dependencies:
228
242
  - 3
229
243
  version: 0.7.3
230
244
  type: :development
231
- version_requirements: *id014
245
+ version_requirements: *id015
232
246
  - !ruby/object:Gem::Dependency
233
247
  name: gettext
234
248
  prerelease: false
235
- requirement: &id015 !ruby/object:Gem::Requirement
249
+ requirement: &id016 !ruby/object:Gem::Requirement
236
250
  none: false
237
251
  requirements:
238
252
  - - ">="
@@ -244,11 +258,11 @@ dependencies:
244
258
  - 0
245
259
  version: 2.1.0
246
260
  type: :development
247
- version_requirements: *id015
261
+ version_requirements: *id016
248
262
  - !ruby/object:Gem::Dependency
249
263
  name: fssm
250
264
  prerelease: false
251
- requirement: &id016 !ruby/object:Gem::Requirement
265
+ requirement: &id017 !ruby/object:Gem::Requirement
252
266
  none: false
253
267
  requirements:
254
268
  - - ">="
@@ -258,7 +272,7 @@ dependencies:
258
272
  - 0
259
273
  version: "0"
260
274
  type: :development
261
- version_requirements: *id016
275
+ version_requirements: *id017
262
276
  description: Spider is yet another Ruby framework.
263
277
  email: abmajor7@gmail.com
264
278
  executables:
@@ -301,8 +315,6 @@ files:
301
315
  - apps/config_editor/views/index.shtml
302
316
  - apps/config_editor/widgets/edit/edit.rb
303
317
  - apps/config_editor/widgets/edit/edit.shtml
304
- - apps/config_editor/widgets/edit_bool/edit_bool.rb
305
- - apps/config_editor/widgets/edit_bool/edit_bool.shtml
306
318
  - apps/core/admin/_init.rb
307
319
  - apps/core/admin/admin.rb
308
320
  - apps/core/admin/controllers/admin_controller.rb
@@ -1151,6 +1163,7 @@ files:
1151
1163
  - blueprints/home/.gitignore
1152
1164
  - blueprints/home/apps/.gitignore
1153
1165
  - blueprints/home/config/config.yml
1166
+ - blueprints/home/config.ru
1154
1167
  - blueprints/home/Gemfile
1155
1168
  - blueprints/home/init.rb
1156
1169
  - blueprints/home/public/.gitignore
@@ -1399,6 +1412,9 @@ files:
1399
1412
  - views/errors/simple.layout.shtml
1400
1413
  - views/generic.layout.shtml
1401
1414
  - views/maintenance.shtml
1415
+ - public/css/error_page.css
1416
+ - public/js/error_page.js
1417
+ - templates/email/error.erb
1402
1418
  has_rdoc: true
1403
1419
  homepage: http://github.com/me/spider
1404
1420
  licenses: []
@@ -1,8 +0,0 @@
1
- module Spider; module ConfigEditor
2
-
3
- class EditBool < Edit
4
-
5
-
6
- end
7
-
8
- end; end
@@ -1,5 +0,0 @@
1
- <div>
2
- <label>{ @name }</label>
3
- _(Yes) <input type="radio" name="options[{ @name }]" value="1">
4
- _(No) <input type="radio" name="options[{ @name }]" value="0">
5
- </div>