New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Synchronous CLI calls mix content #30
Comments
This may be due to the cache file not been cleared after running spectacle
each time. Note the `clean:html` task that specifically deletes the
previous HTML cache.
…On 13 January 2017 at 00:10, Ryan Leonard ***@***.***> wrote:
Hi,
I've been starting two Spectacle runs at the same time in a build script,
but some of the time (maybe one in four runs) one of the API pages is
wrongly embedded in the other.
[image: spectacle-embedded-obs]
<https://cloud.githubusercontent.com/assets/9272847/21912075/bd835840-d8f1-11e6-9b6a-1c69442c6d4d.png>
Censored as it's for a closed-source project (my apologies). Below
"Documentation by Spectacle", the other document starts, with the title,
schemes, and all routes.
I've paraphrased my Cakefile (CoffeeScript Make alternative).
{spawn, exec} = require "child-process-promise"replace = require "replace-in-file"chalk = require "chalk"
allSpectacle = (opts) ->
spectacleDocs opts, "#{__dirname}/src1/api/api.yml", "#{__dirname}/doc/extra/src1/api"
spectacleDocs opts, "#{__dirname}/src2/api/api.yml", "#{__dirname}/doc/extra/src2/api"
###Build API docs via ***@***.*** [Object] opts the options passed to ***@***.*** [String] spec a path to the ***@***.*** [String] out a path to the output directory###spectacleDocs = (opts, spec, out) ->
exec "$(npm bin)/spectacle #{spec} -t #{out}"
.then ->
replace
files: "#{out}/index.html"
replace: /(src|href)="\/\//g
with: "$1=\"https://"
.then ->
replace
files: "#{out}/index.html"
replace: /(src|href)="\//g
with: "$1=\""
.then ->
console.log chalk.green "Documented #{chalk.blue spec}"
I've changed my build file to run the two Spectacle compiles one after the
other which may have fixed it (tested several of times), but it does slow
the build down as Spectacle is one of the longer tasks.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#30>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAGKDOzj6TZphlGWXuJVppvZpsIjThPUks5rRrLvgaJpZM4LiWNz>
.
|
@auscaster Could the cache be changed so multiple files could be compiled at once? I've used |
Yes it that could work ... would you be interested in making a PR?
…On 13 January 2017 at 15:10, Ryan Leonard ***@***.***> wrote:
@auscaster <https://github.com/auscaster> Could the cache be changed so
multiple files could be compiled at once? I've used tmp
<https://www.npmjs.com/package/tmp> before to automatically create a
clean directory, which could be used to keep runs separate from each other.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#30 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAGKDN80-KBUgP3ODavE7zQGN-y7NRU-ks5rR4XIgaJpZM4LiWNz>
.
|
@auscaster Sure, I can give it a go. For my CLI usage, I could just change Alternatively, the grunt file ( Is one of these an acceptable approach for you? |
OK great! Lets just modify program.cacheDir if possible so there's no
regression in other parts of the app that rely on that value.
…On 13 January 2017 at 16:20, Ryan Leonard ***@***.***> wrote:
@auscaster <https://github.com/auscaster> Sure, I can give it a go.
For my CLI usage, I could just change program.cacheDir = os.tmpdir() +
'/.spectacle'; in bin/spectacle.js to use the tmp package.
Alternatively, the grunt file (index.js) could be altered to generate
unique filenames inside .spectacle, or call tmp internally instead of
being passed a temporary directory.
Is one of these an acceptable approach for you?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#30 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAGKDIBE0XGtRG9_RS1ProMM_fTss2ZFks5rR5YmgaJpZM4LiWNz>
.
|
@auscaster I've created a PR. It looks like the latest release wasn't pushed to GitHub, so you may want to do that before merging. Thanks! |
Thanks again, npm package updated |
You're welcome, thanks for the quick merge! Looks like something might have broken in the testing, I didn't see the tests. |
@auscaster Not just testing, it's failing an assertion. I'll take a look into it. |
Bug fix toc and links
Hi,
I've been starting two Spectacle runs on different files at the same time in a build script, but some of the time (maybe one in four runs) one of the API pages is wrongly embedded in the other.
Censored as it's for a closed-source project (my apologies). Below "Documentation by Spectacle", the other document starts, with the title, schemes, and all routes.
I've paraphrased my Cakefile (CoffeeScript Make alternative).
I've changed my build file to run the two Spectacle compiles one after the other which may have fixed it (tested several of times), but it does slow the build down as Spectacle is one of the longer tasks.
The text was updated successfully, but these errors were encountered: