forked from metabase/metabase
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathosx-setup
executable file
·40 lines (30 loc) · 1.18 KB
/
osx-setup
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
#! /usr/bin/env perl -I./bin
use strict;
use warnings;
use Cwd 'getcwd';
use File::Copy 'copy';
use File::Copy::Recursive 'rcopy';
use File::Find 'find';
use File::Path 'remove_tree';
use String::Util 'trim';
use Metabase::Util;
use constant JRE_DEST => getcwd() . '/OSX/Metabase/jre';
use constant JRE_HOME => trim(`/usr/libexec/java_home`) . '/jre';
use constant UBERJAR_SRC => getcwd() . '/target/uberjar/metabase.jar';
use constant UBERJAR_DEST => getcwd() . '/OSX/Resources/metabase.jar';
use constant RESET_PW_SRC => getcwd() . '/reset-password-artifacts/reset-password/reset-password.jar';
use constant RESET_PW_DEST => getcwd() . '/OSX/Resources/reset-password.jar';
# Copy the JRE if needed
(rcopy(JRE_HOME, JRE_DEST) or die $!) unless -d JRE_DEST;
# Build jars if needed
(system('./bin/build') or die $!) unless -f UBERJAR_SRC;
(system('lein', 'with-profile', 'reset-password', 'jar') or die $!) unless -f RESET_PW_SRC;
# Copy jars over
sub copy_jar {
my ($src, $dest) = @_;
announce 'Copying jar ' . $src . ' -> ' . $dest;
copy(get_file_or_die($src), $dest) or die $!;
}
copy_jar(UBERJAR_SRC, UBERJAR_DEST);
copy_jar(RESET_PW_SRC, RESET_PW_DEST);
print_giant_success_banner();