mirror of
https://github.com/freeCodeCamp/devdocs
synced 2024-11-16 19:48:10 +01:00
Add private thor docs:commit
This commit is contained in:
parent
3317df29c1
commit
b5d4875f48
2 changed files with 13 additions and 1 deletions
|
@ -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…
Reference in a new issue