[Groonga-commit] groonga/heroku-buildpack-groonga at 67e7f8f [master] Implement by Ruby

Back to archive index

Kouhei Sutou null+****@clear*****
Mon May 19 23:29:38 JST 2014


Kouhei Sutou	2014-05-19 23:29:38 +0900 (Mon, 19 May 2014)

  New Revision: 67e7f8f1100d1a8f64bb79b07f8e8aa6589b9039
  https://github.com/groonga/heroku-buildpack-groonga/commit/67e7f8f1100d1a8f64bb79b07f8e8aa6589b9039

  Message:
    Implement by Ruby

  Modified files:
    bin/compile
    bin/release

  Modified: bin/compile (+35 -24)
===================================================================
--- bin/compile    2014-05-14 23:28:53 +0900 (a7b794b)
+++ bin/compile    2014-05-19 23:29:38 +0900 (f307a13)
@@ -1,26 +1,37 @@
-#!/usr/bin/env bash
+#!/usr/bin/env ruby
 # bin/compile <build-dir> <cache-dir>
 
-GROONGA_VERSION=2.0.9
-GROONGA_DATABASE_PATH=groonga/database
-
-echo "-----> Installing groonga $VERSION"
-
-cd $1
-
-curl http://cloud.github.com/downloads/groonga/heroku-buildpack-groonga/groonga-$GROONGA_VERSION.tgz -s -O
-mkdir -p vendor/groonga
-tar -C vendor/groonga -xf groonga-$GROONGA_VERSION.tgz
-rm groonga-$GROONGA_VERSION.tgz
-
-export PATH=$PATH:$1/vendor/groonga/bin
-export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$1/vendor/groonga/lib
-
-echo "-----> Modifying groonga-httpd.conf"
-sed --in-place -e "s|# groonga_database /path/to/groonga/db;|groonga_database /app/$GROONGA_DATABASE_PATH;|" $1/vendor/groonga/etc/groonga/httpd/groonga-httpd.conf
-
-echo "-----> Creating groonga database"
-groonga -n $GROONGA_DATABASE_PATH quit
-
-echo "-----> Loading data"
-find groonga -name "*.grn" | sort | xargs -t -I % -n 1 -P 1 groonga --file % $GROONGA_DATABASE_PATH
+require "fileutils"
+
+build_dir, cache_dir, env_dir, = ARGV
+
+version = "4.0.1"
+database_path = "groonga/database"
+
+Dir.chdir(build_dir) do
+  puts("-----> Installing Groonga #{version}")
+
+  base_name = "heroku-groonga-#{version}.tar.xz"
+  system("curl",
+         "--silent",
+         "--remote-name",
+         "http://groonga-builder.herokuapp.com/#{base_name}")
+  system("tar", "xf", base_name)
+  FileUtils.rm(base_name)
+
+  puts("-----> Creating groonga database")
+  ENV["PATH"] = [
+    "#{build_dir}/vendor/groonga/bin",
+    ENV["PATH"],
+  ].join(File::PATH_SEPARATOR)
+  ENV["LD_LIBRARY_PATH"] = [
+    "#{build_dir}/vendor/groonga/lib",
+    ENV["LD_LIBRARY_PATH"],
+  ].join(File::PATH_SEPARATOR)
+  system("groonga", "-n", database_path, "quit")
+
+  puts("-----> Loading data")
+  Dir.glob("groonga/*.grn").sort.each do |grn|
+    system("groonga", "--file", grn, database_path)
+  end
+end

  Modified: bin/release (+29 -9)
===================================================================
--- bin/release    2014-05-14 23:28:53 +0900 (5b74c9f)
+++ bin/release    2014-05-19 23:29:38 +0900 (e92b6f1)
@@ -1,9 +1,29 @@
-#!/usr/bin/env bash
-
-echo "---"
-echo "addons:"
-echo "config_vars:"
-echo "  PATH: $PATH:/app/vendor/groonga/bin:/app/vendor/groonga/sbin"
-echo "  LD_LIBRARY_PATH: $LD_LIBRARY_PATH:/app/vendor/groonga/lib"
-echo "default_process_types:"
-echo "  web: sed --in-place -e \"s/10041/\$PORT/\" /app/vendor/groonga/etc/groonga/httpd/groonga-httpd.conf && /app/vendor/groonga/sbin/groonga-httpd -g \"daemon off;\""
+#!/usr/bin/env ruby
+
+require "yaml"
+
+build_dir = ARGV.first
+
+release = {}
+
+release["addons"] = []
+
+paths = [
+  File.join(build_dir, "vendor", "local", "bin"),
+  File.join(build_dir, "vendor", "local", "sbin"),
+  ENV["PATH"],
+]
+ld_library_paths = [
+  File.join(build_dir, "vendor", "local", "lib"),
+  ENV["LD_LIBRARY_PATH"],
+]
+release["config_vars"] = {
+  "PATH"            => paths.join(":"),
+  "LD_LIBRARY_PATH" => ld_library_paths.compact.join(":"),
+}
+
+release["default_process_types"] = {
+  "web" => "groonga-httpd",
+}
+
+puts(release.to_yaml)
-------------- next part --------------
HTML����������������������������...
다운로드 



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