ymdp 0.1.4 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. data/Rakefile +1 -0
  2. data/VERSION +1 -1
  3. data/lib/ymdp/application.rb +22 -0
  4. data/lib/ymdp/application_view.rb +312 -0
  5. data/lib/ymdp/base.rb +119 -0
  6. data/lib/ymdp/commands/build.rb +0 -6
  7. data/lib/ymdp/compiler/base.rb +12 -10
  8. data/lib/ymdp/compiler/domains.rb +8 -34
  9. data/lib/ymdp/compiler/template.rb +58 -85
  10. data/lib/ymdp/configuration/config.rb +70 -28
  11. data/lib/ymdp/configuration/constants.rb +17 -3
  12. data/lib/ymdp/processor/form_post.rb +5 -1
  13. data/lib/ymdp/support/file.rb +29 -11
  14. data/lib/ymdp/tasks/keys.rake +13 -13
  15. data/lib/ymdp/tasks/ymdp.rake +4 -4
  16. data/spec/application_spec.rb +29 -0
  17. data/spec/application_view_spec.rb +5 -0
  18. data/spec/compiler_spec.rb +3 -3
  19. data/spec/compiler_template_spec.rb +26 -54
  20. data/spec/data/app/views/layouts/application.html.haml +2 -0
  21. data/spec/data/config/config.yml +1 -0
  22. data/spec/data/config/constants.rb +3 -7
  23. data/spec/data/script/destroy +2 -2
  24. data/spec/data/script/langs +1 -3
  25. data/spec/default_settings.rb +42 -0
  26. data/spec/domains_spec.rb +3 -22
  27. data/spec/spec_helper.rb +3 -0
  28. data/spec/stubs.rb +11 -0
  29. data/spec/ymdp_base_spec.rb +125 -0
  30. data/test.rb +46 -0
  31. data/ymdp.gemspec +15 -65
  32. metadata +14 -64
  33. data/lib/new_application/.base +0 -11
  34. data/lib/new_application/Gemfile +0 -13
  35. data/lib/new_application/Rakefile +0 -3
  36. data/lib/new_application/app/.gitignore +0 -1
  37. data/lib/new_application/app/assets/images/lightbox/lightbox_bg.png +0 -0
  38. data/lib/new_application/app/assets/javascripts/OpenMailIntl.js +0 -291
  39. data/lib/new_application/app/assets/javascripts/controls.js +0 -965
  40. data/lib/new_application/app/assets/javascripts/date.js +0 -104
  41. data/lib/new_application/app/assets/javascripts/dragdrop.js +0 -974
  42. data/lib/new_application/app/assets/javascripts/effects.js +0 -1123
  43. data/lib/new_application/app/assets/javascripts/lowpro.js +0 -320
  44. data/lib/new_application/app/assets/javascripts/prototype.js +0 -4874
  45. data/lib/new_application/app/assets/javascripts/scriptaculous.js +0 -68
  46. data/lib/new_application/app/assets/yrb/en-US/application_en-US.pres +0 -7
  47. data/lib/new_application/app/helpers/application_helper.rb +0 -3
  48. data/lib/new_application/app/javascripts/application.js +0 -580
  49. data/lib/new_application/app/javascripts/debug.js +0 -138
  50. data/lib/new_application/app/javascripts/flash.js +0 -96
  51. data/lib/new_application/app/javascripts/header.js +0 -13
  52. data/lib/new_application/app/javascripts/help.js +0 -76
  53. data/lib/new_application/app/javascripts/i18n.js +0 -235
  54. data/lib/new_application/app/javascripts/launcher.js +0 -159
  55. data/lib/new_application/app/javascripts/logger.js +0 -61
  56. data/lib/new_application/app/javascripts/tag_helper.js +0 -178
  57. data/lib/new_application/app/stylesheets/application.css +0 -0
  58. data/lib/new_application/app/stylesheets/ie.css +0 -0
  59. data/lib/new_application/app/stylesheets/ie6.css +0 -0
  60. data/lib/new_application/app/stylesheets/ie7.css +0 -0
  61. data/lib/new_application/app/stylesheets/ie8.css +0 -0
  62. data/lib/new_application/app/stylesheets/lightbox.css +0 -30
  63. data/lib/new_application/app/stylesheets/non_ie.css +0 -0
  64. data/lib/new_application/app/views/layouts/application.html.haml +0 -35
  65. data/lib/new_application/app/views/shared/_error.html.haml +0 -8
  66. data/lib/new_application/app/views/shared/_flash.html.haml +0 -2
  67. data/lib/new_application/app/views/shared/_javascripts.html.haml +0 -22
  68. data/lib/new_application/app/views/shared/_loading.html.haml +0 -13
  69. data/lib/new_application/app/views/shared/_stylesheets.html.haml +0 -23
  70. data/lib/new_application/config/categories.yml +0 -6
  71. data/lib/new_application/config/config.yml.example +0 -30
  72. data/lib/new_application/config/constants.rb +0 -54
  73. data/lib/new_application/config/servers.yml.example +0 -9
  74. data/lib/new_application/lib/init.rb +0 -13
  75. data/lib/new_application/lib/tasks/environment.rake +0 -4
  76. data/lib/new_application/lib/tasks/keys.rake +0 -3
  77. data/lib/new_application/lib/tasks/setup.rake +0 -13
  78. data/lib/new_application/lib/tasks/ymdp.rake +0 -4
  79. data/lib/new_application/script/build +0 -9
  80. data/lib/new_application/script/config +0 -13
  81. data/lib/new_application/script/destroy +0 -18
  82. data/lib/new_application/script/generate +0 -4
  83. data/lib/new_application/script/gitrm +0 -17
  84. data/lib/new_application/script/growl +0 -6
  85. data/lib/new_application/script/images +0 -48
  86. data/lib/new_application/script/jslint.js +0 -5072
  87. data/lib/new_application/script/langs +0 -31
  88. data/lib/new_application/script/translate +0 -5
  89. data/lib/new_application/script/ymdt +0 -1895
  90. data/lib/new_application/script/ymdt.old +0 -1890
  91. data/lib/new_application/script/yuicompressor-2.4.2.jar +0 -0
  92. data/lib/new_application/ymdp +0 -8
  93. data/lib/ymdp/processor/processor.rb +0 -132
  94. data/lib/ymdp/ymdp.rb +0 -208
@@ -1,138 +0,0 @@
1
- var Debug;
2
-
3
- Debug = {
4
- on: false,
5
- console: false,
6
- alerts: false,
7
- logs: false,
8
- ajaxErrors: false,
9
-
10
- consoleOn: function() {
11
- return (typeof window['console'] !== 'undefined' && this.console);
12
- },
13
-
14
- alertsOn: function() {
15
- return (Debug.on || Debug.logs);
16
- },
17
-
18
- logsOn: function() {
19
- return (Debug.on || Debug.logs);
20
- },
21
-
22
- ajaxErrorsOn: function() {
23
- return (Debug.on || Debug.ajaxErrors);
24
- },
25
-
26
- profile: function(name) {
27
- if (this.consoleOn()) {
28
- console.profile(name);
29
- }
30
- },
31
-
32
- profileEnd: function(name) {
33
- if (this.consoleOn()) {
34
- console.profileEnd(name);
35
- }
36
- },
37
-
38
- call: function(level, message, obj) {
39
- try {
40
- message = this.message(message, obj);
41
-
42
- if (Debug.consoleOn()) {
43
- console[level](message);
44
- }
45
- if (Debug.logsOn()) {
46
- alert(message);
47
- }
48
- } catch(e) {
49
- if (Debug.consoleOn()) {
50
- console[level](e);
51
- } else {
52
- alert(e);
53
- }
54
- }
55
- },
56
-
57
- log: function(message, obj) {
58
- this.call("log", message, obj);
59
- },
60
-
61
- error: function(message, obj) {
62
- this.call("error", message, obj);
63
- },
64
-
65
- info: function(message, obj) {
66
- this.call("info", message, obj);
67
- },
68
-
69
- warn: function(message, obj) {
70
- this.call("warn", message, obj);
71
- },
72
-
73
- alert: this.log,
74
-
75
- ajaxError: function(message, path, params, response) {
76
- var m;
77
- m = message + " path: " + path + "?" + Object.toQueryString(params);
78
- m = m + ", response: " + Object.toJSON(response);
79
-
80
- try {
81
- $('error_details').update(m);
82
- } catch(err) {
83
- YAHOO.logger.error(err);
84
- }
85
-
86
- this.error(m);
87
-
88
- if (Debug.ajaxErrorsOn()) {
89
- alert(m);
90
- }
91
- if (Debug.logsOn()) {
92
- YAHOO.logger.error(m);
93
- }
94
- },
95
-
96
- message: function(message, obj) {
97
- try {
98
- message = this.timestamp() + " " + this.generalInfo() + " " + message;
99
- if (obj) {
100
- message = message + ", " + Object.toJSON(obj);
101
- }
102
- } catch(e) {
103
- // alert(e);
104
- }
105
- return message;
106
- },
107
-
108
- timestamp: function() {
109
- var time, year, month, date, hour, minute, second, timestamp, checktime;
110
-
111
- checktime = function checkTime(i) {
112
- if (i<10) {
113
- i="0" + i;
114
- }
115
- return i;
116
- };
117
-
118
- time = new Date();
119
- // year = time.getFullYear();
120
- // month = time.getMonth() + 1;
121
- // date = time.getDate();
122
- hour = checktime(time.getHours());
123
- minute = checktime(time.getMinutes());
124
- second = checktime(time.getSeconds());
125
-
126
- // timestamp = month + "/" + date + "/" + year + " " +
127
-
128
- timestamp = hour + ":" + minute + ":" + second;
129
-
130
- return timestamp;
131
- },
132
-
133
- generalInfo: function() {
134
- return "[<%= @domain %>/<%= @server %>] [<%= @version %> <%= @sprint_name %>]";
135
- }
136
- };
137
-
138
- Debug.console = true;
@@ -1,96 +0,0 @@
1
- var FLASH, Flash;
2
-
3
- /* set asset version */
4
-
5
- FLASH = {
6
- VERSION: "<%= @hash %>",
7
- MESSAGE: "<%= @message %>",
8
- DEPLOYED: <%= Time.now.to_i %>,
9
- DEPLOYED_STRING: "<%= Time.now.to_s %>"
10
- };
11
-
12
-
13
- /* FLASH MESSAGE HANDLERS */
14
-
15
- YAHOO.namespace("flash");
16
-
17
- Flash = {};
18
-
19
- Flash.timeout = 8;
20
- Flash.duration = 0.25;
21
-
22
- Flash.write = function(type, message) {
23
- type = type || "notice";
24
- if (message) {
25
- $('flash_message').update(message);
26
- Flash.setFlashClass('flash', type);
27
-
28
- // blindDown if the flash is currently hidden
29
- if ($('flash').getStyle("display") === "none") {
30
- $('flash').blindDown({queue: "end", duration: Flash.duration});
31
- }
32
- YAHOO.oib.setTimeoutInSeconds(Flash.close, Flash.timeout);
33
- }
34
- };
35
-
36
- Flash.close = function() {
37
- Try.these(function() {
38
- $('flash').blindUp({queue: "end", duration: Flash.duration});
39
- });
40
- };
41
-
42
- Flash.setFlashClass = function(flash_id, type) {
43
- if (type === "error") {
44
- Try.these(function() {
45
- $(flash_id).removeClassName('notice');
46
- });
47
- }
48
- if (type === "notice") {
49
- Try.these(function() {
50
- $(flash_id).removeClassName('error');
51
- });
52
- }
53
- Try.these(function() {
54
- $(flash_id).addClassName(type);
55
- });
56
- };
57
-
58
-
59
- Flash.error = function(message) {
60
- YAHOO.logger.error(message);
61
- Flash.write("error", message, true);
62
- };
63
-
64
- Flash.notice = function(message) {
65
- Flash.write("notice", message, true);
66
- };
67
-
68
- Flash.success = Flash.notice;
69
-
70
- Flash.t = {};
71
- Flash.t.notice = function(key, args) {
72
- var m;
73
-
74
- m = I18n.t(key, args);
75
- Flash.notice(m);
76
- };
77
- Flash.t.success = Flash.t.notice;
78
-
79
- Flash.t.error = function(key, args) {
80
- var m;
81
-
82
- m = I18n.t(key, args);
83
- Flash.error(m);
84
- };
85
-
86
-
87
- Flash.settingsChanged = function() {
88
- Flash.t.success("SETTINGS_CHANGED");
89
- };
90
- Flash.problemSubmitting = function() {
91
- Flash.t.error("PROBLEM_SUBMITTING");
92
- };
93
-
94
- YAHOO.flash = Flash;
95
-
96
- /* ----------------------- */
@@ -1,13 +0,0 @@
1
-
2
- /*
3
- LOCAL NAMESPACES/CONSTANTS
4
- */
5
-
6
- YAHOO.constants.base_url = "http://<%= @server %>.otherinbox.com/";
7
- YAHOO.constants.controller_url = "http://<%= @server %>.otherinbox.com/ymdp";
8
-
9
- YAHOO.oib.page_loaded = false;
10
-
11
- YAHOO.namespace("<%= @view %>");
12
-
13
- document.observe("dom:loaded", YAHOO.oib.init);
@@ -1,76 +0,0 @@
1
- // popup help text
2
- //
3
- var Help = function(content) {
4
- try {
5
- this.content = content;
6
-
7
- // instance method
8
- this.show = function(event) {
9
- var x = event.clientX + 20;
10
- var y = event.clientY - 10;
11
- this.create(x,y);
12
- };
13
-
14
- this.create = function(x, y) {
15
- try {
16
- if (!$(this.css_id)) {
17
- var popup = new Element('div', {
18
- "id": this.css_id,
19
- "class": "popup"
20
- });
21
- popup.update(this.content);
22
- popup.setStyle({
23
- "display": "none",
24
- "left": x + "px",
25
- "top": y + "px"
26
- });
27
- $$('body').first().insert(popup);
28
- setTimeout("$(\"" + this.css_id + "\").show();", 500);
29
- }
30
- } catch(e) {
31
- // alert(e);
32
- }
33
- };
34
-
35
- this.destroy = function() {
36
- setTimeout("$('" + this.css_id + "').remove();", 4000);
37
- };
38
-
39
- this.link = function(text) {
40
- text = text || "?";
41
- return Tags.linkToFunction(text, "", {
42
- "onmouseover": "Help.show(event, " + this.id + ");",
43
- "onmouseout": "Help.destroy(" + this.id + ")"
44
- });
45
- };
46
-
47
- Help.popups = Help.popups || [];
48
- Help.popups.push(this);
49
-
50
- this.id = Help.popups.size() - 1;
51
- this.css_id = "popup_" + this.id;
52
- } catch(e) {
53
- // alert(e);
54
- }
55
- };
56
-
57
- Help.show = function(event, id) {
58
- var help = Help.popups[id];
59
- help.show(event);
60
- };
61
-
62
- Help.destroy = function(id) {
63
- var help = Help.popups[id];
64
- help.destroy();
65
- };
66
-
67
- Help.closeAll = function() {
68
- $$('.popup').each(function(p) {
69
- p.remove();
70
- });
71
- };
72
-
73
- Help.init = function() {
74
- // initialize any help popups. Overwrite this locally.
75
- };
76
-
@@ -1,235 +0,0 @@
1
- /*
2
- I18N
3
-
4
- global to every view.
5
-
6
- Methods and constants dealing with internationalization.
7
- */
8
-
9
- var I18N, I18n;
10
-
11
- /* set asset version */
12
-
13
- I18N = {
14
- VERSION: "<%= @hash %>",
15
- MESSAGE: "<%= @message %>",
16
- DEPLOYED: <%= Time.now.to_i %>,
17
- DEPLOYED_STRING: "<%= Time.now.to_s %>"
18
- };
19
-
20
-
21
- I18n = {};
22
-
23
- I18n.setResources = function() {
24
- var scope, asset_path;
25
-
26
- scope = "keys";
27
-
28
- Debug.log("begin I18n.setResources for language " + I18n.currentLanguage);
29
- try {
30
- asset_path = "<%= @assets_directory %>/yrb/";
31
- I18n[scope] = I18n[scope] || OpenMailIntl.getResources(asset_path, scope, I18n.currentLanguage);
32
- if (I18n.currentLanguage !== "en-US") {
33
- I18n.default_keys = OpenMailIntl.getResources(asset_path, scope, "en-US");
34
- } else {
35
- I18n.default_keys = I18n[scope];
36
- }
37
- } catch(err) {
38
- Debug.error("error in I18n.setResources: " + err);
39
- }
40
- I18n.scope = scope;
41
- Debug.log("end I18n.setResources");
42
- };
43
-
44
-
45
- // I18n.translate(key, [args])
46
- // I18n.t(key, [args])
47
- //
48
- // Using .translate with a single key argument will return the simple translated string for that key
49
- //
50
- // Using a key argument with values after it will insert the values into the placeholders in
51
- // the returned translated string
52
- //
53
- I18n.translate = function(key, args) {
54
- key = key.toUpperCase();
55
- key = key.replace(" ", "_");
56
- if (args) {
57
- var m;
58
- m = I18n.translate_sentence(key, args);
59
- } else
60
- {
61
- m = I18n.translate_phrase(key);
62
- if (!m) {
63
- m = I18n.default_keys[key];
64
- }
65
- }
66
- return m;
67
- };
68
- I18n.t = I18n.translate;
69
-
70
- I18n.translate_phrase = function(key) {
71
- return I18n["keys"][key];
72
- };
73
-
74
- I18n.translate_sentence = function(key, args) {
75
- return OpenMailIntl.formatMessage(I18n["keys"][key], args, I18n.currentLanguage);
76
- };
77
-
78
- // I18n.update(id, scope, key, args)
79
- //
80
- // updates an element with the given _id_ with the
81
- // translation from scope, key and optional args
82
- //
83
- // only updates the element if the translation is not blank
84
- //
85
- I18n.update = function(id, key, args) {
86
- Try.these(function() {
87
- var message;
88
- message = I18n.t(key, args);
89
- if (message) {
90
- $(id).update(message);
91
- }
92
- }, function() {
93
- Debug.error("Error in i18n.update: " + Object.toJSON({
94
- id: id,
95
- key: key,
96
- args: args
97
- }));
98
- });
99
- };
100
-
101
- // I18n.u(id, args)
102
- //
103
- // updates an element with a local YRB key of the same name
104
- //
105
- // given an id of "messages" it will look for a YRB key named "MESSAGES"
106
- // within the local scope of the current view, and update the element with
107
- // that translation
108
- //
109
- I18n.u = function(id, args) {
110
- Try.these(
111
- function() {
112
- id.each(I18n.u);
113
- },
114
- function() {
115
- var key;
116
- key = id.toUpperCase();
117
- I18n.update(id, key, args);
118
- },
119
- function() {
120
- Debug.error("Error in i18n.u: " + Object.toJSON({
121
- id: id,
122
- args: args
123
- }));
124
- });
125
- };
126
-
127
-
128
- // I18n.updateValue(id, key, args)
129
- //
130
- // updates an element with the given _id_ with the
131
- // translation from scope, key and optional args
132
- //
133
- // only updates the element if the translation is not blank
134
- //
135
- I18n.updateValue = function(id, key, args) {
136
- Try.these(function() {
137
- var message;
138
- message = I18n.t(key, args);
139
- if (message) {
140
- $(id).value = message;
141
- }
142
- }, function() {
143
- Debug.error("Error in i18n.updateValue: " + Object.toJSON({
144
- id: id,
145
- key: key,
146
- args: args
147
- }));
148
- });
149
- };
150
-
151
-
152
- // I18n.v(id, args)
153
- //
154
- // updates the value of an element with a local YRB key of the same name
155
- //
156
- // given an id of "messages" it will look for a YRB key named "MESSAGES"
157
- // within the local scope of the current view, and update the element's value with
158
- // that translation
159
- //
160
- I18n.v = function(id, args) {
161
- Try.these(
162
- function() {
163
- id.each(I18n.v);
164
- },
165
- function() {
166
- var key;
167
- key = id.toUpperCase();
168
- I18n.updateValue(id, key, args);
169
- },
170
- function() {
171
- Debug.error("Error in i18n.v: " + Object.toJSON({
172
- id: id,
173
- args: args
174
- }));
175
- });
176
- };
177
-
178
- I18n.translateError = function() {
179
- I18n.update('error_1', 'ERROR_1');
180
- I18n.update('error_2', 'ERROR_2');
181
- I18n.update('retry', 'RETRY');
182
- };
183
-
184
- I18n.translateLoading = function() {
185
- I18n.update('loading_heading', 'LOADING_HEADING');
186
- I18n.update('loading_subhead', 'LOADING_SUBHEAD');
187
- I18n.update('loading_paragraph_1', 'LOADING_PARAGRAPH_1');
188
- };
189
-
190
- I18n.addLanguageToBody = function() {
191
- Try.these(function() {
192
- $$('body').first().addClassName(I18n.currentLanguage);
193
- });
194
- };
195
-
196
- I18n.findAndTranslateAll = function() {
197
- Element.addMethods({
198
- translate: function(element) {
199
- element = $(element);
200
-
201
- var e;
202
- e = element.inspect();
203
- if (e.match(/<input/)) {
204
- I18n.v(element.identify());
205
- } else {
206
- if (e.match(/<img/)) {
207
- I18n.src(element.identify());
208
- } else {
209
- I18n.u(element.identify());
210
- }
211
- }
212
- }
213
- });
214
-
215
- $$('.t').each(function(element) {
216
- try {
217
- element.translate();
218
- } catch(e) {
219
- Debug.error("Translation error for element: " + e);
220
- }
221
- });
222
- };
223
-
224
- I18n.translateSidebar = function() {
225
- I18n.u('faq_q1');
226
- var link;
227
- link = Tags.a(I18n.t('faq_link1'), {"href": 'http://go.otherinbox.com/q-stop-sender', "target": "_blank"});
228
- I18n.u('faq_a1', [link]);
229
-
230
- I18n.u('faq_q2');
231
- link = Tags.a(I18n.t('faq_link2'), {"href": 'http://go.otherinbox.com/q-custom-sender', "target": "_blank"});
232
- I18n.u('faq_a2', [link]);
233
- };
234
-
235
-