File tree 2 files changed +17
-11
lines changed 2 files changed +17
-11
lines changed Original file line number Diff line number Diff line change @@ -5,13 +5,4 @@ set -euo pipefail
5
5
bundle
6
6
7
7
# install ragel
8
- if [[ $( command -v ragel) == " " ]]; then
9
- if [[ $( command -v brew) != " " ]]; then
10
- brew install ragel
11
- elif [[ $( command -v apt-get) != " " ]]; then
12
- sudo apt-get install -y ragel
13
- else
14
- echo " could not install ragel, please do so manually"
15
- exit 1
16
- fi
17
- fi
8
+ rake ragel:install
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ RAGEL_SOURCE_FILES = %w[scanner] # scanner.rl imports the other files
4
4
5
5
namespace :ragel do
6
6
desc 'Process the ragel source files and output ruby code'
7
- task :rb do
7
+ task rb : :install do
8
8
RAGEL_SOURCE_FILES . each do |source_file |
9
9
output_file = "#{ RAGEL_OUTPUT_DIR } /#{ source_file } .rb"
10
10
# using faster flat table driven FSM, about 25% larger code, but about 30% faster
@@ -26,4 +26,19 @@ namespace :ragel do
26
26
sh "rm -f #{ RAGEL_OUTPUT_DIR } /#{ file } .rb"
27
27
end
28
28
end
29
+
30
+ desc 'Make sure that ragel is installed'
31
+ task :install do
32
+ if system ( 'command -v ragel' )
33
+ # already installed
34
+ elsif system ( 'command -v brew' )
35
+ puts 'ragel not found, installing with homebrew ...'
36
+ `brew install ragel`
37
+ elsif system ( 'command -v apt-get' )
38
+ puts 'ragel not found, installing with apt-get ...'
39
+ `sudo apt-get install -y ragel`
40
+ else
41
+ raise 'Could not install ragel. Please install it manually.'
42
+ end
43
+ end
29
44
end
You can’t perform that action at this time.
0 commit comments