vagrant-yarrs-and-yamls 0.8.3 → 0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +13 -5
- data/Gemfile +2 -0
- data/README.md +58 -11
- data/Yarrs.example.yaml +20 -0
- data/example.Vagrantfile +2 -8
- data/lib/scripts/apache2.sh +34 -0
- data/lib/scripts/apache2_ssl.sh +24 -0
- data/lib/scripts/base.sh +32 -0
- data/lib/scripts/composer.sh +28 -0
- data/lib/scripts/deploy.sh +38 -0
- data/lib/scripts/deploy_init.sh +11 -0
- data/lib/scripts/export_vars.sh +16 -0
- data/lib/scripts/git.sh +11 -0
- data/lib/scripts/hhvm.sh +33 -0
- data/lib/scripts/install-nodejs-modules.sh +19 -0
- data/lib/scripts/mariadb.sh +35 -0
- data/lib/scripts/mysql-create-databases.sh +19 -0
- data/lib/scripts/mysql.sh +28 -0
- data/lib/scripts/mysql_client.sh +22 -0
- data/lib/scripts/newrelic_php.sh +37 -0
- data/lib/scripts/nginx.sh +26 -0
- data/lib/scripts/nginx_site.sh +27 -0
- data/lib/scripts/nodejs.sh +24 -0
- data/lib/scripts/nvm.sh +30 -0
- data/lib/scripts/permissions.sh +18 -0
- data/lib/scripts/php.sh +25 -0
- data/lib/scripts/php_configure.sh +18 -0
- data/lib/scripts/php_xdebug.sh +18 -0
- data/lib/scripts/phpbrew.sh +11 -0
- data/lib/scripts/postfix.sh +13 -0
- data/lib/scripts/pubkeys.sh +35 -0
- data/lib/scripts/rvm.sh +35 -0
- data/lib/scripts/test.sh +48 -0
- data/lib/scripts/tz.sh +8 -0
- data/lib/scripts/wp_env.sh +16 -0
- data/lib/scripts/wpcli.sh +27 -0
- data/lib/templates/apache2.conf +151 -0
- data/lib/templates/apache2_vhost_http.conf +8 -0
- data/lib/templates/apache2_vhost_https.conf +16 -0
- data/lib/templates/apache2_vhost_redirect_http.conf +17 -0
- data/lib/templates/apache2_vhost_redirect_https.conf +18 -0
- data/lib/templates/gitconfig.conf +32 -0
- data/lib/templates/logrotate.conf +14 -0
- data/lib/templates/nginx.conf +56 -0
- data/lib/templates/nginx_vhost.erb +45 -0
- data/lib/templates/proxy_params.conf +3 -0
- data/lib/templates/xdebug.ini +6 -0
- data/lib/vagrant-yarrs-and-yamls/api.rb +423 -0
- data/lib/vagrant-yarrs-and-yamls/plugin.rb +4 -48
- data/lib/vagrant-yarrs-and-yamls/version.rb +1 -1
- data/vagrant-yarrs-and-yamls.gemspec +1 -1
- metadata +51 -8
- data/example.Vagrantfile.yml +0 -8
- data/lib/vagrant-yarrs-and-yamls/v1.rb +0 -234
data/lib/scripts/tz.sh
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
|
|
3
|
+
echo "wp_env.sh: provisioning starts"
|
|
4
|
+
|
|
5
|
+
$ENV_PATH=/var/www/.env
|
|
6
|
+
|
|
7
|
+
# get the value of WP_ENV or die
|
|
8
|
+
if [ -f $ENV_PATH ]; then
|
|
9
|
+
source $ENV_PATH 2> /dev/null
|
|
10
|
+
echo $WP_ENV
|
|
11
|
+
else
|
|
12
|
+
echo "WP_ENV not defined yet."
|
|
13
|
+
exit 1
|
|
14
|
+
fi
|
|
15
|
+
|
|
16
|
+
echo "wp_env.sh: provisioning ends"
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
|
|
3
|
+
echo "wpcli.sh: provisioning starts"
|
|
4
|
+
|
|
5
|
+
# check prereq
|
|
6
|
+
if ! which php > /dev/null 2>&1; then
|
|
7
|
+
echo "wpcli.sh: php not installed :/" 1>&2
|
|
8
|
+
exit 1
|
|
9
|
+
fi
|
|
10
|
+
|
|
11
|
+
# wp-cli
|
|
12
|
+
if ! which wp > /dev/null 2>&1; then
|
|
13
|
+
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
|
|
14
|
+
sudo chmod +x wp-cli.phar
|
|
15
|
+
sudo mv wp-cli.phar /usr/local/bin/wp
|
|
16
|
+
sudo chown root: /usr/local/bin/composer
|
|
17
|
+
fi
|
|
18
|
+
|
|
19
|
+
if ! which wp > /dev/null 2>&1; then
|
|
20
|
+
echo "wpcli.sh: wp-cli failed to install :/" 1>&2
|
|
21
|
+
exit 1
|
|
22
|
+
fi
|
|
23
|
+
|
|
24
|
+
echo "-+-+-+- software versions:"
|
|
25
|
+
wp --version --allow-root
|
|
26
|
+
|
|
27
|
+
echo "wpcli.sh: provisioning ends"
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
# This is the main Apache server configuration file. It contains the
|
|
2
|
+
# configuration directives that give the server its instructions.
|
|
3
|
+
# See http://httpd.apache.org/docs/2.4/ for detailed information about
|
|
4
|
+
# the directives and /usr/share/doc/apache2/README.Debian about Debian specific
|
|
5
|
+
# hints.
|
|
6
|
+
|
|
7
|
+
# Global configuration
|
|
8
|
+
#
|
|
9
|
+
|
|
10
|
+
#
|
|
11
|
+
# The accept serialization lock file MUST BE STORED ON A LOCAL DISK.
|
|
12
|
+
#
|
|
13
|
+
Mutex file:${APACHE_LOCK_DIR} default
|
|
14
|
+
|
|
15
|
+
#
|
|
16
|
+
# PidFile: The file in which the server should record its process
|
|
17
|
+
# identification number when it starts.
|
|
18
|
+
# This needs to be set in /etc/apache2/envvars
|
|
19
|
+
#
|
|
20
|
+
PidFile ${APACHE_PID_FILE}
|
|
21
|
+
|
|
22
|
+
#
|
|
23
|
+
# Timeout: The number of seconds before receives and sends time out.
|
|
24
|
+
#
|
|
25
|
+
Timeout 300
|
|
26
|
+
|
|
27
|
+
#
|
|
28
|
+
# KeepAlive: Whether or not to allow persistent connections (more than
|
|
29
|
+
# one request per connection). Set to "Off" to deactivate.
|
|
30
|
+
#
|
|
31
|
+
KeepAlive On
|
|
32
|
+
|
|
33
|
+
#
|
|
34
|
+
# MaxKeepAliveRequests: The maximum number of requests to allow
|
|
35
|
+
# during a persistent connection. Set to 0 to allow an unlimited amount.
|
|
36
|
+
# We recommend you leave this number high, for maximum performance.
|
|
37
|
+
#
|
|
38
|
+
MaxKeepAliveRequests 100
|
|
39
|
+
|
|
40
|
+
#
|
|
41
|
+
# KeepAliveTimeout: Number of seconds to wait for the next request from the
|
|
42
|
+
# same client on the same connection.
|
|
43
|
+
#
|
|
44
|
+
KeepAliveTimeout 5
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
# These need to be set in /etc/apache2/envvars
|
|
48
|
+
User ${APACHE_RUN_USER}
|
|
49
|
+
Group ${APACHE_RUN_GROUP}
|
|
50
|
+
|
|
51
|
+
#
|
|
52
|
+
# HostnameLookups: Log the names of clients or just their IP addresses
|
|
53
|
+
# e.g., www.apache.org (on) or 204.62.129.132 (off).
|
|
54
|
+
# The default is off because it'd be overall better for the net if people
|
|
55
|
+
# had to knowingly turn this feature on, since enabling it means that
|
|
56
|
+
# each client request will result in AT LEAST one lookup request to the
|
|
57
|
+
# nameserver.
|
|
58
|
+
#
|
|
59
|
+
HostnameLookups Off
|
|
60
|
+
|
|
61
|
+
# ErrorLog: The location of the error log file.
|
|
62
|
+
# If you do not specify an ErrorLog directive within a <VirtualHost>
|
|
63
|
+
# container, error messages relating to that virtual host will be
|
|
64
|
+
# logged here. If you *do* define an error logfile for a <VirtualHost>
|
|
65
|
+
# container, that host's errors will be logged there and not here.
|
|
66
|
+
#
|
|
67
|
+
ErrorLog ${APACHE_LOG_DIR}/error.log
|
|
68
|
+
|
|
69
|
+
#
|
|
70
|
+
# LogLevel: Control the severity of messages logged to the error_log.
|
|
71
|
+
# Available values: trace8, ..., trace1, debug, info, notice, warn,
|
|
72
|
+
# error, crit, alert, emerg.
|
|
73
|
+
# It is also possible to configure the log level for particular modules, e.g.
|
|
74
|
+
# "LogLevel info ssl:warn"
|
|
75
|
+
#
|
|
76
|
+
LogLevel warn
|
|
77
|
+
|
|
78
|
+
# Include module configuration:
|
|
79
|
+
IncludeOptional mods-enabled/*.load
|
|
80
|
+
IncludeOptional mods-enabled/*.conf
|
|
81
|
+
|
|
82
|
+
# Include list of ports to listen on
|
|
83
|
+
Include ports.conf
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
# Sets the default security model of the Apache2 HTTPD server. It does
|
|
87
|
+
# not allow access to the root filesystem outside of /usr/share and /var/www.
|
|
88
|
+
# The former is used by web applications packaged in Debian,
|
|
89
|
+
# the latter may be used for local directories served by the web server. If
|
|
90
|
+
# your system is serving content from a sub-directory in /srv you must allow
|
|
91
|
+
# access here, or in any related virtual host.
|
|
92
|
+
<Directory />
|
|
93
|
+
Options FollowSymLinks
|
|
94
|
+
AllowOverride None
|
|
95
|
+
Require all denied
|
|
96
|
+
</Directory>
|
|
97
|
+
|
|
98
|
+
<Directory /usr/share>
|
|
99
|
+
AllowOverride None
|
|
100
|
+
Require all granted
|
|
101
|
+
</Directory>
|
|
102
|
+
|
|
103
|
+
<Directory /var/www/web>
|
|
104
|
+
Options Indexes FollowSymLinks
|
|
105
|
+
AllowOverride All
|
|
106
|
+
Require all granted
|
|
107
|
+
</Directory>
|
|
108
|
+
|
|
109
|
+
# AccessFileName: The name of the file to look for in each directory
|
|
110
|
+
# for additional configuration directives. See also the AllowOverride
|
|
111
|
+
# directive.
|
|
112
|
+
#
|
|
113
|
+
AccessFileName .htaccess
|
|
114
|
+
|
|
115
|
+
#
|
|
116
|
+
# The following lines prevent .htaccess and .htpasswd files from being
|
|
117
|
+
# viewed by Web clients.
|
|
118
|
+
#
|
|
119
|
+
<FilesMatch "^\.ht">
|
|
120
|
+
Require all denied
|
|
121
|
+
</FilesMatch>
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
#
|
|
125
|
+
# The following directives define some format nicknames for use with
|
|
126
|
+
# a CustomLog directive.
|
|
127
|
+
#
|
|
128
|
+
# These deviate from the Common Log Format definitions in that they use %O
|
|
129
|
+
# (the actual bytes sent including headers) instead of %b (the size of the
|
|
130
|
+
# requested file), because the latter makes it impossible to detect partial
|
|
131
|
+
# requests.
|
|
132
|
+
#
|
|
133
|
+
# Note that the use of %{X-Forwarded-For}i instead of %h is not recommended.
|
|
134
|
+
# Use mod_remoteip instead.
|
|
135
|
+
#
|
|
136
|
+
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
|
|
137
|
+
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
|
|
138
|
+
LogFormat "%h %l %u %t \"%r\" %>s %O" common
|
|
139
|
+
LogFormat "%{Referer}i -> %U" referer
|
|
140
|
+
LogFormat "%{User-agent}i" agent
|
|
141
|
+
|
|
142
|
+
# Include of directories ignores editors' and dpkg's backup files,
|
|
143
|
+
# see README.Debian for details.
|
|
144
|
+
|
|
145
|
+
# Include generic snippets of statements
|
|
146
|
+
IncludeOptional conf-enabled/*.conf
|
|
147
|
+
|
|
148
|
+
# Include the virtual host configurations:
|
|
149
|
+
IncludeOptional sites-enabled/*.conf
|
|
150
|
+
|
|
151
|
+
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
|
|
2
|
+
<VirtualHost _default_:443>
|
|
3
|
+
DocumentRoot /var/www/web
|
|
4
|
+
ErrorLog ${APACHE_LOG_DIR}/https_error.log
|
|
5
|
+
CustomLog ${APACHE_LOG_DIR}/https_access.log combined
|
|
6
|
+
|
|
7
|
+
ServerName devagency.co
|
|
8
|
+
|
|
9
|
+
SSLEngine on
|
|
10
|
+
SSLProtocol all
|
|
11
|
+
SSLCertificateFile /etc/apache2/ssl/public.crt
|
|
12
|
+
SSLCertificateKeyFile /etc/apache2/ssl/private.key
|
|
13
|
+
SSLCertificateChainFile /etc/apache2/ssl/intermediate.crt
|
|
14
|
+
</VirtualHost>
|
|
15
|
+
|
|
16
|
+
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
<VirtualHost _default_:443>
|
|
3
|
+
DocumentRoot /var/www/web
|
|
4
|
+
ErrorLog ${APACHE_LOG_DIR}/error.log
|
|
5
|
+
CustomLog ${APACHE_LOG_DIR}/access.log combined
|
|
6
|
+
|
|
7
|
+
RewriteEngine on
|
|
8
|
+
RewriteCond %{HTTPS} == on
|
|
9
|
+
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
|
|
10
|
+
</VirtualHost>
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
<VirtualHost _default_:80>
|
|
14
|
+
RedirectMatch 301 "http://%{HTTP_HOST}%{REQUEST_URI}" [L,R=301]
|
|
15
|
+
</VirtualHost>
|
|
16
|
+
|
|
17
|
+
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
|
|
2
|
+
<VirtualHost _default_:80>
|
|
3
|
+
DocumentRoot /var/www/web
|
|
4
|
+
ErrorLog ${APACHE_LOG_DIR}/error.log
|
|
5
|
+
CustomLog ${APACHE_LOG_DIR}/access.log combined
|
|
6
|
+
|
|
7
|
+
ServerName devagency.co
|
|
8
|
+
|
|
9
|
+
RewriteEngine on
|
|
10
|
+
RewriteCond %{HTTPS} !=on
|
|
11
|
+
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
|
|
12
|
+
</VirtualHost>
|
|
13
|
+
|
|
14
|
+
<VirtualHost _default_:80>
|
|
15
|
+
Redirect "/" "https://%{HTTP_HOST}%{REQUEST_URI}"
|
|
16
|
+
</VirtualHost>
|
|
17
|
+
|
|
18
|
+
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
[push]
|
|
2
|
+
default = current
|
|
3
|
+
[alias]
|
|
4
|
+
co = checkout
|
|
5
|
+
ci = commit
|
|
6
|
+
st = status
|
|
7
|
+
b = branch
|
|
8
|
+
hist = log --pretty=format:\"%h %ad | %s%d [%an]\" --graph --date=short
|
|
9
|
+
type = cat-file -t
|
|
10
|
+
dump = cat-file -p
|
|
11
|
+
[color]
|
|
12
|
+
ui = true
|
|
13
|
+
branch = auto
|
|
14
|
+
diff = auto
|
|
15
|
+
status = auto
|
|
16
|
+
interactive = auto
|
|
17
|
+
[color "branch"]
|
|
18
|
+
current = yellow reverse
|
|
19
|
+
local = yellow
|
|
20
|
+
remote = green
|
|
21
|
+
[color "diff"]
|
|
22
|
+
meta = yellow bold
|
|
23
|
+
frag = magenta bold
|
|
24
|
+
old = red
|
|
25
|
+
new = cyan
|
|
26
|
+
[color "status"]
|
|
27
|
+
added = yellow
|
|
28
|
+
changed = green
|
|
29
|
+
untracked = cyan
|
|
30
|
+
[filter "media"]
|
|
31
|
+
clean = git-media-clean %f
|
|
32
|
+
smudge = git-media-smudge %f
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"/var/www/myserver/releases/current/logs/myserver.out"
|
|
2
|
+
"/var/www/myserver/releases/current/logs/upstart"
|
|
3
|
+
"/var/www/myserver/releases/current/logs/myserver.err" {
|
|
4
|
+
daily
|
|
5
|
+
create 777 www-data www-data
|
|
6
|
+
rotate 7
|
|
7
|
+
compress
|
|
8
|
+
postrotate
|
|
9
|
+
reload myserver >/dev/null 2>&1 || true
|
|
10
|
+
endscript
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
cp this /etc/logrotate.d/pressvarrs
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
user www-data;
|
|
2
|
+
worker_processes 4;
|
|
3
|
+
pid /var/run/nginx.pid;
|
|
4
|
+
events {
|
|
5
|
+
worker_connections 768;
|
|
6
|
+
# multi_accept on;
|
|
7
|
+
}
|
|
8
|
+
http {
|
|
9
|
+
##
|
|
10
|
+
# Basic Settings
|
|
11
|
+
##
|
|
12
|
+
sendfile on;
|
|
13
|
+
tcp_nopush on;
|
|
14
|
+
tcp_nodelay on;
|
|
15
|
+
keepalive_timeout 65;
|
|
16
|
+
types_hash_max_size 2048;
|
|
17
|
+
# server_tokens off;
|
|
18
|
+
# server_names_hash_bucket_size 64;
|
|
19
|
+
# server_name_in_redirect off;
|
|
20
|
+
include /etc/nginx/mime.types;
|
|
21
|
+
default_type application/octet-stream;
|
|
22
|
+
##
|
|
23
|
+
# Logging Settings
|
|
24
|
+
##
|
|
25
|
+
access_log /var/log/nginx/access.log;
|
|
26
|
+
error_log /var/log/nginx/error.log;
|
|
27
|
+
##
|
|
28
|
+
# Gzip Settings
|
|
29
|
+
##
|
|
30
|
+
gzip on;
|
|
31
|
+
gzip_disable "msie6";
|
|
32
|
+
# gzip_vary on;
|
|
33
|
+
# gzip_proxied any;
|
|
34
|
+
# gzip_comp_level 6;
|
|
35
|
+
# gzip_buffers 16 8k;
|
|
36
|
+
# gzip_http_version 1.1;
|
|
37
|
+
# gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
|
|
38
|
+
##
|
|
39
|
+
# nginx-naxsi config
|
|
40
|
+
##
|
|
41
|
+
# Uncomment it if you installed nginx-naxsi
|
|
42
|
+
##
|
|
43
|
+
#include /etc/nginx/naxsi_core.rules;
|
|
44
|
+
##
|
|
45
|
+
# nginx-passenger config
|
|
46
|
+
##
|
|
47
|
+
# Uncomment it if you installed nginx-passenger
|
|
48
|
+
##
|
|
49
|
+
#passenger_root /usr;
|
|
50
|
+
#passenger_ruby /usr/bin/ruby;
|
|
51
|
+
##
|
|
52
|
+
# Virtual Host Configs
|
|
53
|
+
##
|
|
54
|
+
include /etc/nginx/conf.d/*.conf;
|
|
55
|
+
include /etc/nginx/sites-enabled/*;
|
|
56
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
server {
|
|
2
|
+
listen 80 default_server;
|
|
3
|
+
listen [::]:80 default_server ipv6only=on;
|
|
4
|
+
charset utf-8;
|
|
5
|
+
<% if ssl? %>
|
|
6
|
+
|
|
7
|
+
listen 443 ssl;
|
|
8
|
+
ssl_certificate /etc/nginx/ssl/<% host %>.crt;
|
|
9
|
+
ssl_certificate_key /etc/nginx/ssl/<% host %>.key;
|
|
10
|
+
|
|
11
|
+
<% end %>
|
|
12
|
+
root <%= path %>;
|
|
13
|
+
index index.html index.php;
|
|
14
|
+
<% if host? %>
|
|
15
|
+
|
|
16
|
+
server_name <% host %>;
|
|
17
|
+
|
|
18
|
+
<% end %>
|
|
19
|
+
location / {
|
|
20
|
+
try_files \$uri \$uri/ /index.php?\$query_string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
location = /favicon.ico { access_log off; log_not_found off; }
|
|
24
|
+
location = /robots.txt { access_log off; log_not_found off; }
|
|
25
|
+
|
|
26
|
+
access_log off;
|
|
27
|
+
error_log /var/log/nginx/<% host %>-error.log error;
|
|
28
|
+
sendfile off;
|
|
29
|
+
|
|
30
|
+
location ~ \.php\$ {
|
|
31
|
+
try_files \$uri /index.php =404;
|
|
32
|
+
|
|
33
|
+
fastcgi_split_path_info ^(.+\.php)(/.+)\$;
|
|
34
|
+
fastcgi_pass unix:/var/run/php5-fpm.sock;
|
|
35
|
+
fastcgi_index index.php;
|
|
36
|
+
include fastcgi_params;
|
|
37
|
+
fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;
|
|
38
|
+
fastcgi_intercept_errors off;
|
|
39
|
+
fastcgi_buffer_size 16k;
|
|
40
|
+
fastcgi_buffers 4 16k;
|
|
41
|
+
fastcgi_connect_timeout 300;
|
|
42
|
+
fastcgi_send_timeout 300;
|
|
43
|
+
fastcgi_read_timeout 300;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,423 @@
|
|
|
1
|
+
require 'yaml'
|
|
2
|
+
require 'erb'
|
|
3
|
+
|
|
4
|
+
@template_path = File.expand_path('../../templates', __FILE__)
|
|
5
|
+
@scripts_path = File.expand_path('../../scripts', __FILE__)
|
|
6
|
+
@local_template_path = '/tmp/yarrs-and-yamls-templates'
|
|
7
|
+
@temp_path = '/etc/profile.d/vagrant.sh'
|
|
8
|
+
@profile = 'nginx'
|
|
9
|
+
|
|
10
|
+
def yarrs(yamlfile, vagrant_config)
|
|
11
|
+
raise 'Missing required parameters, try: yarrs_and_yamls(\'Yarrs.yaml\', config)' if ! vagrant_config
|
|
12
|
+
|
|
13
|
+
# load yaml config from file provided in Vagrantfile
|
|
14
|
+
config = get_config_from_file(yamlfile)
|
|
15
|
+
|
|
16
|
+
# convert single node to multi-node data structure
|
|
17
|
+
config = { "nodes" => [config] } unless config.include?('nodes')
|
|
18
|
+
|
|
19
|
+
# format nodes into instances
|
|
20
|
+
instances = prepare(config)
|
|
21
|
+
|
|
22
|
+
# loop through each instance and apply settings
|
|
23
|
+
instances.each do |hostname, settings|
|
|
24
|
+
|
|
25
|
+
vagrant_config.vm.define hostname do |node|
|
|
26
|
+
|
|
27
|
+
apply_vagrant_settings(node, settings)
|
|
28
|
+
apply_vagrant_ssh_settings(node, settings)
|
|
29
|
+
apply_vagrant_shell_provisioning(node, settings)
|
|
30
|
+
apply_vagrant_shared_folders(node, settings)
|
|
31
|
+
apply_aws_provider(node, settings)
|
|
32
|
+
apply_digitalocean_providier(node, settings)
|
|
33
|
+
apply_local_scripts(node, settings)
|
|
34
|
+
apply_vagrant_hostupdater(node, settings)
|
|
35
|
+
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
yield hostname, settings if block_given?
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
instances
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def apply_vagrant_hostupdater(node, settings)
|
|
45
|
+
if defined? VagrantPlugins::HostsUpdater && settings["hostname"] && settings["ip"]
|
|
46
|
+
node.hostsupdater.aliases = get_config_part('sites', settings)
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def apply_vagrant_settings(node, settings)
|
|
51
|
+
node.vm.box = settings["box"]
|
|
52
|
+
node.vm.box_url = settings["box_url"]
|
|
53
|
+
node.vm.box_check_update = settings["box_check_update"]
|
|
54
|
+
node.vm.boot_timeout = settings["boot_timeout"]
|
|
55
|
+
node.vm.graceful_halt_timeout = settings["graceful_halt_timeout"]
|
|
56
|
+
node.vm.guest = settings["guest"]
|
|
57
|
+
node.vm.post_up_message = settings["post_up_message"]
|
|
58
|
+
node.vm.usable_port_range = settings["usable_port_range"]
|
|
59
|
+
|
|
60
|
+
node.vm.provider :virtualbox do |virtualbox, override|
|
|
61
|
+
virtualbox.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
|
|
62
|
+
virtualbox.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
|
|
63
|
+
virtualbox.customize ["modifyvm", :id, "--ostype", "Ubuntu_64"]
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
node.vm.provider :virtualbox do |virtualbox, override|
|
|
67
|
+
virtualbox.gui = true if settings["gui"]
|
|
68
|
+
virtualbox.cpus = settings["cpus"] if settings["cpus"]
|
|
69
|
+
virtualbox.memory = settings["memory"] if settings["memory"]
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
["vmware_fusion", "vmware_workstation"].each do |vmware|
|
|
73
|
+
node.vm.provider vmware do |vmware, override|
|
|
74
|
+
vmware.vmx["displayName"] = settings["hostname"]
|
|
75
|
+
override.vm.node_url = "http://files.vagrantup.com/precise64_vmware.node"
|
|
76
|
+
vmware.gui = true if settings["gui"]
|
|
77
|
+
vmware.vmx["numvcpus"] = settings["cpus"] if settings["cpus"]
|
|
78
|
+
vmware.vmx["memsize"] = settings["cpus"] if settings["memory"]
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
node.vm.network "private_network", ip: settings["ip"], :netmask => "255.255.255.0" if settings["ip"]
|
|
83
|
+
|
|
84
|
+
if settings["ports"]
|
|
85
|
+
settings["ports"].each do |args|
|
|
86
|
+
args = Hash[args.map{ |key, value| [key.to_sym, value] }]
|
|
87
|
+
node.vm.network "forwarded_port", args
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def apply_vagrant_ssh_settings(node, settings)
|
|
94
|
+
node.ssh.username = settings["ssh_username"] if settings["ssh_username"]
|
|
95
|
+
node.ssh.password = settings["ssh_password"] if settings["ssh_password"]
|
|
96
|
+
node.ssh.host = settings["ssh_host"] if settings["ssh_host"]
|
|
97
|
+
node.ssh.port = settings["ssh_port"] if settings["ssh_port"]
|
|
98
|
+
node.ssh.guest_port = settings["ssh_guest_port"] if settings["ssh_guest_port"]
|
|
99
|
+
node.ssh.private_key_path = settings["ssh_private_key_path"] if settings["ssh_private_key_path"]
|
|
100
|
+
node.ssh.forward_agent = settings["ssh_forward_agent"] if settings["ssh_forward_agent"]
|
|
101
|
+
node.ssh.forward_x11 = settings["ssh_forward_x11"] if settings["ssh_forward_x11"]
|
|
102
|
+
node.ssh.insert_key = settings["ssh_insert_key"] if settings["ssh_insert_key"]
|
|
103
|
+
node.ssh.proxy_command = settings["ssh_proxy_command"] if settings["ssh_proxy_command"]
|
|
104
|
+
node.ssh.pty = settings["ssh_pty"] if settings["ssh_pty"]
|
|
105
|
+
node.ssh.shell = settings["ssh_shell"] if settings["ssh_shell"]
|
|
106
|
+
|
|
107
|
+
# Configure The Public Key For SSH Access
|
|
108
|
+
if settings["authorize"]
|
|
109
|
+
config.vm.provision "shell" do |s|
|
|
110
|
+
s.inline = "echo $1 | grep -xq \"$1\" /home/vagrant/.ssh/authorized_keys || echo $1 | tee -a /home/vagrant/.ssh/authorized_keys"
|
|
111
|
+
s.args = [File.read(File.expand_path(settings["authorize"]))]
|
|
112
|
+
end
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
# Copy The SSH Private Keys To The Box
|
|
116
|
+
if settings["keys"]
|
|
117
|
+
settings["keys"].each do |key|
|
|
118
|
+
config.vm.provision "shell" do |s|
|
|
119
|
+
s.privileged = false
|
|
120
|
+
s.inline = "echo \"$1\" > /home/vagrant/.ssh/$2 && chmod 600 /home/vagrant/.ssh/$2"
|
|
121
|
+
s.args = [File.read(File.expand_path(key)), key.split('/').last]
|
|
122
|
+
end
|
|
123
|
+
end
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
def apply_vagrant_shell_provisioning(node, settings)
|
|
128
|
+
return unless settings["provision"]
|
|
129
|
+
|
|
130
|
+
settings["provision"].each do |script|
|
|
131
|
+
node.vm.provision "shell" do |s|
|
|
132
|
+
s.inline = script["inline"] if script["inline"]
|
|
133
|
+
s.path = script["path"] if script["path"]
|
|
134
|
+
s.args = script["args"] if script["args"]
|
|
135
|
+
s.privileged = script["privileged"] if script["privileged"]
|
|
136
|
+
s.binary = script["binary"] if script["binary"]
|
|
137
|
+
s.upload_path = script["upload_path"] if script["upload_path"]
|
|
138
|
+
s.keep_color = script["keep_color"] if script["keep_color"]
|
|
139
|
+
s.powershell_args = script["powershell_args"] if script["powershell_args"]
|
|
140
|
+
end
|
|
141
|
+
end
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
def apply_vagrant_shared_folders(node, settings)
|
|
145
|
+
return unless settings["synced_folders"]
|
|
146
|
+
|
|
147
|
+
settings["synced_folders"].each do |item|
|
|
148
|
+
next unless ( item.include?("host") or item.include?("guest") )
|
|
149
|
+
args = item.dup
|
|
150
|
+
args.delete('host')
|
|
151
|
+
args.delete('guest')
|
|
152
|
+
args = Hash[args.map{ |key, value| [key.to_sym, value] }]
|
|
153
|
+
node.vm.synced_folder item["host"], item["guest"], args
|
|
154
|
+
end
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
def apply_aws_provider(node, settings)
|
|
158
|
+
return unless settings["aws"]
|
|
159
|
+
node.vm.provider :aws do |aws, override|
|
|
160
|
+
override.vm.box_url = "https://github.com/mitchellh/vagrant-aws/raw/master/dummy.box"
|
|
161
|
+
|
|
162
|
+
# Required parameters
|
|
163
|
+
aws.ami = settings["aws"]["ami"] if settings["aws"]["ami"]
|
|
164
|
+
aws.instance_type = settings["aws"]["instance_type"] if settings["aws"]["instance_type"]
|
|
165
|
+
aws.keypair_name = settings["aws"]["keypair_name"] if settings["aws"]["keypair_name"]
|
|
166
|
+
override.ssh.username = settings["aws"]["username"] if settings["aws"]["username"]
|
|
167
|
+
override.ssh.private_key_path = settings["aws"]["private_key_path"] if settings["aws"]["private_key_path"]
|
|
168
|
+
|
|
169
|
+
# Alternative approach: add keys into your .bashrc or .zshrc profile
|
|
170
|
+
# export AWS_SECRET_KEY=secret_key
|
|
171
|
+
# export AWS_ACCESS_KEY=secret_key
|
|
172
|
+
aws.access_key_id = settings["aws"]["access_key_id"] || ENV["AWS_ACCESS_KEY"]
|
|
173
|
+
aws.secret_access_key = settings["aws"]["secret_access_key"] || ENV["AWS_SECRET_KEY"]
|
|
174
|
+
aws.session_token = settings["aws"]["session_token"] || ENV["AWS_SESSION_TOKEN"]
|
|
175
|
+
|
|
176
|
+
# optional settings
|
|
177
|
+
aws.region = settings["aws"]["region"] if settings["aws"]["region"]
|
|
178
|
+
aws.availability_zone = settings["aws"]["availability_zone"] if settings["aws"]["availability_zone"]
|
|
179
|
+
aws.security_groups = settings["aws"]["security_groups"] if settings["aws"]["security_groups"]
|
|
180
|
+
aws.tags = settings["aws"]["tags"] if settings["aws"]["tags"]
|
|
181
|
+
aws.subnet_id = settings["aws"]["subnet_id"] if settings["aws"]["subnet_id"]
|
|
182
|
+
aws.availability_zone = settings["aws"]["availability_zone"] if settings["aws"]["availability_zone"]
|
|
183
|
+
aws.elastic_ip = settings["aws"]["elastic_ip"] if settings["aws"]["elastic_ip"]
|
|
184
|
+
aws.use_iam_profile = settings["aws"]["use_iam_profile"] if settings["aws"]["use_iam_profile"]
|
|
185
|
+
aws.private_ip_address = settings["aws"]["private_ip_address"] if settings["aws"]["private_ip_address"]
|
|
186
|
+
aws.user_data = settings["aws"]["user_data"] if settings["aws"]["user_data"]
|
|
187
|
+
aws.iam_instance_profile_name = settings["aws"]["iam_instance_profile_name"] if settings["aws"]["iam_instance_profile_name"]
|
|
188
|
+
aws.iam_instance_profile_arn = settings["aws"]["iam_instance_profile_arn"] if settings["aws"]["iam_instance_profile_arn"]
|
|
189
|
+
aws.instance_package_timeout = settings["aws"]["instance_package_timeout"] if settings["aws"]["instance_package_timeout"]
|
|
190
|
+
aws.instance_ready_timeout = settings["aws"]["instance_ready_timeout"] if settings["aws"]["instance_ready_timeout"]
|
|
191
|
+
end
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
def apply_digitalocean_providier(node, settings)
|
|
195
|
+
return unless settings["digital_ocean"]
|
|
196
|
+
|
|
197
|
+
node.vm.provider :digital_ocean do |digital_ocean, override|
|
|
198
|
+
override.vm.box_url = "https://github.com/smdahlen/vagrant-digitalocean/raw/master/box/digital_ocean.box"
|
|
199
|
+
|
|
200
|
+
digital_ocean.token = settings["digital_ocean"].include?("token") ? settings["digital_ocean"]["token"] : ENV["DIGITAL_OCEAN_TOKEN"]
|
|
201
|
+
|
|
202
|
+
# Optional
|
|
203
|
+
override.ssh.private_key_path = settings["digital_ocean"]["private_key_path"]
|
|
204
|
+
override.ssh.username = settings["digital_ocean"]["username"] if settings["digital_ocean"]["username"]
|
|
205
|
+
digital_ocean.ssh_key_name = settings["digital_ocean"].include?("ssh_key_name") ? settings["digital_ocean"]["ssh_key_name"] : 'Vagrant'
|
|
206
|
+
digital_ocean.image = settings["digital_ocean"].include?("image") ? settings["digital_ocean"]["image"] : "ubuntu-14-04-x64"
|
|
207
|
+
digital_ocean.region = settings["digital_ocean"].include?("region") ? settings["digital_ocean"]["region"] : "nyc2"
|
|
208
|
+
digital_ocean.size = settings["digital_ocean"].include?("size") ? settings["digital_ocean"]["size"] : "512mb"
|
|
209
|
+
digital_ocean.ipv6 = settings["digital_ocean"].include?("ipv6") ? settings["digital_ocean"]["ipv6"] : false
|
|
210
|
+
digital_ocean.private_networking = settings["digital_ocean"].include?("private_networking") ? settings["digital_ocean"]["private_networking"] : false
|
|
211
|
+
digital_ocean.backups_enabled = settings["digital_ocean"].include?("backups_enabled") ? settings["digital_ocean"]["backups_enabled"] : false
|
|
212
|
+
digital_ocean.setup = settings["digital_ocean"].include?("setup") ? settings["digital_ocean"]["setup"] : true
|
|
213
|
+
end
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
def get_config_from_file(configfile)
|
|
217
|
+
|
|
218
|
+
config = {}
|
|
219
|
+
|
|
220
|
+
return config unless configfile.index('.yaml')
|
|
221
|
+
|
|
222
|
+
configfile = File.expand_path(configfile)
|
|
223
|
+
localfile = File.expand_path(configfile.dup)
|
|
224
|
+
localfile = localfile.insert(configfile.index('.yaml'), '.local')
|
|
225
|
+
|
|
226
|
+
if File.exists? localfile
|
|
227
|
+
config = YAML.load_file(localfile)
|
|
228
|
+
elsif File.exists? configfile
|
|
229
|
+
config = YAML.load_file(configfile)
|
|
230
|
+
end
|
|
231
|
+
|
|
232
|
+
config
|
|
233
|
+
end
|
|
234
|
+
|
|
235
|
+
def prepare(v=nil)
|
|
236
|
+
boxes = {}
|
|
237
|
+
|
|
238
|
+
return boxes if v["nodes"].empty?
|
|
239
|
+
|
|
240
|
+
v["nodes"].collect do |box|
|
|
241
|
+
next unless box["hostname"]
|
|
242
|
+
boxes[box["hostname"]] = box
|
|
243
|
+
end
|
|
244
|
+
|
|
245
|
+
boxes
|
|
246
|
+
end
|
|
247
|
+
|
|
248
|
+
def apply_local_scripts(node, settings)
|
|
249
|
+
node.vm.synced_folder @template_path, @local_template_path
|
|
250
|
+
|
|
251
|
+
node.vm.provision "shell", inline: "touch #{@temp_path} && chmod +x #{@temp_path}"
|
|
252
|
+
|
|
253
|
+
if settings["timezone"]
|
|
254
|
+
node.vm.provision "shell" do |s|
|
|
255
|
+
s.path = "#{@scripts_path}/tz.sh"
|
|
256
|
+
s.args = [settings["timezone"]]
|
|
257
|
+
end
|
|
258
|
+
end
|
|
259
|
+
|
|
260
|
+
if settings["update"]
|
|
261
|
+
node.vm.provision "shell", path: "#{@scripts_path}/base.sh"
|
|
262
|
+
end
|
|
263
|
+
|
|
264
|
+
# if settings["rvm"]
|
|
265
|
+
# node.vm.provision "shell", path: "#{@scripts_path}/rvm.sh"
|
|
266
|
+
# end
|
|
267
|
+
|
|
268
|
+
if settings["git"]
|
|
269
|
+
if File.exists? settings["git"].to_s
|
|
270
|
+
gitconfig = settings["git"]
|
|
271
|
+
else
|
|
272
|
+
gitconfig = "#{@local_template_path}/gitconfig.conf"
|
|
273
|
+
end
|
|
274
|
+
|
|
275
|
+
node.vm.provision "shell" do |s|
|
|
276
|
+
s.path = "#{@scripts_path}/git.sh"
|
|
277
|
+
s.args = [gitconfig]
|
|
278
|
+
end
|
|
279
|
+
end
|
|
280
|
+
|
|
281
|
+
if settings["mysql_root_password"]
|
|
282
|
+
node.vm.provision "shell", inline: "echo export MYSQL_ROOT_PASSWORD=#{settings["mysql_root_password"]} >> #{@temp_path}"
|
|
283
|
+
end
|
|
284
|
+
|
|
285
|
+
if settings["databases"]
|
|
286
|
+
node.vm.provision "shell", path: "#{@scripts_path}/mysql.sh"
|
|
287
|
+
node.vm.provision "shell" do |s|
|
|
288
|
+
s.path = "#{@scripts_path}/mysql-create-databases.sh"
|
|
289
|
+
s.args = settings["databases"]
|
|
290
|
+
end
|
|
291
|
+
end
|
|
292
|
+
|
|
293
|
+
if settings["variables"]
|
|
294
|
+
settings["variables"].each do |pair|
|
|
295
|
+
node.vm.provision "shell" do |s|
|
|
296
|
+
s.path = "#{@scripts_path}/export_vars.sh"
|
|
297
|
+
s.args = [ pair["key"], pair["value"] ]
|
|
298
|
+
end
|
|
299
|
+
end
|
|
300
|
+
end
|
|
301
|
+
|
|
302
|
+
if settings["nodejs"]
|
|
303
|
+
node.vm.provision "shell", path: "#{@scripts_path}/nodejs.sh"
|
|
304
|
+
|
|
305
|
+
if settings["nodejs"].kind_of?(Hash)
|
|
306
|
+
settings["nodejs"].each do |key, value|
|
|
307
|
+
if "global" == key
|
|
308
|
+
node.vm.provision "shell" do |s|
|
|
309
|
+
s.path = "#{@scripts_path}/install-nodejs-modules.sh"
|
|
310
|
+
s.args = [value]
|
|
311
|
+
end
|
|
312
|
+
end
|
|
313
|
+
end
|
|
314
|
+
end
|
|
315
|
+
end
|
|
316
|
+
|
|
317
|
+
@profile = settings["webserver"] if settings["webserver"]
|
|
318
|
+
@profile = settings["profile"] if settings["profile"]
|
|
319
|
+
|
|
320
|
+
if File.exists?("#{@scripts_path}/#{@profile}.sh")
|
|
321
|
+
node.vm.provision "shell", path: "#{@scripts_path}/#{@profile}.sh"
|
|
322
|
+
end
|
|
323
|
+
|
|
324
|
+
if settings["php"]
|
|
325
|
+
node.vm.provision "shell", path: "#{@scripts_path}/php.sh"
|
|
326
|
+
node.vm.provision "shell" do |s|
|
|
327
|
+
s.path = "#{@scripts_path}/php_configure.sh"
|
|
328
|
+
s.args = ["master"]
|
|
329
|
+
end
|
|
330
|
+
|
|
331
|
+
if settings["php"].include?('xdebug')
|
|
332
|
+
xdebugconfig = "#{@local_template_path}/xdebug.ini"
|
|
333
|
+
|
|
334
|
+
node.vm.provision "shell" do |s|
|
|
335
|
+
s.path = "#{@scripts_path}/php_xdebug.sh"
|
|
336
|
+
s.args = [xdebugconfig]
|
|
337
|
+
end
|
|
338
|
+
end
|
|
339
|
+
|
|
340
|
+
node.vm.provision "shell", path: "#{@scripts_path}/composer.sh" if settings["php"].include?('composer')
|
|
341
|
+
|
|
342
|
+
node.vm.provision "shell", path: "#{@scripts_path}/wpcli.sh" if settings["php"].include?('wp')
|
|
343
|
+
end
|
|
344
|
+
|
|
345
|
+
if settings["sites"]
|
|
346
|
+
settings["sites"].each do |opts|
|
|
347
|
+
opts = Hash[opts.map{ |key, value| [key.to_sym, value] }]
|
|
348
|
+
@site = create_site(opts)
|
|
349
|
+
|
|
350
|
+
next unless ! @site[:host].empty? && ! @site[:path].empty? && ! @site[:config].empty?
|
|
351
|
+
|
|
352
|
+
backup_file = "#{Dir.pwd}/.#{@profile}-#{@site[:host]}.conf"
|
|
353
|
+
File.open(backup_file, File::RDWR|File::CREAT) do |file|
|
|
354
|
+
file.write(@site[:config].to_s)
|
|
355
|
+
end
|
|
356
|
+
|
|
357
|
+
node.vm.provision "shell" do |s|
|
|
358
|
+
s.name = "nginx_site.sh: #{@site[:host]}, #{@site[:path]}"
|
|
359
|
+
s.path = "#{@scripts_path}/nginx_site.sh"
|
|
360
|
+
s.args = ["#{@site[:host]}", "#{@site[:path]}", "#{@site[:config]}"]
|
|
361
|
+
end
|
|
362
|
+
end
|
|
363
|
+
end
|
|
364
|
+
|
|
365
|
+
node.vm.provision "shell", inline: "rm -rf /etc/profile.d/vagrant.sh"
|
|
366
|
+
|
|
367
|
+
end
|
|
368
|
+
|
|
369
|
+
def get_config_part(key, config)
|
|
370
|
+
result = nil
|
|
371
|
+
|
|
372
|
+
if 'sites' == key && config.include?(key)
|
|
373
|
+
sites = []
|
|
374
|
+
|
|
375
|
+
config["sites"].each do |opts|
|
|
376
|
+
opts = Hash[opts.map{ |key, value| [key.to_sym, value] }]
|
|
377
|
+
site = create_site(opts)
|
|
378
|
+
|
|
379
|
+
next unless ! site[:host].empty? && ! site[:path].empty? && ! site[:config].empty?
|
|
380
|
+
|
|
381
|
+
sites.push(site[:host])
|
|
382
|
+
end
|
|
383
|
+
|
|
384
|
+
result = sites
|
|
385
|
+
end
|
|
386
|
+
|
|
387
|
+
result
|
|
388
|
+
end
|
|
389
|
+
|
|
390
|
+
def create_site(opts)
|
|
391
|
+
site = {
|
|
392
|
+
host: '',
|
|
393
|
+
path: '',
|
|
394
|
+
port: 80,
|
|
395
|
+
ssl: false,
|
|
396
|
+
template: "#{@template_path}/nginx_vhost.erb",
|
|
397
|
+
config: '',
|
|
398
|
+
vhost: '',
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
opts[:host] = opts[:map] || opts[:host]
|
|
402
|
+
opts[:path] = opts[:to] || opts[:path]
|
|
403
|
+
|
|
404
|
+
opts.each do |key, value|
|
|
405
|
+
if !!key.to_s.index('.')
|
|
406
|
+
site[:host] = key
|
|
407
|
+
end
|
|
408
|
+
if !!value.to_s.index('/')
|
|
409
|
+
opts[:path] = value
|
|
410
|
+
end
|
|
411
|
+
end
|
|
412
|
+
|
|
413
|
+
site.each do |key, val|
|
|
414
|
+
if opts[key.to_sym]
|
|
415
|
+
site[key.to_sym] = opts[key.to_sym]
|
|
416
|
+
end
|
|
417
|
+
end
|
|
418
|
+
|
|
419
|
+
site[:config] = ERB.new(File.read(site[:template]))
|
|
420
|
+
.result(OpenStruct.new(site).instance_eval { binding })
|
|
421
|
+
|
|
422
|
+
site
|
|
423
|
+
end
|