puffer_pages 0.1.1 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (197) hide show
  1. data/.gitignore +5 -0
  2. data/.rspec +3 -1
  3. data/.rvmrc +1 -1
  4. data/.travis.yml +13 -5
  5. data/CHANGELOG.md +130 -7
  6. data/Gemfile +10 -1
  7. data/README.md +18 -20
  8. data/Rakefile +1 -1
  9. data/app/assets/javascripts/puffer/codemirror.js +4237 -2223
  10. data/app/assets/javascripts/puffer/codemirror/css.js +359 -18
  11. data/app/assets/javascripts/puffer/codemirror/htmlmixed.js +15 -14
  12. data/app/assets/javascripts/puffer/codemirror/javascript.js +91 -29
  13. data/app/assets/javascripts/puffer/codemirror/liquid.js +185 -0
  14. data/app/assets/javascripts/puffer/codemirror/xml.js +99 -27
  15. data/app/assets/javascripts/puffer/codemirror/yaml.js +95 -0
  16. data/app/assets/javascripts/puffer/liquid.js +28 -12
  17. data/app/assets/javascripts/puffer/matchbrackets.js +63 -0
  18. data/app/assets/javascripts/puffer/multiplex.js +95 -0
  19. data/app/assets/javascripts/puffer/puffer_pages.js +140 -44
  20. data/app/assets/stylesheets/puffer/codemirror.css +203 -67
  21. data/app/assets/stylesheets/puffer/codemirror/ambiance-mobile.css +6 -0
  22. data/app/assets/stylesheets/puffer/codemirror/ambiance.css +76 -0
  23. data/app/assets/stylesheets/puffer/codemirror/blackboard.css +25 -0
  24. data/app/assets/stylesheets/puffer/codemirror/cobalt.css +4 -4
  25. data/app/assets/stylesheets/puffer/codemirror/eclipse.css +1 -1
  26. data/app/assets/stylesheets/puffer/codemirror/elegant.css +2 -2
  27. data/app/assets/stylesheets/puffer/codemirror/erlang-dark.css +21 -0
  28. data/app/assets/stylesheets/puffer/codemirror/lesser-dark.css +44 -0
  29. data/app/assets/stylesheets/puffer/codemirror/monokai.css +4 -4
  30. data/app/assets/stylesheets/puffer/codemirror/neat.css +3 -3
  31. data/app/assets/stylesheets/puffer/codemirror/night.css +4 -4
  32. data/app/assets/stylesheets/puffer/codemirror/rubyblue.css +5 -5
  33. data/app/assets/stylesheets/puffer/codemirror/solarized.css +207 -0
  34. data/app/assets/stylesheets/puffer/codemirror/twilight.css +26 -0
  35. data/app/assets/stylesheets/puffer/codemirror/vibrant-ink.css +27 -0
  36. data/app/assets/stylesheets/puffer/codemirror/xq-dark.css +46 -0
  37. data/app/assets/stylesheets/puffer/puffer_pages.css +64 -35
  38. data/app/components/codemirror/form.html.erb +22 -6
  39. data/app/components/codemirror_component.rb +1 -8
  40. data/app/components/handlers/form.html.erb +8 -0
  41. data/app/components/handlers_component.rb +8 -0
  42. data/app/components/page_parts/_page_part.html.erb +6 -0
  43. data/app/components/page_parts/form.html.erb +8 -27
  44. data/app/components/page_parts_component.rb +1 -3
  45. data/app/components/render/_tree_page.html.erb +3 -2
  46. data/app/controllers/admin/layouts_controller.rb +1 -1
  47. data/app/controllers/admin/origins_controller.rb +3 -0
  48. data/app/controllers/admin/pages_controller.rb +1 -1
  49. data/app/controllers/admin/snippets_controller.rb +1 -1
  50. data/app/controllers/pages_controller.rb +3 -3
  51. data/app/helpers/puffer_pages_helper.rb +3 -3
  52. data/app/models/puffer_pages/layout.rb +2 -7
  53. data/app/models/puffer_pages/origin.rb +2 -0
  54. data/app/models/puffer_pages/page.rb +1 -117
  55. data/app/models/puffer_pages/page_part.rb +2 -22
  56. data/app/models/puffer_pages/snippet.rb +2 -5
  57. data/config/routes.rb +3 -0
  58. data/db/migrate/20120812100913_create_origins.rb +16 -0
  59. data/db/migrate/20120924120226_migrate_to_uuid.rb +126 -0
  60. data/db/migrate/20130110144030_add_handler_to_page_parts.rb +9 -0
  61. data/db/migrate/20130118064524_add_locales_to_pages.rb +9 -0
  62. data/gemfiles/Gemfile.rails-3-1 +7 -0
  63. data/gemfiles/Gemfile.rails-3-2 +7 -0
  64. data/gemfiles/Gemfile.rails-head +7 -0
  65. data/lib/puffer_pages.rb +43 -7
  66. data/lib/puffer_pages/backends.rb +16 -0
  67. data/{app/controllers/puffer_pages → lib/puffer_pages/backends/controllers}/layouts_base.rb +2 -5
  68. data/lib/puffer_pages/backends/controllers/origins_base.rb +43 -0
  69. data/lib/puffer_pages/backends/controllers/pages_base.rb +52 -0
  70. data/{app/controllers/puffer_pages → lib/puffer_pages/backends/controllers}/snippets_base.rb +2 -5
  71. data/lib/puffer_pages/backends/models/layout.rb +34 -0
  72. data/lib/puffer_pages/backends/models/mixins/importable.rb +42 -0
  73. data/lib/puffer_pages/backends/models/mixins/localable.rb +65 -0
  74. data/lib/puffer_pages/backends/models/mixins/renderable.rb +153 -0
  75. data/lib/puffer_pages/backends/models/mixins/translatable.rb +52 -0
  76. data/lib/puffer_pages/backends/models/origin.rb +59 -0
  77. data/lib/puffer_pages/backends/models/page.rb +221 -0
  78. data/lib/puffer_pages/backends/models/page_part.rb +71 -0
  79. data/lib/puffer_pages/backends/models/snippet.rb +34 -0
  80. data/lib/puffer_pages/engine.rb +13 -2
  81. data/lib/puffer_pages/extensions/context.rb +31 -0
  82. data/lib/puffer_pages/extensions/core.rb +1 -8
  83. data/lib/puffer_pages/extensions/pagenator.rb +69 -0
  84. data/lib/puffer_pages/extensions/renderer.rb +31 -0
  85. data/lib/puffer_pages/globalize/migrator.rb +23 -0
  86. data/lib/puffer_pages/handlers.rb +29 -0
  87. data/lib/puffer_pages/handlers/base.rb +21 -0
  88. data/lib/puffer_pages/handlers/yaml.rb +20 -0
  89. data/lib/puffer_pages/helpers.rb +14 -0
  90. data/lib/puffer_pages/liquid/backend.rb +16 -0
  91. data/lib/puffer_pages/liquid/file_system.rb +36 -12
  92. data/lib/puffer_pages/liquid/page_drop.rb +26 -23
  93. data/lib/puffer_pages/liquid/tags/array.rb +39 -0
  94. data/lib/puffer_pages/liquid/tags/{javascripts.rb → assets.rb} +13 -4
  95. data/lib/puffer_pages/liquid/tags/helper.rb +15 -0
  96. data/lib/puffer_pages/liquid/tags/include.rb +32 -0
  97. data/lib/puffer_pages/liquid/tags/javascript.rb +15 -0
  98. data/lib/puffer_pages/liquid/tags/partials.rb +22 -0
  99. data/lib/puffer_pages/liquid/tags/render.rb +28 -0
  100. data/lib/puffer_pages/liquid/tags/scope.rb +31 -0
  101. data/lib/puffer_pages/liquid/tags/super.rb +36 -0
  102. data/lib/puffer_pages/liquid/tags/translate.rb +56 -0
  103. data/lib/puffer_pages/liquid/tags/url.rb +53 -0
  104. data/lib/puffer_pages/liquid/tags/yield.rb +3 -1
  105. data/lib/puffer_pages/log_subscriber.rb +29 -0
  106. data/lib/puffer_pages/migrations.rb +31 -0
  107. data/lib/puffer_pages/renderer.rb +25 -0
  108. data/lib/puffer_pages/rspec/matchers.rb +27 -0
  109. data/lib/puffer_pages/rspec/matchers/render_page.rb +90 -0
  110. data/lib/puffer_pages/version.rb +1 -1
  111. data/puffer_pages.gemspec +18 -18
  112. data/spec/controllers/pages_controller_spec.rb +44 -0
  113. data/spec/controllers/puffer_pages_controller_spec.rb +194 -0
  114. data/spec/data/broken.json +8 -0
  115. data/spec/data/import.json +55 -0
  116. data/spec/data/localized.json +106 -0
  117. data/spec/data/unlocalized.json +82 -0
  118. data/spec/dummy/.rvmrc +1 -0
  119. data/spec/dummy/app/controllers/application_controller.rb +6 -0
  120. data/spec/dummy/app/views/layouts/sample.en.erb +1 -0
  121. data/spec/dummy/app/views/layouts/sample.ru.erb +1 -0
  122. data/spec/dummy/app/views/shared/_first.html.erb +1 -0
  123. data/spec/dummy/config/application.rb +21 -2
  124. data/spec/dummy/config/boot.rb +0 -2
  125. data/spec/dummy/config/database.yml +7 -1
  126. data/spec/dummy/config/environments/development.rb +11 -2
  127. data/spec/dummy/config/environments/pg_test.rb +6 -6
  128. data/spec/dummy/config/environments/production.rb +19 -3
  129. data/spec/dummy/config/environments/test.rb +6 -6
  130. data/spec/dummy/config/initializers/inflections.rb +5 -0
  131. data/spec/dummy/config/initializers/puffer_pages.rb +4 -0
  132. data/spec/dummy/config/initializers/secret_token.rb +1 -1
  133. data/spec/dummy/config/initializers/wrap_parameters.rb +5 -3
  134. data/spec/dummy/config/routes.rb +2 -1
  135. data/spec/dummy/db/migrate/{20090422092419_create_pages.rb → 20130118071511_create_pages.rb} +1 -0
  136. data/spec/dummy/db/migrate/{20090504132337_create_page_parts.rb → 20130118071512_create_page_parts.rb} +1 -0
  137. data/spec/dummy/db/migrate/{20090506102004_create_layouts.rb → 20130118071513_create_layouts.rb} +1 -0
  138. data/spec/dummy/db/migrate/{20090510121824_create_snippets.rb → 20130118071514_create_snippets.rb} +1 -0
  139. data/spec/dummy/db/migrate/20130118071515_create_origins.rb +17 -0
  140. data/spec/dummy/db/migrate/20130118071516_migrate_to_uuid.rb +127 -0
  141. data/spec/dummy/db/migrate/20130118071517_add_handler_to_page_parts.rb +10 -0
  142. data/spec/dummy/db/migrate/20130118071518_add_locales_to_pages.rb +10 -0
  143. data/spec/dummy/db/migrate/20130118071519_add_translations.rb +9 -0
  144. data/spec/dummy/db/schema.rb +65 -17
  145. data/spec/fabricators/articles_fabricator.rb +2 -2
  146. data/spec/fabricators/layouts_fabricator.rb +24 -3
  147. data/spec/fabricators/origin_fabricator.rb +5 -0
  148. data/spec/fabricators/page_parts_fabricator.rb +17 -2
  149. data/spec/fabricators/pages_fabricator.rb +20 -5
  150. data/spec/fabricators/snippets_fabricator.rb +14 -3
  151. data/spec/lib/handlers/base_spec.rb +10 -0
  152. data/spec/lib/handlers/yaml_spec.rb +34 -0
  153. data/spec/lib/handlers_spec.rb +36 -0
  154. data/spec/lib/liquid/backend_spec.rb +20 -0
  155. data/spec/lib/liquid/interpolation_spec.rb +25 -0
  156. data/spec/lib/liquid/tags/include_spec.rb +38 -0
  157. data/spec/lib/liquid/tags/partials_spec.rb +39 -0
  158. data/spec/lib/liquid/tags/scope_spec.rb +18 -0
  159. data/spec/lib/liquid/tags/translate_spec.rb +107 -0
  160. data/spec/lib/liquid/tags_spec.rb +81 -0
  161. data/spec/lib/page_drop_spec.rb +65 -0
  162. data/spec/lib/pagenator_spec.rb +176 -0
  163. data/spec/lib/rspec/matchers/render_page_spec.rb +107 -0
  164. data/spec/models/puffer_pages/layout_spec.rb +15 -0
  165. data/spec/models/puffer_pages/localable_spec.rb +62 -0
  166. data/spec/models/puffer_pages/origin_spec.rb +112 -0
  167. data/spec/models/puffer_pages/page_part_spec.rb +14 -0
  168. data/spec/models/puffer_pages/page_spec.rb +307 -0
  169. data/spec/models/puffer_pages/renderable_spec.rb +84 -0
  170. data/spec/models/puffer_pages/snippet_spec.rb +15 -0
  171. data/spec/requests/origins_requests_spec.rb +37 -0
  172. data/spec/spec_helper.rb +7 -6
  173. metadata +349 -87
  174. data/Gemfile.lock +0 -176
  175. data/app/assets/javascripts/puffer/overlay.js +0 -51
  176. data/app/controllers/puffer_pages/pages_base.rb +0 -38
  177. data/app/models/layout.rb +0 -2
  178. data/app/models/page.rb +0 -2
  179. data/app/models/page_part.rb +0 -2
  180. data/app/models/snippet.rb +0 -2
  181. data/app/views/layouts/puffer_pages_layout.html.erb +0 -2
  182. data/config/puffer_routes.rb +0 -3
  183. data/gemfiles/Gemfile-rails-3.1 +0 -5
  184. data/gemfiles/Gemfile-rails-3.1.lock +0 -173
  185. data/gemfiles/Gemfile-rails-3.2 +0 -5
  186. data/gemfiles/Gemfile-rails-3.2.lock +0 -171
  187. data/lib/puffer_pages/extensions/controller.rb +0 -30
  188. data/lib/puffer_pages/extensions/mapper.rb +0 -23
  189. data/lib/puffer_pages/liquid/tags/page_attribute.rb +0 -39
  190. data/lib/puffer_pages/liquid/tags/stylesheets.rb +0 -38
  191. data/spec/controllers/articles_controller_spec.rb +0 -65
  192. data/spec/dummy/app/controllers/articles_controller.rb +0 -9
  193. data/spec/integration/navigation_spec.rb +0 -9
  194. data/spec/lib/drops_spec.rb +0 -55
  195. data/spec/lib/tags_spec.rb +0 -98
  196. data/spec/models/page_spec.rb +0 -235
  197. data/spec/puffer_pages_spec.rb +0 -7
