disguise 2.0.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (228) hide show
  1. data/README.rdoc +26 -24
  2. data/Rakefile +1 -1
  3. data/VERSION +1 -1
  4. data/app/models/domain_theme.rb +1 -1
  5. data/app/models/theme.rb +4 -4
  6. data/app/views/admin/themes/_theme.html.erb +3 -3
  7. data/app/views/admin/themes/edit.html.erb +9 -2
  8. data/config/locales/ar.yml +20 -0
  9. data/config/locales/bg.yml +20 -0
  10. data/config/locales/ca.yml +20 -0
  11. data/config/locales/cs.yml +20 -0
  12. data/{locales → config/locales}/da.yml +8 -8
  13. data/config/locales/de.yml +20 -0
  14. data/config/locales/el.yml +20 -0
  15. data/{locales → config/locales}/en.yml +0 -0
  16. data/config/locales/es.yml +20 -0
  17. data/config/locales/et.yml +20 -0
  18. data/config/locales/fa.yml +20 -0
  19. data/config/locales/fi.yml +20 -0
  20. data/{locales → config/locales}/fr.yml +8 -8
  21. data/config/locales/gl.yml +20 -0
  22. data/config/locales/hi.yml +20 -0
  23. data/config/locales/hr.yml +20 -0
  24. data/config/locales/hu.yml +20 -0
  25. data/config/locales/id.yml +20 -0
  26. data/config/locales/it.yml +20 -0
  27. data/config/locales/iw.yml +20 -0
  28. data/config/locales/ja.yml +20 -0
  29. data/config/locales/ko.yml +20 -0
  30. data/config/locales/lt.yml +20 -0
  31. data/config/locales/lv.yml +20 -0
  32. data/config/locales/mt.yml +20 -0
  33. data/config/locales/nl.yml +20 -0
  34. data/config/locales/no.yml +21 -0
  35. data/config/locales/pl.yml +20 -0
  36. data/config/locales/pt-PT.yml +20 -0
  37. data/{locales → config/locales}/pt.yml +0 -0
  38. data/config/locales/ro.yml +20 -0
  39. data/config/locales/ru.yml +20 -0
  40. data/config/locales/sk.yml +20 -0
  41. data/config/locales/sl.yml +20 -0
  42. data/{locales → config/locales}/sq.yml +7 -7
  43. data/config/locales/sr.yml +20 -0
  44. data/config/locales/sv.yml +20 -0
  45. data/config/locales/th.yml +20 -0
  46. data/config/locales/tl.yml +20 -0
  47. data/config/locales/tr.yml +20 -0
  48. data/config/locales/uk.yml +20 -0
  49. data/config/locales/vi.yml +20 -0
  50. data/config/locales/zh-CN.yml +20 -0
  51. data/config/locales/zh-TW.yml +20 -0
  52. data/config/locales/zh.yml +20 -0
  53. data/config/routes.rb +6 -0
  54. data/disguise.gemspec +157 -181
  55. data/lib/disguise.rb +2 -10
  56. data/lib/disguise/config.rb +22 -9
  57. data/lib/disguise/controllers/disguise_application.rb +58 -0
  58. data/lib/disguise/engine.rb +14 -0
  59. data/lib/tasks/diguise.rake +9 -0
  60. data/test/{rails_root → rails_test}/.gitignore +0 -0
  61. data/test/{rails_root → rails_test}/.rake_tasks +0 -0
  62. data/test/rails_test/Gemfile +18 -0
  63. data/test/rails_test/Gemfile.lock +114 -0
  64. data/test/{rails_root → rails_test}/Rakefile +2 -4
  65. data/test/{rails_root → rails_test}/app/controllers/admin/domain_themes_controller.rb +0 -0
  66. data/test/{rails_root → rails_test}/app/controllers/admin/themes_controller.rb +0 -0
  67. data/test/{rails_root → rails_test}/app/controllers/application_controller.rb +0 -0
  68. data/test/{rails_root → rails_test}/app/controllers/default_controller.rb +0 -0
  69. data/test/{rails_root → rails_test}/app/models/.keep +0 -0
  70. data/test/rails_test/app/models/user.rb +3 -0
  71. data/test/{rails_root → rails_test}/app/views/default/index.html.erb +0 -0
  72. data/test/{rails_root → rails_test}/app/views/layouts/default.html.erb +0 -0
  73. data/test/rails_test/config.ru +4 -0
  74. data/test/rails_test/config/application.rb +42 -0
  75. data/test/rails_test/config/boot.rb +13 -0
  76. data/test/rails_test/config/database.yml +14 -0
  77. data/test/rails_test/config/environment.rb +5 -0
  78. data/test/rails_test/config/environments/development.rb +26 -0
  79. data/test/rails_test/config/environments/production.rb +49 -0
  80. data/test/rails_test/config/environments/test.rb +35 -0
  81. data/test/rails_test/config/initializers/backtrace_silencers.rb +7 -0
  82. data/test/rails_test/config/initializers/disguise.rb +5 -0
  83. data/test/{rails_root → rails_test}/config/initializers/inflections.rb +2 -2
  84. data/test/{rails_root → rails_test}/config/initializers/mime_types.rb +0 -0
  85. data/test/rails_test/config/initializers/secret_token.rb +7 -0
  86. data/test/rails_test/config/initializers/session_store.rb +8 -0
  87. data/test/rails_test/config/routes.rb +3 -0
  88. data/test/{rails_root → rails_test}/db/.keep +0 -0
  89. data/test/{rails_root → rails_test}/db/migrate/20090530170040_create_themes.rb +0 -0
  90. data/test/{rails_root → rails_test}/db/migrate/20090602041838_create_users.rb +0 -0
  91. data/test/{rails_root → rails_test}/db/migrate/20090606153236_create_domain_themes.rb +0 -0
  92. data/test/{rails_root → rails_test}/features/step_definitions/webrat_steps.rb +0 -0
  93. data/test/{rails_root → rails_test}/features/support/env.rb +0 -0
  94. data/test/{rails_root → rails_test}/public/.htaccess +0 -0
  95. data/test/rails_test/public/404.html +26 -0
  96. data/test/rails_test/public/422.html +26 -0
  97. data/test/rails_test/public/500.html +26 -0
  98. data/test/{rails_root → rails_test}/public/dispatch.rb +1 -1
  99. data/test/{rails_root → rails_test}/public/favicon.ico +0 -0
  100. data/test/{rails_root → rails_test}/public/images/blue/preview.gif +0 -0
  101. data/test/rails_test/public/images/rails.png +0 -0
  102. data/test/{rails_root → rails_test}/public/javascripts/application.js +0 -0
  103. data/test/{rails_root → rails_test}/public/javascripts/controls.js +75 -73
  104. data/test/{rails_root → rails_test}/public/javascripts/dragdrop.js +171 -169
  105. data/test/{rails_root → rails_test}/public/javascripts/effects.js +180 -177
  106. data/test/rails_test/public/javascripts/prototype.js +6001 -0
  107. data/test/rails_test/public/javascripts/rails.js +175 -0
  108. data/test/rails_test/public/robots.txt +5 -0
  109. data/test/{rails_root/public/stylesheets/.keep → rails_test/public/stylesheets/.gitkeep} +0 -0
  110. data/test/{rails_root/test/functional/.keep → rails_test/public/stylesheets/application.css} +0 -0
  111. data/test/rails_test/script/rails +6 -0
  112. data/test/{rails_root → rails_test}/test/factories.rb +0 -0
  113. data/test/{rails_root/test/integration → rails_test/test/functional}/.keep +0 -0
  114. data/test/{rails_root → rails_test}/test/functional/admin/domain_themes_controller_test.rb +6 -6
  115. data/test/{rails_root → rails_test}/test/functional/admin/themes_controller_test.rb +6 -6
  116. data/test/{rails_root → rails_test}/test/functional/default_controller_test.rb +2 -2
  117. data/test/{rails_root/test/mocks/development → rails_test/test/integration}/.keep +0 -0
  118. data/test/{rails_root → rails_test}/test/test_helper.rb +6 -9
  119. data/test/{rails_root/test/mocks/test → rails_test/test/unit}/.keep +0 -0
  120. data/test/{rails_root → rails_test}/test/unit/domain_theme_test.rb +2 -1
  121. data/test/{rails_root → rails_test}/test/unit/theme_test.rb +4 -2
  122. data/test/{rails_root → rails_test}/themes/blue/description.txt +0 -0
  123. data/test/{rails_root → rails_test}/themes/blue/locales/blue.yml +0 -0
  124. data/test/{rails_root → rails_test}/themes/blue/locales/en.yml +0 -0
  125. data/test/{rails_root → rails_test}/themes/blue/views/default/index.html.erb +0 -0
  126. data/test/{rails_root → rails_test}/themes/blue/views/layouts/default.html.erb +0 -0
  127. data/test/{rails_root → rails_test}/themes/blue/views/layouts/global/_footer.html.erb +0 -0
  128. data/test/{rails_root → rails_test}/themes/blue/views/layouts/global/_head.html.erb +0 -0
  129. data/test/{rails_root → rails_test}/themes/blue/views/layouts/global/_header.html.erb +0 -0
  130. data/test/{rails_root → rails_test}/themes/red/description.txt +0 -0
  131. data/test/{rails_root → rails_test}/themes/red/locales/en.yml +0 -0
  132. data/test/{rails_root → rails_test}/themes/red/views/layouts/default.html.erb +0 -0
  133. data/test/{rails_root → rails_test}/themes/red/views/layouts/global/_footer.html.erb +0 -0
  134. data/test/{rails_root → rails_test}/themes/red/views/layouts/global/_head.html.erb +0 -0
  135. data/test/{rails_root → rails_test}/themes/red/views/layouts/global/_header.html.erb +0 -0
  136. metadata +159 -183
  137. data/config/disguise_routes.rb +0 -7
  138. data/lib/action_controller/disguise_application.rb +0 -61
  139. data/lib/disguise/initialize_routes.rb +0 -8
  140. data/lib/disguise/tasks.rb +0 -34
  141. data/locales/ar.yml +0 -20
  142. data/locales/bg.yml +0 -20
  143. data/locales/ca.yml +0 -20
  144. data/locales/cs.yml +0 -20
  145. data/locales/de.yml +0 -20
  146. data/locales/el.yml +0 -20
  147. data/locales/es.yml +0 -20
  148. data/locales/et.yml +0 -20
  149. data/locales/fa.yml +0 -20
  150. data/locales/fi.yml +0 -20
  151. data/locales/gl.yml +0 -20
  152. data/locales/hi.yml +0 -20
  153. data/locales/hr.yml +0 -20
  154. data/locales/hu.yml +0 -20
  155. data/locales/id.yml +0 -20
  156. data/locales/it.yml +0 -20
  157. data/locales/iw.yml +0 -20
  158. data/locales/ja.yml +0 -20
  159. data/locales/ko.yml +0 -20
  160. data/locales/lt.yml +0 -20
  161. data/locales/lv.yml +0 -20
  162. data/locales/mt.yml +0 -20
  163. data/locales/nl.yml +0 -20
  164. data/locales/no.yml +0 -21
  165. data/locales/pl.yml +0 -20
  166. data/locales/pt-PT.yml +0 -20
  167. data/locales/ro.yml +0 -20
  168. data/locales/ru.yml +0 -20
  169. data/locales/sk.yml +0 -20
  170. data/locales/sl.yml +0 -20
  171. data/locales/sr.yml +0 -20
  172. data/locales/sv.yml +0 -20
  173. data/locales/th.yml +0 -20
  174. data/locales/tl.yml +0 -20
  175. data/locales/tr.yml +0 -20
  176. data/locales/uk.yml +0 -20
  177. data/locales/vi.yml +0 -20
  178. data/locales/zh-CN.yml +0 -20
  179. data/locales/zh-TW.yml +0 -20
  180. data/locales/zh.yml +0 -20
  181. data/rails/init.rb +0 -2
  182. data/tasks/rails.rake +0 -2
  183. data/test/rails_root/Capfile +0 -3
  184. data/test/rails_root/app/models/user.rb +0 -9
  185. data/test/rails_root/config/amazon_s3.yml +0 -14
  186. data/test/rails_root/config/boot.rb +0 -109
  187. data/test/rails_root/config/database.yml +0 -14
  188. data/test/rails_root/config/environment.rb +0 -21
  189. data/test/rails_root/config/environments/development.rb +0 -19
  190. data/test/rails_root/config/environments/production.rb +0 -1
  191. data/test/rails_root/config/environments/test.rb +0 -33
  192. data/test/rails_root/config/global_config.yml +0 -18
  193. data/test/rails_root/config/initializers/disguise.rb +0 -2
  194. data/test/rails_root/config/initializers/requires.rb +0 -13
  195. data/test/rails_root/config/initializers/s3_credentials.rb +0 -9
  196. data/test/rails_root/config/initializers/session_store.rb +0 -8
  197. data/test/rails_root/config/routes.rb +0 -7
  198. data/test/rails_root/public/404.html +0 -30
  199. data/test/rails_root/public/422.html +0 -30
  200. data/test/rails_root/public/500.html +0 -30
  201. data/test/rails_root/public/images/rails.png +0 -0
  202. data/test/rails_root/public/images/red/preview.gif +0 -0
  203. data/test/rails_root/public/javascripts/builder.js +0 -136
  204. data/test/rails_root/public/javascripts/prototype.js +0 -4225
  205. data/test/rails_root/public/javascripts/scriptaculous.js +0 -58
  206. data/test/rails_root/public/javascripts/slider.js +0 -277
  207. data/test/rails_root/public/javascripts/sound.js +0 -60
  208. data/test/rails_root/public/robots.txt +0 -1
  209. data/test/rails_root/public/stylesheets/themes/blue/styles.css +0 -1
  210. data/test/rails_root/public/stylesheets/themes/red/styles.css +0 -1
  211. data/test/rails_root/script/about +0 -3
  212. data/test/rails_root/script/breakpointer +0 -3
  213. data/test/rails_root/script/console +0 -3
  214. data/test/rails_root/script/create_project.rb +0 -52
  215. data/test/rails_root/script/cucumber +0 -7
  216. data/test/rails_root/script/dbconsole +0 -3
  217. data/test/rails_root/script/destroy +0 -3
  218. data/test/rails_root/script/generate +0 -3
  219. data/test/rails_root/script/performance/benchmarker +0 -3
  220. data/test/rails_root/script/performance/profiler +0 -3
  221. data/test/rails_root/script/performance/request +0 -3
  222. data/test/rails_root/script/plugin +0 -3
  223. data/test/rails_root/script/process/inspector +0 -3
  224. data/test/rails_root/script/process/reaper +0 -3
  225. data/test/rails_root/script/process/spawner +0 -3
  226. data/test/rails_root/script/runner +0 -3
  227. data/test/rails_root/script/server +0 -3
  228. data/test/rails_root/test/unit/.keep +0 -0
