@@ -145,13 +145,18 @@ rule %r{#{$root}/gen/ext_pdf_doc/.*/adoc/.*_extension\.adoc} => proc { |tname|
145145 erb . filename = template_path . to_s
146146
147147 ext = arch_def . extension ( ext_name )
148- version_num =
149- if ENV . key? ( "EXT_VERSION" )
150- ENV [ "EXT_VERSION" ]
148+ version_strs = ENV [ "VERSION" ] . split ( "," )
149+ versions =
150+ if version_strs . include? ( "all" )
151+ ext . versions
151152 else
152- ext . versions . max { |a , b | Gem ::Version . new ( a [ "version" ] ) <=> Gem ::Version . new ( b [ "version" ] ) } [ "version" ]
153+ vs = ext . versions . select do |ext_ver |
154+ version_strs . include? ( ext_ver . version . to_s )
155+ end
156+ vs << ext . max_version if version_strs . include? ( "latest" )
157+ vs . uniq
153158 end
154- ext_version = ext . versions . find { |v | v [ " version" ] == version_num }
159+ max_version = versions . max { |a , b | a . version <=> b . version }
155160 FileUtils . mkdir_p File . dirname ( t . name )
156161 File . write t . name , AsciidocUtils . resolve_links ( arch_def . find_replace_links ( erb . result ( binding ) ) )
157162end
@@ -161,25 +166,36 @@ namespace :gen do
161166 Generate PDF documentation for :extension
162167
163168 If the extension is custom (from an arch_overlay), also give the config name
164- DESC
165- task :ext_pdf , [ :extension ] do |_t , args |
166- extension = args [ :extension ]
167169
168- Rake ::Task [ $root / "gen" / "ext_pdf_doc" / "_" / "pdf" / "#{ extension } _extension.pdf" ] . invoke
169- end
170+ Options:
170171
171- desc <<~DESC
172- Generate PDF documentation for :extension that is defined or overlayed in :cfg
172+ * EXT - The extension name
173+ * CFG - The config name, required only when an overlay is required
174+ * VERSION - A list of versions to include. May also be "all" or "latest".
175+
176+ Examples:
177+
178+ ./do gen:ext_pdf EXT=Xqci CFG=qc_iu VERSION=latest
179+ ./do gen:ext_pdf EXT=B VERSION=all
180+ ./do gen:ext_pdf EXT=B VERSION=1.0.0
181+ ./do gen:ext_pdf EXT=B VERSION=1.0.0,1.1.0
173182
174- The latest version will be used, but can be overloaded by setting the EXT_VERSION environment variable.
175183 DESC
176- task :cfg_ext_pdf , [ :extension , :cfg ] do |_t , args |
177- raise ArgumentError , "Missing required argument :extension" if args [ :extension ] . nil?
178- raise ArgumentError , "Missing required argument :cfg" if args [ :cfg ] . nil?
184+ task :ext_pdf , [ :extension ] do |_t , args |
185+ raise ArgumentError , "Missing required argument EXT" if ENV [ "EXT" ] . nil?
179186
180- extension = args [ :extension ]
187+ extension = ENV [ "EXT" ]
188+ cfg = ENV [ "CFG" ]
189+ version = ENV [ "VERSION" ]
190+
191+ versions = version . split ( "," )
192+ raise ArgumentError , "Nothing else should be specified with 'all'" if versions . include? ( "all" ) && versions . size > 1
181193
182- Rake ::Task [ $root / "gen" / "ext_pdf_doc" / args [ :cfg ] / "pdf" / "#{ extension } _extension.pdf" ] . invoke ( args )
194+ if cfg . nil?
195+ Rake ::Task [ $root / "gen" / "ext_pdf_doc" / "_" / "pdf" / "#{ extension } _extension.pdf" ] . invoke
196+ else
197+ Rake ::Task [ $root / "gen" / "ext_pdf_doc" / cfg / "pdf" / "#{ extension } _extension.pdf" ] . invoke ( args )
198+ end
183199 end
184200
185201 desc <<~DESC
0 commit comments