@@ -0,0 +1,106 @@
1
+ {
2
+ "layouts": [{
3
+ "created_at": "2013-12-23T16:23:00Z",
4
+ "id": "404DF5860F01492EB470711FE3BE4535",
5
+ "name": "application",
6
+ "updated_at": "2013-12-23T16:23:00Z",
7
+ "body_translations": {
8
+ "en": "Nulla suscipit ligula in lacus.",
9
+ "ru": "Morbi ut odio.",
10
+ "cn": "Donec ut mauris eget massa tempor convallis."
11
+ }
12
+ }],
13
+ "snippets": [{
14
+ "created_at": "2013-12-23T16:23:00Z",
15
+ "id": "C647D698E0D64A99BC8AA0C0A0F0BAEF",
16
+ "name": "lacus",
17
+ "updated_at": "2013-12-23T16:23:00Z",
18
+ "body_translations": {
19
+ "en": "Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Nulla dapibus dolor vel est.",
20
+ "ru": "Curabitur gravida nisi at nibh.",
21
+ "cn": "Nam nulla."
22
+ }
23
+ }],
24
+ "pages": [{
25
+ "created_at": "2013-12-23T16:23:00Z",
26
+ "id": "55E458FCA2BB4BA0B95AE99ACDDAF094",
27
+ "layout_name": "application",
28
+ "locales": {},
29
+ "name": "Nunc nisl.",
30
+ "parent_id": null,
31
+ "slug": null,
32
+ "status": "published",
33
+ "updated_at": "2013-12-23T16:23:00Z",
34
+ "page_parts": [{
35
+ "created_at": "2013-12-23T16:23:00Z",
36
+ "handler": "html",
37
+ "id": "A0C54DBB446D4727903A2B6FA5D4C9E2",
38
+ "name": "body",
39
+ "page_id": "55E458FCA2BB4BA0B95AE99ACDDAF094",
40
+ "updated_at": "2013-12-23T16:23:00Z",
41
+ "body_translations": {
42
+ "en": "PagePart: `body`, Page: ``",
43
+ "ru": "Nulla neque libero, convallis eget, eleifend luctus, ultricies eu, nibh.",
44
+ "cn": "Fusce posuere felis sed lacus."
45
+ }
46
+ }, {
47
+ "created_at": "2013-12-23T16:23:00Z",
48
+ "handler": "html",
49
+ "id": "EA1DE54674D1430894134AA9FDB603F3",
50
+ "name": "sidebar",
51
+ "page_id": "55E458FCA2BB4BA0B95AE99ACDDAF094",
52
+ "updated_at": "2013-12-23T16:23:00Z",
53
+ "body_translations": {
54
+ "en": "PagePart: `sidebar`, Page: ``",
55
+ "ru": "Mauris enim leo, rhoncus sed, vestibulum sit amet, cursus id, turpis.",
56
+ "cn": "Vivamus vel nulla eget eros elementum pellentesque."
57
+ }
58
+ }]
59
+ }, {
60
+ "created_at": "2013-12-23T16:23:00Z",
61
+ "id": "58C3B16335C242E8B231E2B634D1B7EA",
62
+ "layout_name": null,
63
+ "locales": {},
64
+ "name": "Morbi non quam nec dui luctus rutrum.",
65
+ "parent_id": "55E458FCA2BB4BA0B95AE99ACDDAF094",
66
+ "slug": "first",
67
+ "status": "published",
68
+ "updated_at": "2013-12-23T16:23:00Z",
69
+ "page_parts": [{
70
+ "created_at": "2013-12-23T16:23:00Z",
71
+ "handler": "html",
72
+ "id": "A0BC46E472FC45CB8C57F068685DEA3D",
73
+ "name": "body",
74
+ "page_id": "58C3B16335C242E8B231E2B634D1B7EA",
75
+ "updated_at": "2013-12-23T16:23:00Z",
76
+ "body_translations": {
77
+ "en": "PagePart: `body`, Page: `first`",
78
+ "ru": "Nam ultrices, libero non mattis pulvinar, nulla pede ullamcorper augue, a suscipit nulla elit ac nulla.",
79
+ "cn": "Etiam justo."
80
+ }
81
+ }]
82
+ }, {
83
+ "created_at": "2013-12-23T16:23:00Z",
84
+ "id": "C8D5E74CE293403DAB5FBB5A89BDE6C5",
85
+ "layout_name": null,
86
+ "locales": {},
87
+ "name": "Donec dapibus.",
88
+ "parent_id": "58C3B16335C242E8B231E2B634D1B7EA",
89
+ "slug": "second",
90
+ "status": "published",
91
+ "updated_at": "2013-12-23T16:23:00Z",
92
+ "page_parts": [{
93
+ "created_at": "2013-12-23T16:23:00Z",
94
+ "handler": "html",
95
+ "id": "504F931E6E8C495699BA5D4C9D1FAD06",
96
+ "name": "sidebar",
97
+ "page_id": "C8D5E74CE293403DAB5FBB5A89BDE6C5",
98
+ "updated_at": "2013-12-23T16:23:00Z",
99
+ "body_translations": {
100
+ "en": "PagePart: `sidebar`, Page: `first/second`",
101
+ "ru": "Vivamus in felis eu sapien cursus vestibulum.",
102
+ "cn": "Aenean sit amet justo."
103
+ }
104
+ }]
105
+ }]
106
+ }
@@ -0,0 +1,82 @@
1
+ {
2
+ "layouts": [{
3
+ "created_at": "2013-12-23T16:23:00Z",
4
+ "id": "404DF5860F01492EB470711FE3BE4535",
5
+ "name": "application",
6
+ "updated_at": "2013-12-23T16:23:00Z",
7
+ "body": "Nulla suscipit ligula in lacus."
8
+ }],
9
+ "snippets": [{
10
+ "created_at": "2013-12-23T16:23:00Z",
11
+ "id": "C647D698E0D64A99BC8AA0C0A0F0BAEF",
12
+ "name": "lacus",
13
+ "updated_at": "2013-12-23T16:23:00Z",
14
+ "body": "Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Nulla dapibus dolor vel est."
15
+ }],
16
+ "pages": [{
17
+ "created_at": "2013-12-23T16:23:00Z",
18
+ "id": "55E458FCA2BB4BA0B95AE99ACDDAF094",
19
+ "layout_name": "application",
20
+ "locales": {},
21
+ "name": "Nunc nisl.",
22
+ "parent_id": null,
23
+ "slug": null,
24
+ "status": "published",
25
+ "updated_at": "2013-12-23T16:23:00Z",
26
+ "page_parts": [{
27
+ "created_at": "2013-12-23T16:23:00Z",
28
+ "handler": "html",
29
+ "id": "A0C54DBB446D4727903A2B6FA5D4C9E2",
30
+ "name": "body",
31
+ "page_id": "55E458FCA2BB4BA0B95AE99ACDDAF094",
32
+ "updated_at": "2013-12-23T16:23:00Z",
33
+ "body": "PagePart: `body`, Page: ``"
34
+ }, {
35
+ "created_at": "2013-12-23T16:23:00Z",
36
+ "handler": "html",
37
+ "id": "EA1DE54674D1430894134AA9FDB603F3",
38
+ "name": "sidebar",
39
+ "page_id": "55E458FCA2BB4BA0B95AE99ACDDAF094",
40
+ "updated_at": "2013-12-23T16:23:00Z",
41
+ "body": "PagePart: `sidebar`, Page: ``"
42
+ }]
43
+ }, {
44
+ "created_at": "2013-12-23T16:23:00Z",
45
+ "id": "58C3B16335C242E8B231E2B634D1B7EA",
46
+ "layout_name": null,
47
+ "locales": {},
48
+ "name": "Morbi non quam nec dui luctus rutrum.",
49
+ "parent_id": "55E458FCA2BB4BA0B95AE99ACDDAF094",
50
+ "slug": "first",
51
+ "status": "published",
52
+ "updated_at": "2013-12-23T16:23:00Z",
53
+ "page_parts": [{
54
+ "created_at": "2013-12-23T16:23:00Z",
55
+ "handler": "html",
56
+ "id": "A0BC46E472FC45CB8C57F068685DEA3D",
57
+ "name": "body",
58
+ "page_id": "58C3B16335C242E8B231E2B634D1B7EA",
59
+ "updated_at": "2013-12-23T16:23:00Z",
60
+ "body": "PagePart: `body`, Page: `first`"
61
+ }]
62
+ }, {
63
+ "created_at": "2013-12-23T16:23:00Z",
64
+ "id": "C8D5E74CE293403DAB5FBB5A89BDE6C5",
65
+ "layout_name": null,
66
+ "locales": {},
67
+ "name": "Donec dapibus.",
68
+ "parent_id": "58C3B16335C242E8B231E2B634D1B7EA",
69
+ "slug": "second",
70
+ "status": "published",
71
+ "updated_at": "2013-12-23T16:23:00Z",
72
+ "page_parts": [{
73
+ "created_at": "2013-12-23T16:23:00Z",
74
+ "handler": "html",
75
+ "id": "504F931E6E8C495699BA5D4C9D1FAD06",
76
+ "name": "sidebar",
77
+ "page_id": "C8D5E74CE293403DAB5FBB5A89BDE6C5",
78
+ "updated_at": "2013-12-23T16:23:00Z",
79
+ "body": "PagePart: `sidebar`, Page: `first/second`"
80
+ }]
81
+ }]
82
+ }
data/spec/dummy/.rvmrc ADDED
@@ -0,0 +1 @@
1
+ rvm use 1.9.3@puffer_pages --create
@@ -1,6 +1,12 @@
1
1
  class ApplicationController < ActionController::Base
