-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstep.jam
136 lines (105 loc) · 4.03 KB
/
step.jam
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#*****************************************************************************#
# File : step.jam #
# Author : Alain Achkar #
# Summary: Rules related to a step. #
#*****************************************************************************#
#=============================================================================#
# *** G L O B A L V A R I A B L E S *** #
#=============================================================================#
#=============================================================================#
# *** P S E U D O - T A R G E T S *** #
#=============================================================================#
#=============================================================================#
# *** R U L E & A C T I O N S D E F I N I T I O N S *** #
#=============================================================================#
#-----------------------------------------------------------------------------#
# Step #
#-----------------------------------------------------------------------------#
#rule Step ( step_name : commands * )
#{
# DebugVars step_name : commands ;
#
# step_common $(step_name) : $(commands) ;
#}
#
#actions Step
#{
# #echo actions Step: $(1) ;
# #echo actions Step: $(2) ;
# #echo "bash\> $(2)"
# $(2) ;
#}
#-----------------------------------------------------------------------------#
# Sh #
#-----------------------------------------------------------------------------#
# Shell commands
rule Sh ( step_name : commands * )
{
DebugVars step_name : commands ;
step_common $(step_name) : $(commands) ;
JAMSHELL on $(step_name) = /bin/bash -c % ; # NON-INTERACTIVE SHELL
}
# The space between $(2) and ' is very important!
actions Sh
{
#!/usr/bin/env sh
echo 'bash> $(2) '
$(2)
}
# Sh interactive
rule Shi ( step_name : commands * )
{
DebugVars step_name : commands ;
step_common $(step_name) : $(commands) ;
JAMSHELL on $(step_name) = /bin/bash -i -c % ; # INTERACTIVE SHELL
}
# The space between $(2) and ' is very important!
actions Shi
{
#!/usr/bin/env sh
echo 'bash> $(2) '
echo 'Press <ENTER> to execute the command or <Ctrl-C> to abort.'
read x
$(2)
}
#-----------------------------------------------------------------------------#
# Rails #
#-----------------------------------------------------------------------------#
# Rails commands
rule Rails ( step_name : commands * )
{
DebugVars step_name : commands ;
step_common $(step_name) : $(commands) ;
# JAMSHELL on $(step_name) = $(PROJECT_ROOT)/$(RAILS_APP)/script/runner % ;
JAMSHELL on $(step_name) = /bin/bash -c % ; # NON-INTERACTIVE SHELL
}
actions Rails
{
#!/usr/bin/env $(PROJECT_ROOT)/$(RAILS_APP)/script/runner
puts 'Rails>' + <<EOF
$(2)
EOF
$(2)
}
#-----------------------------------------------------------------------------#
# RFile #
#-----------------------------------------------------------------------------#
rule RFile ( step_name : filename : commands * )
{
DebugVars step_name : filename commands ;
step_common $(step_name) : $(filename) $(commands) ;
JAMSHELL on $(step_name) = /usr/bin/evn ruby % ;
RUBY_CMDS on $(step_name) = $(commands) ;
}
actions RFile
{
#!/usr/bin/env ruby
File::open("$(PROJECT_ROOT)/$(RAILS_APP)/$(2)", "w") do |f|
f << <<CMDS_HEREDOC
$(RUBY_CMDS)
CMDS_HEREDOC
end
}
#=============================================================================#
# *** R U L E I N V O C A T I O N S *** #
#=============================================================================#