fix stuff

main
sandyx 11 months ago
parent c2e71ed880
commit af91725d03

@ -31,13 +31,16 @@ def parse(arg)
when "debug" when "debug"
$EFLAGS = "-DDEBUG" $EFLAGS = "-DDEBUG"
main main
else
#error "unknown argument: #{arg}"
print arg
end
when arg.split("=")[0] = "cc" case arg.split("=")[0]
when "cc"
$CC = arg.split("=")[1] $CC = arg.split("=")[1]
main main
else
error "unknown argument: #{arg}"
end end
end end

26
rub

@ -2,6 +2,11 @@
require 'fileutils' require 'fileutils'
HELP = "\trub init <name> - initialize a new project\n" \
"\trub help - display help message\n" \
"\trub meow - meows\n" \
"\trub - run build.rb in current directory\n"
ANSI_RED = "\e[31m" ANSI_RED = "\e[31m"
ANSI_CLEAR = "\e[0m" ANSI_CLEAR = "\e[0m"
RUB = "#{ANSI_RED}RUB#{ANSI_CLEAR}" RUB = "#{ANSI_RED}RUB#{ANSI_CLEAR}"
@ -22,9 +27,13 @@ def rub_init(name)
error("build directory already exists") if File.exist? "build" error("build directory already exists") if File.exist? "build"
error(".git already exists") if File.exist? ".git" error(".git already exists") if File.exist? ".git"
File.mkdir "src" FileUtils.mkdir "src"
File.mkdir "build" FileUtils.mkdir "build"
FileUtils.cp(RUBDIR + "build.rb", Dir.pwd) #FileUtils.cp(RUBDIR + "build.rb", Dir.pwd)
buildfile = File.readlines(RUBDIR + "build.rb")
buildfile.insert(17, "APPNAME=\"#{name}\"\n")
File.write("build.rb", buildfile.join)
`git init` `git init`
`git branch -m main` `git branch -m main`
@ -37,6 +46,10 @@ def parse_arg(arg)
when "meow" when "meow"
puts "#{RUB}: meow :3" puts "#{RUB}: meow :3"
when "help"
puts HELP
end end
end end
@ -49,9 +62,16 @@ end
case ARGV.count case ARGV.count
when 0 when 0
unless File.exist? "build.rb"
error("could not find 'build.rb'")
end
require "#{Dir.pwd}/build.rb" require "#{Dir.pwd}/build.rb"
exit 0
when 1 when 1
parse_arg(ARGV[0]) parse_arg(ARGV[0])
when 2 when 2
parse_args(ARGV) parse_args(ARGV)
end end
#require "#{Dir.pwd}/build.rb"

Loading…
Cancel
Save