From 874bec2af5800b0847d702999efbe796b1c20cfa Mon Sep 17 00:00:00 2001 From: Daniel Bovensiepen Date: Sun, 20 Apr 2014 05:39:40 +0800 Subject: Implement :checksum_hash mrbgem option. This allows to use a mgem with a specific checksum hash. The following modification were necessary to implement this function: - add run_checkout build command to use 'git checkout' - skip shallow copy in case checksum_hash is used - make 'master' the default branch if branch isn't defined --- tasks/mruby_build_commands.rake | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'tasks/mruby_build_commands.rake') diff --git a/tasks/mruby_build_commands.rake b/tasks/mruby_build_commands.rake index d64b20ff3..4beb7e743 100644 --- a/tasks/mruby_build_commands.rake +++ b/tasks/mruby_build_commands.rake @@ -228,14 +228,15 @@ module MRuby class Command::Git < Command attr_accessor :flags - attr_accessor :clone_options, :pull_options + attr_accessor :clone_options, :pull_options, :checkout_options def initialize(build) super @command = 'git' - @flags = %w[--depth 1] + @flags = %w[] @clone_options = "clone %{flags} %{url} %{dir}" @pull_options = "pull" + @checkout_options = "checkout %{checksum_hash}" end def run_clone(dir, url, _flags = []) @@ -250,6 +251,14 @@ module MRuby _run pull_options Dir.chdir root end + + def run_checkout(dir, checksum_hash) + root = Dir.pwd + Dir.chdir dir + _pp "GIT CHECKOUT", checksum_hash + _run checkout_options, { :checksum_hash => checksum_hash } + Dir.chdir root + end end class Command::Mrbc < Command -- cgit v1.2.3