forked from oscarotero/jquery-cheatsheet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRoboFile.php
75 lines (66 loc) · 1.71 KB
/
RoboFile.php
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
<?php
require __DIR__.'/bootstrap.php';
/**
* This is project's console commands configuration for Robo task runner.
*
* @see http://robo.li/
*/
class RoboFile extends \Robo\Tasks
{
/**
* Install all npm and bower components.
*/
public function install()
{
//npm + bower
$this->taskNpmInstall()->run();
$this->taskBowerInstall('node_modules/.bin/bower')->run();
}
/**
* Run the server.
*/
public function run()
{
$url = env('APP_CLI_SERVER_URL');
//php server
$this->taskServer(parse_url($url, PHP_URL_PORT) ?: 80)
->arg('server.php')
->background()
->run();
//gulp + browser sync
$this->taskExec('node node_modules/.bin/gulp sync')
->env([
'APP_URL' => $url,
'APP_SYNC_PORT' => 3000,
])
->run();
}
/**
* Build the site in ./build.
*/
public function build()
{
//Remove the previous building
$this->taskFilesystemStack()
->remove('build')
->mkdir('build')
->copy('source/.htaccess', 'build/.htaccess')
->run();
//Build the site
(new Site())->build($this->getOutput());
//Generate + optimize
$this->taskExec('node node_modules/.bin/gulp build')->run();
}
/**
* Publish the static site in the server using rsync
* You can configure the path connection in .env > APP_PUBLISH_RSYNC.
*/
public function publish()
{
$this->taskRsync()
->fromPath('build/')
->toPath(env('APP_PUBLISH_RSYNC'))
->recursive()
->run();
}
}