use Rsconscript instead of Rsconsfile - close #62

This commit is contained in:
Josh Holtrop 2018-11-25 15:42:09 -05:00
parent 9975eec165
commit 1eb07e9a22
15 changed files with 164 additions and 164 deletions

View File

@ -31,7 +31,7 @@ module Rscons
module Cli module Cli
# Default files to look for to execute if none specified. # Default files to look for to execute if none specified.
DEFAULT_RSCONSFILES = %w[Rsconsfile Rsconsfile.rb] DEFAULT_RSCONSCRIPTS = %w[Rsconscript Rsconscript.rb]
class << self class << self
@ -43,14 +43,14 @@ module Rscons
# @return [void] # @return [void]
def run(argv) def run(argv)
argv = argv.dup argv = argv.dup
rsconsfile = nil rsconscript = nil
do_help = false do_help = false
OptionParser.new do |opts| OptionParser.new do |opts|
opts.banner = "Usage: #{$0} [options]" opts.banner = "Usage: #{$0} [options]"
opts.on("-f FILE") do |f| opts.on("-f FILE") do |f|
rsconsfile = f rsconscript = f
end end
opts.on("-j NTHREADS") do |n_threads| opts.on("-j NTHREADS") do |n_threads|
@ -86,24 +86,24 @@ module Rscons
end end
end end
if rsconsfile if rsconscript
unless File.exists?(rsconsfile) unless File.exists?(rsconscript)
$stderr.puts "Cannot read #{rsconsfile}" $stderr.puts "Cannot read #{rsconscript}"
exit 1 exit 1
end end
else else
rsconsfile = DEFAULT_RSCONSFILES.find do |f| rsconscript = DEFAULT_RSCONSCRIPTS.find do |f|
File.exists?(f) File.exists?(f)
end end
unless rsconsfile unless rsconscript
$stderr.puts "Could not find the Rsconsfile to execute." $stderr.puts "Could not find the Rsconscript to execute."
$stderr.puts "Looked for: #{DEFAULT_RSCONSFILES.join(", ")}" $stderr.puts "Looked for: #{DEFAULT_RSCONSCRIPTS.join(", ")}"
exit 1 exit 1
end end
end end
script = Script.new script = Script.new
script.load(rsconsfile) script.load(rsconscript)
if do_help if do_help
puts USAGE puts USAGE

File diff suppressed because it is too large Load Diff