@@ -0,0 +1,175 @@
1
+ (function() {
2
+ // Technique from Juriy Zaytsev
3
+ // http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/
4
+ function isEventSupported(eventName) {
5
+ var el = document.createElement('div');
6
+ eventName = 'on' + eventName;
7
+ var isSupported = (eventName in el);
8
+ if (!isSupported) {
9
+ el.setAttribute(eventName, 'return;');
10
+ isSupported = typeof el[eventName] == 'function';
11
+ }
12
+ el = null;
13
+ return isSupported;
14
+ }
15
+
16
+ function isForm(element) {
17
+ return Object.isElement(element) && element.nodeName.toUpperCase() == 'FORM'
18
+ }
19
+
20
+ function isInput(element) {
21
+ if (Object.isElement(element)) {
22
+ var name = element.nodeName.toUpperCase()
23
+ return name == 'INPUT' || name == 'SELECT' || name == 'TEXTAREA'
24
+ }
25
+ else return false
26
+ }
27
+
28
+ var submitBubbles = isEventSupported('submit'),
29
+ changeBubbles = isEventSupported('change')
30
+
31
+ if (!submitBubbles || !changeBubbles) {
32
+ // augment the Event.Handler class to observe custom events when needed
33
+ Event.Handler.prototype.initialize = Event.Handler.prototype.initialize.wrap(
34
+ function(init, element, eventName, selector, callback) {
35
+ init(element, eventName, selector, callback)
36
+ // is the handler being attached to an element that doesn't support this event?
37
+ if ( (!submitBubbles && this.eventName == 'submit' && !isForm(this.element)) ||
38
+ (!changeBubbles && this.eventName == 'change' && !isInput(this.element)) ) {
39
+ // "submit" => "emulated:submit"
40
+ this.eventName = 'emulated:' + this.eventName
41
+ }
42
+ }
43
+ )
44
+ }
45
+
46
+ if (!submitBubbles) {
47
+ // discover forms on the page by observing focus events which always bubble
48
+ document.on('focusin', 'form', function(focusEvent, form) {
49
+ // special handler for the real "submit" event (one-time operation)
50
+ if (!form.retrieve('emulated:submit')) {
51
+ form.on('submit', function(submitEvent) {
52
+ var emulated = form.fire('emulated:submit', submitEvent, true)
53
+ // if custom event received preventDefault, cancel the real one too
54
+ if (emulated.returnValue === false) submitEvent.preventDefault()
55
+ })
56
+ form.store('emulated:submit', true)
57
+ }
58
+ })
59
+ }
60
+
61
+ if (!changeBubbles) {
62
+ // discover form inputs on the page
63
+ document.on('focusin', 'input, select, texarea', function(focusEvent, input) {
64
+ // special handler for real "change" events
65
+ if (!input.retrieve('emulated:change')) {
66
+ input.on('change', function(changeEvent) {
67
+ input.fire('emulated:change', changeEvent, true)
68
+ })
69
+ input.store('emulated:change', true)
70
+ }
71
+ })
72
+ }
73
+
74
+ function handleRemote(element) {
75
+ var method, url, params;
76
+
77
+ var event = element.fire("ajax:before");
78
+ if (event.stopped) return false;
79
+
80
+ if (element.tagName.toLowerCase() === 'form') {
81
+ method = element.readAttribute('method') || 'post';
82
+ url = element.readAttribute('action');
83
+ params = element.serialize();
84
+ } else {
85
+ method = element.readAttribute('data-method') || 'get';
86
+ url = element.readAttribute('href');
87
+ params = {};
88
+ }
89
+
90
+ new Ajax.Request(url, {
91
+ method: method,
92
+ parameters: params,
93
+ evalScripts: true,
94
+
95
+ onComplete: function(request) { element.fire("ajax:complete", request); },
96
+ onSuccess: function(request) { element.fire("ajax:success", request); },
97
+ onFailure: function(request) { element.fire("ajax:failure", request); }
98
+ });
99
+
100
+ element.fire("ajax:after");
101
+ }
102
+
103
+ function handleMethod(element) {
104
+ var method = element.readAttribute('data-method'),
105
+ url = element.readAttribute('href'),
106
+ csrf_param = $$('meta[name=csrf-param]')[0],
107
+ csrf_token = $$('meta[name=csrf-token]')[0];
108
+
109
+ var form = new Element('form', { method: "POST", action: url, style: "display: none;" });
110
+ element.parentNode.insert(form);
111
+
112
+ if (method !== 'post') {
113
+ var field = new Element('input', { type: 'hidden', name: '_method', value: method });
114
+ form.insert(field);
115
+ }
116
+
117
+ if (csrf_param) {
118
+ var param = csrf_param.readAttribute('content'),
119
+ token = csrf_token.readAttribute('content'),
120
+ field = new Element('input', { type: 'hidden', name: param, value: token });
121
+ form.insert(field);
122
+ }
123
+
124
+ form.submit();
125
+ }
126
+
127
+
128
+ document.on("click", "*[data-confirm]", function(event, element) {
129
+ var message = element.readAttribute('data-confirm');
130
+ if (!confirm(message)) event.stop();
131
+ });
132
+
133
+ document.on("click", "a[data-remote]", function(event, element) {
134
+ if (event.stopped) return;
135
+ handleRemote(element);
136
+ event.stop();
137
+ });
138
+
139
+ document.on("click", "a[data-method]", function(event, element) {
140
+ if (event.stopped) return;
141
+ handleMethod(element);
142
+ event.stop();
143
+ });
144
+
145
+ document.on("submit", function(event) {
146
+ var element = event.findElement(),
147
+ message = element.readAttribute('data-confirm');
148
+ if (message && !confirm(message)) {
149
+ event.stop();
150
+ return false;
151
+ }
152
+
153
+ var inputs = element.select("input[type=submit][data-disable-with]");
154
+ inputs.each(function(input) {
155
+ input.disabled = true;
156
+ input.writeAttribute('data-original-value', input.value);
157
+ input.value = input.readAttribute('data-disable-with');
158
+ });
159
+
160
+ var element = event.findElement("form[data-remote]");
161
+ if (element) {
162
+ handleRemote(element);
163
+ event.stop();
164
+ }
165
+ });
166
+
167
+ document.on("ajax:after", "form", function(event, element) {
168
+ var inputs = element.select("input[type=submit][disabled=true][data-disable-with]");
169
+ inputs.each(function(input) {
170
+ input.value = input.readAttribute('data-original-value');
171
+ input.removeAttribute('data-original-value');
172
+ input.disabled = false;
173
+ });
174
+ });
175
+ })();
@@ -0,0 +1,5 @@
1
+ # See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file
2
+ #
3
+ # To ban all spiders from the entire site uncomment the next two lines:
4
+ # User-Agent: *
5
+ # Disallow: /
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
5
+ require File.expand_path('../../config/boot', __FILE__)
6
+ require 'rails/commands'
@@ -12,8 +12,8 @@ class Admin::DomainThemesControllerTest < ActionController::TestCase
12
12
  setup do
