capistrano-laravel 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b03cb47879f02595e858aa71eadaadc8457cfb5b
4
+ data.tar.gz: 92f4535330e34d0f8e313c2b8cacf429a1df6639
5
+ SHA512:
6
+ metadata.gz: 63567ba7474436fbeb694ffb11d908c92411fd80e0575f395c8952319fb33f6cdc654870acb5c2a45912b8c2f2011864bf8041719cc1e8f257cd1b81adca52ee
7
+ data.tar.gz: ad6d24774e0fbf6b7979a2ea198c20e11862dba6b13295e56ba0b9d8065c49a8d708ce2f8056ae23450839e0ad82e0d833e652d506495e635714e9dd142abf71
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ *.gem
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
- # Capistrano::FilePermissions
1
+ # Capistrano::laravel
2
2
 
3
- File permissions handling for Capistrano v3.*
3
+ Deploy Laravel applications with Capistrano v3.*
4
4
 
5
5
  ## Installation
6
6
 
@@ -29,14 +29,75 @@ require 'capistrano/laravel'
29
29
 
30
30
  ### Configuration
31
31
 
32
- The gem makes the following configuration variables available (shown with defaults)
32
+ The gem makes the following configuration variables available (shown with defaults).
33
33
 
34
34
  ```ruby
35
+ # Which roles to execute commands on.
35
36
  set :laravel_roles, :all
36
- set :laravel_artisan_flags, "--env production"
37
+
38
+ # Determines which operations to perform based on which version
39
+ # of the Laravel framework your project is using.
40
+ set :laravel_version, 5.1
41
+
42
+ # If using Laravel 5+, a dotenv file is used for environment configuration.
43
+ # This variable uploads the given file from the the host to the guest.
44
+ set :laravel_dotenv_file, './.env'
45
+
46
+ # Flags to add to artisan calls.
47
+ set :laravel_artisan_flags, "--env=production"
48
+
49
+ # Will set linked folders based on your Laravel version
50
+ set :laravel_set_linked_dirs, false
51
+
52
+ # Will set ACL paths based on your Laravel version
53
+ set :laravel_set_acl_paths, true
54
+
55
+ # Which user to set ACL permissions for.
37
56
  set :laravel_server_user, "www-data"
38
57
  ```
39
58
 
59
+ ### Tasks
60
+
61
+ The tasks are more or less automatic and are executed as follows:
62
+
63
+ ```ruby
64
+ before "deploy:starting", :prepare_laravel do
65
+ invoke "laravel:configure_folders"
66
+ end
67
+
68
+ before "deploy:updated", :laravel_tasks do
69
+ invoke "laravel:upload_dotenv_file"
70
+ invoke "laravel:optimize_release"
71
+ invoke "laravel:create_acl_paths"
72
+ invoke "deploy:set_permissions:acl"
73
+ end
74
+ ```
75
+
76
+ #### Task Descriptions
77
+
78
+ ```ruby
79
+ # Execute an artisan command
80
+ invoke "laravel:artisan", "command"
81
+
82
+ # Run any optimization commands
83
+ invoke "laravel:optimize_release"
84
+
85
+ # Configure linked dirs/acl dirs
86
+ invoke "laravel:configure_folders"
87
+
88
+ # Upload the dotenv file from local to remote
89
+ invoke "laravel:upload_dotenv_file"
90
+
91
+ # Seed the database
92
+ invoke "laravel:seed_db"
93
+
94
+ # Create any missing folders for ACL
95
+ invoke "laravel:create_acl_paths"
96
+
97
+ # Run migrations for the database
98
+ invoke "laravel:migrate_db"
99
+ ```
100
+
40
101
  ## Contributing
41
102
 
42
103
  1. Fork it
