Skip to content

Commit 954ff47

Browse files
committed
Add command to generate doc if last release is available
For exemple with: ```sh $ bundle exec rake "update_docs[4.0, 4-0-maintenance]" ``` We only have rspec-rails with a v4.0.0 version at the moment, so the command will generate documentation only for `rspec-rails` 4.0 documentation, other rspec gem will be skipped. If we run: ```sh $ bundle exec rake "update_docs[3.9, 3-9-maintenance]" ``` Every last 3.x release version of documented rspec gems will have their documentation re-generated.
1 parent 8050208 commit 954ff47

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

Rakefile

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ require 'erb'
88

99
Projects = ['rspec', 'rspec-core', 'rspec-expectations', 'rspec-mocks', 'rspec-rails', 'rspec-support']
1010
UnDocumentedProjects = %w[ rspec rspec-support ]
11-
SemverUnlinkedProjects = ['rspec-rails']
1211
BaseRspecPath = Pathname.new(Dir.pwd)
1312
ReposPath = BaseRspecPath.join('repos')
1413

@@ -63,8 +62,14 @@ desc "Updates the rspec.github.io docs"
6362
task :update_docs, [:version, :branch, :website_path] do |t, args|
6463
abort "You must have ag installed to generate docs" if `which ag` == ""
6564
args.with_defaults(:website_path => "../rspec.github.io")
66-
run_command "git fetch --tags && git checkout `git tag | grep #{args[:version]} | tail -1`"
67-
each_project :except => (UnDocumentedProjects + SemverUnlinkedProjects) do |project|
65+
each_project :except => (UnDocumentedProjects) do |project|
66+
latest_release = `git tag | grep '^v\\\d.\\\d.\\\d$' | grep v#{args[:version]} | tail -1`
67+
68+
if latest_release.empty?
69+
next "No release found for #{args[:version]} in #{`pwd`}"
70+
end
71+
72+
`git fetch --tags && git checkout #{latest_release}`
6873
doc_destination_path = "#{args[:website_path]}/source/documentation/#{args[:version]}/#{project}/"
6974
cmd = "bundle install && \
7075
RUBYOPT='-I#{args[:website_path]}/lib' bundle exec yard \

0 commit comments

Comments
 (0)