Skip to content

Commit e640f4f

Browse files
committed
Validate the user-specified versions to generate
We allow specifying which versions we want to generate, but without validation, we would end up with an empty list, which is not what the user meant if they mistyped a version.
1 parent e9d137f commit e640f4f

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

lib/docurium.rb

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,16 @@ def generate_docs(options)
125125
@tf = File.expand_path(File.join(File.dirname(__FILE__), 'docurium', 'layout.mustache'))
126126
versions = get_versions
127127
versions << 'HEAD'
128-
versions = versions & options[:for] unless options[:for].empty?
128+
# If the user specified versions, validate them and overwrite
129+
if !(vers = options[:for]).empty?
130+
vers.each do |v|
131+
next if versions.include?(v)
132+
puts "Unknown version #{v}"
133+
exit(false)
134+
end
135+
versions = vers
136+
end
137+
129138
nversions = versions.size
130139
output = Queue.new
131140
pipes = {}

0 commit comments

Comments
 (0)