@@ -4,12 +4,12 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = 'capistrano-laravel'
7
- spec.version = '0.0.2'
8
- spec.authors = ['Peter Mitchell']
9
- spec.email = ['peterjmit@gmail.com']
10
- spec.description = %q{Laravel deployment for Capistrano 3.x}
7
+ spec.version = '0.0.3'
8
+ spec.authors = ['Peter Mitchell', 'Andrew Miller']
9
+ spec.email = ['peterjmit@gmail.com', 'ikari7789@yahoo.com']
10
+ spec.description = %q{Laravel specific deployment options for Capistrano 3.x}
11
11
  spec.summary = %q{Laravel deployment for Capistrano 3.x}
12
- spec.homepage = 'https://github.com/peterjmit/capistrano-laravel'
12
+ spec.homepage = 'https://github.com/capistrano/laravel'
13
13
  spec.license = 'MIT'
14
14
 
15
15
  spec.files = `git ls-files`.split($/)
@@ -17,10 +17,10 @@ Gem::Specification.new do |spec|
17
17
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
18
  spec.require_paths = ['lib']
19
19
 
20
- spec.add_dependency 'capistrano', '>= 3.0.0'
21
- spec.add_dependency 'capistrano-composer', '>= 0.0.3'
22
- spec.add_dependency 'capistrano-file-permissions'
20
+ spec.add_dependency 'capistrano', '~> 3.0'
21
+ spec.add_dependency 'capistrano-composer', '~> 0.0.6'
22
+ spec.add_dependency 'capistrano-file-permissions', '~> 1.0'
23
23
 
24
24
  spec.add_development_dependency 'bundler', '~> 1.3'
25
- spec.add_development_dependency 'rake'
25
+ spec.add_development_dependency 'rake', '~> 10.4'
26
26
  end
@@ -1,11 +1,4 @@
1
1
  require "capistrano/composer"
2
2
  require "capistrano/file-permissions"
3
- require "capistrano/laravel/artisan"
4
- require "capistrano/laravel/laravel"
5
- # require "capistrano/laravel/migrations"
6
3
 
