From d389296f33532ebfcc554a60f8cdc2aab6c76755 Mon Sep 17 00:00:00 2001 From: Thibaut Courouble Date: Sun, 6 Mar 2016 17:36:12 -0500 Subject: [PATCH] Add --packaged option to docs:upload command --- lib/docs.rb | 2 +- lib/tasks/docs.thor | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/docs.rb b/lib/docs.rb index 33d54bbc..a83ed1c6 100644 --- a/lib/docs.rb +++ b/lib/docs.rb @@ -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 diff --git a/lib/tasks/docs.thor b/lib/tasks/docs.thor index f8c7af20..e727224e 100644 --- a/lib/tasks/docs.thor +++ b/lib/tasks/docs.thor @@ -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