13
13
  post :create, :domain_theme => { :name => 'red', :uri => @new_uri }
14
14
  end
15
- should_set_the_flash_to(I18n.t("disguise.theme_updated"))
16
- should_redirect_to("edit theme") { edit_admin_theme_path }
15
+ should set_the_flash.to(I18n.t("disguise.theme_updated"))
16
+ should redirect_to("edit theme") { edit_admin_theme_path }
17
17
  should "create a new domain theme" do
18
18
  assert_difference 'DomainTheme.count' do
19
19
  post :create, :domain_theme => { :name => 'red_too', :uri => 'red_too_unique.example.com' }
@@ -30,8 +30,8 @@ class Admin::DomainThemesControllerTest < ActionController::TestCase
30
30
  should "change the domain theme uri" do
31
31
  assert_equal @domain_theme.uri, @new_uri
32
32
  end
33
- should_set_the_flash_to(I18n.t("disguise.theme_updated"))
34
- should_redirect_to("edit theme") { edit_admin_theme_path }
33
+ should set_the_flash.to(I18n.t("disguise.theme_updated"))
34
+ should redirect_to("edit theme") { edit_admin_theme_path }
35
35
  end
36
36
 
37
37
  context "DELETE to destroy" do
@@ -39,8 +39,8 @@ class Admin::DomainThemesControllerTest < ActionController::TestCase
39
39
  @domain_theme = Factory(:domain_theme)