2
2
  protect_from_forgery
3
3
 
4
+ around_filter :locale_context
5
+
6
+ def locale_context &block
7
+ params[:locale].present? ? I18n.with_locale(params[:locale], &block) : block.call
8
+ end
9
+
4
10
  def has_puffer_access? namespace
5
11
  true
6
12
  end
@@ -0,0 +1 @@
1
+ sample.en.erb
@@ -0,0 +1 @@
1
+ sample.ru.erb
@@ -0,0 +1 @@
1
+ shared/first content
@@ -2,7 +2,8 @@ require File.expand_path('../boot', __FILE__)
2
2
 
3
3
  require 'rails/all'
4
4
 
5
- Bundler.require
5
+ Bundler.require :development
6
+
6
7
  require "puffer_pages"
7
8
 
8
9
  module Dummy
@@ -27,7 +28,9 @@ module Dummy
27
28
 
28
29
  # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
29
30
  # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
30
- # config.i18n.default_locale = :de
31
+ config.i18n.default_locale = :en
32
+ config.i18n.available_locales = [:ru, :en, :cn]
33
+ config.i18n.fallbacks = true
31
34
 
32
35
  # Configure the default encoding used in templates for Ruby 1.9.
33
36
  config.encoding = "utf-8"
@@ -35,7 +38,23 @@ module Dummy
35
38
  # Configure sensitive parameters which will be filtered from the log file.
36
39
  config.filter_parameters += [:password]
37
40
 
41
+ # Use SQL instead of Active Record's schema dumper when creating the database.
42
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
43
+ # like if you have constraints or database-specific column types
44
+ # config.active_record.schema_format = :sql
45
+
46
+ # Enforce whitelist mode for mass assignment.
47
+ # This will create an empty whitelist of attributes available for mass-assignment for all models
48
+ # in your app. As such, your models will need to explicitly whitelist or blacklist accessible
49
+ # parameters by using an attr_accessible or attr_protected declaration.
50
+ # config.active_record.whitelist_attributes = true
51
+
38
52
  # Enable the asset pipeline
39
53
  config.assets.enabled = true
54
+
55
+ # Version of your assets, change this if you want to expire all your assets
56
+ config.assets.version = '1.0'
57
+
58
+ config.puffer_pages.raise_errors = true
40
59
  end
41
60
  end
@@ -4,5 +4,3 @@ require 'rubygems'
4
4
  ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
5
5
 
6
6
  require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
7
-
8
- $:.unshift File.expand_path('../../../../lib', __FILE__)
@@ -6,12 +6,18 @@ development:
6
6
  pool: 5
7
7
  timeout: 5000
8
8
 
9
+ # development:
10
+ # adapter: mysql2
11
+ # database: puffer_pages_development
12
+ # usename: root
13
+ # encoding: utf8
14
+
9
15
  # Warning: The database defined as "test" will be erased and
