Add --packaged option to docs:upload command

pull/382/head
Thibaut Courouble 9 years ago
parent 3daa54a97a
commit d389296f33

@ -56,7 +56,7 @@ module Docs
doc = const_get(const)
if version.present?
doc = doc.versions.find { |klass| klass.version == version }
doc = doc.versions.find { |klass| klass.version == version || klass.version_slug == version }
raise DocNotFound.new(%(could not find version "#{version}" for doc "#{name}"), name) unless doc
else
doc = doc.versions.first

@ -141,7 +141,9 @@ class DocsCLI < Thor
desc 'upload', '[private]'
option :dryrun, type: :boolean
option :packaged, type: :boolean
def upload(*names)
names = Dir[File.join(Docs.store_path, '*.tar.gz')].map { |f| File.basename(f, '.tar.gz') } if options[:packaged]
docs = find_docs(names)
assert_docs(docs)
docs.each do |doc|
@ -156,7 +158,7 @@ class DocsCLI < Thor
def find_docs(names)
names.map do |name|
name, version = name.split('@')
name, version = name.split(/@|~/)
Docs.find(name, version)
end
end

Loading…
Cancel
Save