40
40
  delete :destroy, :id => @domain_theme.to_param
41
41
  end
42
- should_set_the_flash_to(I18n.t('disguise.uri_deleted'))
43
- should_redirect_to("admin edit theme") { edit_admin_theme_path }
42
+ should set_the_flash.to(I18n.t('disguise.uri_deleted'))
43
+ should redirect_to("admin edit theme") { edit_admin_theme_path }
44
44
  end
45
45
 
46
46
 
@@ -16,16 +16,16 @@ class Admin::ThemesControllerTest < ActionController::TestCase
16
16
  Theme.stubs(:available_themes).returns([@current_theme, @themes])
17
17
  get :edit
18
18
  end
19
- should_respond_with :success
20
- should_render_template 'admin/themes/no_themes'
19
+ should respond_with :success
20
+ should render_template 'admin/themes/no_themes'
21
21
  end
22
22
 
23
23
  context "get edit page" do
24
24
  setup do
25
25
  get :edit
26
26
  end
27
- should_respond_with :success
28
- should_render_template 'admin/themes/edit'
27
+ should respond_with :success
28
+ should render_template 'admin/themes/edit'
29
29
  end
30
30
 
31
31
  context "update the current theme" do
@@ -36,7 +36,7 @@ class Admin::ThemesControllerTest < ActionController::TestCase
36
36
  should "change the current theme" do
