Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sudo support for source installer. #214

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions lib/sprinkle/installers/source.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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!"'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please leave the {} deferred examples unless you want to document the difference and when someone should use one over the other.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New reverted commit pushed.

# 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:
#
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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} && "
Expand Down