10
16
  # re-generated from your development database when you run "rake".
11
17
  # Do not set this db to the same as development or production.
12
18
  test:
13
19
  adapter: sqlite3
14
- database: db/test.sqlite3
20
+ database: ":memory:"
15
21
  pool: 5
16
22
  timeout: 5000
17
23
 
@@ -2,7 +2,7 @@ Dummy::Application.configure do
2
2
  # Settings specified here will take precedence over those in config/application.rb
3
3
 
4
4
  # In the development environment your application's code is reloaded on
5
- # every request. This slows down response time but is perfect for development
5
+ # every request. This slows down response time but is perfect for development
6
6
  # since you don't have to restart the web server when you make code changes.
7
7
  config.cache_classes = false
8
8
 
@@ -22,9 +22,18 @@ Dummy::Application.configure do
22
22
  # Only use best-standards-support built into browsers
23
23
  config.action_dispatch.best_standards_support = :builtin
24
24
 
25
+ # Raise exception on mass assignment protection for Active Record models
26
+ # config.active_record.mass_assignment_sanitizer = :strict
27
+
28
+ # Log the query plan for queries taking more than this (works
29
+ # with SQLite, MySQL, and PostgreSQL)
30
+ # config.active_record.auto_explain_threshold_in_seconds = 0.5
31
+
25
32
  # Do not compress assets