37
37
  assert_equal Theme.first.name, 'red'
38
38
  end
39
- should_set_the_flash_to(I18n.t("disguise.theme_updated"))
40
- should_redirect_to("edit theme") { edit_admin_theme_path }
39
+ should set_the_flash.to(I18n.t("disguise.theme_updated"))
40
+ should redirect_to("edit theme") { edit_admin_theme_path }
41
41
  end
42
42
  end
@@ -12,8 +12,8 @@ class DefaultControllerTest < ActionController::TestCase
12
12
  setup do
13
13
  get :index
14
14
  end
15
- should_respond_with :success
16
- should_render_template :index # rendering the default home page
15
+ should respond_with :success
16
+ should render_template :index # rendering the default home page
17
17
  end
18
18
 
19
19
  context "requests" do
@@ -1,14 +1,11 @@
1
1
  $:.reject! { |e| e.include? 'TextMate' }
2
2
  ENV["RAILS_ENV"] = "test"
3
- require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
3
+ require File.expand_path('../../config/environment', __FILE__)
4
+
5
+ require 'rails/test_help'
4
6
 
5
- require 'test_help'
6
- gem 'thoughtbot-factory_girl' # from github
7
- require 'factory_girl'
8
- require 'ruby-debug'
9
- require 'mocha'
10
- require 'redgreen' rescue LoadError
11
7
  require File.expand_path(File.dirname(__FILE__) + '/factories')
8
+
12
9
  class ActiveSupport::TestCase
13
10
 
14
11
  self.use_transactional_fixtures = true
@@ -25,11 +22,11 @@ class ActiveSupport::TestCase
25
22
  end
26
23
 
27
24
  def clean_theme_view_path(controller)
28
- controller.view_paths.delete_if {|view_path| view_path.to_s.index(Disguise::Config.theme_path) == 0}
25
+ controller.view_paths.delete_if {|view_path| view_path.to_path.index(Disguise.configuration.theme_full_base_path) == 0}
29
26
  end
30
27
 
31
28
  def clean_theme_locale
32
- I18n.load_path.delete_if {|localization_path| localization_path.index(Disguise::Config.theme_full_base_path) == 0}
29
+ I18n.load_path.delete_if {|localization_path| localization_path.index(Disguise.configuration.theme_full_base_path) == 0}
33
30
  end
34
31
 
35
32
  end
@@ -6,7 +6,8 @@ class DomainThemeTest < ActiveSupport::TestCase
6
6
  setup do
7
7
  @domain_theme = Factory(:domain_theme)
8
8
  end
9
- should_validate_presence_of :name, :uri
9
+ should validate_presence_of :name
10
+ should validate_presence_of :uri
10
11
  end
11
12
 
12
13
  context "theme by request" do
@@ -6,7 +6,7 @@ class ThemeTest < ActiveSupport::TestCase
6
6
  setup do
7
7
  @theme = Theme.first || Theme.create
8
8
  @theme.name = 'blue'
9
- @blue_theme_hash = {:name=>"blue", :description=>"Put information about your theme here", :preview_image=>"/images/blue/preview.gif"}
9
+ @blue_theme_hash = {:name => "blue", :description => "Put information about your theme here", :preview_image => "/images/blue/preview.gif"}
10
10
  end
11
11
  context "locales" do
12
12
  should "get the locales for the current theme" do
@@ -17,7 +17,9 @@ class ThemeTest < ActiveSupport::TestCase
17
17
  should "find 2 themes" do
18
18
  current_theme, themes = Theme.available_themes(@theme)
19
19
  assert themes.length == 2
20
- assert_equal current_theme, @blue_theme_hash
20
+ assert_equal @blue_theme_hash[:name], current_theme[:name]
21
+ assert_equal @blue_theme_hash[:description], current_theme[:description]
22
+ assert_equal @blue_theme_hash[:preview_image], current_theme[:preview_image]
21
23
  end
22
24
  end
23
25
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: disguise
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
4
+ hash: 7
5
5
  prerelease: false
6
6
  segments:
7
- - 2
7
+ - 3
8
8
  - 0
9
9
  - 0
10
- version: 2.0.0
10
+ version: 3.0.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Justin Ball
@@ -42,7 +42,52 @@ files:
42
42
  - app/views/admin/themes/_theme.html.erb
43
43
  - app/views/admin/themes/edit.html.erb
44
44
  - app/views/admin/themes/no_themes.html.erb
