diff options
author | Samuel Giddins <segiddins@segiddins.me> | 2017-06-12 17:04:01 -0500 |
---|---|---|
committer | Samuel Giddins <segiddins@segiddins.me> | 2017-06-12 22:44:05 -0500 |
commit | ef1784d6385f35c468c8f40527e8483608c91fb8 (patch) | |
tree | 30671c5f0c972e3cd758b12cc579012d6178fac3 | |
parent | ef325adb54c3a7f309915e6ff90c562cbd90dada (diff) | |
download | bundler-ef1784d6385f35c468c8f40527e8483608c91fb8.tar.gz |
Add a rake task to generate build metadata
-rw-r--r-- | task/build_metadata.rake | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/task/build_metadata.rake b/task/build_metadata.rake new file mode 100644 index 0000000000..5104898026 --- /dev/null +++ b/task/build_metadata.rake @@ -0,0 +1,18 @@ +# frozen_string_literal: true +file "lib/bundler/generated/build_metadata.rb" => [".git/HEAD", __FILE__] do |t| + build_metadata = { + :built_at => BUNDLER_SPEC.date.strftime("%Y-%m-%d"), + :git_sha => `git rev-parse --short HEAD`.strip, + :release => Rake::Task["release"].instance_variable_get(:@already_invoked), + } + + File.open(t.name, "w") {|f| f << <<-RUBY } +# frozen_string_literal: true + +module Bundler + BUILD_METADATA = { +#{build_metadata.sort.map {|k, v| " #{k.inspect} => #{BUNDLER_SPEC.send(:ruby_code, v)}," }.join("\n")} + }.freeze +end + RUBY +end |