class Ki::TestVersion
Tests version from repository or metadata file @see VersionTester
Public Instance Methods
execute(ctx, args)
click to toggle source
# File lib/cmd/version_cmd.rb, line 114 def execute(ctx, args) @tester = VersionTester.new.recursive(false).print(true) ver_strs = opts.parse(args) if ver_strs.size > 0 || @tester.recursive @tester.ki_home(ctx.ki_home) versions = ver_strs.map { |v| ctx.ki_home.version(v) } else versions = [] end if @file versions.unshift Version.create_version(@file, @input_dir) end all_ok = true versions.each do |v| all_ok = all_ok && @tester.test_version(v) end if all_ok puts "All files ok." end end
help()
click to toggle source
# File lib/cmd/version_cmd.rb, line 158 def help <<EOF "#{shell_command}" tests versions, their files and their dependencies. Can also test version that has not been imported yet. ### Examples #{shell_command} -r my/product other/product #{shell_command} -f ki-version.json -i file-directory ### Parameters #{opts} EOF end
opts()
click to toggle source
# File lib/cmd/version_cmd.rb, line 135 def opts OptionParser.new do |opts| opts.banner = "" opts.on("-f", "--file FILE", "Version source file. By default uses file's directory as source for binary files.'") do |v| if @input_dir.nil? dir = File.dirname(v) @input_dir = dir != "." ? dir : Dir.pwd end @file = v end opts.on("-i", "--input-directory INPUT-DIR", "Binary file input directory") do |v| @input_dir = v end opts.on("-r", "--recursive", "Tests version's dependencies also.'") do |v| @tester.recursive = true end end end
summary()
click to toggle source
# File lib/cmd/version_cmd.rb, line 154 def summary "Tests versions and their dependencies" end