26
33
  config.assets.compress = false
27
34
 
28
35
  # Expands the lines which load the assets
29
- config.assets.debug = true
36
+ config.assets.debug = false
37
+
38
+ config.puffer_pages.raise_errors = true
30
39
  end
@@ -2,9 +2,9 @@ Dummy::Application.configure do
2
2
  # Settings specified here will take precedence over those in config/application.rb
3
3
 
4
4
  # The test environment is used exclusively to run your application's
5
- # test suite. You never need to work with it otherwise. Remember that
5
+ # test suite. You never need to work with it otherwise. Remember that
6
6
  # your test database is "scratch space" for the test suite and is wiped
7
- # and recreated between test runs. Don't rely on the data there!
7
+ # and recreated between test runs. Don't rely on the data there!
8
8
  config.cache_classes = true
9
9
 
10
10
  # Configure static asset server for tests with Cache-Control for performance
@@ -29,11 +29,11 @@ Dummy::Application.configure do
29
29
  # ActionMailer::Base.deliveries array.
30
30
  config.action_mailer.delivery_method = :test
31
31
 
32
- # Use SQL instead of Active Record's schema dumper when creating the test database.
33
- # This is necessary if your schema can't be completely dumped by the schema dumper,
34
- # like if you have constraints or database-specific column types
35
- # config.active_record.schema_format = :sql
32
+ # Raise exception on mass assignment protection for Active Record models
33
+ # config.active_record.mass_assignment_sanitizer = :strict
36
34
 
