-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjam-setup.bash
executable file
·103 lines (83 loc) · 2.87 KB
/
jam-setup.bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#*****************************************************************************#
# File : jam-setup.bash #
# Author : Alain Achkar #
# Summary: Setup env vars for Jam #
#*****************************************************************************#
# #
# Usage: #
# (bash) source jam_setup.bash #
# #
#*****************************************************************************#
echo 'Setting environment for Jam to use al-jam-tools...'
if [ "$1" == "" ] ; then
echo Must specify PROJECT_ROOT as arg1
return
fi
if [ "$2" == "" ] ; then
echo Must specify RAILS_APP as arg2
return
fi
#Example:
alias js="source ~/code/al-jam-tools/jam-setup.bash ~/rails_projects/rails3-unr photos"
unset TOP
unset JAMRULES
unset JAMFILE
unset JAM_DEBUG
unset JAM_DEBUG_INCLUDED_FILES
export TOP=~/code/al-jam-tools
export JAMRULES=$TOP/rules.jam
export JAMFILE=$TOP/makefile.jam
export PROJECT_ROOT=$1
export RAILS_APP=$2
#export JAM_DEBUG=1
#export JAM_DEBUG_INCLUDED_FILES=1
echo TOP=$TOP
echo JAMRULES=$JAMRULES
echo JAMFILE=$JAMFILE
echo PROJECT_ROOT=$PROJECT_ROOT
echo RAILS_APP=$RAILS_APP
# To rename Boost Jam from bjam to jam, however, jam already exists, so I renamed it to al-jam.
# The name should not contain 'bjam' because they do a wildcard search on argv[0] to determine
# if we want to run jam or bjam
alias j='al-jam'
# Execute a step at Page <n>
# Example:
# cd ~/rails_projects/rails3-unr
# p 4
# will execute:
# rails new chapter-1
# Execute commands on Page <n>
p()
{
# The 'tail' is needed because jam seems to generate an empty line at the beginning of the output file, which messes up the shebang processing, since shebang should be on the first line. What this means is that we cannot use jam directly to execute stuff using JAMSHELL, instead we have to use this function.
# I would love to use -d0, but not only does it suppress debugging messages, it also does not generate any output using the -o to the output file!
#al-jam -d0 -o .my-cmd.tmp "$@"
al-jam -o .my-cmd.tmp "$@" && \
tail -n +2 .my-cmd.tmp > .my-cmd && \
chmod +x .my-cmd && \
./.my-cmd
}
# Execute commands on Page <n>, and submit (i.e. commit)
pp()
{
p "$@"
s "$@"
}
# Execute commands on Page <n> intercatively
i()
{
p "$@"
echo 'Press <ENTER> to continue to next command or <Ctrl-C> to abort.'
read x
}
# Submit or check-in
s()
{
export CUR_DIR=`pwd`
cd $PROJECT_ROOT
git add .
git commit -m "Page $@"
git tag -f "$@"
# git push origin master
cd $CUR_DIR
}