capistrano-symfony 0.4.0

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: 0b727a9e7183a8223bd8e058e9b40a7d12d38cf2
4
+ data.tar.gz: 1c88d66c1f6e43edf90b35295de2e25570ac7f3c
5
+ SHA512:
6
+ metadata.gz: 30eb6fa38b3b5c9e47697c9882ecf0175d41db2c23b1108cf3293d0457d54ae36a73241f088ff9d837f624922371c2f69f2a61f21e2d509c5a444b6348f2e838
7
+ data.tar.gz: 3b2db625b7f91e074e786fd372f4cbeeb9e0a9d8b719466a8bec5949f86de24676943b536e4f362643f1fecd7469f67edab8f842e852fbf084f362fea046e060
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/LICENCE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Peter Mitchell
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,173 @@
1
+ # Capistrano::Symfony
2
+
3
+ Symfony 2 (standard edition) specific tasks for Capistrano v3
4
+ (inspired by [capifony][2])
5
+
6
+ It leverages the following capistrano tasks to deploy a Symfony app
7
+
8
+ * https://github.com/capistrano/composer
9
+ * https://github.com/capistrano/file-permissions
10
+
11
+ ## Installation
12
+
13
+ ```
14
+ # Gemfile
15
+ gem 'capistrano', '~> 3.1'
16
+ gem 'capistrano-symfony', '~> 0.1', :github => 'capistrano/symfony'
17
+ ```
18
+
19
+ ## Usage
20
+
21
+ Require capistrano-symfony in your cap file
22
+
23
+ ```
24
+ # Capfile
25
+ require 'capistrano/symfony'
26
+ ```
27
+
28
+ ### Settings
29
+
30
+ capistrano-symfony exposes the following settings (displayed with defaults):
31
+
32
+ ```ruby
33
+ # Symfony environment
34
+ set :symfony_env, "prod"
35
+
36
+ # Symfony application path
37
+ set :app_path, "app"
38
+
39
+ # Symfony web path
40
+ set :web_path, "web"
41
+
42
+ # Symfony log path
43
+ set :log_path, fetch(:app_path) + "/logs"
44
+
45
+ # Symfony cache path
46
+ set :cache_path, fetch(:app_path) + "/cache"
47
+
48
+ # Symfony config file path
49
+ set :app_config_path, fetch(:app_path) + "/config"
50
+
51
+ # Controllers to clear
52
+ set :controllers_to_clear, ["app_*.php"]
53
+
54
+ # Files that need to remain the same between deploys
55
+ set :linked_files, []
56
+
57
+ # Dirs that need to remain the same between deploys (shared dirs)
58
+ set :linked_dirs, [fetch(:log_path), fetch(:web_path) + "/uploads"]
59
+
60
+ # Dirs that need to be writable by the HTTP Server (i.e. cache, log dirs)
61
+ set :file_permissions_paths, [fetch(:log_path), fetch(:cache_path)]
62
+
63
+ # Name used by the Web Server (i.e. www-data for Apache)
64
+ set :webserver_user, "www-data"
65
+
66
+ # Method used to set permissions (:chmod, :acl, or :chown)
67
+ set :permission_method, false
68
+
69
+ # Execute set permissions
70
+ set :use_set_permissions, false
71
+
72
+ # Symfony console path
73
+ set :symfony_console_path, fetch(:app_path) + "/console"
74
+
75
+ # Symfony console flags
76
+ set :symfony_console_flags, "--no-debug"
77
+
78
+ # Assets install path
79
+ set :assets_install_path, fetch(:web_path)
80
+
81
+ # Assets install flags
82
+ set :assets_install_flags, '--symlink'
83
+
84
+ # Assetic dump flags
85
+ set :assetic_dump_flags, ''
86
+
87
+ fetch(:default_env).merge!(symfony_env: fetch(:symfony_env))
88
+ ```
89
+
90
+ ### Flow
91
+
92
+ capistrano-symfony hooks into the [flow][1] offered by capistrano. It adds to that flow like so
93
+
94
+ * ```symfony:create_cache_dir```
95
+ * ```symfony:set_permissions```
96
+ * ```symfony:cache:warmup```
97
+ * ```symfony:clear_controllers```
98
+
99
+ ```
100
+ deploy
101
+ |__ deploy:starting
102
+ | |__ [before]
103
+ | | |__ deploy:ensure_stage
104
+ | | |__ deploy:set_shared_assets
105
+ | |__ deploy:check
106
+ |__ deploy:started
107
+ |__ deploy:updating
108
+ | |__ git:create_release
109
+ | |__ deploy:symlink:shared
110
+ | |__ symfony:create_cache_dir
111
+ | |__ symfony:set_permissions
112
+ |__ deploy:updated
113
+ | |__ symfony:cache:warmup
114
+ | |__ symfony:clear_controllers
115
+ |__ deploy:publishing
116
+ | |__ deploy:symlink:release
117
+ | |__ deploy:restart
118
+ |__ deploy:published
119
+ |__ deploy:finishing
120
+ | |__ deploy:cleanup
121
+ |__ deploy:finished
122
+ |__ deploy:log_revision
123
+ ```
124
+
125
+ ### Integrated common tasks
126
+
127
+ The folowing common tasks are already integrated:
128
+ * ```symfony:assets:install```
129
+ * ```symfony:assetic:dump```
130
+
131
+ So you can use them with hooks like this:
132
+ ```ruby
133
+ after 'deploy:updated', 'symfony:assets:install'
134
+ after 'deploy:updated', 'symfony:assetic:dump'
135
+ ```
136
+
137
+ ### Using the Symfony console
138
+
139
+ A task wrapping the symfony console is provided, making it easy to create tasks
140
+ that call console methods.
141
+
142
+ For example if you have installed the [DoctrineMigrationsBundle][3] in your
143
+ project you may want to run migrations during a deploy.
144
+
145
+ ```ruby
146
+ namespace :deploy do
147
+ task :migrate do
148
+ invoke 'symfony:console', 'doctrine:migrations:migrate', '--no-interaction'
149
+ end
150
+ end
151
+ ```
152
+
153
+ You can also apply role filter on your commands by passing a fourth parameter.
154
+
155
+ ```ruby
156
+ namespace :deploy do
157
+ task :migrate do
158
+ invoke 'symfony:console', 'doctrine:migrations:migrate', '--no-interaction', 'db'
159
+ end
160
+ end
161
+ ```
162
+
163
+ [1]: http://capistranorb.com/documentation/getting-started/flow/
164
+ [2]: http://capifony.org/
165
+ [3]: http://symfony.com/doc/current/bundles/DoctrineMigrationsBundle/index.html
166
+
167
+ ## Contributing
168
+
169
+ 1. Fork it
170
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
171
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
172
+ 4. Push to the branch (`git push origin my-new-feature`)
173
+ 5. Create new Pull Request
@@ -0,0 +1,35 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+
5
+ Gem::Specification.new do |gem|
6
+ gem.name = "capistrano-symfony"
7
+ gem.version = '0.4.0'
8
+ gem.authors = ["Peter Mitchell"]
9
+ gem.email = ["pete@peterjmit.com"]
10
+ gem.description = %q{Symfony specific Capistrano tasks}
11
+ gem.summary = %q{Capistrano Symfony - Easy deployment of Symfony 2 apps with Ruby over SSH}
12
+ gem.homepage = "http://github.com/capitrano/capistrano-symfony"
13
+
14
+ gem.files = `git ls-files`.split($/)
15
+ # no tests as of yet
16
+ # gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
17
+ gem.require_paths = ["lib"]
18
+
19
+ gem.licenses = ['MIT']
20
+
21
+ gem.post_install_message = <<eos
22
+ WARNING - This gem has switched repositories. This gem is now for the
23
+ capitrano-symfony plugin located at https://github.com/capistrano/symfony.
24
+ This package behaves differently from the previous, and the release versions
25
+ have changed.
26
+
27
+ The Big Brains Company and Thomas Tourlourat (@armetiz) kindly agreed to
28
+ tranfer the ownership of this gem over to the Capistrano organization. The
29
+ previous repository can be found here https://github.com/TheBigBrainsCompany/capistrano-symfony
30
+ eos
31
+
32
+ gem.add_dependency 'capistrano', '~> 3.1'
33
+ gem.add_dependency 'capistrano-composer', '~> 0.0.3'
34
+ gem.add_dependency 'capistrano-file-permissions', '~> 0.1.0'
35
+ end
File without changes
@@ -0,0 +1,13 @@
1
+ require "capistrano/file-permissions"
2
+ require "capistrano/composer"
3
+ require "capistrano/symfony/dsl"
4
+ require "capistrano/symfony/symfony"
5
+
6
+ # Core tasks for deploying symfony
7
+ load File.expand_path("../tasks/deploy.rake", __FILE__)
8
+
9
+ namespace :load do
10
+ task :defaults do
11
+ load "capistrano/symfony/defaults.rb"
12
+ end
13
+ end
@@ -0,0 +1,53 @@
1
+ # Symfony environment
2
+ set :symfony_env, "prod"
3
+
4
+ # Symfony application path
5
+ set :app_path, "app"
6
+
7
+ # Symfony web path
8
+ set :web_path, "web"
9
+
10
+ # Symfony log path
11
+ set :log_path, fetch(:app_path) + "/logs"
12
+
13
+ # Symfony cache path
14
+ set :cache_path, fetch(:app_path) + "/cache"
15
+
16
+ # Symfony config file path
17
+ set :app_config_path, fetch(:app_path) + "/config"
18
+
19
+ # Controllers to clear
20
+ set :controllers_to_clear, ["app_*.php"]
21
+
22
+ # Files that need to remain the same between deploys
23
+ set :linked_files, []
24
+
25
+ # Dirs that need to remain the same between deploys (shared dirs)
26
+ set :linked_dirs, [fetch(:log_path), fetch(:web_path) + "/uploads"]
27
+
28
+ # Dirs that need to be writable by the HTTP Server (i.e. cache, log dirs)
29
+ set :file_permissions_paths, [fetch(:log_path), fetch(:cache_path)]
30
+
31
+ # Name used by the Web Server (i.e. www-data for Apache)
32
+ set :webserver_user, "www-data"
33
+
34
+ # Method used to set permissions (:chmod, :acl, or :chown)
35
+ set :permission_method, false
36
+
37
+ # Execute set permissions
38
+ set :use_set_permissions, false
39
+
40
+ # Symfony console path
41
+ set :symfony_console_path, fetch(:app_path) + "/console"
42
+
43
+ # Symfony console flags
44
+ set :symfony_console_flags, "--no-debug"
45
+
46
+ # Assets install path
47
+ set :assets_install_path, fetch(:web_path)
48
+
49
+ # Assets install flags
50
+ set :assets_install_flags, '--symlink'
51
+
52
+ # Assetic dump flags
53
+ set :assetic_dump_flags, ''
@@ -0,0 +1 @@
1
+ load File.expand_path("../../tasks/deploy.rake", __FILE__)
@@ -0,0 +1 @@
1
+ require 'capistrano/symfony/dsl/paths'
@@ -0,0 +1,29 @@
1
+ require "capistrano/dsl/paths"
2
+
3
+ module Capistrano
4
+ module DSL
5
+ module Paths
6
+
7
+ def symfony_app_path
8
+ release_path.join(fetch(:app_path))
9
+ end
10
+
11
+ def symfony_web_path
12
+ release_path.join(fetch(:web_path))
13
+ end
14
+
15
+ def symfony_log_path
16
+ release_path.join(fetch(:log_path))
17
+ end
18
+
19
+ def symfony_cache_path
20
+ release_path.join(fetch(:cache_path))
21
+ end
22
+
23
+ def symfony_config_path
24
+ release_path.join(fetch(:app_config_path))
25
+ end
26
+
27
+ end
28
+ end
29
+ end
@@ -0,0 +1 @@
1
+ load File.expand_path("../../tasks/symfony.rake", __FILE__)
@@ -0,0 +1,18 @@
1
+ module Capistrano
2
+ class FileNotFound < StandardError
3
+ end
4
+ end
5
+
6
+ namespace :deploy do
7
+
8
+ task :updating do
9
+ invoke "symfony:create_cache_dir"
10
+ invoke "symfony:set_permissions"
11
+ end
12
+
13
+ task :updated do
14
+ invoke "symfony:cache:warmup"
15
+ invoke "symfony:clear_controllers"
16
+ end
17
+
18
+ end
@@ -0,0 +1,9 @@
1
+ namespace :deploy do
2
+ task :set_symfony_env do
3
+ fetch(:default_env).merge!(symfony_env: fetch(:symfony_env) || 'prod')
4
+ end
5
+ end
6
+
7
+ Capistrano::DSL.stages.each do |stage|
8
+ after stage, 'deploy:set_symfony_env'
9
+ end
@@ -0,0 +1,97 @@
1
+ load File.expand_path("../set_symfony_env.rake", __FILE__)
2
+
3
+ namespace :symfony do
4
+ desc "Execute a provided symfony command"
5
+ task :console, :command, :params, :role do |t, args|
6
+ # ask only runs if argument is not provided
7
+ ask(:cmd, "cache:clear")
8
+ command = args[:command] || fetch(:cmd)
9
+ role = args[:role] || :all
10
+ params = args[:params] || ''
11
+
12
+ on release_roles(role) do
13
+ within release_path do
14
+ execute :php, fetch(:symfony_console_path), command, params, fetch(:symfony_console_flags)
15
+ end
16
+ end
17
+
18
+ Rake::Task[t.name].reenable
19
+ end
20
+
21
+ task :command, :command_name, :flags do |t, args|
22
+ on roles(:all) do
23
+ warn "The task symfony:command is deprecated in favor of symfony:console"
24
+ invoke "symfony:console", args[:command_name], args[:flags]
25
+ end
26
+ end
27
+
28
+
29
+ namespace :cache do
30
+ desc "Run app/console cache:clear for the #{fetch(:symfony_env)} environment"
31
+ task :clear do
32
+ invoke "symfony:console", "cache:clear"
33
+ end
34
+
35
+ desc "Run app/console cache:warmup for the #{fetch(:symfony_env)} environment"
36
+ task :warmup do
37
+ invoke "symfony:console", "cache:warmup"
38
+ end
39
+ end
40
+
41
+ namespace :assets do
42
+ desc "Install assets"
43
+ task :install do
44
+ invoke "symfony:console", "assets:install", fetch(:assets_install_path) + ' ' + fetch(:assets_install_flags)
45
+ end
46
+ end
47
+
48
+ namespace :assetic do
49
+ desc "Dump assets with Assetic"
50
+ task :dump do
51
+ invoke "symfony:console", "assetic:dump", fetch(:assetic_dump_flags)
52
+ end
53
+ end
54
+
55
+ desc "Create the cache directory"
56
+ task :create_cache_dir do
57
+ on release_roles :all do
58
+ within release_path do
59
+ if test "[ -d #{symfony_cache_path} ]"
60
+ execute :rm, "-rf", symfony_cache_path
61
+ end
62
+ execute :mkdir, "-pv", fetch(:cache_path)
63
+ end
64
+ end
65
+ end
66
+
67
+ desc "Create the cache directory"
68
+ task :set_permissions do
69
+ on release_roles :all do
70
+ if fetch(:use_set_permissions)
71
+ invoke "deploy:set_permissions:#{fetch(:permission_method).to_s}"
72
+ end
73
+ end
74
+ end
75
+
76
+ desc "Clear non production controllers"
77
+ task :clear_controllers do
78
+ next unless any? :controllers_to_clear
79
+ on release_roles :all do
80
+ within symfony_web_path do
81
+ execute :rm, "-f", *fetch(:controllers_to_clear)
82
+ end
83
+ end
84
+ end
85
+
86
+ desc "Build the bootstrap file"
87
+ task :build_bootstrap do
88
+ on release_roles :all do
89
+ within release_path do
90
+ execute :php, "./vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php", fetch(:app_path)
91
+ end
92
+ end
93
+ end
94
+
95
+ end
96
+
97
+ task :symfony => ["symfony:console"]
metadata ADDED
@@ -0,0 +1,108 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: capistrano-symfony
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.4.0
5
+ platform: ruby
6
+ authors:
7
+ - Peter Mitchell
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-10-17 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: capistrano
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3.1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '3.1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: capistrano-composer
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 0.0.3
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 0.0.3
41
+ - !ruby/object:Gem::Dependency
42
+ name: capistrano-file-permissions
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 0.1.0
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 0.1.0
55
+ description: Symfony specific Capistrano tasks
56
+ email:
57
+ - pete@peterjmit.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - LICENCE.txt
64
+ - README.md
65
+ - capistrano-symfony.gemspec
66
+ - lib/capistrano-symfony.rb
67
+ - lib/capistrano/symfony.rb
68
+ - lib/capistrano/symfony/defaults.rb
69
+ - lib/capistrano/symfony/deploy.rb
70
+ - lib/capistrano/symfony/dsl.rb
71
+ - lib/capistrano/symfony/dsl/paths.rb
72
+ - lib/capistrano/symfony/symfony.rb
73
+ - lib/capistrano/tasks/deploy.rake
74
+ - lib/capistrano/tasks/set_symfony_env.rake
75
+ - lib/capistrano/tasks/symfony.rake
76
+ homepage: http://github.com/capitrano/capistrano-symfony
77
+ licenses:
78
+ - MIT
79
+ metadata: {}
80
+ post_install_message: |2
81
+ WARNING - This gem has switched repositories. This gem is now for the
82
+ capitrano-symfony plugin located at https://github.com/capistrano/symfony.
83
+ This package behaves differently from the previous, and the release versions
84
+ have changed.
85
+
86
+ The Big Brains Company and Thomas Tourlourat (@armetiz) kindly agreed to
87
+ tranfer the ownership of this gem over to the Capistrano organization. The
88
+ previous repository can be found here https://github.com/TheBigBrainsCompany/capistrano-symfony
89
+ rdoc_options: []
90
+ require_paths:
91
+ - lib
92
+ required_ruby_version: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ required_rubygems_version: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ requirements: []
103
+ rubyforge_project:
104
+ rubygems_version: 2.2.2
105
+ signing_key:
106
+ specification_version: 4
107
+ summary: Capistrano Symfony - Easy deployment of Symfony 2 apps with Ruby over SSH
108
+ test_files: []