7
- namespace :load do
8
- task :defaults do
9
- load 'capistrano/laravel/defaults.rb'
10
- end
11
- end
4
+ load File.expand_path("../tasks/laravel.rake", __FILE__)
@@ -0,0 +1,6 @@
1
+ module Capistrano
2
+ module Laravel
3
+ module Helpers
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ module Capistrano
2
+ module Laravel
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -1,8 +1,174 @@
1
- namespace :deploy do
2
- task :optimize do
3
- invoke "laravel:artisan", "optimize"
1
+ require 'capistrano/laravel/helpers'
2
+
3
+ include Comparable
4
+ include Capistrano::Laravel::Helpers
5
+
6
+ namespace :load do
7
+ task :defaults do
8
+ set :laravel_roles, :all
9
+ set :laravel_migrate_roles, :all
10
+ set :laravel_version, 5.1
11
+ set :laravel_dotenv_file, './.env'
12
+ set :laravel_artisan_flags, '--env=production'
13
+ set :laravel_artisan_migrate_flags, '--env=production'
14
+ set :laravel_set_linked_dirs, true
15
+ set :laravel_set_acl_paths, true
16
+ set :laravel_create_linked_acl_paths, true
17
+ set :laravel_server_user, 'www-data'
18
+
19
+ # Folders to link between releases
20
+ set :laravel_4_linked_dirs, [
21
+ 'app/storage'
22
+ ]
23
+ set :laravel_5_linked_dirs, [
24
+ 'storage'
25
+ ]
26
+ set :laravel_5_1_linked_dirs, [
27
+ 'storage'
28
+ ]
29
+
30
+ # Folders to set permissions on based on laravel version
31
+ set :laravel_4_acl_paths, [
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, [
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, [
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
+ ]
58
+ end
59
+ end
60
+
61
+ namespace :laravel do
62
+ desc 'Set the ACL for the web user based on Laravel version.'
63
+ task :configure_folders do
64
+ laravel_version = fetch(:laravel_version)
65
+ laravel_linked_dirs = []
66
+ laravel_acl_paths = []
67
+ if laravel_version < 5 # Laravel 4
68
+ laravel_linked_dirs = fetch(:laravel_4_linked_dirs)
69
+ laravel_acl_paths = fetch(:laravel_4_acl_paths)
70
+ elsif laravel_version < 5.1 # Laravel 5
71
+ laravel_linked_dirs = fetch(:laravel_5_linked_dirs)
72
+ laravel_acl_paths = fetch(:laravel_5_acl_paths)
73
+ else # Laravel 5.1 or greater
74
+ laravel_linked_dirs = fetch(:laravel_5_1_linked_dirs)
75
+ laravel_acl_paths = fetch(:laravel_5_1_acl_paths)
76
+ end
77
+
78
+ if fetch(:laravel_set_linked_dirs)
79
+ set :linked_dirs, fetch(:linked_dirs, []).push(*laravel_linked_dirs)
80
+ end
81
+
82
+ if fetch(:laravel_set_acl_paths)
83
+ set :file_permissions_paths, fetch(:file_permissions_paths, []).push(*laravel_acl_paths)
84
+ set :file_permissions_users, [fetch(:laravel_server_user)]
85
+ end
86
+ end
87
+
88
+ desc 'Create missing directories.'
89
+ task :create_linked_acl_paths do
90
+ if fetch(:laravel_create_linked_acl_paths)
91
+ if fetch(:laravel_version) < 5
92
+ laravel_acl_paths = fetch(:laravel_4_acl_paths)
93
+ elsif fetch(:laravel_version) < 5.1
94
+ laravel_acl_paths = fetch(:laravel_5_acl_paths)
95
+ else
96
+ laravel_acl_paths = fetch(:laravel_5_1_acl_paths)
97
+ end
98
+
99
+ on roles fetch(:laravel_roles) do
100
+ laravel_acl_paths.each do |path|
101
+ acl_path = release_path.join(path)
102
+ if test("[ ! -e '#{acl_path}' ]")
103
+ execute :mkdir, '-vp', acl_path
104
+ else
105
+ info "#{acl_path} already exists."
106
+ end
107
+ end
108
+ end
109
+ end
110
+ end
111
+
112
+ desc 'Upload dotenv file for release.'
113
+ task :upload_dotenv_file do
114
+ if fetch(:laravel_version) >= 5
115
+ on roles fetch(:laravel_roles) do
116
+ unless fetch(:laravel_dotenv_file).empty?
117
+ upload! fetch(:laravel_dotenv_file), "#{release_path}/.env"
118
+ end
119
+ end
120
+ end
121
+ end
122
+
123
+ desc 'Execute a provided artisan command'
124
+ task :artisan, :command_name do |_t, args|
125
+ # ask only runs if argument is not provided
126
+ ask(:cmd, 'list')
127
+ command = args[:command_name] || fetch(:cmd)
128
+
129
+ on roles fetch(:laravel_roles) do
130
+ within release_path do
131
+ execute :php, :artisan, command, *args.extras, fetch(:laravel_artisan_flags)
132
+ end
133
+ end
134
+ end
135
+
136
+ desc 'Optimize the configuration'
137
+ task :optimize_config do
138
+ invoke 'laravel:artisan', 'config:cache' if fetch(:laravel_version) >= 5
139
+ end
140
+
141
+ desc 'Optimize the routing file'
142
+ task :optimize_route do
143
+ invoke 'laravel:artisan', 'route:cache' if fetch(:laravel_version) >= 5
144
+ end
145
+
146
+ desc 'Optimize a Laravel installation for optimimum performance in production.'
147
+ task :optimize_release do
148
+ invoke 'laravel:artisan', :optimize, :'--force'
149
+ end
150
+
151
+ desc 'Run migrations against the database using Artisan.'
152
+ task :migrate_db do |_t, args|
153
+ on roles fetch(:laravel_migrate_roles) do
154
+ within release_path do
155
+ execute :php, :artisan, :migrate, *args.extras, fetch(:laravel_artisan_migrate_flags)
156
+ end
157
+ end
158
+ end
159
+
160
+ desc 'Rollback migrations against the database using Artisan.'
161
+ task :rollback_db do
162
+ on roles fetch(:laravel_roles) do
163
+ within release_path do
164
+ execute :php, :artisan, 'migrate:rollback', *args.extras, fetch(:laravel_artisan_migrate_flags)
165
+ end
166
+ end
4
167
  end
5
168
 
6
- after :updated, "deploy:optimize"
7
- after :updated, 'deploy:set_permissions:acl'
169
+ before 'deploy:starting', 'laravel:configure_folders'
170
+ after 'deploy:symlink:shared', 'laravel:create_linked_acl_paths'
171
+ after 'deploy:symlink:shared', 'deploy:set_permissions:acl'
172
+ after 'deploy:symlink:shared', 'laravel:upload_dotenv_file'
173
+ before 'deploy:updated', 'laravel:optimize_release'
8
174
  end
metadata CHANGED
@@ -1,103 +1,95 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-laravel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
5
- prerelease:
4
+ version: 0.0.3
6
5
  platform: ruby
7
6
  authors:
8
7
  - Peter Mitchell
8
+ - Andrew Miller
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-11-12 00:00:00.000000000 Z
12
+ date: 2016-03-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: capistrano
16
16
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
17
  requirements:
19
- - - ! '>='
18
+ - - "~>"
20
19
  - !ruby/object:Gem::Version
21
- version: 3.0.0
20
+ version: '3.0'
22
21
  type: :runtime
23
22
  prerelease: false
24
23
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
24
  requirements:
27
- - - ! '>='
25
+ - - "~>"
28
26
  - !ruby/object:Gem::Version
29
- version: 3.0.0
27
+ version: '3.0'
30
28
  - !ruby/object:Gem::Dependency
31
29
  name: capistrano-composer
32
30
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
31
  requirements:
35
- - - ! '>='
32
+ - - "~>"
36
33
  - !ruby/object:Gem::Version
37
- version: 0.0.3
34
+ version: 0.0.6
38
35
  type: :runtime
39
36
  prerelease: false
40
37
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
38
  requirements:
43
- - - ! '>='
39
+ - - "~>"
44
40
  - !ruby/object:Gem::Version
45
- version: 0.0.3
41
+ version: 0.0.6
46
42
  - !ruby/object:Gem::Dependency
47
43
  name: capistrano-file-permissions
48
44
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
45
  requirements:
51
- - - ! '>='
46
+ - - "~>"
52
47
  - !ruby/object:Gem::Version
53
- version: '0'
48
+ version: '1.0'
54
49
  type: :runtime
55
50
  prerelease: false
56
51
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
52
  requirements:
59
- - - ! '>='
53
+ - - "~>"
60
54
  - !ruby/object:Gem::Version
61
- version: '0'
55
+ version: '1.0'
62
56
  - !ruby/object:Gem::Dependency
63
57
  name: bundler
64
58
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
59
  requirements:
67
- - - ~>
60
+ - - "~>"
68
61
  - !ruby/object:Gem::Version
69
62
  version: '1.3'
70
63
  type: :development
71
64
  prerelease: false
72
65
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
66
  requirements:
75
- - - ~>
67
+ - - "~>"
76
68
  - !ruby/object:Gem::Version
77
69
  version: '1.3'
78
70
  - !ruby/object:Gem::Dependency
79
71
  name: rake
80
72
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
73
  requirements:
83
- - - ! '>='
74
+ - - "~>"
84
75
  - !ruby/object:Gem::Version
85
- version: '0'
76
+ version: '10.4'
86
77
  type: :development
87
78
  prerelease: false
88
79
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
80
  requirements:
91
- - - ! '>='
81
+ - - "~>"
92
82
  - !ruby/object:Gem::Version
93
- version: '0'
94
- description: Laravel deployment for Capistrano 3.x
83
+ version: '10.4'
84
+ description: Laravel specific deployment options for Capistrano 3.x
95
85
  email:
96
86
  - peterjmit@gmail.com
87
+ - ikari7789@yahoo.com
97
88
  executables: []
98
89
  extensions: []
99
90
  extra_rdoc_files: []
100
91
  files:
92
+ - ".gitignore"
101
93
  - Gemfile
102
94
  - LICENSE
103
95
  - README.md
@@ -105,36 +97,31 @@ files:
105
97
  - capistrano-laravel.gemspec
106
98
  - lib/capistrano-laravel.rb
107
99
  - lib/capistrano/laravel.rb
108
- - lib/capistrano/laravel/artisan.rb
109
- - lib/capistrano/laravel/defaults.rb
110
- - lib/capistrano/laravel/laravel.rb
111
- - lib/capistrano/laravel/migrations.rb
112
- - lib/capistrano/tasks/artisan.rake
100
+ - lib/capistrano/laravel/helpers.rb
101
+ - lib/capistrano/laravel/version.rb
113
102
  - lib/capistrano/tasks/laravel.rake
114
- - lib/capistrano/tasks/migrations.rake
115
- homepage: https://github.com/peterjmit/capistrano-laravel
103
+ homepage: https://github.com/capistrano/laravel
116
104
  licenses:
117
105
  - MIT
106
+ metadata: {}
118
107
  post_install_message:
119
108
  rdoc_options: []
120
109
  require_paths:
121
110
  - lib
122
111
  required_ruby_version: !ruby/object:Gem::Requirement
123
- none: false
124
112
  requirements:
125
- - - ! '>='
113
+ - - ">="
126
114
  - !ruby/object:Gem::Version
127
115
  version: '0'
128
116
  required_rubygems_version: !ruby/object:Gem::Requirement
129
- none: false
130
117
  requirements:
131
- - - ! '>='
118
+ - - ">="
132
119
  - !ruby/object:Gem::Version
133
120
  version: '0'
134
121
  requirements: []
135
122
  rubyforge_project:
136
- rubygems_version: 1.8.25
123
+ rubygems_version: 2.5.1
137
124
  signing_key:
138
- specification_version: 3
125
+ specification_version: 4
139
126
  summary: Laravel deployment for Capistrano 3.x
140
127
  test_files: []
@@ -1 +0,0 @@
1
- load File.expand_path("../../tasks/artisan.rake", __FILE__)
@@ -1,17 +0,0 @@
1
- set :laravel_roles, :all
2
- set :laravel_artisan_flags, "--env production"
3
- set :laravel_server_user, "www-data"
4
-
5
- # fix bug in capistrano-file-permissions
6
- set :linked_dirs, []
7
-
8
- set :file_permissions_paths, [
9
- 'app/storage',
10
- 'app/storage/cache',
11
- 'app/storage/logs',
12
- 'app/storage/meta',
13
- 'app/storage/sessions',
14
- 'app/storage/views',
15
- ]
16
- set :file_permissions_users, [fetch(:laravel_server_user)]
17
-
@@ -1 +0,0 @@
1
- load File.expand_path("../../tasks/laravel.rake", __FILE__)
@@ -1 +0,0 @@
1
- load File.expand_path("../../tasks/migrations.rake", __FILE__)
@@ -1,14 +0,0 @@
1
- namespace :laravel do
2
- desc "Exceute a provided artisan command"
3
- task :artisan, :command_name do |t, args|
4
- # ask only runs if argument is not provided
5
- ask(:cmd, "list")
6
- command = args[:command_name] || fetch(:cmd)
7
-
8
- on roles fetch(:laravel_roles) do
9
- within release_path do
10
- execute :php, :artisan, command, *args.extras, fetch(:laravel_artisan_flags)
11
- end
12
- end
13
- end
14
- end
@@ -1,7 +0,0 @@
1
- namespace :deploy do
2
- task :migrate do
3
- within release_path do
4
- invoke "laravel:artisan", "migrate"
5
- end
6
- end
7
- end