Kouhei Sutou
null+****@clear*****
Tue Feb 23 00:20:39 JST 2016
Kouhei Sutou 2016-02-23 00:20:39 +0900 (Tue, 23 Feb 2016) New Revision: 4f939f2e173fc7d16afc1db437fc1a5e7196ec20 https://github.com/groonga/heroku-buildpack-groonga/commit/4f939f2e173fc7d16afc1db437fc1a5e7196ec20 Message: Expand MeCab dictionary change span Modified files: bin/compile Modified: bin/compile (+20 -12) =================================================================== --- bin/compile 2016-02-23 00:16:58 +0900 (ed844e1) +++ bin/compile 2016-02-23 00:20:39 +0900 (efddc2e) @@ -76,6 +76,15 @@ def fix_prefix_in_pc(prefix, real_prefix) end end +def update_mecabrc(mecabrc, prefix) + sh("sed", "-i.bak", "-e", "s,/app,#{prefix},g", mecabrc) + begin + yield + ensure + mv("#{mecabrc}.bak", mecabrc) + end +end + puts("-----> Loading environment variables") environment_variables = load_environment_variables(env_dir) @@ -117,18 +126,17 @@ Dir.chdir(build_dir) do ENV["LD_LIBRARY_PATH"] = build_path_environment_value(ld_library_paths) ENV["GRN_PLUGINS_DIR"] = "#{absolete_prefix}/lib/groonga/plugins" ENV["GRN_RUBY_SCRIPTS_DIR"] = "#{absolete_prefix}/lib/groonga/scripts/ruby" - mecabrc = "#{build_dir}/vendor/mecab/etc/mecabrc" - ENV["MECABRC"] = mecabrc - sh("sed", "-i.bak", "-e", "s,/app,#{build_dir},g", ENV["MECABRC"]) - mkdir_p(File.dirname(database_path)) - sh("groonga", "--log-path", "/tmp/log", "--log-level", "debug", "-n", database_path, "quit") - puts(File.read("/tmp/log")) - mv("#{mecabrc}.bak", mecabrc) - - puts("-----> Loading data") - Dir.glob("groonga/*.grn").sort.each do |grn| - sh("groonga", "--file", grn, database_path) - rm(grn) + ENV["MECABRC"] = "#{build_dir}/vendor/mecab/etc/mecabrc" + update_mecabrc(ENV["MECABRC"], build_dir) do + mkdir_p(File.dirname(database_path)) + sh("groonga", "--log-path", "/tmp/log", "--log-level", "debug", "-n", database_path, "quit") + puts(File.read("/tmp/log")) + + puts("-----> Loading data") + Dir.glob("groonga/*.grn").sort.each do |grn| + sh("groonga", "--file", grn, database_path) + rm(grn) + end end puts("-----> Setting environment variables") -------------- next part -------------- HTML����������������������������... Descargar