From 591f4c242853f87741a92f3131592055bc7ef5da Mon Sep 17 00:00:00 2001 From: Jakukyo Friel Date: Tue, 3 May 2016 22:25:38 +0800 Subject: [PATCH 1/2] Add `sudo` support for source installer. --- lib/sprinkle/installers/source.rb | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/sprinkle/installers/source.rb b/lib/sprinkle/installers/source.rb index 40389c7..71d3cc2 100644 --- a/lib/sprinkle/installers/source.rb +++ b/lib/sprinkle/installers/source.rb @@ -47,12 +47,16 @@ module Installers # source 'http://magicbeansland.com/latest-1.1.1.tar.gz' do # prefix '/usr/local' # - # pre :prepare { 'echo "Here we go folks."' } - # post :extract { 'echo "I believe..."' } - # pre :build { 'echo "Cross your fingers!"' } + # pre :prepare, 'echo "Here we go folks."' + # post :extract, 'echo "I believe..."' + # pre :build, 'echo "Cross your fingers!"' # end # end # + # Be careful! Hooks will get logged via appending '>> LOG_FILE 2&>1'. + # Thus if you use '>> FILE' in hooks, the output won't go to the FILE + # you specified. You can use '| tee -a FILE' instead. + # # Fourth, specifying a custom archive name because the downloaded file name # differs from the source URL: # @@ -158,7 +162,7 @@ def build_commands #:nodoc: def install_commands #:nodoc: return custom_install_commands if custom_install? - [ in_build_dir(with_log("#{install_command || "make install"}",:install)) ] + [ in_build_dir(with_log("#{install_command || "#{sudo_cmd}make install"}",:install)) ] end def custom_install? #:nodoc: @@ -189,7 +193,7 @@ def post_commands(stage) #:nodoc: end - # dress is overriden from the base Sprinkle::Installers::Installer class so that the command changes + # dress is overridden from the base Sprinkle::Installers::Installer class so that the command changes # directory to the build directory first. Also, the result of the command is logged. def dress(commands, pre_or_post, stage) chdir = "cd #{build_dir} && " From 79381277af3dff6229c64fc02b115da17afe6167 Mon Sep 17 00:00:00 2001 From: Jakukyo Friel Date: Mon, 11 Jul 2016 18:11:45 +0800 Subject: [PATCH 2/2] source: revert typos. --- lib/sprinkle/installers/source.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/sprinkle/installers/source.rb b/lib/sprinkle/installers/source.rb index 71d3cc2..188bf4f 100644 --- a/lib/sprinkle/installers/source.rb +++ b/lib/sprinkle/installers/source.rb @@ -47,9 +47,9 @@ module Installers # source 'http://magicbeansland.com/latest-1.1.1.tar.gz' do # prefix '/usr/local' # - # pre :prepare, 'echo "Here we go folks."' - # post :extract, 'echo "I believe..."' - # pre :build, 'echo "Cross your fingers!"' + # pre :prepare { 'echo "Here we go folks."' } + # post :extract { 'echo "I believe..."' } + # pre :build { 'echo "Cross your fingers!"' } # end # end #