From 104dd62687b646f3ec821af1aa8749a2374a258f Mon Sep 17 00:00:00 2001 From: sandyx Date: Mon, 3 Feb 2025 18:23:31 -0600 Subject: [PATCH] update --- install.rb | 2 +- rub | 26 +++++++++++++++++++++----- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/install.rb b/install.rb index 9f1ca5a..93febe9 100644 --- a/install.rb +++ b/install.rb @@ -8,4 +8,4 @@ File.mkdir RUBDIR unless File.exist? RUBDIR FileUtils.cp("build.rb", RUBDIR) FileUtils.chmod("+x", "rub") FileUtils.cp("rub", "/usr/local/bin") -FileUtils.cp_r(Dir.pwd, RUBDIR) +#FileUtils.cp_r(Dir.pwd, RUBDIR) diff --git a/rub b/rub index 0d1626e..b11558c 100755 --- a/rub +++ b/rub @@ -10,9 +10,8 @@ HELP = "\trub init - 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