45
- - config/disguise_routes.rb
45
+ - config/locales/ar.yml
46
+ - config/locales/bg.yml
47
+ - config/locales/ca.yml
48
+ - config/locales/cs.yml
49
+ - config/locales/da.yml
50
+ - config/locales/de.yml
51
+ - config/locales/el.yml
52
+ - config/locales/en.yml
53
+ - config/locales/es.yml
54
+ - config/locales/et.yml
55
+ - config/locales/fa.yml
56
+ - config/locales/fi.yml
57
+ - config/locales/fr.yml
58
+ - config/locales/gl.yml
59
+ - config/locales/hi.yml
60
+ - config/locales/hr.yml
61
+ - config/locales/hu.yml
62
+ - config/locales/id.yml
63
+ - config/locales/it.yml
64
+ - config/locales/iw.yml
65
+ - config/locales/ja.yml
66
+ - config/locales/ko.yml
67
+ - config/locales/lt.yml
68
+ - config/locales/lv.yml
69
+ - config/locales/mt.yml
70
+ - config/locales/nl.yml
71
+ - config/locales/no.yml
72
+ - config/locales/pl.yml
73
+ - config/locales/pt-PT.yml
74
+ - config/locales/pt.yml
75
+ - config/locales/ro.yml
76
+ - config/locales/ru.yml
77
+ - config/locales/sk.yml
78
+ - config/locales/sl.yml
79
+ - config/locales/sq.yml
80
+ - config/locales/sr.yml
81
+ - config/locales/sv.yml
82
+ - config/locales/th.yml
83
+ - config/locales/tl.yml
84
+ - config/locales/tr.yml
85
+ - config/locales/uk.yml
86
+ - config/locales/vi.yml
87
+ - config/locales/zh-CN.yml
88
+ - config/locales/zh-TW.yml
89
+ - config/locales/zh.yml
90
+ - config/routes.rb
46
91
  - db/migrate/20090530170040_create_themes.rb
47
92
  - db/migrate/20090606153236_create_domain_themes.rb
48
93
  - disguise.gemspec
@@ -57,156 +102,87 @@ files:
57
102
  - generators/theme/templates/views/_header.html.erb
58
103
  - generators/theme/templates/views/default.html.erb
59
104
  - generators/theme/theme_generator.rb
60
- - lib/action_controller/disguise_application.rb
61
105
  - lib/disguise.rb
62
106
  - lib/disguise/config.rb
63
- - lib/disguise/initialize_routes.rb
64
- - lib/disguise/tasks.rb
65
- - locales/ar.yml
66
- - locales/bg.yml
67
- - locales/ca.yml
68
- - locales/cs.yml
69
- - locales/da.yml
70
- - locales/de.yml
71
- - locales/el.yml
72
- - locales/en.yml
73
- - locales/es.yml
74
- - locales/et.yml
75
- - locales/fa.yml
76
- - locales/fi.yml
77
- - locales/fr.yml
78
- - locales/gl.yml
79
- - locales/hi.yml
80
- - locales/hr.yml
81
- - locales/hu.yml
82
- - locales/id.yml
83
- - locales/it.yml
84
- - locales/iw.yml
85
- - locales/ja.yml
86
- - locales/ko.yml
87
- - locales/lt.yml
88
- - locales/lv.yml
89
- - locales/mt.yml
90
- - locales/nl.yml
91
- - locales/no.yml
92
- - locales/pl.yml
93
- - locales/pt-PT.yml
94
- - locales/pt.yml
95
- - locales/ro.yml
96
- - locales/ru.yml
97
- - locales/sk.yml
98
- - locales/sl.yml
99
- - locales/sq.yml
100
- - locales/sr.yml
101
- - locales/sv.yml
102
- - locales/th.yml
103
- - locales/tl.yml
104
- - locales/tr.yml
105
- - locales/uk.yml
106
- - locales/vi.yml
107
- - locales/zh-CN.yml
108
- - locales/zh-TW.yml
109
- - locales/zh.yml
110
- - rails/init.rb
111
- - tasks/rails.rake
112
- - test/rails_root/.gitignore
113
- - test/rails_root/.rake_tasks
114
- - test/rails_root/Capfile
115
- - test/rails_root/Rakefile
116
- - test/rails_root/app/controllers/admin/domain_themes_controller.rb
117
- - test/rails_root/app/controllers/admin/themes_controller.rb
118
- - test/rails_root/app/controllers/application_controller.rb
119
- - test/rails_root/app/controllers/default_controller.rb
120
- - test/rails_root/app/models/.keep
121
- - test/rails_root/app/models/user.rb
122
- - test/rails_root/app/views/default/index.html.erb
123
- - test/rails_root/app/views/layouts/default.html.erb
124
- - test/rails_root/config/amazon_s3.yml
125
- - test/rails_root/config/boot.rb
126
- - test/rails_root/config/database.yml
127
- - test/rails_root/config/environment.rb
128
- - test/rails_root/config/environments/development.rb
129
- - test/rails_root/config/environments/production.rb
130
- - test/rails_root/config/environments/test.rb
131
- - test/rails_root/config/global_config.yml
132
- - test/rails_root/config/initializers/disguise.rb
133
- - test/rails_root/config/initializers/inflections.rb
134
- - test/rails_root/config/initializers/mime_types.rb
135
- - test/rails_root/config/initializers/requires.rb
136
- - test/rails_root/config/initializers/s3_credentials.rb
137
- - test/rails_root/config/initializers/session_store.rb
138
- - test/rails_root/config/routes.rb
139
- - test/rails_root/db/.keep
140
- - test/rails_root/db/migrate/20090530170040_create_themes.rb
141
- - test/rails_root/db/migrate/20090602041838_create_users.rb
142
- - test/rails_root/db/migrate/20090606153236_create_domain_themes.rb
143
- - test/rails_root/features/step_definitions/webrat_steps.rb
144
- - test/rails_root/features/support/env.rb
145
- - test/rails_root/public/.htaccess
146
- - test/rails_root/public/404.html
147
- - test/rails_root/public/422.html
148
- - test/rails_root/public/500.html
149
- - test/rails_root/public/dispatch.rb
150
- - test/rails_root/public/favicon.ico
151
- - test/rails_root/public/images/blue/preview.gif
152
- - test/rails_root/public/images/rails.png
153
- - test/rails_root/public/images/red/preview.gif
154
- - test/rails_root/public/javascripts/application.js
155
- - test/rails_root/public/javascripts/builder.js
156
- - test/rails_root/public/javascripts/controls.js
157
- - test/rails_root/public/javascripts/dragdrop.js
158
- - test/rails_root/public/javascripts/effects.js
159
- - test/rails_root/public/javascripts/prototype.js
160
- - test/rails_root/public/javascripts/scriptaculous.js
161
- - test/rails_root/public/javascripts/slider.js
162
- - test/rails_root/public/javascripts/sound.js
163
- - test/rails_root/public/robots.txt
164
- - test/rails_root/public/stylesheets/.keep
165
- - test/rails_root/public/stylesheets/themes/blue/styles.css
166
- - test/rails_root/public/stylesheets/themes/red/styles.css
167
- - test/rails_root/script/about
168
- - test/rails_root/script/breakpointer
169
- - test/rails_root/script/console
170
- - test/rails_root/script/create_project.rb
171
- - test/rails_root/script/cucumber
172
- - test/rails_root/script/dbconsole
173
- - test/rails_root/script/destroy
174
- - test/rails_root/script/generate
175
- - test/rails_root/script/performance/benchmarker
176
- - test/rails_root/script/performance/profiler
177
- - test/rails_root/script/performance/request
178
- - test/rails_root/script/plugin
179
- - test/rails_root/script/process/inspector
180
- - test/rails_root/script/process/reaper
181
- - test/rails_root/script/process/spawner
182
- - test/rails_root/script/runner
183
- - test/rails_root/script/server
184
- - test/rails_root/test/factories.rb
185
- - test/rails_root/test/functional/.keep
186
- - test/rails_root/test/functional/admin/domain_themes_controller_test.rb
187
- - test/rails_root/test/functional/admin/themes_controller_test.rb
188
- - test/rails_root/test/functional/default_controller_test.rb
189
- - test/rails_root/test/integration/.keep
190
- - test/rails_root/test/mocks/development/.keep
191
- - test/rails_root/test/mocks/test/.keep
192
- - test/rails_root/test/test_helper.rb
193
- - test/rails_root/test/unit/.keep
194
- - test/rails_root/test/unit/domain_theme_test.rb
195
- - test/rails_root/test/unit/theme_test.rb
196
- - test/rails_root/themes/blue/description.txt
197
- - test/rails_root/themes/blue/locales/blue.yml
198
- - test/rails_root/themes/blue/locales/en.yml
199
- - test/rails_root/themes/blue/views/default/index.html.erb
200
- - test/rails_root/themes/blue/views/layouts/default.html.erb
201
- - test/rails_root/themes/blue/views/layouts/global/_footer.html.erb
202
- - test/rails_root/themes/blue/views/layouts/global/_head.html.erb
203
- - test/rails_root/themes/blue/views/layouts/global/_header.html.erb
204
- - test/rails_root/themes/red/description.txt
205
- - test/rails_root/themes/red/locales/en.yml
206
- - test/rails_root/themes/red/views/layouts/default.html.erb
207
- - test/rails_root/themes/red/views/layouts/global/_footer.html.erb
208
- - test/rails_root/themes/red/views/layouts/global/_head.html.erb
209
- - test/rails_root/themes/red/views/layouts/global/_header.html.erb
107
+ - lib/disguise/controllers/disguise_application.rb
108
+ - lib/disguise/engine.rb
109
+ - lib/tasks/diguise.rake
110
+ - test/rails_test/.gitignore
111
+ - test/rails_test/.rake_tasks
112
+ - test/rails_test/Gemfile
113
+ - test/rails_test/Gemfile.lock
114
+ - test/rails_test/Rakefile
115
+ - test/rails_test/app/controllers/admin/domain_themes_controller.rb
116
+ - test/rails_test/app/controllers/admin/themes_controller.rb
117
+ - test/rails_test/app/controllers/application_controller.rb
118
+ - test/rails_test/app/controllers/default_controller.rb
119
+ - test/rails_test/app/models/.keep
120
+ - test/rails_test/app/models/user.rb
121
+ - test/rails_test/app/views/default/index.html.erb
122
+ - test/rails_test/app/views/layouts/default.html.erb
123
+ - test/rails_test/config.ru
124
+ - test/rails_test/config/application.rb
125
+ - test/rails_test/config/boot.rb
126
+ - test/rails_test/config/database.yml
127
+ - test/rails_test/config/environment.rb
128
+ - test/rails_test/config/environments/development.rb
129
+ - test/rails_test/config/environments/production.rb
130
+ - test/rails_test/config/environments/test.rb
131
+ - test/rails_test/config/initializers/backtrace_silencers.rb
132
+ - test/rails_test/config/initializers/disguise.rb
133
+ - test/rails_test/config/initializers/inflections.rb
134
+ - test/rails_test/config/initializers/mime_types.rb
135
+ - test/rails_test/config/initializers/secret_token.rb
136
+ - test/rails_test/config/initializers/session_store.rb
137
+ - test/rails_test/config/routes.rb
138
+ - test/rails_test/db/.keep
139
+ - test/rails_test/db/migrate/20090530170040_create_themes.rb
140
+ - test/rails_test/db/migrate/20090602041838_create_users.rb
141
+ - test/rails_test/db/migrate/20090606153236_create_domain_themes.rb
142
+ - test/rails_test/features/step_definitions/webrat_steps.rb
143
+ - test/rails_test/features/support/env.rb
144
+ - test/rails_test/public/.htaccess
145
+ - test/rails_test/public/404.html
146
+ - test/rails_test/public/422.html
147
+ - test/rails_test/public/500.html
148
+ - test/rails_test/public/dispatch.rb
149
+ - test/rails_test/public/favicon.ico
150
+ - test/rails_test/public/images/blue/preview.gif
151
+ - test/rails_test/public/images/rails.png
152
+ - test/rails_test/public/javascripts/application.js
153
+ - test/rails_test/public/javascripts/controls.js
154
+ - test/rails_test/public/javascripts/dragdrop.js
155
+ - test/rails_test/public/javascripts/effects.js
156
+ - test/rails_test/public/javascripts/prototype.js
157
+ - test/rails_test/public/javascripts/rails.js
158
+ - test/rails_test/public/robots.txt
159
+ - test/rails_test/public/stylesheets/.gitkeep
160
+ - test/rails_test/public/stylesheets/application.css
161
+ - test/rails_test/script/rails
162
+ - test/rails_test/test/factories.rb
163
+ - test/rails_test/test/functional/.keep
164
+ - test/rails_test/test/functional/admin/domain_themes_controller_test.rb
165
+ - test/rails_test/test/functional/admin/themes_controller_test.rb
166
+ - test/rails_test/test/functional/default_controller_test.rb
167
+ - test/rails_test/test/integration/.keep
168
+ - test/rails_test/test/test_helper.rb
169
+ - test/rails_test/test/unit/.keep
170
+ - test/rails_test/test/unit/domain_theme_test.rb
171
+ - test/rails_test/test/unit/theme_test.rb
172
+ - test/rails_test/themes/blue/description.txt
173
+ - test/rails_test/themes/blue/locales/blue.yml
174
+ - test/rails_test/themes/blue/locales/en.yml
175
+ - test/rails_test/themes/blue/views/default/index.html.erb
176
+ - test/rails_test/themes/blue/views/layouts/default.html.erb
177
+ - test/rails_test/themes/blue/views/layouts/global/_footer.html.erb
178
+ - test/rails_test/themes/blue/views/layouts/global/_head.html.erb
179
+ - test/rails_test/themes/blue/views/layouts/global/_header.html.erb
180
+ - test/rails_test/themes/red/description.txt
181
+ - test/rails_test/themes/red/locales/en.yml
182
+ - test/rails_test/themes/red/views/layouts/default.html.erb
183
+ - test/rails_test/themes/red/views/layouts/global/_footer.html.erb
184
+ - test/rails_test/themes/red/views/layouts/global/_head.html.erb
185
+ - test/rails_test/themes/red/views/layouts/global/_header.html.erb
210
186
  has_rdoc: true
