aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2011-01-19 12:35:17 +0000
committerBibiko <bibiko@eva.mpg.de>2011-01-19 12:35:17 +0000
commit6e2a43045f6f98c4fabf5a3358c2bdfdda2d6688 (patch)
treeb31cff90e22cb9e0a9d5f4adee0d45cdd4ede273
parent3f813a65b0d41b4a1771349f27a2d0ccafb740f5 (diff)
downloadsequelpro-6e2a43045f6f98c4fabf5a3358c2bdfdda2d6688.tar.gz
sequelpro-6e2a43045f6f98c4fabf5a3358c2bdfdda2d6688.tar.bz2
sequelpro-6e2a43045f6f98c4fabf5a3358c2bdfdda2d6688.zip
• fixed issue while updating Default Bundles for key equivalent
• improved JSON Bundle commands - got rid of trailing whitespaces inside data and as JSON object - added error handling for serialization a JSON object to suppress inserting of "null"
-rw-r--r--SharedSupport/Default Bundles/CopyAsJSON.spBundle/command.plist7
-rw-r--r--SharedSupport/Default Bundles/Toggle JSON Format.spBundle/command.plist10
-rw-r--r--Source/SPAppController.m3
3 files changed, 14 insertions, 6 deletions
diff --git a/SharedSupport/Default Bundles/CopyAsJSON.spBundle/command.plist b/SharedSupport/Default Bundles/CopyAsJSON.spBundle/command.plist
index 86bf998a..f4f1ecd9 100644
--- a/SharedSupport/Default Bundles/CopyAsJSON.spBundle/command.plist
+++ b/SharedSupport/Default Bundles/CopyAsJSON.spBundle/command.plist
@@ -64,8 +64,11 @@ while($rowData) {
print "null";
}
elsif($meta[$i]-&gt;[1] eq "integer" || $meta[$i]-&gt;[1] eq "float") {
- print "$cellData";
+ chomp($cellData);
+ $d = $cellData+0;
+ print "$d";
} else {
+ chomp($cellData);
print "\"$cellData\"";
}
@@ -91,7 +94,7 @@ while($rowData) {
print "\n";
}
-print "\t]\n}\n";
+print "\t]\n}";
' | __CF_USER_TEXT_ENCODING=$UID:0x8000100:0x8000100 pbcopy</string>
<key>contact</key>
diff --git a/SharedSupport/Default Bundles/Toggle JSON Format.spBundle/command.plist b/SharedSupport/Default Bundles/Toggle JSON Format.spBundle/command.plist
index 6476d86b..39555369 100644
--- a/SharedSupport/Default Bundles/Toggle JSON Format.spBundle/command.plist
+++ b/SharedSupport/Default Bundles/Toggle JSON Format.spBundle/command.plist
@@ -9,10 +9,10 @@
<key>command</key>
<string>DATA=$(cat)
-FORMAT=$(echo "$DATA" | head -n 1 | perl -e '$l=&lt;&gt;;print "1" if($l=~m/^\s*\{\s*$/)')
+FORMAT=$(echo "$DATA" | head -n 1 | perl -e '$l=&lt;&gt;;if($l=~m/^\s*\{\s*$/) {print "1";} else {print "2";}')
# if FORMAT == 1 then serialize JSON data otherwise pretty print them
-if [ "$FORMAT" == 1 ]; then
+if [ "$FORMAT" -eq "1" ]; then
DATA=$(echo "$DATA" | php -r '
$jsonData = "";
@@ -20,6 +20,10 @@ if [ "$FORMAT" == 1 ]; then
while($d = fgets($inputStream)) { $jsonData .= $d; }
print json_encode(json_decode($jsonData));
')
+ if [ "$DATA" == "null" ]; then
+ echo "&lt;font&gt;An error occured while serializing JSON data!&lt;/font&gt;"
+ exit $SP_BUNDLE_EXIT_SHOW_AS_HTML_TOOLTIP
+ fi
else
@@ -30,7 +34,7 @@ fi
# if there's a need to preserve Unicode characters remove the first to characters of the following line
# DATA=$(echo "$DATA" | perl -Xpe 'binmode STDIN,":utf8";binmode STDOUT,":utf8";s/\\u([0-9A-F]{4})/chr(hex($1))/ieg')
-echo "$DATA"</string>
+printf "%b" "$DATA"</string>
<key>contact</key>
<string>znvy@ovovxb.qr</string>
<key>description</key>
diff --git a/Source/SPAppController.m b/Source/SPAppController.m
index a0e47137..a38dc631 100644
--- a/Source/SPAppController.m
+++ b/Source/SPAppController.m
@@ -1754,7 +1754,8 @@ YY_BUFFER_STATE yy_scan_string (const char *);
if(![[bundleKeyEquivalents objectForKey:scope] objectForKey:[cmdData objectForKey:SPBundleFileKeyEquivalentKey]])
[[bundleKeyEquivalents objectForKey:scope] setObject:[NSMutableArray array] forKey:[cmdData objectForKey:SPBundleFileKeyEquivalentKey]];
- [[[bundleKeyEquivalents objectForKey:scope] objectForKey:[cmdData objectForKey:SPBundleFileKeyEquivalentKey]] addObject:
+ if(!doBundleUpdate || (doBundleUpdate && (![[cmdData objectForKey:SPBundleFileIsDefaultBundleKey] boolValue] || processDefaultBundles)))
+ [[[bundleKeyEquivalents objectForKey:scope] objectForKey:[cmdData objectForKey:SPBundleFileKeyEquivalentKey]] addObject:
[NSDictionary dictionaryWithObjectsAndKeys:
infoPath, @"path",
[cmdData objectForKey:SPBundleFileNameKey], @"title",