37
35
  # Print deprecation notices to the stderr
38
36
  config.active_support.deprecation = :stderr
37
+
38
+ config.puffer_pages.raise_errors = true
39
39
  end
@@ -14,9 +14,18 @@ Dummy::Application.configure do
14
14
  # Compress JavaScripts and CSS
15
15
  config.assets.compress = true
16
16
 
17
+ # Don't fallback to assets pipeline if a precompiled asset is missed
18
+ config.assets.compile = false
19
+
20
+ # Generate digests for assets URLs
21
+ config.assets.digest = true
22
+
23
+ # Defaults to Rails.root.join("public/assets")
24
+ # config.assets.manifest = YOUR_PATH
25
+
17
26
  # Specifies the header that your server uses for sending files
18
- # (comment out if your front-end server doesn't support this)
19
- config.action_dispatch.x_sendfile_header = "X-Sendfile" # Use 'X-Accel-Redirect' for nginx
27
+ # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
28
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
20
29
 
21
30
  # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
22
31
  # config.force_ssl = true
@@ -24,8 +33,11 @@ Dummy::Application.configure do
24
33
  # See everything in the log (default is :info)
25
34
  # config.log_level = :debug
26
35
 
36
+ # Prepend all log lines with the following tags
37
+ # config.log_tags = [ :subdomain, :uuid ]
38
+
27
39
  # Use a different logger for distributed setups
