Bug 766406
| Summary: | 3. Client Workflow automation - building a spec | ||
|---|---|---|---|
| Product: | [Community] PressGang CCMS | Reporter: | Joshua Wulf <jwulf> |
| Component: | CSProcessor | Assignee: | Joshua Wulf <jwulf> |
| Status: | CLOSED DUPLICATE | QA Contact: | |
| Severity: | unspecified | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 1.x | CC: | jwulf, lcarlon |
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2012-03-23 08:31:43 UTC | Type: | --- |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
| Bug Depends On: | |||
| Bug Blocks: | 766408, 766412, 766413 | ||
|
Description
Joshua Wulf
2011-12-12 00:59:04 UTC
OK, here it is:
----------------------------------------------------------------------
#!/bin/bash
SKYNETCLIENTCMD="java -jar /home/jwulf/Skynet/skynet.jar"
DIR=`pwd`
CONFFILE=csprocessor.cfg
if [ ! -f $CONFFILE ]
then
echo "Cannot find $CONFFILE. Exiting."
exit 2
else
source $CONFFILE
fi
if [ -z "$SPECID" ]
then
echo "Please set a value for SPECID in $CONFFILE"
exit 3
fi
if [ -z "$SPECNAME" ]
then
echo "Please set a value for SPECNAME in $CONFFILE"
exit 3
fi
rm -rf $SPECNAME
rm $SPECNAME.zip
$SKYNETCLIENTCMD build $SPECID
unzip $SPECNAME.zip
cd $SPECNAME
publican build --formats=html-single --langs=en-US
#google-chrome file://$DIR/$SPECNAME/tmp/en-US/html-single/index.html
xdg-open file://$DIR/$SPECNAME/tmp/en-US/html-single/index.html
----------------------------------------------------------
Here's how to set it up:
Copy the script above and put it into a file like ~/skynet/buildit.sh.
Modify the value of SKYNETCLIENTCMD in the script to point to your local installation of the skynet client.
Make it executable with "chmod 755 buildit.sh".
Edit ~/.bashrc and add a line to point to the buildit.sh script:
alias buildit='~/skynet/buildit.sh'
Reload your environment with "source ~/.bashrc"
Now create a csprocessor.cfg with the following syntax:
-----------------------------------
SPECID=14
SPECNAME=Writing_with_Topics
-----------------------------------
Then just run "buildit" in the same directory as the csprocessor.cfg file. The script will delete the previously downloaded zip and the extracted files, contact the webservice to get the latest build as a zip, extract it, build it with publican, and then open it for preview in your browser.
Enjoy!
This version will copy in a custom entities file. Just put the entities file next to the csprocessor.cfg file. Whenever you build, the custom entities file will be copied into the correct location.
-------------------------------------------------------------------
#!/bin/bash
SKYNETCLIENTCMD="java -jar /home/jwulf/Skynet/skynet.jar"
DIR=`pwd`
CONFFILE=csprocessor.cfg
if [ ! -f $CONFFILE ]
then
echo "Cannot find $CONFFILE. Exiting."
exit 2
else
source $CONFFILE
fi
if [ -z "$SPECID" ]
then
echo "Please set a value for SPECID in $CONFFILE"
exit 3
fi
if [ -z "$SPECNAME" ]
then
echo "Please set a value for SPECNAME in $CONFFILE"
exit 3
fi
rm -rf $SPECNAME
rm $SPECNAME.zip
$SKYNETCLIENTCMD build $SPECID
unzip $SPECNAME.zip
# Copy a custom entities file, if one exists next to the csprocessor.cfg file
if [ -f $SPECNAME.ent ]
then
cp $SPECNAME.ent $SPECNAME/en-US/$SPECNAME.ent
fi
cd $SPECNAME
cd $SPECNAME
publican build --formats=html-single --langs=en-US
#google-chrome file://$DIR/$SPECNAME/tmp/en-US/html-single/index.html
xdg-open file://$DIR/$SPECNAME/tmp/en-US/html-single/index.html
#!/bin/bash
SKYNETCLIENTCMD="csprocessor"
DIR=`pwd`
# Note that this script fails when the path of the current working directory contains spaces
# To fix this, a function should be added to escape characters in the xdg-open argument
CONFFILE=csprocessor.cfg
if [ ! -f $CONFFILE ]
then
echo "Cannot find $CONFFILE. Exiting."
exit 2
else
source $CONFFILE
fi
if [ -z "$SPECID" ]
then
echo "Please set a value for SPECID in $CONFFILE"
exit 3
fi
if [ -z "$SPECNAME" ]
then
echo "Please set a value for SPECNAME in $CONFFILE"
exit 3
fi
if [ -f $SPECNAME.zip ]
then
rm $SPECNAME.zip
fi
rm -rf $SPECNAME
$SKYNETCLIENTCMD build $SPECID
unzip $SPECNAME.zip
rm $SPECNAME.zip
cd $SPECNAME
publican build --formats=html-single --langs=en-US
# The command below will fail if there are spaces in the path name
# WORKAROUND: Make sure no directories in the path have spaces in them. Use _ instead
xdg-open file://$DIR/$SPECNAME/tmp/en-US/html-single/index.html
Below is a fix to allow Working Directories to have spaces in them.
#!/bin/bash
SKYNETCLIENTCMD="csprocessor"
DIR=`pwd`
CONFFILE=csprocessor.cfg
if [ ! -f $CONFFILE ]
then
echo "Cannot find $CONFFILE. Exiting."
exit 2
else
source $CONFFILE
fi
if [ -z "$SPECID" ]
then
echo "Please set a value for SPECID in $CONFFILE"
exit 3
fi
if [ -z "$SPECNAME" ]
then
echo "Please set a value for SPECNAME in $CONFFILE"
exit 3
fi
if [ -f $SPECNAME.zip ]
then
rm $SPECNAME.zip
fi
rm -rf $SPECNAME
$SKYNETCLIENTCMD build $SPECID
unzip $SPECNAME.zip
rm $SPECNAME.zip
cd $SPECNAME
publican build --formats=html-single --langs=en-US
# Open the index.html file
xdg-open "file://$DIR/$SPECNAME/tmp/en-US/html-single/index.html"
Functionality implemented by 796009 *** This bug has been marked as a duplicate of bug 796009 *** |