Unified · Split
| @@ -58,7 +58,7 @@ module Docs · 57 unmodified lines | ||
| 58 | 58 | if version.present? |
| 59 | 59 | doc = doc.versions.find { |klass| klass.version == version || klass.version_slug == version } |
| 60 | 60 | raise DocNotFound.new(%(could not find version "#{version}" for doc "#{name}"), name) unless doc |
| 61 | − else | |
| 61 | + elsif version != false | |
| 62 | 62 | doc = doc.versions.first |
| 63 | 63 | end |
| 64 | 64 | |
| @@ -154,6 +154,18 @@ class DocsCLI < Thor · 153 unmodified lines | ||
| 154 | 154 | end |
| 155 | 155 | end |
| 156 | 156 | |
| 157 | + desc 'commit', '[private]' | |
| 158 | + option :message, type: :string | |
| 159 | + option :amend, type: :boolean | |
| 160 | + def commit(name) | |
| 161 | + doc = Docs.find(name, false) | |
| 162 | + message = options[:message] || "Update #{doc.name} documentation (#{doc.versions.map(&:release).join(', ')})" | |
| 163 | + amend = " --amend" if options[:amend] | |
| 164 | + system("git add assets/ *#{doc.slug}*") && system("git commit -m '#{message}'#{amend}") | |
| 165 | + rescue Docs::DocNotFound => error | |
| 166 | + handle_doc_not_found_error(error) | |
| 167 | + end | |
| 168 | + | |
| 157 | 169 | private |
| 158 | 170 | |
| 159 | 171 | def find_docs(names) |