2015-06-07 19:41:54 +00:00
|
|
|
#!/usr/bin/env ruby
|
|
|
|
# Copyright 2015 Dominik Richter. All rights reserved.
|
|
|
|
|
|
|
|
require 'thor'
|
|
|
|
require 'json'
|
|
|
|
require_relative '../lib/vulcano'
|
2015-06-19 14:45:36 +00:00
|
|
|
require_relative '../lib/verify'
|
2015-06-07 19:41:54 +00:00
|
|
|
|
|
|
|
class VulcanoCLI < Thor
|
|
|
|
|
|
|
|
desc "json PATH", "read all tests in PATH and generate a JSON-profile"
|
|
|
|
option :output, aliases: :o, type: :string
|
|
|
|
option :print, aliases: :p, type: :boolean
|
|
|
|
def json(*paths)
|
|
|
|
paths.each do |path|
|
2015-06-10 15:54:35 +00:00
|
|
|
Vulcano::Profiles.new.valid_folder? path unless options[:print]
|
2015-06-07 19:41:54 +00:00
|
|
|
vc = Vulcano::Profiles.new({ quiet: options[:print] })
|
|
|
|
vc.add_folder(path)
|
|
|
|
if options[:print]
|
|
|
|
puts JSON.pretty_generate( vc.profiles )
|
|
|
|
else
|
|
|
|
dst = options[:output] || File.join( path, '.vulcano.json' )
|
|
|
|
if File::exist? dst
|
|
|
|
puts "----> updating #{dst}"
|
|
|
|
else
|
|
|
|
puts "----> creating #{dst}"
|
|
|
|
end
|
|
|
|
fdst = File::expand_path(dst)
|
|
|
|
File::write(fdst, JSON.dump(vc.profiles))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-06-10 15:03:12 +00:00
|
|
|
desc "check PATH", "check all tests in PATH"
|
|
|
|
def check(*paths)
|
|
|
|
paths.each do |path|
|
|
|
|
puts "#{path}"
|
|
|
|
Vulcano::Profiles.new.valid_folder? path
|
|
|
|
puts
|
|
|
|
end
|
|
|
|
end
|
2015-06-07 19:41:54 +00:00
|
|
|
|
|
|
|
end
|
|
|
|
VulcanoCLI.start(ARGV)
|