|
|
|
|
@ -2,6 +2,11 @@
|
|
|
|
|
|
|
|
|
|
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_CLEAR = "\e[0m"
|
|
|
|
|
RUB = "#{ANSI_RED}RUB#{ANSI_CLEAR}"
|
|
|
|
|
@ -22,9 +27,13 @@ def rub_init(name)
|
|
|
|
|
error("build directory already exists") if File.exist? "build"
|
|
|
|
|
error(".git already exists") if File.exist? ".git"
|
|
|
|
|
|
|
|
|
|
File.mkdir "src"
|
|
|
|
|
File.mkdir "build"
|
|
|
|
|
FileUtils.cp(RUBDIR + "build.rb", Dir.pwd)
|
|
|
|
|
FileUtils.mkdir "src"
|
|
|
|
|
FileUtils.mkdir "build"
|
|
|
|
|
#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 branch -m main`
|
|
|
|
|
@ -37,6 +46,10 @@ def parse_arg(arg)
|
|
|
|
|
|
|
|
|
|
when "meow"
|
|
|
|
|
puts "#{RUB}: meow :3"
|
|
|
|
|
|
|
|
|
|
when "help"
|
|
|
|
|
puts HELP
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
@ -49,9 +62,16 @@ end
|
|
|
|
|
|
|
|
|
|
case ARGV.count
|
|
|
|
|
when 0
|
|
|
|
|
unless File.exist? "build.rb"
|
|
|
|
|
error("could not find 'build.rb'")
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
require "#{Dir.pwd}/build.rb"
|
|
|
|
|
exit 0
|
|
|
|
|
when 1
|
|
|
|
|
parse_arg(ARGV[0])
|
|
|
|
|
when 2
|
|
|
|
|
parse_args(ARGV)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
#require "#{Dir.pwd}/build.rb"
|
|
|
|
|
|