211
187
  homepage: http://github.com/jbasdf/disguise
212
188
  licenses: []
@@ -242,34 +218,34 @@ signing_key:
242
218
  specification_version: 3
243
219
  summary: Easy to use view theme system for Rails
244
220
  test_files:
245
- - test/rails_root/app/controllers/admin/domain_themes_controller.rb
246
- - test/rails_root/app/controllers/admin/themes_controller.rb
247
- - test/rails_root/app/controllers/application_controller.rb
248
- - test/rails_root/app/controllers/default_controller.rb
249
- - test/rails_root/app/models/user.rb
250
- - test/rails_root/config/boot.rb
251
- - test/rails_root/config/environment.rb
252
- - test/rails_root/config/environments/development.rb
253
- - test/rails_root/config/environments/production.rb
254
- - test/rails_root/config/environments/test.rb
255
- - test/rails_root/config/initializers/disguise.rb
256
- - test/rails_root/config/initializers/inflections.rb
257
- - test/rails_root/config/initializers/mime_types.rb
258
- - test/rails_root/config/initializers/requires.rb
259
- - test/rails_root/config/initializers/s3_credentials.rb
260
- - test/rails_root/config/initializers/session_store.rb
261
- - test/rails_root/config/routes.rb
262
- - test/rails_root/db/migrate/20090530170040_create_themes.rb
263
- - test/rails_root/db/migrate/20090602041838_create_users.rb
264
- - test/rails_root/db/migrate/20090606153236_create_domain_themes.rb
265
- - test/rails_root/features/step_definitions/webrat_steps.rb
266
- - test/rails_root/features/support/env.rb
267
- - test/rails_root/public/dispatch.rb
268
- - test/rails_root/script/create_project.rb
269
- - test/rails_root/test/factories.rb
270
- - test/rails_root/test/functional/admin/domain_themes_controller_test.rb
271
- - test/rails_root/test/functional/admin/themes_controller_test.rb
272
- - test/rails_root/test/functional/default_controller_test.rb
273
- - test/rails_root/test/test_helper.rb
274
- - test/rails_root/test/unit/domain_theme_test.rb
275
- - test/rails_root/test/unit/theme_test.rb
221
+ - test/rails_test/app/controllers/admin/domain_themes_controller.rb
222
+ - test/rails_test/app/controllers/admin/themes_controller.rb
223
+ - test/rails_test/app/controllers/application_controller.rb
224
+ - test/rails_test/app/controllers/default_controller.rb
225
+ - test/rails_test/app/models/user.rb
226
+ - test/rails_test/config/application.rb
227
+ - test/rails_test/config/boot.rb
228
+ - test/rails_test/config/environment.rb
229
+ - test/rails_test/config/environments/development.rb
230
+ - test/rails_test/config/environments/production.rb
231
+ - test/rails_test/config/environments/test.rb
232
+ - test/rails_test/config/initializers/backtrace_silencers.rb
233
+ - test/rails_test/config/initializers/disguise.rb
234
+ - test/rails_test/config/initializers/inflections.rb
235
+ - test/rails_test/config/initializers/mime_types.rb
236
+ - test/rails_test/config/initializers/secret_token.rb
237
+ - test/rails_test/config/initializers/session_store.rb
238
+ - test/rails_test/config/routes.rb
239
+ - test/rails_test/db/migrate/20090530170040_create_themes.rb
240
+ - test/rails_test/db/migrate/20090602041838_create_users.rb
241
+ - test/rails_test/db/migrate/20090606153236_create_domain_themes.rb
242
+ - test/rails_test/features/step_definitions/webrat_steps.rb
243
+ - test/rails_test/features/support/env.rb
244
+ - test/rails_test/public/dispatch.rb
245
+ - test/rails_test/test/factories.rb
246
+ - test/rails_test/test/functional/admin/domain_themes_controller_test.rb
247
+ - test/rails_test/test/functional/admin/themes_controller_test.rb
248
+ - test/rails_test/test/functional/default_controller_test.rb
249
+ - test/rails_test/test/test_helper.rb
250
+ - test/rails_test/test/unit/domain_theme_test.rb
251
+ - test/rails_test/test/unit/theme_test.rb