Reformatting rake libs
This commit is contained in:
parent
faa745c384
commit
889a15ad70
|
@ -1,9 +1,12 @@
|
||||||
include Rake::DSL
|
include Rake::DSL
|
||||||
|
|
||||||
def git(url,dest)
|
def git(url, dest)
|
||||||
sh "git clone #{url} #{dest}" unless Dir.exists?(dest)
|
unless Dir.exists?("#{dest}/.git")
|
||||||
|
rm_rf dest if Dir.exists?(dest)
|
||||||
|
sh "git clone '#{url}' '#{dest}'"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def github(repo,dest)
|
def github(repo, dest, protocol = "https")
|
||||||
git "https://github.com/#{repo}.git", dest
|
git "#{protocol}://github.com/#{repo}.git", dest
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
def echo(msg)
|
def echo(msg, level = 1)
|
||||||
# print green text
|
# print green text
|
||||||
puts "\e[32m=> #{msg}\e[0m"
|
puts "\e[32m#{"="*level}> #{msg}\e[0m"
|
||||||
end
|
end
|
||||||
|
|
||||||
def echoerr(msg)
|
def error(msg)
|
||||||
# print red text
|
# print red text
|
||||||
puts "\e[31m=> #{msg}\e[0m"
|
puts "\e[31m=> #{msg}\e[0m"
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,16 +4,16 @@ require_relative 'output'
|
||||||
# when it encounters a problem. I'll leave it up to the
|
# when it encounters a problem. I'll leave it up to the
|
||||||
# programmer to expect problems and terminate when necessary.
|
# programmer to expect problems and terminate when necessary.
|
||||||
def sh_safe(cmd)
|
def sh_safe(cmd)
|
||||||
begin
|
begin
|
||||||
return sh(cmd)
|
return sh(cmd)
|
||||||
rescue
|
rescue
|
||||||
echoerr $!
|
error $!
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def do_link(src, dest)
|
def do_link(src, dest)
|
||||||
if not (File.exist?(path_to_file) || File.symlink?(path_to_file))
|
if not (File.exist?(path_to_file) || File.symlink?(path_to_file))
|
||||||
sh_safe "ln -sf #{src} #{dest}"
|
sh_safe "ln -sf #{src} #{dest}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue