/
maglev
136 lines (96 loc) · 3.36 KB
/
maglev
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
136
#!/usr/bin/env bash
maglev_install()
{
__rvm_ensure_has_18_compat_ruby
rvm_log "Running MagLev prereqs checking script."
"$rvm_scripts_path/maglev"
result=$?
if (( result > 0 ))
then
rvm_error "Prerequisite checks have failed. \nHalting the installation."
exit $result
fi
builtin cd "${rvm_src_path}"
true ${rvm_force_flag:=0}
if [[ ! -d "${rvm_src_path}/$rvm_ruby_string" ]] || (( rvm_force_flag == 1 ))
then
__rvm_rm_rf "${rvm_src_path}/$rvm_ruby_string/"
__rvm_fetch_ruby
result=$?
if (( result > 0 ))
then
rvm_error "There has been an error while trying to fetch the source. \nHalting the installation."
exit $result
fi
fi
if (( ${rvm_head_flag:=0} == 1 ))
then
builtin cd "${rvm_src_path}/$rvm_ruby_string"
rvm_gemstone_package_file="GemStone-$(\grep ^GEMSTONE version.txt | cut -f2 -d-).$(uname -sm | \tr ' ' '-')"
rvm_gemstone_url="$maglev_url/${rvm_gemstone_package_file}.${rvm_archive_extension}"
fi
rvm_log "Downloading the GemStone package, this may take a while depending on your connection..."
"$rvm_scripts_path/fetch" "$rvm_gemstone_url"
result=$?
if (( result > 0 ))
then
rvm_error "There has been an error while trying to fetch the GemStone package.\nHalting the installation."
exit $result
fi
builtin cd "${rvm_src_path}"
if [[ -s "$rvm_ruby_package_file" ]]
then
mv "$rvm_ruby_package_file" "${rvm_src_path}/$rvm_ruby_string"
fi
builtin cd "${rvm_src_path}/$rvm_ruby_string"
__rvm_run "gemstone.extract" \
"gunzip < \"${rvm_archives_path}/${rvm_gemstone_package_file}.${rvm_archive_extension}\" | tar xf - -C ${rvm_src_path}/$rvm_ruby_string --no-same-owner"
result=$?
if (( result > 0 ))
then
rvm_error "There has been an error while trying to extract the GemStone package. \nHalting the installation."
exit $result
fi
ln -fs "$rvm_gemstone_package_file" "gemstone"
__rvm_rm_rf $rvm_ruby_home
__rvm_run "install" \
"/bin/cp -Rf ${rvm_src_path}/$rvm_ruby_string $rvm_ruby_home" \
"Installing maglev to $rvm_ruby_home"
(
builtin cd "$rvm_ruby_home/bin/"
for binary in maglev-irb maglev-ruby maglev-gem
do
ln -fs "$binary" "${binary#maglev-}"
done
unset binary
)
binaries=(maglev-ruby maglev-irb maglev-gem)
for binary in "${binaries[@]}"
do
__rvm_inject_gem_env "$rvm_ruby_home/bin/$binary"
done
builtin cd "$rvm_ruby_home"
if (( ${rvm_head_flag:=0} == 1 ))
then
git submodule update --init
"$rvm_ruby_home/bin/maglev" force-reload
ln -sf maglev.demo.key-$(uname -sm | \tr ' ' '-') etc/maglev.demo.key
fi
#ln -fs "$rvm_ruby_home/$(echo $rvm_gemstone_package_file | awk -F'.' '{print $1}')" "$rvm_ruby_home/gemstone"
compatible_ruby="$(__rvm_18_compat_ruby)"
if [[ ! -e ${rvm_ruby_home}/etc/conf.d/maglev.conf ]]
then
rvm_log "Creating default 'maglev' repository."
"$rvm_wrappers_path/$compatible_ruby/rake" "stone:create[maglev]" >/dev/null 2>&1
fi
rvm_log "Generating maglev HTML documentation"
"$rvm_wrappers_path/$compatible_ruby/rake" rdoc >/dev/null 2>&1
rvm_log "Generating smalltalk FFI."
"$rvm_wrappers_path/$compatible_ruby/rake" stwrappers >/dev/null 2>&1
unset compatible_ruby
# MagLev comes with RubyGems preinstalled -- don't try to install it
# "$rvm_scripts_path/rubygems" latest
__rvm_irbrc
__rvm_bin_script
__rvm_use
}