capistrano-laravel-lazy 0.0.3 → 0.0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/capistrano-laravel.gemspec +1 -1
- data/lib/capistrano/laravel.rb +1 -3
- data/lib/capistrano/tasks/composer.rake +9 -0
- data/lib/capistrano/tasks/laravel.rake +33 -42
- data/lib/capistrano/tasks/phplint.rake +26 -0
- data/lib/capistrano/tasks/setup_config.rake +24 -11
- data/lib/capistrano/templates/deploy.rb.erb +6 -3
- data/lib/capistrano/templates/nginx.conf.erb +1 -2
- data/lib/capistrano/templates/stage.rb.erb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 78a03e34abf0a91788a16a1e87da828558bae481
|
4
|
+
data.tar.gz: 477fded8b29ddb6ac042f7864fa9e5668a80a283
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: afce59e034121783f392c3cf7dd03a1e3abc6a005e12e296bca24ceb8a35f48f8b2b1083004c371cfb7172671899f8792df0bde1ccf506e2c98481c2e2e34966
|
7
|
+
data.tar.gz: 8d412ac87d5332ed648f9862d03c3bf9ec4e125d20bd5418f622280072626c99dc59df055512080b5791d58e2179c874c3be6bc988f785759a83ee7dff5b7ae1
|
data/capistrano-laravel.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = 'capistrano-laravel-lazy'
|
7
|
-
spec.version = '0.0.3'
|
7
|
+
spec.version = '0.0.3.2'
|
8
8
|
spec.authors = ['Ivan Chou', 'Peter Mitchell', 'Andrew Miller']
|
9
9
|
spec.email = ['yiichou@gmail.com', 'peterjmit@gmail.com', 'ikari7789@yahoo.com']
|
10
10
|
spec.description = %q{Laravel specific deployment options for Capistrano 3.x}
|
data/lib/capistrano/laravel.rb
CHANGED
@@ -1,6 +1,4 @@
|
|
1
1
|
require "capistrano/composer"
|
2
2
|
require "capistrano/file-permissions"
|
3
3
|
|
4
|
-
|
5
|
-
load File.expand_path("../tasks/php_fpm.rake", __FILE__)
|
6
|
-
load File.expand_path("../tasks/setup_config.rake", __FILE__)
|
4
|
+
Dir[File.expand_path('../tasks/*.rake', __FILE__)].each { |file| load file }
|
@@ -15,7 +15,6 @@ namespace :load do
|
|
15
15
|
set :laravel_set_acl_paths, true
|
16
16
|
set :laravel_create_linked_acl_paths, true
|
17
17
|
set :laravel_server_user, 'www-data'
|
18
|
-
set :laravel_phplint, false
|
19
18
|
|
20
19
|
# Folders to link between releases
|
21
20
|
set :laravel_4_linked_dirs, [
|
@@ -29,33 +28,33 @@ namespace :load do
|
|
29
28
|
]
|
30
29
|
|
31
30
|
# Folders to set permissions on based on laravel version
|
32
|
-
set :laravel_4_acl_paths,
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
set :laravel_5_acl_paths,
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
set :laravel_5_1_acl_paths,
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
31
|
+
set :laravel_4_acl_paths, %w(
|
32
|
+
app/storage
|
33
|
+
app/storage/cache
|
34
|
+
app/storage/logs
|
35
|
+
app/storage/meta
|
36
|
+
app/storage/sessions
|
37
|
+
app/storage/views
|
38
|
+
)
|
39
|
+
set :laravel_5_acl_paths, %w(
|
40
|
+
storage
|
41
|
+
storage/app
|
42
|
+
storage/framework
|
43
|
+
storage/framework/cache
|
44
|
+
storage/framework/sessions
|
45
|
+
storage/framework/views
|
46
|
+
storage/logs
|
47
|
+
)
|
48
|
+
set :laravel_5_1_acl_paths, %w(
|
49
|
+
bootstrap/cache
|
50
|
+
storage
|
51
|
+
storage/app
|
52
|
+
storage/framework
|
53
|
+
storage/framework/cache
|
54
|
+
storage/framework/sessions
|
55
|
+
storage/framework/views
|
56
|
+
storage/logs
|
57
|
+
)
|
59
58
|
end
|
60
59
|
end
|
61
60
|
|
@@ -63,17 +62,15 @@ namespace :laravel do
|
|
63
62
|
desc 'Set the ACL for the web user based on Laravel version.'
|
64
63
|
task :configure_folders do
|
65
64
|
laravel_version = fetch(:laravel_version)
|
66
|
-
laravel_linked_dirs = []
|
67
|
-
laravel_acl_paths = []
|
68
65
|
if laravel_version < 5 # Laravel 4
|
69
|
-
laravel_linked_dirs = fetch(:laravel_4_linked_dirs)
|
70
|
-
laravel_acl_paths = fetch(:laravel_4_acl_paths)
|
66
|
+
laravel_linked_dirs = fetch(:laravel_4_linked_dirs, [])
|
67
|
+
laravel_acl_paths = fetch(:laravel_4_acl_paths, [])
|
71
68
|
elsif laravel_version < 5.1 # Laravel 5
|
72
|
-
laravel_linked_dirs = fetch(:laravel_5_linked_dirs)
|
73
|
-
laravel_acl_paths = fetch(:laravel_5_acl_paths)
|
69
|
+
laravel_linked_dirs = fetch(:laravel_5_linked_dirs, [])
|
70
|
+
laravel_acl_paths = fetch(:laravel_5_acl_paths, [])
|
74
71
|
else # Laravel 5.1 or greater
|
75
|
-
laravel_linked_dirs = fetch(:laravel_5_1_linked_dirs)
|
76
|
-
laravel_acl_paths = fetch(:laravel_5_1_acl_paths)
|
72
|
+
laravel_linked_dirs = fetch(:laravel_5_1_linked_dirs, [])
|
73
|
+
laravel_acl_paths = fetch(:laravel_5_1_acl_paths, [])
|
77
74
|
end
|
78
75
|
|
79
76
|
if fetch(:laravel_set_linked_dirs)
|
@@ -170,16 +167,10 @@ namespace :laravel do
|
|
170
167
|
end
|
171
168
|
end
|
172
169
|
|
173
|
-
desc 'Check syntax error with PHPLint.'
|
174
|
-
task :phplint do
|
175
|
-
invoke 'laravel:artisan', :phplint if fetch(:laravel_phplint)
|
176
|
-
end
|
177
|
-
|
178
170
|
before 'deploy:starting', 'laravel:configure_folders'
|
179
171
|
after 'deploy:symlink:shared', 'laravel:create_linked_acl_paths'
|
180
172
|
after 'deploy:symlink:shared', 'deploy:set_permissions:acl'
|
181
173
|
# after 'deploy:symlink:shared', 'laravel:upload_dotenv_file'
|
182
|
-
before 'deploy:updated', 'laravel:phplint'
|
183
174
|
after 'deploy:updated', 'laravel:optimize_release'
|
184
175
|
|
185
176
|
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
namespace :test do
|
2
|
+
|
3
|
+
desc 'Check syntax error with PHPLint.'
|
4
|
+
task :phplint do
|
5
|
+
on release_roles :all do
|
6
|
+
within release_path do
|
7
|
+
next unless fetch(:enable_phplint, false)
|
8
|
+
|
9
|
+
if test('[ -f ./vendor/bin/phplint ]')
|
10
|
+
phplint_exec = './vendor/bin/phplint'
|
11
|
+
elsif test('[ -f ~/.composer/vendor/bin/phplint ]')
|
12
|
+
phplint_exec = '~/.composer/vendor/bin/phplint'
|
13
|
+
else
|
14
|
+
warn 'command not found: phplint, please install phplint first'
|
15
|
+
info ' How to install phplint:'
|
16
|
+
info ' composer [global] require overtrue/phplint'
|
17
|
+
next
|
18
|
+
end
|
19
|
+
|
20
|
+
execute phplint_exec, './', '--exclude=vendor'
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
before 'deploy:updated', 'test:phplint'
|
26
|
+
end
|
@@ -2,7 +2,7 @@ namespace :load do
|
|
2
2
|
task :defaults do
|
3
3
|
set :server_name, 'localhost'
|
4
4
|
set :nginx_user, 'nginx'
|
5
|
-
set :bind, "unix:/run/php/#{fetch(:
|
5
|
+
set :bind, "unix:/run/php/#{fetch(:full_app_name)}.sock"
|
6
6
|
end
|
7
7
|
end
|
8
8
|
|
@@ -14,6 +14,7 @@ namespace :deploy do
|
|
14
14
|
|
15
15
|
def upload_shared
|
16
16
|
local_shared_path = 'config/deploy/shared'
|
17
|
+
return unless File.exist? local_shared_path
|
17
18
|
|
18
19
|
files = Dir.entries local_shared_path
|
19
20
|
files.shift(2)
|
@@ -42,38 +43,50 @@ namespace :deploy do
|
|
42
43
|
end
|
43
44
|
|
44
45
|
def upload_config(conf, path)
|
45
|
-
if
|
46
|
-
|
47
|
-
|
48
|
-
conf_file = "config/templates/#{conf}"
|
46
|
+
return if path.to_s.empty?
|
47
|
+
|
48
|
+
if File.exist? "config/deploy/templates/#{conf}.erb"
|
49
|
+
conf_file = render_template "config/deploy/templates/#{conf}.erb"
|
50
|
+
elsif File.exist? "config/deploy/templates/#{conf}"
|
51
|
+
conf_file = "config/deploy/templates/#{conf}"
|
49
52
|
else
|
50
53
|
conf_file = render_template File.expand_path("../../templates/#{conf}.erb", __FILE__)
|
51
54
|
end
|
52
55
|
|
53
|
-
|
56
|
+
execute :mkdir, '-p', "#{fetch(:tmp_dir)}/#{fetch(:application)}/"
|
57
|
+
tmp_target = "#{fetch(:tmp_dir)}/#{fetch(:application)}/#{fetch(:full_app_name)}.#{conf}"
|
54
58
|
target = File.join(path, "#{fetch(:full_app_name)}.conf")
|
55
59
|
upload! conf_file, tmp_target
|
56
60
|
execute :sudo, :mv, "-n #{tmp_target} #{target}"
|
57
61
|
info "Compile & upload #{conf} to: #{target}"
|
58
62
|
end
|
59
63
|
|
64
|
+
def install_phplint
|
65
|
+
execute :composer, :global, :require, 'overtrue/phplint'
|
66
|
+
end
|
67
|
+
|
60
68
|
desc 'setup config to prepare deploying project.'
|
61
69
|
task :setup_config do
|
62
70
|
on release_roles :all do
|
63
71
|
execute :mkdir, "-p #{shared_path}"
|
64
72
|
|
65
73
|
# compile & upload all the config files
|
66
|
-
upload_shared
|
74
|
+
upload_shared
|
67
75
|
|
68
76
|
# Compile & upload nginx config
|
69
|
-
upload_config 'nginx.conf', fetch(:nginx_server_path)
|
77
|
+
upload_config 'nginx.conf', fetch(:nginx_server_path)
|
70
78
|
|
71
79
|
# Compile & upload php-fpm config
|
72
|
-
upload_config 'fpm.conf', fetch(:fpm_pool_path)
|
80
|
+
upload_config 'fpm.conf', fetch(:fpm_pool_path)
|
81
|
+
|
82
|
+
# Change composer packagist repo
|
83
|
+
invoke 'composer:set_repo'
|
84
|
+
|
85
|
+
install_phplint if fetch(:enable_phplint)
|
73
86
|
|
74
87
|
# Upload dotenv file to shared path
|
75
|
-
if fetch(:laravel_version) >= 5
|
76
|
-
unless
|
88
|
+
if fetch(:laravel_version) >= 5 && fetch(:laravel_dotenv_file, '') != ''
|
89
|
+
unless test("[ -e #{shared_path}/.env ]")
|
77
90
|
upload! fetch(:laravel_dotenv_file), "#{shared_path}/.env"
|
78
91
|
end
|
79
92
|
end
|
@@ -20,7 +20,7 @@ set :repo_url, 'git@example.com:me/my_repo.git'
|
|
20
20
|
# set :log_level, :debug
|
21
21
|
|
22
22
|
# Default value for :pty is false
|
23
|
-
set :pty,
|
23
|
+
# set :pty, false
|
24
24
|
|
25
25
|
# Default value for :linked_files is []
|
26
26
|
set :linked_files, ['.env']
|
@@ -48,8 +48,11 @@ set :laravel_version, 5.2
|
|
48
48
|
# Default value for :laravel_server_user is true
|
49
49
|
# set :laravel_server_user, 'www-data'
|
50
50
|
|
51
|
-
# Default value for :
|
52
|
-
# set :
|
51
|
+
# Default value for :enable_phplint is false
|
52
|
+
# set :enable_phplint, false
|
53
|
+
|
54
|
+
# Default value for :packagist_repo is empty
|
55
|
+
# set :packagist_repo, 'https://packagist.phpcomposer.com'
|
53
56
|
|
54
57
|
# See more configuration at https://github.com/capistrano/laravel.
|
55
58
|
|
@@ -16,12 +16,11 @@ server {
|
|
16
16
|
access_log /data/logs/nginx/<%= fetch(:application) %>.log customized_<%= fetch(:application) %>;
|
17
17
|
error_log /data/logs/nginx/<%= fetch(:application) %>.error.log warn;
|
18
18
|
|
19
|
-
# 修改为 Laravel 转发规则
|
20
19
|
location / {
|
21
20
|
try_files $uri $uri/ /index.php?$query_string;
|
22
21
|
}
|
23
22
|
|
24
|
-
# PHP
|
23
|
+
# To PHP-FPM
|
25
24
|
location ~ \.php$ {
|
26
25
|
try_files $uri /index.php =404;
|
27
26
|
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
@@ -26,7 +26,7 @@ set :enable_ssl, false
|
|
26
26
|
# Which user to run nginx, default: nginx
|
27
27
|
# set :nginx_user, 'nginx'
|
28
28
|
|
29
|
-
# Bind for php-fpm, default: unix:/run/php/#{fetch(:
|
29
|
+
# Bind for php-fpm, default: unix:/run/php/#{fetch(:full_app_name)}.sock
|
30
30
|
# set :bind, '127.0.0.1:8080'
|
31
31
|
|
32
32
|
# Where to set fpm pool config, default: nil
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-laravel-lazy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.3
|
4
|
+
version: 0.0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ivan Chou
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2016-08-
|
13
|
+
date: 2016-08-20 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: capistrano
|
@@ -103,8 +103,10 @@ files:
|
|
103
103
|
- lib/capistrano/laravel.rb
|
104
104
|
- lib/capistrano/laravel/helpers.rb
|
105
105
|
- lib/capistrano/laravel/version.rb
|
106
|
+
- lib/capistrano/tasks/composer.rake
|
106
107
|
- lib/capistrano/tasks/laravel.rake
|
107
108
|
- lib/capistrano/tasks/php_fpm.rake
|
109
|
+
- lib/capistrano/tasks/phplint.rake
|
108
110
|
- lib/capistrano/tasks/setup_config.rake
|
109
111
|
- lib/capistrano/templates/Capfile
|
110
112
|
- lib/capistrano/templates/deploy.rb.erb
|