Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
marlin-anet-a8
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jonas Leder
marlin-anet-a8
Commits
dd436cee
Commit
dd436cee
authored
8 years ago
by
Scott Lahteine
Browse files
Options
Downloads
Patches
Plain Diff
Add 'mfdoc' and 'mfpub' scripts to help with documentation
parent
78308b1c
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
buildroot/share/git/mfdoc
+48
-0
48 additions, 0 deletions
buildroot/share/git/mfdoc
buildroot/share/git/mfinfo
+3
-2
3 additions, 2 deletions
buildroot/share/git/mfinfo
buildroot/share/git/mfpub
+90
-0
90 additions, 0 deletions
buildroot/share/git/mfpub
with
141 additions
and
2 deletions
buildroot/share/git/mfdoc
0 → 100755
+
48
−
0
View file @
dd436cee
#!/usr/bin/env bash
#
# mfdoc
#
# Start Jekyll in watch mode to work on Marlin Documentation and preview locally
#
MFINFO
=
$(
mfinfo
"
$@
"
)
||
exit
IFS
=
' '
read
-a
INFO
<<<
"
$MFINFO
"
ORG
=
${
INFO
[0]
}
REPO
=
${
INFO
[2]
}
BRANCH
=
${
INFO
[4]
}
if
[[
$ORG
!=
"MarlinFirmware"
||
$REPO
!=
"MarlinDocumentation"
]]
;
then
echo
"Wrong repository."
exit
fi
if
[[
$BRANCH
!=
"master"
]]
;
then
echo
"Stashing changes and changing to master."
git stash
git checkout master
fi
opensite
()
{
TOOL
=
$(
which gnome-open xdg-open open |
awk
'{ print $1 }'
)
URL
=
"http://127.0.0.1:4000/"
if
[
-z
"
$TOOL
"
]
;
then
echo
"Can't find a tool to open the URL:"
echo
$URL
else
echo
"Opening preview site in the browser..."
"
$TOOL
"
"
$URL
"
fi
}
echo
"Previewing MarlinDocumentation..."
# wait to open the url for about 8s
(
sleep
8
;
opensite
)
&
bundle
exec
jekyll serve
--watch
--incremental
if
[[
$BRANCH
!=
"master"
]]
;
then
echo
"Restoring branch '
$BRANCH
'"
git checkout
$BRANCH
git stash pop
fi
This diff is collapsed.
Click to expand it.
buildroot/share/git/mfinfo
+
3
−
2
View file @
dd436cee
...
@@ -27,6 +27,7 @@ fi
...
@@ -27,6 +27,7 @@ fi
case
"
$REPO
"
in
case
"
$REPO
"
in
Marlin
)
TARG
=
RCBugFix
;;
Marlin
)
TARG
=
RCBugFix
;;
MarlinDev
)
TARG
=
dev
;;
MarlinDev
)
TARG
=
dev
;;
MarlinDocumentation
)
TARG
=
master
;;
esac
esac
FORK
=
$(
git remote get-url origin 2>/dev/null |
sed
-E
's/.*[\/:](.*)\/.*$/\1/'
)
FORK
=
$(
git remote get-url origin 2>/dev/null |
sed
-E
's/.*[\/:](.*)\/.*$/\1/'
)
...
...
This diff is collapsed.
Click to expand it.
buildroot/share/git/mfpub
0 → 100755
+
90
−
0
View file @
dd436cee
#!/usr/bin/env bash
#
# mfpub
#
# Use Jekyll to publish Marlin Documentation to the HTML site
#
MFINFO
=
$(
mfinfo
"
$@
"
)
||
exit
IFS
=
' '
read
-a
INFO
<<<
"
$MFINFO
"
ORG
=
${
INFO
[0]
}
FORK
=
${
INFO
[1]
}
REPO
=
${
INFO
[2]
}
TARG
=
${
INFO
[3]
}
BRANCH
=
${
INFO
[4]
}
if
[[
$ORG
!=
"MarlinFirmware"
||
$REPO
!=
"MarlinDocumentation"
]]
;
then
echo
"Wrong repository."
exit
fi
if
[[
$BRANCH
==
"gh-pages"
]]
;
then
echo
"Can't build from 'gh-pages.' Only the Jekyll branches."
bundle
exec
jekyll serve
--watch
exit
fi
if
[[
$BRANCH
!=
"master"
]]
;
then
echo
"Don't forget to update and push 'master'!"
fi
git checkout
$BRANCH
echo
"Generating MarlinDocumentation..."
# GOJF Card
git stash
TMPFOLDER
=
$(
mktemp
-d
)
COMMIT
=
$(
git log
--format
=
"%H"
-n
1
)
# Clean out changes and other junk in the branch
git reset
--hard
git clean
-d
-f
# Push 'master' to the fork and make a proper PR...
if
[[
$BRANCH
==
"master"
]]
;
then
if
[
-z
"
$(
git branch
-vv
|
grep
^
\*
|
grep
\\
[
origin
)
"
]
;
then
firstpush
;
fi
git push
-f
origin
TOOL
=
$(
which gnome-open xdg-open open |
awk
'{ print $1 }'
)
URL
=
"https://github.com/
$ORG
/
$REPO
/compare/
$TARG
...
$FORK
:
$BRANCH
?expand=1"
if
[
-z
"
$TOOL
"
]
;
then
echo
"Can't find a tool to open the URL:"
echo
$URL
else
echo
"Opening a New PR Form..."
"
$TOOL
"
"
$URL
"
fi
fi
# Uncomment to compress the final html files
# mv ./_plugins/jekyll-press.rb-disabled ./_plugins/jekyll-press.rb
# bundle install
bundle
exec
jekyll build
--profile
--trace
--no-watch
bundle
exec
htmlproofer ./_site
--only-4xx
--allow-hash-href
--check-favicon
--check-html
--url-swap
".*marlinfw.org/:/"
rsync
-av
_site/
${
TMPFOLDER
}
/
# Clean out changes and other junk in the branch
git reset
--hard
git clean
-d
-f
# Sync built-site with gh-pages
git checkout gh-pages
rsync
-av
${
TMPFOLDER
}
/ ./
# Commit and push the new live site directly
git add
--all
git commit
--message
"Built from
${
COMMIT
}
"
git push upstream
rm
-rf
${
TMPFOLDER
}
# Go back to the branch we started from
git checkout
$BRANCH
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment