ymdp 0.0.7 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/bin/ymdp +51 -0
- data/lib/new_application/.base +11 -0
- data/lib/new_application/Gemfile +12 -0
- data/lib/new_application/Rakefile +3 -0
- data/lib/new_application/app/.gitignore +1 -0
- data/lib/new_application/app/assets/images/lightbox/lightbox_bg.png +0 -0
- data/lib/new_application/app/assets/javascripts/OpenMailIntl.js +291 -0
- data/lib/new_application/app/assets/javascripts/controls.js +965 -0
- data/lib/new_application/app/assets/javascripts/date.js +104 -0
- data/lib/new_application/app/assets/javascripts/dragdrop.js +974 -0
- data/lib/new_application/app/assets/javascripts/effects.js +1123 -0
- data/lib/new_application/app/assets/javascripts/lowpro.js +320 -0
- data/lib/new_application/app/assets/javascripts/prototype.js +4874 -0
- data/lib/new_application/app/assets/javascripts/scriptaculous.js +68 -0
- data/lib/new_application/app/assets/yrb/en-US/application_en-US.pres +7 -0
- data/lib/new_application/app/helpers/application_helper.rb +3 -0
- data/lib/new_application/app/javascripts/application.js +580 -0
- data/lib/new_application/app/javascripts/debug.js +138 -0
- data/lib/new_application/app/javascripts/flash.js +96 -0
- data/lib/new_application/app/javascripts/header.js +13 -0
- data/lib/new_application/app/javascripts/help.js +76 -0
- data/lib/new_application/app/javascripts/i18n.js +235 -0
- data/lib/new_application/app/javascripts/launcher.js +159 -0
- data/lib/new_application/app/javascripts/logger.js +61 -0
- data/lib/new_application/app/javascripts/tag_helper.js +178 -0
- data/lib/new_application/app/stylesheets/application.css +0 -0
- data/lib/new_application/app/stylesheets/ie.css +0 -0
- data/lib/new_application/app/stylesheets/ie6.css +0 -0
- data/lib/new_application/app/stylesheets/ie7.css +0 -0
- data/lib/new_application/app/stylesheets/ie8.css +0 -0
- data/lib/new_application/app/stylesheets/lightbox.css +30 -0
- data/lib/new_application/app/stylesheets/non_ie.css +0 -0
- data/lib/new_application/app/views/layouts/application.html.haml +35 -0
- data/lib/new_application/app/views/shared/_error.html.haml +8 -0
- data/lib/new_application/app/views/shared/_flash.html.haml +2 -0
- data/lib/new_application/app/views/shared/_javascripts.html.haml +22 -0
- data/lib/new_application/app/views/shared/_loading.html.haml +13 -0
- data/lib/new_application/app/views/shared/_stylesheets.html.haml +23 -0
- data/lib/new_application/config/categories.yml +6 -0
- data/lib/new_application/config/config.yml.example +30 -0
- data/lib/new_application/config/constants.rb +54 -0
- data/lib/new_application/config/servers.yml.example +9 -0
- data/lib/new_application/lib/init.rb +13 -0
- data/lib/new_application/lib/tasks/environment.rake +4 -0
- data/lib/new_application/lib/tasks/keys.rake +235 -0
- data/lib/new_application/lib/tasks/setup.rake +13 -0
- data/lib/new_application/lib/tasks/ymdp.rake +718 -0
- data/lib/new_application/script/build +9 -0
- data/lib/new_application/script/config +13 -0
- data/lib/new_application/script/destroy +18 -0
- data/lib/new_application/script/generate +4 -0
- data/lib/new_application/script/gitrm +17 -0
- data/lib/new_application/script/growl +6 -0
- data/lib/new_application/script/images +48 -0
- data/lib/new_application/script/jslint.js +5072 -0
- data/lib/new_application/script/langs +31 -0
- data/lib/new_application/script/translate +5 -0
- data/lib/new_application/script/ymdt +1895 -0
- data/lib/new_application/script/ymdt.old +1890 -0
- data/lib/new_application/script/yuicompressor-2.4.2.jar +0 -0
- data/lib/new_application/ymdp +8 -0
- data/ymdp.gemspec +64 -1
- metadata +65 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.8
|
data/bin/ymdp
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
@command = ARGV[0]
|
4
|
+
|
5
|
+
if @command == "init"
|
6
|
+
|
7
|
+
require 'fileutils'
|
8
|
+
|
9
|
+
dir = File.dirname(__FILE__)
|
10
|
+
|
11
|
+
new_application_dir = "#{dir}/../lib/new_application/."
|
12
|
+
|
13
|
+
# Create the structure for a YMDP project
|
14
|
+
|
15
|
+
@project_name = ARGV[1]
|
16
|
+
|
17
|
+
@message = <<MESSAGE
|
18
|
+
Creating YMDP directory for project #{@project_name}
|
19
|
+
|
20
|
+
First, run:
|
21
|
+
|
22
|
+
gem bundle
|
23
|
+
|
24
|
+
Then:
|
25
|
+
|
26
|
+
./script/config
|
27
|
+
|
28
|
+
Then open config.yml and set your username and password.
|
29
|
+
Then open servers.yml and set your server keys.
|
30
|
+
|
31
|
+
Then run:
|
32
|
+
|
33
|
+
bin/rake create:all
|
34
|
+
|
35
|
+
to fetch your applications from Yahoo! Mail's servers.
|
36
|
+
|
37
|
+
MESSAGE
|
38
|
+
|
39
|
+
puts @message
|
40
|
+
|
41
|
+
FileUtils.mkdir_p(@project_name)
|
42
|
+
FileUtils.cp_r(new_application_dir, @project_name)
|
43
|
+
else
|
44
|
+
commands = ARGV.join(" ")
|
45
|
+
if File.exists?("./rake")
|
46
|
+
system "./rake #{commands}"
|
47
|
+
else
|
48
|
+
system "rake #{commands}"
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
assets.zip
|
Binary file
|
@@ -0,0 +1,291 @@
|
|
1
|
+
/**
|
2
|
+
* The OpenMailIntl class provides minimal internationalization
|
3
|
+
* support for OpenMail.
|
4
|
+
* @module openmailintl
|
5
|
+
*/
|
6
|
+
|
7
|
+
/**
|
8
|
+
* The OpenMailIntl class provides minimal internationalization
|
9
|
+
* support for OpenMail.
|
10
|
+
* @class OpenMailIntl
|
11
|
+
*/
|
12
|
+
|
13
|
+
/*global window, YAHOO, ActiveXObject, XMLHttpRequest */
|
14
|
+
|
15
|
+
var OpenMailIntl = function () {
|
16
|
+
|
17
|
+
var openmailintl = {};
|
18
|
+
|
19
|
+
/**
|
20
|
+
* Returns the user's preferred languages as a list of
|
21
|
+
* RFC 4646 language tags in decreasing priority order.
|
22
|
+
* @method getPreferredLanguages
|
23
|
+
* @private
|
24
|
+
* @return {String[]} A list of RFC 4646 language tags.
|
25
|
+
*/
|
26
|
+
var getPreferredLanguages = function () {
|
27
|
+
// this is a stub until OpenMail can synchronously provide
|
28
|
+
// a complete and accurate language list
|
29
|
+
var intl, match;
|
30
|
+
intl = "us";
|
31
|
+
match = window.location.href.match(/[\?&]\.intl=([a-z0-9]{2})/);
|
32
|
+
if (match) {
|
33
|
+
intl = match[1];
|
34
|
+
}
|
35
|
+
switch (intl) {
|
36
|
+
// only support Mail INTLs
|
37
|
+
case "aa": return ["en-AA"];
|
38
|
+
case "ar": return ["es-AR"];
|
39
|
+
case "au": return ["en-AU"];
|
40
|
+
case "br": return ["pt-BR"];
|
41
|
+
case "ca": return ["en-CA"];
|
42
|
+
case "cf": return ["fr-CA"];
|
43
|
+
case "cl": return ["es-CL"];
|
44
|
+
case "cn": return ["zh-Hans-CN"];
|
45
|
+
case "co": return ["es-CO"];
|
46
|
+
case "de": return ["de-DE"];
|
47
|
+
case "dk": return ["da-DK"];
|
48
|
+
case "e1": return ["es-US"];
|
49
|
+
case "es": return ["es-ES"];
|
50
|
+
case "fr": return ["fr-FR"];
|
51
|
+
case "hk": return ["zh-Hant-HK"];
|
52
|
+
case "cn": return ["zh-Hant-CN"];
|
53
|
+
case "in": return ["en-IN"];
|
54
|
+
case "it": return ["it-IT"];
|
55
|
+
case "jp": return ["ja-JP"];
|
56
|
+
case "kr": return ["ko-KR"];
|
57
|
+
case "mx": return ["es-MX"];
|
58
|
+
case "my": return ["en-MY"];
|
59
|
+
case "nl": return ["nl-NL"];
|
60
|
+
case "no": return ["nb-NO"];
|
61
|
+
case "nz": return ["en-NZ"];
|
62
|
+
case "pe": return ["es-PE"];
|
63
|
+
case "ph": return ["en-PH"];
|
64
|
+
case "pl": return ["pl-PL"];
|
65
|
+
case "ru": return ["ru-RU"];
|
66
|
+
case "se": return ["sv-SE"];
|
67
|
+
case "sg": return ["en-SG"];
|
68
|
+
case "th": return ["th-TH"];
|
69
|
+
case "tr": return ["tr-TR"];
|
70
|
+
case "tw": return ["zh-Hant-TW"];
|
71
|
+
case "uk": return ["en-GB"];
|
72
|
+
case "us": return ["en-US"];
|
73
|
+
case "ve": return ["es-VE"];
|
74
|
+
case "vn": return ["vi-VN"];
|
75
|
+
case "id": return ["id-ID"];
|
76
|
+
default: return ["en-US"];
|
77
|
+
}
|
78
|
+
};
|
79
|
+
|
80
|
+
/**
|
81
|
+
* Returns the language among those available that
|
82
|
+
* best matches the user's preferences, using the Lookup
|
83
|
+
* algorithm of RFC 4647.
|
84
|
+
* If none of the available languages meets the user's preferences,
|
85
|
+
* then <code>availableLanguages[0]</code> is returned.
|
86
|
+
* @method findBestLanguage
|
87
|
+
* @param {String[]} availableLanguages The list of languages
|
88
|
+
* that the application supports, represented as RFC 4646 language
|
89
|
+
* tags.
|
90
|
+
* @return {String} The available language that best matches the
|
91
|
+
* user's preferences.
|
92
|
+
*/
|
93
|
+
openmailintl.findBestLanguage = function (availableLanguages) {
|
94
|
+
|
95
|
+
var preferencesList, i, language, normalized, result, index, normalization;
|
96
|
+
|
97
|
+
preferencesList = getPreferredLanguages();
|
98
|
+
|
99
|
+
// check whether the list of available languages
|
100
|
+
// contains language; if so return it
|
101
|
+
function scan(language) {
|
102
|
+
var i;
|
103
|
+
for (i = 0; i < availableLanguages.length; i += 1) {
|
104
|
+
if (language.toLowerCase() === availableLanguages[i].toLowerCase()) {
|
105
|
+
return availableLanguages[i];
|
106
|
+
}
|
107
|
+
}
|
108
|
+
}
|
109
|
+
|
110
|
+
normalization = {
|
111
|
+
"zh-hk": "zh-Hant-TW",
|
112
|
+
"zh-cn": "zh-Hant-CN",
|
113
|
+
"zh-tw": "zh-Hant-TW",
|
114
|
+
"zh": "zh-Hant-CN",
|
115
|
+
"hk": "zh-Hant-TW",
|
116
|
+
"en": "en-US",
|
117
|
+
"es": "es-ES",
|
118
|
+
"fr": "fr-FR",
|
119
|
+
"hi": "hi-IN",
|
120
|
+
"id": "id-ID",
|
121
|
+
"it": "it-IT",
|
122
|
+
"ja": "ja-JP",
|
123
|
+
"kr": "ko-KR",
|
124
|
+
"nb": "nb-NO",
|
125
|
+
"nl": "nl-NL",
|
126
|
+
"pl": "pl-PL",
|
127
|
+
"pt": "pt-BR",
|
128
|
+
"ru": "ru-RU",
|
129
|
+
"sv": "sv-SE",
|
130
|
+
"th": "th-TH",
|
131
|
+
"tr": "tr-TR",
|
132
|
+
"vi": "vi-VN",
|
133
|
+
"zh": "zh-Hans-CN",
|
134
|
+
"zh-cn": "zh-Hans-CN",
|
135
|
+
"zh-hk": "zh-Hant-HK",
|
136
|
+
"zh-tw": "zh-Hant-TW"
|
137
|
+
};
|
138
|
+
if (YAHOO.lang.isString(preferencesList)) {
|
139
|
+
preferencesList = preferencesList.split(/[, ]/);
|
140
|
+
}
|
141
|
+
for (i = 0; i < preferencesList.length; i += 1) {
|
142
|
+
language = preferencesList[i];
|
143
|
+
if (!language) {
|
144
|
+
continue;
|
145
|
+
}
|
146
|
+
normalized = normalization[language.toLowerCase()];
|
147
|
+
if (normalized) {
|
148
|
+
language = normalized;
|
149
|
+
}
|
150
|
+
// check the fallback sequence for one language
|
151
|
+
while (language.length > 0) {
|
152
|
+
result = scan(language);
|
153
|
+
if (result) {
|
154
|
+
return result;
|
155
|
+
} else {
|
156
|
+
index = language.lastIndexOf("-");
|
157
|
+
if (index >= 0) {
|
158
|
+
language = language.substring(0, index);
|
159
|
+
// one-character subtags get cut along with the following subtag
|
160
|
+
if (index >= 2 && language.charAt(index - 2) === "-") {
|
161
|
+
language = language.substring(0, index - 2);
|
162
|
+
}
|
163
|
+
} else {
|
164
|
+
// nothing available for this language
|
165
|
+
break;
|
166
|
+
}
|
167
|
+
}
|
168
|
+
}
|
169
|
+
}
|
170
|
+
|
171
|
+
// we use the first available language as the default
|
172
|
+
return availableLanguages[0];
|
173
|
+
};
|
174
|
+
|
175
|
+
|
176
|
+
var getFile = function (url) {
|
177
|
+
var XHR;
|
178
|
+
if (window.XMLHttpRequest) {
|
179
|
+
XHR = new XMLHttpRequest();
|
180
|
+
} else {
|
181
|
+
XHR = new ActiveXObject("Microsoft.XMLHTTP");
|
182
|
+
}
|
183
|
+
if (XHR) {
|
184
|
+
XHR.open("GET", url, false);
|
185
|
+
XHR.send(null);
|
186
|
+
if (XHR.status === 200) {
|
187
|
+
return XHR.responseText;
|
188
|
+
}
|
189
|
+
}
|
190
|
+
};
|
191
|
+
|
192
|
+
/**
|
193
|
+
* Retrieves a language specific JSON file that's part of the application's assets,
|
194
|
+
* and returns the decoded JSON object.
|
195
|
+
* The method first looks for the asset with the name <code>assetPath + baseName + "_" + language + ".json"</code>.
|
196
|
+
* If that asset doesn't exist, it looks for the asset with the name <code>assetPath + baseName + ".json"</code>.
|
197
|
+
* @method getResources
|
198
|
+
* @param {String} assetPath The path to the assets of the application.
|
199
|
+
* @param {String} baseName The base name of a resource bundle.
|
200
|
+
* @param {String} language The language for which resources are needed, as an RFC 4646 language tag.
|
201
|
+
* @return {Object} The object decoded from the JSON file found.
|
202
|
+
*/
|
203
|
+
openmailintl.getResources = function (assetPath, baseName, language) {
|
204
|
+
var url, contents;
|
205
|
+
|
206
|
+
if (assetPath.charAt(assetPath.length - 1) !== "/") {
|
207
|
+
assetPath += "/";
|
208
|
+
}
|
209
|
+
if (language) {
|
210
|
+
url = assetPath + baseName + "_" + language + ".json";
|
211
|
+
} else {
|
212
|
+
url = assetPath + baseName + ".json";
|
213
|
+
}
|
214
|
+
|
215
|
+
contents = getFile(url);
|
216
|
+
if (contents) {
|
217
|
+
try {
|
218
|
+
return YAHOO.lang.JSON.parse(contents);
|
219
|
+
} catch (x) {
|
220
|
+
}
|
221
|
+
}
|
222
|
+
if (language) {
|
223
|
+
return this.getResources(assetPath, baseName);
|
224
|
+
} else {
|
225
|
+
throw new Error("bundle " + baseName + " for language " + language + " not found.");
|
226
|
+
}
|
227
|
+
};
|
228
|
+
|
229
|
+
/**
|
230
|
+
* Formats a string by substituting parameters into the pattern.
|
231
|
+
* The pattern syntax is similar to that of the Java
|
232
|
+
* <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/text/MessageFormat.html">MessageFormat class</a>,
|
233
|
+
* but currently only the following format elements are supported:
|
234
|
+
* <ul>
|
235
|
+
* <li>{ <i>ArgumentIndex</i> }
|
236
|
+
* <li>{ <i>ArgumentIndex</i> , number }
|
237
|
+
* <li>{ <i>ArgumentIndex</i> , date }
|
238
|
+
* </ul>
|
239
|
+
* Quote characters do not escape braces; if you want to use
|
240
|
+
* a literal brace, write it as &#x007b; or &#x007d;.
|
241
|
+
* @method formatMessage
|
242
|
+
* @param {String} pattern The pattern string into which the arguments are inserted.
|
243
|
+
* @param {Object[]} arguments The objects to insert into the pattern string.
|
244
|
+
* @param {String} language The language for which arguments such as numbers and dates
|
245
|
+
* should be formatted.
|
246
|
+
* @return {String} The pattern string with substituted parameters.
|
247
|
+
*/
|
248
|
+
openmailintl.formatMessage = function (pattern, args, language) {
|
249
|
+
var i, j, k, token, key, value, meta;
|
250
|
+
|
251
|
+
for (;;) {
|
252
|
+
i = pattern.lastIndexOf('{');
|
253
|
+
if (i < 0) {
|
254
|
+
break;
|
255
|
+
}
|
256
|
+
j = pattern.indexOf('}', i);
|
257
|
+
if (i + 1 >= j) {
|
258
|
+
break;
|
259
|
+
}
|
260
|
+
|
261
|
+
// extract format element information
|
262
|
+
token = pattern.substring(i + 1, j);
|
263
|
+
key = token;
|
264
|
+
meta = null;
|
265
|
+
k = key.indexOf(',');
|
266
|
+
if (k > -1) {
|
267
|
+
meta = key.substring(k + 1);
|
268
|
+
key = key.substring(0, k);
|
269
|
+
}
|
270
|
+
|
271
|
+
// lookup the value
|
272
|
+
value = args[key];
|
273
|
+
|
274
|
+
if (meta !== null) {
|
275
|
+
if (meta.indexOf("date") === 0 && value instanceof Date) {
|
276
|
+
value = value.toLocaleString();
|
277
|
+
} else if (meta.indexOf("number") === 0 && typeof value === "number") {
|
278
|
+
value = value.toLocaleString();
|
279
|
+
}
|
280
|
+
}
|
281
|
+
|
282
|
+
pattern = pattern.substring(0, i) + value + pattern.substring(j + 1);
|
283
|
+
}
|
284
|
+
|
285
|
+
return pattern;
|
286
|
+
};
|
287
|
+
|
288
|
+
return openmailintl;
|
289
|
+
|
290
|
+
}();
|
291
|
+
|