Add private thor docs:commit

pull/382/head
Thibaut Courouble 9 years ago
parent 3317df29c1
commit b5d4875f48

@ -58,7 +58,7 @@ module Docs
if version.present?
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
elsif version != false
doc = doc.versions.first
end

@ -154,6 +154,18 @@ class DocsCLI < Thor
end
end
desc 'commit', '[private]'
option :message, type: :string
option :amend, type: :boolean
def commit(name)
doc = Docs.find(name, false)
message = options[:message] || "Update #{doc.name} documentation (#{doc.versions.map(&:release).join(', ')})"
amend = " --amend" if options[:amend]
system("git add assets/ *#{doc.slug}*") && system("git commit -m '#{message}'#{amend}")
rescue Docs::DocNotFound => error
handle_doc_not_found_error(error)
end
private
def find_docs(names)

Loading…
Cancel
Save