[Groonga-commit] groonga/gcs [master] Update gcs-import-examples-http for environments installed from .deb

Back to archive index

YUKI Hiroshi null+****@clear*****
Wed Aug 29 11:49:15 JST 2012


YUKI Hiroshi	2012-08-29 11:49:15 +0900 (Wed, 29 Aug 2012)

  New Revision: 0151c8607dd18c31bf7d4928a031495da4ef8158
  https://github.com/groonga/gcs/commit/0151c8607dd18c31bf7d4928a031495da4ef8158

  Log:
    Update gcs-import-examples-http for environments installed from .deb

  Modified files:
    bin/gcs-import-examples-http

  Modified: bin/gcs-import-examples-http (+29 -13)
===================================================================
--- bin/gcs-import-examples-http    2012-08-29 11:14:52 +0900 (8ed63ea)
+++ bin/gcs-import-examples-http    2012-08-29 11:49:15 +0900 (107d314)
@@ -46,6 +46,34 @@ EOT
 read enter
 
 
+path_prefixes="`dirname $0`/.."
+if [ -L "$0" ]; then
+  real_dirname="`dirname $0`/`readlink $0`"
+  path_prefixes="$path_prefixes `dirname $real_dirname`/.."
+fi
+path_prefixes="$path_prefixes `npm root`/gcs `npm -g root`/gcs"
+base_path=
+bin_path=
+examples_path=
+for path_prefix in $path_prefixes
+do
+  base_path="$path_prefix"
+
+  if [ -z "$bin_path" ]; then
+    bin_path="$base_path/bin"
+    if [ ! -d "$bin_path" ]; then
+      bin_path=
+    fi
+  fi
+
+  if [ -z "$examples_path" ]; then
+    examples_path="$base_path/examples"
+    if [ ! -d "$examples_path" ]; then
+      examples_path=
+    fi
+  fi
+done
+
 
 echo "==== Deleting 'example' domain (if exists)"
 curl -s "http://localhost:7575/?DomainName=example&Action=DeleteDomain&Version=2011-02-01" > /dev/null
@@ -86,19 +114,7 @@ echo
 
 echo
 echo "==== Indexing data"
-sdf_path=
-sdf_base_path=examples/example.sdf.json
-for sdf_path_prefix in "`dirname $0`/.." "`npm root`/gcs" "`npm -g root`/gcs"
-do
-    sdf_path="$sdf_path_prefix/$sdf_base_path"
-    if [ -f "$sdf_path" ]; then
-	break
-    else
-	sdf_path=
-    fi
-done
-
-curl -X POST --upload-file $sdf_path --header "Content-Type: application/json" http://$documents_endpoint/2011-02-01/documents/batch
+curl -X POST --upload-file $examples_path/example.sdf.json --header "Content-Type: application/json" http://$documents_endpoint/2011-02-01/documents/batch
 echo
 
 echo
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index