restfulx 1.2.5 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. data/README.rdoc +3 -3
  2. data/Rakefile +17 -2
  3. data/VERSION.yml +2 -3
  4. data/bin/rx-gen +1 -1
  5. data/ext/restfulx/ext/amf/serializer/extconf.rb +3 -0
  6. data/lib/restfulx.rb +43 -81
  7. data/lib/restfulx/active_record_tasks.rb +8 -6
  8. data/lib/restfulx/active_record_uuid_helper.rb +9 -10
  9. data/lib/restfulx/amf.rb +14 -0
  10. data/lib/restfulx/amf/class_mapping.rb +106 -0
  11. data/lib/restfulx/amf/ext.rb +11 -0
  12. data/lib/restfulx/amf/ext/serializer.bundle +0 -0
  13. data/lib/restfulx/amf/pure.rb +11 -0
  14. data/lib/restfulx/amf/pure/io_helpers.rb +52 -0
  15. data/lib/restfulx/amf/pure/serializer.rb +304 -0
  16. data/lib/restfulx/configuration.rb +16 -12
  17. data/lib/restfulx/{rails/recipes.rb → recipes.rb} +1 -2
  18. data/lib/restfulx/rx_action_controller.rb +34 -0
  19. data/lib/restfulx/rx_active_record.rb +360 -0
  20. data/lib/restfulx/rx_active_support.rb +139 -0
  21. data/lib/restfulx/{datamapper_foo.rb → rx_datamapper.rb} +0 -2
  22. data/lib/restfulx/{rails/schema_to_yaml.rb → schema_to_rx_yaml.rb} +88 -5
  23. data/lib/restfulx/swf_helper.rb +61 -0
  24. data/lib/restfulx/tasks.rb +5 -3
  25. data/rails_generators/rx_config/rx_config_generator.rb +2 -2
  26. data/rails_generators/rx_config/templates/mainapp.mxml +1 -1
  27. data/rails_generators/rx_config/templates/restfulx.erb +5 -3
  28. data/rails_generators/rx_main_app/rx_main_app_generator.rb +2 -2
  29. data/rails_generators/rx_scaffold/rx_scaffold_generator.rb +7 -7
  30. data/rails_generators/rx_yaml_scaffold/rx_yaml_scaffold_generator.rb +5 -3
  31. data/rxgen_generators/rx_config/rx_config_generator.rb +1 -1
  32. data/test/rails/fixtures/locations.yml +5 -6
  33. data/test/rails/fixtures/notes.yml +5 -15
  34. data/test/rails/fixtures/projects.yml +7 -23
  35. data/test/rails/fixtures/tasks.yml +17 -43
  36. data/test/rails/fixtures/users.yml +7 -11
  37. data/test/rails/helpers/functional_test_helper.rb +5 -4
  38. data/test/rails/helpers/performance_test_helper.rb +5 -0
  39. data/test/rails/helpers/test_helper.rb +27 -0
  40. data/test/rails/helpers/unit_test_helper.rb +3 -15
  41. data/test/rails/test_active_foo.rb +21 -25
  42. data/test/rails/{test_rails_integration_functional.rb → test_notes_controller_functional.rb} +5 -5
  43. data/test/rails/test_serialiazation_performance.rb +32 -0
  44. data/test/rails/test_to_amf.rb +30 -0
  45. data/test/rails/test_to_fxml.rb +18 -15
  46. data/test/rails/test_to_json.rb +2 -14
  47. metadata +30 -19
  48. data/lib/restfulx/active_foo.rb +0 -178
  49. data/lib/restfulx/rails/schema_to_yaml/extensions/enumerable.rb +0 -8
  50. data/lib/restfulx/rails/schema_to_yaml/settings/config.rb +0 -17
  51. data/lib/restfulx/rails/schema_to_yaml/settings/core.rb +0 -73
  52. data/lib/restfulx/rails/swf_helper.rb +0 -59
@@ -1,59 +0,0 @@
1
- # Adds a little helper to make it easier empbedding SWFs in ERB templates.
2
- module SWFHelper
3
- # Creates a swfObject Javascript call. You must include swfobject.js to use this.
4
- # See http://code.google.com/p/swfobject/wiki/documentation for full details and documentation
5
- # of the swfobject js library.
6
- def swfobject(swf_url, params = {})
7
- params.reverse_merge!({:width => '100%',
8
- :height => '100%',
9
- :id => 'flashContent',
10
- :version => '9.0.0',
11
- :express_install_swf => '/expressInstall.swf',
12
- :flash_vars => nil,
13
- :params => { },
14
- :attributes => { },
15
- :create_div => false,
16
- :include_authenticity_token => true,
17
- :include_session_token => true
18
- })
19
- arg_order = [:id, :width, :height, :version, :express_install_swf]
20
- js_params = ["'#{swf_url}'"]
21
- js_params += arg_order.collect {|arg| "'#{params[arg]}'" }
22
-
23
- # Add authenticity_token and the session key to flashVars. This will only work if flashVars is a Hash or nil
24
- # If it's a string representing the name of a Javascript variable, then you need to add them yourself
25
- # like this:
26
- # <script>
27
- # ... other code that defines flashVars and sets some of its parameters
28
- # flashVars['authenticity_token'] = <%= form_authenticity_token -%>
29
- # flashVars['session_token'] = <%= session.session_id -%>
30
- # </script>
31
- params[:flash_vars] ||= {}
32
- if params[:flash_vars].is_a?(Hash)
33
- if params[:include_authenticity_token] && ActionController::Base.allow_forgery_protection
34
- params[:flash_vars].reverse_merge!(:authenticity_token => form_authenticity_token)
35
- end
36
- if params[:include_session_token]
37
- if RAILS_GEM_VERSION =~ /^2.3/
38
- params[:flash_vars].reverse_merge!(:session_token => request.session_options[:id])
39
- else
40
- params[:flash_vars].reverse_merge!(:session_token => session.session_id)
41
- end
42
- end
43
- end
44
-
45
- js_params += [params[:flash_vars], params[:params], params[:attributes]].collect do |hash_or_string|
46
- if hash_or_string.is_a?(Hash)
47
- hash_or_string.to_json
48
- else # If it's not a hash, then it should be a string giving the name of the Javascript variable to use
49
- hash_or_string
50
- end
51
- end.compact
52
-
53
- swf_tag = javascript_tag do
54
- "swfobject.embedSWF(#{js_params.join(',')})"
55
- end
56
- swf_tag += content_tag(:div, nil, :id => params[:id]) if params[:create_div]
57
- swf_tag
58
- end
59
- end