|
|
|
|
@ -10,9 +10,8 @@ HELP = "\trub init <name> - initialize a new project\n" \
|
|
|
|
|
ANSI_RED = "\e[31m"
|
|
|
|
|
ANSI_CLEAR = "\e[0m"
|
|
|
|
|
RUB = "#{ANSI_RED}RUB#{ANSI_CLEAR}"
|
|
|
|
|
RUBGIT="#{RUB}/rub/"
|
|
|
|
|
|
|
|
|
|
RUBDIR = "#{Dir.home}/.rub/"rub
|
|
|
|
|
RUBDIR = "#{Dir.home}/.rub/"
|
|
|
|
|
RUBGIT="#{RUBDIR}/rub/"
|
|
|
|
|
|
|
|
|
|
def error(msg)
|
|
|
|
|
puts "#{RUB}: error: #{msg}"
|
|
|
|
|
@ -40,8 +39,25 @@ def rub_init(name)
|
|
|
|
|
`git branch -m main`
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def rub_install
|
|
|
|
|
FileUtils.mkdir RUBDIR unless File.exist? RUBDIR
|
|
|
|
|
FileUtils.cp("build.rb", RUBDIR)
|
|
|
|
|
FileUtils.chmod("+x", "rub")
|
|
|
|
|
FileUtils.cp("rub", "/usr/local/bin")
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def rub_update
|
|
|
|
|
unless Dir.exist? RUBGIT #hmmmm
|
|
|
|
|
FileUtils.chdir(RUBDIR)
|
|
|
|
|
system("git clone https://git.dragon.ooo/sandyx/rub.git")
|
|
|
|
|
rub_install
|
|
|
|
|
exit 0
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
FileUtils.chdir(RUBGIT)
|
|
|
|
|
message("updating...")
|
|
|
|
|
system("git pull")
|
|
|
|
|
rub_install
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def parse_arg(arg)
|
|
|
|
|
@ -56,8 +72,8 @@ def parse_arg(arg)
|
|
|
|
|
puts HELP
|
|
|
|
|
|
|
|
|
|
when "update"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rub_update
|
|
|
|
|
exit 1
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|