-
Notifications
You must be signed in to change notification settings - Fork 0
/
kickstarter.pm
82 lines (63 loc) · 2.07 KB
/
kickstarter.pm
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
#!/usr/bin/env perl
require "$root/Daemon.pm";
require "$root/Memento/Command.pm";
package Memento::Tool::kickstarter;
use feature 'say';
our @ISA = qw(Memento::Command);
use strict; use warnings;
use Encode qw(decode);
use Cwd;
use Getopt::Long;
use Switch;
use Text::Trim;
use Data::Dumper;
our ($cwd);
$cwd = getcwd();
our(%kickstarters);
%kickstarters = (
nodejs => {
url => 'https://github.com/bmeme/docker-nodejs-kickstarter.git'
},
gatsbyjs => {
url => 'https://github.com/bmeme/gatsby-dev.git'
},
java => {
url => 'https://github.com/bmeme/docker-java-kickstarter.git'
},
drupal => {
url => 'git@gitlab.bmemelab.cloud:bmeme/development-kickstarters/drupal-kickstarter.git',
info => 'To start working with this kickstarter, take a look at: https://bonsaimeme.atlassian.net/wiki/spaces/KNOW/pages/1553694721/Creare+un+nuovo+progetto+Drupal+partendo+dal+Kickstarter'
},
perl => {
url => 'https://github.com/bmeme/docker-perl-kickstarter.git'
},
python => {
url => 'https://github.com/bmeme/docker-python-kickstarter.git'
}
);
sub info {
my $class = shift;
my $arguments = shift;
my $params = shift;
say "Choose your kickstarter and start to do magic!";
}
sub create {
my $class = shift;
my $package = shift;
my $directory = shift;
my @packages = keys %kickstarters;
if (!$package || !Daemon::in_array([@packages], $package)) {
$package = Daemon::prompt("Choose a kickstarter", 'nodejs', [@packages]);
}
my $projectUrl = $kickstarters{$package}{'url'};
if (!$directory) {
$directory = Daemon::prompt("Choose a directory name for your new project", "my-new-${package}-project");
}
Daemon::system("git clone \"${projectUrl}\" \"${directory}\"");
if ($kickstarters{$package}{'info'}) {
say Daemon::printColor($kickstarters{$package}{'info'});
};
}
# OVERRIDDEN METHODS ###########################################################
# PRIVATE METHODS ##############################################################
1;