forked from marmbrus/xsbt-ghpages-plugin
-
Notifications
You must be signed in to change notification settings - Fork 20
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
Support for maintaining old/multiple versions of site/documents by enabling ghpagesKeepVersions flag. #39
Open
kpritam
wants to merge
6
commits into
sbt:master
Choose a base branch
from
kpritam:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
b4fc75b
Support for maintaining old versions of site by enabling ghpagesKeepV…
kpritam c70c6bd
Merge branch 'master' into master
kpritam 970061d
Add test for ghpagesKeepVersions key
kpritam a278ef7
Support automatic pointing to latest/last published version using ghp…
kpritam 73eb305
Make isSnapshot a dynamic task
kpritam d6cc02f
Statically evaluate isSnapshot
kpritam File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
*~ | ||
target/ | ||
boot/ | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
enablePlugins(GhpagesPlugin) | ||
enablePlugins(ParadoxSitePlugin) | ||
|
||
ghpagesKeepVersions := true | ||
git.remoteRepo := "git://github.com/sbt/sbt-ghpages.git" | ||
ghpagesBranch := "scripted-test" | ||
sourceDirectory in Paradox := baseDirectory.value / "src" / "main" | ||
sourceDirectory in(Paradox, paradoxTheme) := (sourceDirectory in Paradox).value / "_template" | ||
ghpagesRepository := target.value / "ghpages" | ||
paradoxTheme := None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<title>Hello · site</title> | ||
</head> | ||
<body> | ||
<h1><a href="#hello" name="hello" class="anchor"><span class="anchor-link"></span></a>Hello</h1> | ||
<p>Hello World!</p> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % sys.props("plugin.version")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<title>$page.title$ · $page.properties.("project.name")$</title> | ||
</head> | ||
<body> | ||
$page.content$ | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Hello | ||
|
||
Hello World! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
####################################################################################### | ||
# Test that site is generated in version number directory (ghpagesKeepVersions = true) | ||
####################################################################################### | ||
> 'set version := "1.0.0"' | ||
> ghpagesSynchLocal | ||
|
||
$ must-mirror target/ghpages/1.0.0/hello.html expected/hello.html | ||
# Verify files does not get generated at top level | ||
-$ must-mirror target/ghpages/hello.html expected/hello.html | ||
|
||
> 'set version := "2.0.0"' | ||
> ghpagesSynchLocal | ||
|
||
# Verify files get generated in 2.0.0 folder | ||
$ must-mirror target/ghpages/2.0.0/hello.html expected/hello.html | ||
|
||
# Verify existing versions are preserved | ||
$ must-mirror target/ghpages/1.0.0/hello.html expected/hello.html | ||
|
||
####################################################################################### | ||
# Test that site is generated in top level directory (ghpagesKeepVersions = false) | ||
####################################################################################### | ||
> 'set version := "3.0.0"' | ||
> 'set ghpagesKeepVersions := false' | ||
> ghpagesSynchLocal | ||
|
||
# Verify files get generated in top level folder when ghpagesKeepVersions flag is false | ||
$ must-mirror target/ghpages/hello.html expected/hello.html | ||
|
||
# Verify existing versions are preserved | ||
$ must-mirror target/ghpages/1.0.0/hello.html expected/hello.html | ||
$ must-mirror target/ghpages/2.0.0/hello.html expected/hello.html |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the fact that all the mappings will all be prefixed with the version number should be more emphasized.
Also, how would you recommend to do to have a page that automatically points to the latest version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For automatic pointing, we can copy latest version at top level as well as inside respective version directory. This can be filtered for snapshot versions which can reside only inside respective snapshot dirs.
We are doing exactly same here:
https://github.com/tmtsoftware/sbt-docs/blob/master/src/main/scala/org/tmt/sbt/docs/Settings.scala
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean sbt-doc or the users of sbt-doc? (Edit: sorry I meant
sbt-ghpages
)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the
GhpagesPlugin
, when creatingghpagesPrivateMapping
check can be added to detect if its a SNAPSHOT version or not and based on that generate mappings. Something like below:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sbt-doc
usesghpages
plugin, I have added workaround I mentioned above insbt-doc
plugin. As currentlyghpages
plugin does not support versioning.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. Do we want to add a setting key letting users control whether they want to have their website at the root in addition to have it prefixed by the version number?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, make sense!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have incorporated all these points in my last commit, let me know if those make sense!