File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ def self.find(name, version = nil)
5858 if version . present?
5959 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
61- else
61+ elsif version != false
6262 doc = doc . versions . first
6363 end
6464
Original file line number Diff line number Diff line change @@ -154,6 +154,18 @@ class DocsCLI < Thor
154154 end
155155 end
156156
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+
157169 private
158170
159171 def find_docs ( names )
You can’t perform that action at this time.
0 commit comments