History

Add --packaged option to docs:upload command

Thibaut Courouble committed 10 years ago

Commit d3892961 parent 3daa54a2 files · +4 −2Browse files

Unified · Split

2 files
  1. lib/docs.rb +1 −1
  2. lib/tasks/docs.thor +3 −1
lib/docs.rb+1−1
@@ -56,7 +56,7 @@ module Docs · 55 unmodified lines
5656 doc = const_get(const)
5757
5858 if version.present?
59− doc = doc.versions.find { |klass| klass.version == version }
59+ doc = doc.versions.find { |klass| klass.version == version || klass.version_slug == version }
6060 raise DocNotFound.new(%(could not find version "#{version}" for doc "#{name}"), name) unless doc
6161 else
6262 doc = doc.versions.first
lib/tasks/docs.thor+3−1
@@ -141,7 +141,9 @@ class DocsCLI < Thor · 140 unmodified lines
141141
142142 desc 'upload', '[private]'
143143 option :dryrun, type: :boolean
144+ option :packaged, type: :boolean
144145 def upload(*names)
146+ names = Dir[File.join(Docs.store_path, '*.tar.gz')].map { |f| File.basename(f, '.tar.gz') } if options[:packaged]
145147 docs = find_docs(names)
146148 assert_docs(docs)
147149 docs.each do |doc|
@@ -156,7 +158,7 @@ class DocsCLI < Thor · 8 unmodified lines
156158
157159 def find_docs(names)
158160 names.map do |name|
159− name, version = name.split('@')
161+ name, version = name.split(/@|~/)
160162 Docs.find(name, version)
161163 end
162164 end