Android Backstage, a podcast by and for Android developers. Hosted by developers from the Android engineering team, this show covers topics of interest to Android programmers, with in-depth discussions and interviews with engineers on the Android team at Google. Subscribe to Android Developers YouTube → https://goo.gle/AndroidDevs
…
continue reading
内容由HPR Volunteer and Hacker Public Radio提供。所有播客内容(包括剧集、图形和播客描述)均由 HPR Volunteer and Hacker Public Radio 或其播客平台合作伙伴直接上传和提供。如果您认为有人在未经您许可的情况下使用您的受版权保护的作品,您可以按照此处概述的流程进行操作https://zh.player.fm/legal。
Player FM -播客应用
使用Player FM应用程序离线!
使用Player FM应用程序离线!
HPR4342: How I use Git to blog on the web and gopherspace
Manage episode 473162887 series 108988
内容由HPR Volunteer and Hacker Public Radio提供。所有播客内容(包括剧集、图形和播客描述)均由 HPR Volunteer and Hacker Public Radio 或其播客平台合作伙伴直接上传和提供。如果您认为有人在未经您许可的情况下使用您的受版权保护的作品,您可以按照此处概述的流程进行操作https://zh.player.fm/legal。
First, I create a Git repository some place on the server. This is the Git repo that's going to be populated with your content, but it doesn't have to be in a world-viewable location on your server. Instead, you can place this anywhere, and then use a Git hook or a cronjob to copy files from it to a world-viewable directory. I don't cover that here. I refer to this location as the staging directory. Next, create a bare repository on your server. In its hooks directory, create a shell script called post-receive: #!/usr/bin/bash # while read oldrev newrev refname do BR=`git rev-parse --symbolic --abbrev-ref $refname` if [ "$BR" == "master" ]; then WEB_DIR="/my/staging/dir" export GIT_DIR="$WEB_DIR/.git" pushd $WEB_DIR > /dev/null git pull popd > /dev/null fi done Now when you push to your bare repository, you are triggering the post-receive script to run, which in turn triggers a git pull in your staging directory. Once your staging directory contains the content you want to distribute, you can copy them to live directories, or you could make your staging directory live (remember to exclude the .git directory though), or whatever you want. For gopher, I create a file listing by date using a shell script: #!/usr/bin/bash SED=/usr/bin/sed DIR_BASE=/my/live/dir DIR_LIVE=blog DIR_STAGING=staging DATE=${DATE:-`date --rfc-3339=date`} for POST in `find "$DIR_BASE"/"$DIR_STAGING" -type f -name "item.md" -exec grep -Hl "$DATE" {} ;`; do POSTDIR=`dirname "$POST"` cp "$POST" "$DIR_BASE"/"$DIR_LIVE"/`basename $POSTDIR`.txt echo -e 0Latest't'../"$DIR_LIVE"/`basename $POSTDIR`.txt > /tmp/updater.tmp echo -e 0"$DATE" `basename $POSTDIR`'t'../"$DIR_LIVE"/`basename $POSTDIR`.txt >> /tmp/updater.tmp "${SED}" -i "/0Latest/ r /tmp/updater.tmp" "$DIR_BASE"/date/gophermap "${SED}" -i '0,/0Latest/{/0Latest/d;}' "$DIR_BASE"/date/gophermap /usr/bin/rm /tmp/updater.tmp done
…
continue reading
4375集单集
Manage episode 473162887 series 108988
内容由HPR Volunteer and Hacker Public Radio提供。所有播客内容(包括剧集、图形和播客描述)均由 HPR Volunteer and Hacker Public Radio 或其播客平台合作伙伴直接上传和提供。如果您认为有人在未经您许可的情况下使用您的受版权保护的作品,您可以按照此处概述的流程进行操作https://zh.player.fm/legal。
First, I create a Git repository some place on the server. This is the Git repo that's going to be populated with your content, but it doesn't have to be in a world-viewable location on your server. Instead, you can place this anywhere, and then use a Git hook or a cronjob to copy files from it to a world-viewable directory. I don't cover that here. I refer to this location as the staging directory. Next, create a bare repository on your server. In its hooks directory, create a shell script called post-receive: #!/usr/bin/bash # while read oldrev newrev refname do BR=`git rev-parse --symbolic --abbrev-ref $refname` if [ "$BR" == "master" ]; then WEB_DIR="/my/staging/dir" export GIT_DIR="$WEB_DIR/.git" pushd $WEB_DIR > /dev/null git pull popd > /dev/null fi done Now when you push to your bare repository, you are triggering the post-receive script to run, which in turn triggers a git pull in your staging directory. Once your staging directory contains the content you want to distribute, you can copy them to live directories, or you could make your staging directory live (remember to exclude the .git directory though), or whatever you want. For gopher, I create a file listing by date using a shell script: #!/usr/bin/bash SED=/usr/bin/sed DIR_BASE=/my/live/dir DIR_LIVE=blog DIR_STAGING=staging DATE=${DATE:-`date --rfc-3339=date`} for POST in `find "$DIR_BASE"/"$DIR_STAGING" -type f -name "item.md" -exec grep -Hl "$DATE" {} ;`; do POSTDIR=`dirname "$POST"` cp "$POST" "$DIR_BASE"/"$DIR_LIVE"/`basename $POSTDIR`.txt echo -e 0Latest't'../"$DIR_LIVE"/`basename $POSTDIR`.txt > /tmp/updater.tmp echo -e 0"$DATE" `basename $POSTDIR`'t'../"$DIR_LIVE"/`basename $POSTDIR`.txt >> /tmp/updater.tmp "${SED}" -i "/0Latest/ r /tmp/updater.tmp" "$DIR_BASE"/date/gophermap "${SED}" -i '0,/0Latest/{/0Latest/d;}' "$DIR_BASE"/date/gophermap /usr/bin/rm /tmp/updater.tmp done
…
continue reading
4375集单集
همه قسمت ها
×欢迎使用Player FM
Player FM正在网上搜索高质量的播客,以便您现在享受。它是最好的播客应用程序,适用于安卓、iPhone和网络。注册以跨设备同步订阅。