28
- # config.logger = SyslogLogger.new
40
+ # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
29
41
 
30
42
  # Use a different cache store in production
31
43
  # config.cache_store = :mem_cache_store
@@ -48,4 +60,8 @@ Dummy::Application.configure do
48
60
 
49
61
  # Send deprecation notices to registered listeners
50
62
  config.active_support.deprecation = :notify
63
+
64
+ # Log the query plan for queries taking more than this (works
65
+ # with SQLite, MySQL, and PostgreSQL)
66
+ # config.active_record.auto_explain_threshold_in_seconds = 0.5
51
67
  end
@@ -2,9 +2,9 @@ Dummy::Application.configure do
2
2
  # Settings specified here will take precedence over those in config/application.rb
3
3
 
4
4
  # The test environment is used exclusively to run your application's
5
- # test suite. You never need to work with it otherwise. Remember that
5
+ # test suite. You never need to work with it otherwise. Remember that
6
6
  # your test database is "scratch space" for the test suite and is wiped
7
- # and recreated between test runs. Don't rely on the data there!
7
+ # and recreated between test runs. Don't rely on the data there!
8
8
  config.cache_classes = true
9
9
 
10
10
  # Configure static asset server for tests with Cache-Control for performance
@@ -29,11 +29,11 @@ Dummy::Application.configure do
29
29
  # ActionMailer::Base.deliveries array.
30
30
  config.action_mailer.delivery_method = :test
31
31
 
32
- # Use SQL instead of Active Record's schema dumper when creating the test database.
33
- # This is necessary if your schema can't be completely dumped by the schema dumper,
34
- # like if you have constraints or database-specific column types
35
- # config.active_record.schema_format = :sql
32
+ # Raise exception on mass assignment protection for Active Record models
33
+ # config.active_record.mass_assignment_sanitizer = :strict
36
34
 
37
35
  # Print deprecation notices to the stderr
38
36
  config.active_support.deprecation = :stderr
37
+
38
+ config.puffer_pages.raise_errors = true
39
39
  end
@@ -8,3 +8,8 @@
8
8
  # inflect.irregular 'person', 'people'
9
9
  # inflect.uncountable %w( fish sheep )
10
10
  # end
11
+ #
12
+ # These inflection rules are supported but not enabled by default:
13
+ # ActiveSupport::Inflector.inflections do |inflect|
14
+ # inflect.acronym 'RESTful'
15
+ # end
@@ -0,0 +1,4 @@
1
+ PufferPages.setup do |config|
2
+ config.localize = ENV['LOCALIZE'] != 'false'
3
+ config.access_token = 'token'
4
+ end
@@ -4,4 +4,4 @@
4
4
  # If you change this key, all old signed cookies will become invalid!
5
5
  # Make sure the secret is at least 30 characters and all random,
6
6
  # no regular words or you'll be exposed to dictionary attacks.
7
- Dummy::Application.config.secret_token = '41d9a6d7e86b4e67cecf3f216e3e7acd3ca080b1cebf7fa467f351241dfe51686208dff2079101d3b4f83d1a954c17e874da814be144d0ff7539621b74c2cdb1'
7
+ Dummy::Application.config.secret_token = '8cf6d9f23949d20957da43a2b5b54c77d84a52592120f14e54969949efef0508ad8cb263ce3949a78ebff63b3143b237e26bc2d147609f831dc57204cecd2561'
@@ -4,9 +4,11 @@
4
4
  # is enabled by default.
5
5
 
6
6
  # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
- ActionController::Base.wrap_parameters format: [:json]
7
+ ActiveSupport.on_load(:action_controller) do
8
+ wrap_parameters format: [:json]
9
+ end
8
10
 
9
11
  # Disable root element in JSON by default.
10
- if defined?(ActiveRecord)
11
- ActiveRecord::Base.include_root_in_json = false
12
+ ActiveSupport.on_load(:active_record) do
13
+ self.include_root_in_json = false
12
14
  end