-
Notifications
You must be signed in to change notification settings - Fork 96
Expand file tree
/
Copy pathcomp
More file actions
executable file
·63 lines (58 loc) · 1.27 KB
/
comp
File metadata and controls
executable file
·63 lines (58 loc) · 1.27 KB
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
#!/usr/bin/perl
#
# compile/make/configure various languages
# -samy kamkar
use strict;
my %files = (
'requirements.txt' => 'pip install -r requirements.txt',
'setup.py' => 'python setup.py install',
'configure' => './configure && make',
'Makefile' => 'make',
'Makefile.PL' => 'perl Makefile.PL && make',
'Rakefile' => 'rake',
'build.xml' => 'ant',
'build.gradle' => 'gradle',
'pom.xml' => 'mvn',
'build.sbt' => 'sbt',
'build.sh' => 'sh build.sh',
'build' => 'sh build',
'build.py' => 'python build.py',
'build.rb' => 'ruby build.rb',
'build.pl' => 'perl build.pl',
'build.coffee' => 'coffee build.coffee',
'build.js' => 'node build.js',
'build.go' => 'go run build.go',
'build.sh' => 'sh build.sh',
'build.php' => 'php build.php',
'build.cmd' => 'build.cmd',
'build.ps1' => 'powershell build.ps1',
'build.bat' => 'build.bat',
);
my $run;
my @files = grep -e, keys %files;
if (@files > 1)
{
foreach my $file (@files)
{
my $cmd = parse($file);
print "$file > $cmd\n";
system($cmd);
}
}
elsif (@files == 1)
{
my $cmd = parse($files[0]);
print "$files[0] > $cmd\n";
exec($cmd);
}
else
{
print "no build files found\n";
}
sub parse
{
my ($file) = @_;
my $cmd = $files{$file};
$cmd =~ s/<FILE>/$file/g;
return $cmd;
}