null+****@clear*****
null+****@clear*****
2012年 7月 5日 (木) 00:20:21 JST
Yoji SHIDARA 2012-07-05 00:20:21 +0900 (Thu, 05 Jul 2012) New Revision: 14bb2330b16299d3d7adc18e72c794bc3036387b https://github.com/groonga/gcs/commit/14bb2330b16299d3d7adc18e72c794bc3036387b Log: Create wrappers for files on 'bin' of package.json Modified files: packages/all-in-one/Rakefile Modified: packages/all-in-one/Rakefile (+12 -8) =================================================================== --- packages/all-in-one/Rakefile 2012-07-05 00:06:03 +0900 (202c3b0) +++ packages/all-in-one/Rakefile 2012-07-05 00:20:21 +0900 (4d23c64) @@ -199,9 +199,10 @@ namespace(:gcs) do end end -def create_gcs_wrapper(run_gcs_path) - run_gcs_path.open("w") do |run_gcs| - run_gcs.puts(<<-EOS) +def create_wrapper_script(executable_name, destination_path) + wrapper_script_path = destination_path + executable_name + wrapper_script_path.open("w") do |wrapper_script| + wrapper_script.puts(<<-EOS) #!/bin/sh set -e @@ -229,14 +230,15 @@ esac PATH="${bin_dir}:${PATH}" export PATH -"${bin_dir}/gcs" "$@" +"${bin_dir}/#{executable_name}" "$@" EOS end - chmod(0755, run_gcs_path.to_s) + chmod(0755, wrapper_script_path.to_s) end gcs_package_json = top_dir + "package.json" -gcs_version = JSON.parse(gcs_package_json.read)["version"] +package_json = JSON.parse(gcs_package_json.read) +gcs_version = package_json["version"] gcs_package_basename = "gcs-#{gcs_version}" gcs_package_tar_gz = "#{gcs_package_basename}.tar.gz" gcs_package_path = tmp_dir + gcs_package_basename @@ -244,12 +246,14 @@ gcs_package_tar_gz_path = base_dir + gcs_package_tar_gz file(gcs_package_tar_gz_path.to_s) do Rake::Task["package"] end +executables_to_wrap = package_json['bin'].keys task(:package => gcs_path.to_s) do rm_rf(gcs_package_path.to_s) cp_r(@dist_dir.to_s, gcs_package_path.to_s) - run_gcs_path = gcs_package_path + "gcs" - create_gcs_wrapper(run_gcs_path) + executables_to_wrap.each do |executable_name| + create_wrapper_script(executable_name, gcs_package_path) + end Dir.chdir(gcs_package_path.dirname.to_s) do sh("tar", "czf", gcs_package_tar_gz_path.to_s, gcs_package_basename) end -------------- next part -------------- HTML$B$NE:IU%U%!%$%k$rJ]4I$7$^$7$?(B... Download