Skip to content

Commit 4020860

Browse files
committedApr 6, 2020
Avoid processing all html multiple times, instead skip to one version
The previous script run commands `ag` commands on rspec-github.io and not the source/lib/version folder. It means we are doing extra work everytime we generate documentation. With this change we reduce the scope of files that can be processed but also the command is much faster.
1 parent 791f593 commit 4020860

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed
 

‎Rakefile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,11 @@ task :update_docs, [:version, :branch, :website_path] do |t, args|
6565
args.with_defaults(:website_path => "../rspec.github.io")
6666
run_command "git checkout #{args[:branch]} && git pull --rebase"
6767
each_project :except => (UnDocumentedProjects + SemverUnlinkedProjects) do |project|
68+
doc_destination_path = "#{args[:website_path]}/source/documentation/#{args[:version]}/#{project}/"
6869
cmd = "bundle install && \
6970
RUBYOPT='-I#{args[:website_path]}/lib' bundle exec yard \
7071
--yardopts .yardopts \
71-
--output-dir #{args[:website_path]}/source/documentation/#{args[:version]}/#{project}/"
72+
--output-dir #{doc_destination_path}"
7273
puts cmd
7374
Bundler.unbundled_system(cmd)
7475
in_place =
@@ -78,9 +79,9 @@ task :update_docs, [:version, :branch, :website_path] do |t, args|
7879
"-i''"
7980
end
8081

81-
Bundler.unbundled_system %Q{pushd #{args[:website_path]}; ag -l src=\\"\\\(?:..\/\\\)*js | xargs -I{} sed #{in_place} 's/src="\\\(..\\\/\\\)*js/src="\\\/documentation\\\/#{args[:version]}\\\/#{project}\\\/js/' {}; popd}
82-
Bundler.unbundled_system %Q{pushd #{args[:website_path]}; ag -l href=\\"\\\(?:..\/\\\)*css | xargs -I{} sed #{in_place} 's/href="\\\(..\\\/\\\)*css/href="\\\/documentation\\\/#{args[:version]}\\\/#{project}\\\/css/' {}; popd}
83-
Bundler.unbundled_system %Q{pushd #{args[:website_path]}; ag --html -l | xargs -I{} sed #{in_place} /^[[:space:]]*$/d {}; popd}
82+
Bundler.unbundled_system %Q{ag -l src=\\"\\\(?:..\/\\\)*js #{doc_destination_path} | xargs -I{} sed #{in_place} 's/src="\\\(..\\\/\\\)*js/src="\\\/documentation\\\/#{args[:version]}\\\/#{project}\\\/js/' {}}
83+
Bundler.unbundled_system %Q{ag -l href=\\"\\\(?:..\/\\\)*css #{doc_destination_path} | xargs -I{} sed #{in_place} 's/href="\\\(..\\\/\\\)*css/href="\\\/documentation\\\/#{args[:version]}\\\/#{project}\\\/css/' {}}
84+
Bundler.unbundled_system %Q{ag --html -l . #{doc_destination_path} | xargs -I{} sed #{in_place} /^[[:space:]]*$/d {}}
8485
end
8586
end
8687

0 commit comments

Comments
 (0)
Please sign in to comment.