capistrano-typo3 0.2.1

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: 76d99608b0dcac5af96531179aaad02982ff4da9
4
+ data.tar.gz: 51a3b0b107ec71204c7242ddadc65384dc0bd9ff
5
+ SHA512:
6
+ metadata.gz: 87348a2e0510449b6f107d8f864b3d4ce8e41d067dc5b226bf24356b33546e141b8b78566cac7f13206ebec90a2f2a3904271ee10a69991b344464a075a89f88
7
+ data.tar.gz: 2f9a6468c5964730a45e72387a70e9d66b0fc6def9845c78e0f00d4ea28ad55ef5d977fd03d00d20f218543c99e9ff6badbe66f0fe5b03a878ec9fb8b52f5bb6
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/CHANGELOG.md ADDED
@@ -0,0 +1,49 @@
1
+ # CHANGELOG
2
+
3
+ ## capistrano-typo3 0.2.1
4
+ * new init tasks and rename setup to init
5
+ * code cleanup
6
+ * use new rake-typo3 repository in place of deployTYPO3
7
+
8
+ ## capistrano-typo3 0.2.0
9
+ * new official name,
10
+ * publishing to rubygems
11
+ * add typo3 db migrations
12
+ * add pre and post tests
13
+ * update src after deploy
14
+ * Removed Manual, for now use README.md
15
+
16
+ ## captypo3 0.1.6
17
+ * add db migrate
18
+ * add always pull deployTYPO3
19
+ * add rspec task
20
+
21
+ ## captypo3 0.1.5
22
+ * add sync & deploy for continuous integration
23
+ * add content cache flush
24
+ * initial 6.x compatibility
25
+ * add stock gitignore
26
+ * update manual
27
+ * add upgrade section howto
28
+ * remove double upgrade task
29
+
30
+ ## captypo3 0.1.4
31
+ * new name captypo3
32
+ * new task git:pending
33
+ * new task git:pending_since[hash]
34
+ * new task deploy:last_revision
35
+
36
+ ## typo3capistrano 0.1.3
37
+
38
+ * new tasks setup_fase1
39
+ * new tasks setup_fase2
40
+ * new tasks setup_fase3
41
+ * update Manual.md
42
+ * lots of fixes
43
+
44
+ ## typo3capistrano 0.1.2
45
+ * rename GEM
46
+
47
+ ## cap3typo3 0.1.1
48
+ * complete rewrite, let deployTYPO3 do all the work, lean and mean
49
+
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in capistrano-typo3.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Pim Snel
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,61 @@
1
+ # Capistrano::Typo3
2
+
3
+ **Note: this plugin works only with Capistrano 3.** Please check the capistrano
4
+ gem version you're using before installing this gem:
5
+ `$ bundle show | grep capistrano`
6
+
7
+ Capistrano deployment tasks for TYPO3 CMS. Incl. TYPO3 versions 4.5.x ... 6.2.x.
8
+
9
+ ## Compatibility
10
+
11
+ The versions below have been tested with capistrano-typo3
12
+
13
+ * 4.5.x
14
+ * 4.6.x
15
+ * 4.7.x
16
+ * 6.2.x
17
+
18
+ ## Configuration
19
+
20
+ :keep_git For development environments. If set 1 a kickstart keep the orginal .git directory so changes can be commited.
21
+ default 0
22
+ set :keep_git, 1
23
+
24
+ ## Installation
25
+
26
+ Add this line to your application's Gemfile:
27
+
28
+ ```ruby
29
+ gem 'capistrano-typo3'
30
+ ```
31
+
32
+ And then execute:
33
+
34
+ $ bundle
35
+
36
+ Or install it yourself as:
37
+
38
+ $ gem install capistrano-typo3
39
+
40
+ ## Usage
41
+
42
+ TODO: Write usage instructions here
43
+
44
+ ## References / inspiration
45
+ * https://github.com/programmerqeu/capistrano-typo3-cms
46
+ * http://webdesign.about.com/od/servers/qt/web-servers-and-workflow.htm
47
+ * https://marketpress.com/2013/deploying-wordpress-with-git-and-capistrano/
48
+ * http://www.slideshare.net/jsegars/site-development-processes-for-small-teams
49
+ * http://www.zodiacmedia.co.uk/blog/capistrano-3-tutorial-series-part-2
50
+ * http://www.slideshare.net/aoemedia/2013-11-typo3-camp-pl
51
+ * http://stackoverflow.com/questions/9860593/deploying-multiple-applications-into-a-single-tree-with-capistrano-and-git
52
+ * http://stackoverflow.com/questions/11905360/how-best-to-manage-typo3-installations-using-git
53
+
54
+ ## Contributing
55
+
56
+ 1. Fork it ( https://github.com/[my-github-username]/capistrano-typo3/fork )
57
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
58
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
59
+ 4. Push to the branch (`git push origin my-new-feature`)
60
+ 5. Create a new Pull Request
61
+
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'capistrano/typo3/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "capistrano-typo3"
8
+ spec.version = Capistrano::Typo3::VERSION
9
+ spec.authors = ["Pim Snel"]
10
+ spec.email = ["pim@lingewoud.nl"]
11
+ spec.summary = %q{Capistrano 3 tasks for TYPO3 CMS}
12
+ spec.description = %q{Capistrano 3 tasks for TYPO3 CMS. Incl. TYPO3 versions 4.5.x ... 6.2.x.}
13
+ spec.homepage = "https://github.com/mipmip/capistrano-typo3"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.7"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ end
@@ -0,0 +1,11 @@
1
+ # vim: ft=ruby:sts=2:expandtab
2
+ namespace :deploy do
3
+ desc "display last revision log line"
4
+ task :last_revision do
5
+ on roles(:all) do
6
+ execute "cd #{fetch(:deploy_to)} && tail -n1 revisions.log"
7
+ end
8
+ end
9
+
10
+ after :finishing, 'typo3:after_deploy'
11
+ end
@@ -0,0 +1,44 @@
1
+ # vim: ft=ruby:sts=2:expandtab
2
+ # -- OVERRIDES
3
+ # Save this file as lib/capistrano/tasks/git.cap
4
+ namespace :git do
5
+
6
+ desc 'Copy repo to releases'
7
+ task create_release: :'git:update' do
8
+ on roles(:all) do
9
+ with fetch(:git_environmental_variables) do
10
+ within repo_path do
11
+ execute :git, :clone, '-b', fetch(:branch), '--recursive', '.', release_path
12
+ end
13
+ end
14
+ end
15
+ end
16
+
17
+ desc "Show last git commit"
18
+ task :last_commit do
19
+ on roles(:all) do
20
+ execute "cd #{fetch(:deploy_to)} && rake cap:git_last_commit"
21
+ end
22
+ end
23
+
24
+ desc 'pending commits since last release'
25
+ task :pending do
26
+ revline=''
27
+ on roles :all do
28
+ revline = capture("tail -n1 #{fetch(:deploy_to)}/revisions.log")
29
+ end
30
+ githash =revline.split("(at")[1].split(")")[0]
31
+
32
+ system("git clone -n #{repo_url} /tmp/cap_pending")
33
+ print `cd /tmp/cap_pending && git log #{githash}..HEAD`
34
+ system("rm -Rf /tmp/cap_pending")
35
+ end
36
+
37
+ desc 'pending commits since [commithash]'
38
+ task :pending_since , :commithash do |t, args|
39
+ githash = args[:commithash]
40
+ on roles(:all) do
41
+ execute "cd #{fetch(:deploy_to)}/current && git log #{githash}..HEAD"
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,421 @@
1
+ # vim: ft=ruby:sts=2:expandtab
2
+ lock '3.1.0'
3
+ require "PP"
4
+
5
+ #-----
6
+
7
+ set :keep_git, 0
8
+ set :relative_current_symlink, 1
9
+ set :a2restart, "/etc/init.d/apache2 restart"
10
+ set :a2status, "/etc/init.d/apache2 status"
11
+ set :skip_pull, 0
12
+
13
+ namespace :typo3 do
14
+
15
+ namespace :helper do
16
+
17
+ # desc "remove deploy_to directory"
18
+ task :rm_deploy_to do
19
+ on roles(:all) do
20
+ execute "rm -Rf #{fetch(:deploy_to)}"
21
+ end
22
+ end
23
+
24
+ #desc "remove deploy_to directory"
25
+ task "create_typo3yaml" do
26
+
27
+ on roles(:all) do
28
+ t3yaml = YAML::load_file('/tmp/typo3.yml') #Load
29
+
30
+ t3yaml = {}
31
+ t3yaml['all'] = {}
32
+ t3yaml['all']['TYPO3_MAIN_VERSION'] = fetch(:t3_main_version)
33
+ t3yaml['all']['SOURCEFORGE_MIRROR'] = fetch(:t3_sourceforge_mirror)
34
+ t3yaml['all']['SYNCLIVE'] = {}
35
+ t3yaml['all']['SYNCLIVE']['SYNCCMDS'] = fetch(:t3_live_sync)['filesync']
36
+ t3yaml['all']['SYNCLIVE']['SSH_DB_SERVER'] = fetch(:t3_live_sync)['dbsync']['ssh_server']
37
+ t3yaml['all']['SYNCLIVE']['SSH_DB_USER'] = fetch(:t3_live_sync)['dbsync']['ssh_user']
38
+ t3yaml['all']['SYNCLIVE']['DB'] = fetch(:t3_live_sync)['dbsync']
39
+
40
+ stage = fetch(:stage).to_s
41
+
42
+ t3yaml[stage] = {}
43
+ t3yaml[stage]['DB'] = {}
44
+ t3yaml[stage]['DB']['dbname'] = fetch(:dbname)
45
+ t3yaml[stage]['DB']['dbuser'] = fetch(:dbuser)
46
+ t3yaml[stage]['DB']['dbpass'] = fetch(:dbpass)
47
+ t3yaml[stage]['DB']['dbhost'] = fetch(:dbhost)
48
+
49
+ t3yaml[stage]['SQL_UPDATES'] = fetch(:t3_sql_updates)
50
+ t3yaml[stage]['TYPO3_CONF_VARS_EXT_EXTCONF'] = fetch(:t3_conf_vars_ext_extconf)
51
+ t3yaml[stage]['TYPO3_SOURCE_PATCHES'] = fetch(:t3_source_patches)
52
+ t3yaml[stage]['DISABLE_EXTENSIONS'] = fetch(:t3_disable_extensions)
53
+ t3yaml[stage]['FILE_SEARCH_REPLACE'] = fetch(:t3_file_search_replace)
54
+
55
+ contents = StringIO.new(t3yaml.to_yaml)
56
+ upload! contents, "#{fetch(:deploy_to)}/typo3.yml"
57
+
58
+ end
59
+ end
60
+ end
61
+
62
+
63
+ # desc "install deployTYPO3 from github"
64
+ task :install_rake_typo3 do
65
+
66
+ set :skip_pull, 1
67
+
68
+ on roles(:all) do
69
+ execute "git clone https://github.com/Lingewoud/rake-typo3.git #{fetch(:deploy_to)}"
70
+ #execute "cd #{fetch(:deploy_to)} && git checkout capistrano_version"
71
+ execute "cd #{fetch(:deploy_to)} && /var/lib/gems/1.8/bin/bundle install"
72
+ end
73
+
74
+ print "rake-typo3 has been installed"
75
+ end
76
+
77
+ # desc "install deployTYPO3 from github"
78
+ task :pull_rake_typo3 do
79
+ if(fetch(:skip_pull)==0)
80
+
81
+ invoke 'typo3:checkandremove_old_deploytypo3_install_new'
82
+ on roles(:all) do
83
+ execute "cd #{fetch(:deploy_to)} && git pull"
84
+ execute "cd #{fetch(:deploy_to)} && /var/lib/gems/1.8/bin/bundle install"
85
+ end
86
+ end
87
+ set :skip_pull, 1
88
+ end
89
+
90
+ task :checkandremove_old_deploytypo3_install_new do
91
+ on roles(:all) do
92
+ remote = capture "cd #{fetch(:deploy_to)} && git remote -v"
93
+ if remote.include?('deploy')
94
+ print "removing old repository"
95
+ execute "cd #{fetch(:deploy_to)} && rm -Rf .bundle config docs lib log spec .gitignore .rspec .travis.yml CHANGELOG.md Gemfile Gemfile.lock README.md Rakefile.rb VERSION .git"
96
+ execute "git clone https://github.com/Lingewoud/rake-typo3.git #{fetch(:deploy_to)}/.clone"
97
+ execute "cd #{fetch(:deploy_to)}/.clone && mv ./* ../"
98
+ execute "cd #{fetch(:deploy_to)}/.clone && mv .bundle .git .gitignore .rspec .travis.yml ../"
99
+ end
100
+ end
101
+ end
102
+
103
+ # Empty repository must exist in git remote.
104
+ # This creates useable fresh skeleton for TYPO3
105
+ #
106
+ # From here:
107
+ # - a new TYPO3 enviroment can be created
108
+ # - an existing TYPO3 environment can be imported in this module
109
+ desc "init a initial dev environment"
110
+ task :init1_empty_dummy do
111
+
112
+ invoke 'typo3:helper:rm_deploy_to'
113
+ invoke 'typo3:install_rake_typo3'
114
+ invoke 'deploy:check'
115
+ invoke 'deploy:updating'
116
+ invoke 'typo3:current_relative_symlink'
117
+ invoke 'typo3:helper:create_typo3yaml'
118
+
119
+ on roles(:all) do
120
+ execute "cd #{fetch(:deploy_to)} && mkdir -p shared/fileadmin shared/typo3temp shared/uploads"
121
+ execute "echo '#{fetch(:stage).to_s}' > #{fetch(:deploy_to)}/STAGE"
122
+ execute "cd #{fetch(:deploy_to)}/current/ && git remote set-url origin #{fetch(:repo_url)}"
123
+ execute "cd #{fetch(:deploy_to)}/current/ && mkdir -p deploy/patches"
124
+ execute "cd #{fetch(:deploy_to)}/current/ && touch deploy/patches/.keep"
125
+ execute "cd #{fetch(:deploy_to)}/current/ && mkdir -p deploy/migrations"
126
+ execute "cd #{fetch(:deploy_to)}/current/ && touch deploy/migrations/.keep"
127
+ execute "cd #{fetch(:deploy_to)}/current/ && mkdir -p dummy/typo3conf/ext"
128
+ execute "cd #{fetch(:deploy_to)}/current/ && touch dummy/typo3conf/ext/index.html"
129
+ execute "cd #{fetch(:deploy_to)} && cp config/gitignore current/.gitignore"
130
+ end
131
+
132
+ invoke 'typo3:upgrade_source'
133
+ print "initial environment has been setup"
134
+ end
135
+
136
+ # desc "init step 2: install a fresh TYPO3 in the designated version"
137
+ task :init2_install_typo3 do
138
+ print "SORRY NOT YET IMPLEMENTED"
139
+ end
140
+
141
+ desc "init step 2: clone from extisting TYPO3 environment"
142
+ task :init2_install_typo3 do
143
+
144
+ print "\nNOTE: When this task fails most times there is a problem with your ssh authorized public keys\n\n"
145
+
146
+ invoke 'typo3:helper:create_typo3yaml'
147
+ invoke 'typo3:sync_from_production'
148
+
149
+ on roles(:all) do
150
+
151
+ execute "rsync -v #{fetch(:t3_clone_original)[:ssh_user]}@#{fetch(:t3_clone_original)[:ssh_host]}:#{fetch(:t3_clone_original)[:dummy_root]}/* #{fetch(:deploy_to)}/current/dummy/"
152
+ execute "rsync -v #{fetch(:t3_clone_original)[:ssh_user]}@#{fetch(:t3_clone_original)[:ssh_host]}:#{fetch(:t3_clone_original)[:dummy_root]}/.* #{fetch(:deploy_to)}/current/dummy/"
153
+ execute "rsync -av --exclude ext --exclude *.log --exclude temp* #{fetch(:t3_clone_original)[:ssh_user]}@#{fetch(:t3_clone_original)[:ssh_host]}:#{fetch(:t3_clone_original)[:dummy_root]}/typo3conf/ #{fetch(:deploy_to)}/current/dummy/typo3conf/"
154
+ execute "rsync -avL #{fetch(:t3_clone_original)[:ssh_user]}@#{fetch(:t3_clone_original)[:ssh_host]}:#{fetch(:t3_clone_original)[:dummy_root]}/typo3conf/ext/ #{fetch(:deploy_to)}/current/dummy/typo3conf/ext/"
155
+
156
+ #TODO cache problem remove temp* files
157
+
158
+ # execute "cd #{fetch(:deploy_to)}/current && find `dummy/typo3conf/ext -name '.git'`"
159
+ #TODO do git module magic
160
+
161
+ execute "cd #{fetch(:deploy_to)} && rake cap:update_localconf_db_credentials"
162
+ execute "cd #{fetch(:deploy_to)} && rake cap:update_localconf_disable_extensions"
163
+ execute "cd #{fetch(:deploy_to)} && rake cap:update_localconf_extconf_settings"
164
+ execute "cd #{fetch(:deploy_to)} && rake cap:run_file_searchreplace_updates"
165
+ end
166
+ end
167
+
168
+ desc "Setup a new production environment. Manually sync content from old production"
169
+ task :init3_setup_new_stage_no_sync do
170
+ invoke 'typo3:rm_deploy_to'
171
+ invoke 'typo3:install_rake_typo3'
172
+
173
+ on roles(:all) do
174
+ execute "cd #{fetch(:deploy_to)} && mkdir -p shared/fileadmin shared/typo3temp shared/uploads"
175
+ execute "echo '#{fetch(:stage).to_s}' > #{fetch(:deploy_to)}/STAGE"
176
+ end
177
+
178
+ invoke 'typo3:helper:create_typo3yaml'
179
+ invoke 'deploy'
180
+ invoke 'typo3:current_relative_symlink'
181
+
182
+ invoke 'typo3:upgrade_source'
183
+
184
+ print "environment has been setup, you do need to sync from old production"
185
+ end
186
+
187
+ desc "Setup a new staged typo3 environment when a it's already in model"
188
+ task :init3_setup_new_stage_sync do
189
+ invoke 'init3_setup_new_stage_no_sync'
190
+ invoke 'typo3:sync_from_production'
191
+ end
192
+
193
+ desc 'merge with [remote_branch]'
194
+ task :merge_with , :remotebranch do |t, args|
195
+
196
+ invoke 'typo3:helper:create_typo3yaml'
197
+ invoke 'deploy'
198
+
199
+ on roles(:all) do
200
+ branch = args[:remotebranch]
201
+ execute "cd #{fetch(:deploy_to)}/current && git remote set-url origin #{fetch(:repo_url)}"
202
+ execute "cd #{fetch(:deploy_to)}/current && git stash"
203
+ execute "cd #{fetch(:deploy_to)}/current && git fetch"
204
+ execute "cd #{fetch(:deploy_to)}/current && git checkout #{branch}"
205
+ execute "cd #{fetch(:deploy_to)}/current && git checkout master"
206
+ execute "cd #{fetch(:deploy_to)}/current && git merge --strategy-option ours #{branch}"
207
+
208
+ execute "cd #{fetch(:deploy_to)} && rake cap:update_localconf_db_credentials"
209
+ execute "cd #{fetch(:deploy_to)} && rake cap:update_localconf_disable_extensions"
210
+ execute "cd #{fetch(:deploy_to)} && rake cap:update_localconf_extconf_settings"
211
+ execute "cd #{fetch(:deploy_to)} && rake cap:run_file_searchreplace_updates"
212
+
213
+ execute "cd #{fetch(:deploy_to)} && rake cap:flush_config_cache"
214
+ execute 'sudo', fetch(:a2restart)
215
+ end
216
+
217
+ invoke 'typo3:db_migrate'
218
+ invoke 'typo3:run_migrations'
219
+ #invoke 'typo3:after_deploy' not working, why?
220
+ invoke 'typo3:current_relative_symlink'
221
+ end
222
+
223
+ desc "sync db & files and then deploy. Typically for Continuous Integration"
224
+ task :sync_n_deploy do
225
+
226
+ invoke 'typo3:helper:create_typo3yaml'
227
+ invoke 'typo3:sync_from_production'
228
+ invoke 'deploy'
229
+ invoke 'typo3:flush_content_cache'
230
+ end
231
+
232
+ # desc "Run site presuite rspecs"
233
+ task :rspec_pre_suite do
234
+ on roles(:all) do
235
+ execute "cd #{fetch(:deploy_to)} && rake env:rspec_pre_suite"
236
+ end
237
+ end
238
+
239
+ # desc "Run site post browser rspecs"
240
+ task :rspec_post_browser do
241
+ on roles(:all) do
242
+ execute "cd #{fetch(:deploy_to)} && rake env:rspec_post_browser"
243
+ end
244
+ end
245
+
246
+ # desc "flush content cache"
247
+ task :flush_content_cache do
248
+ on roles(:all) do
249
+ execute "cd #{fetch(:deploy_to)} && rake env:truncate_cache_tables"
250
+ execute "cd #{fetch(:deploy_to)} && rake env:truncate_session_tables"
251
+ #execute "cd #{fetch(:deploy_to)} && rake env:flush_cache"
252
+ end
253
+ end
254
+
255
+ desc "Make db & files in env. identical to production"
256
+ task :sync_from_production do
257
+
258
+ invoke 'typo3:helper:create_typo3yaml'
259
+ invoke 'typo3:pull_rake_typo3'
260
+
261
+ on roles(:devtest,:syncfiles) do
262
+ execute "cd #{fetch(:deploy_to)} && rake cap:sync_files_from_production"
263
+ end
264
+ on roles(:devtest,:syncdb) do
265
+ execute "cd #{fetch(:deploy_to)} && rake cap:sync_db_from_production"
266
+ execute "cd #{fetch(:deploy_to)} && rake cap:run_sql_updates"
267
+
268
+ print "environment has been synced"
269
+ end
270
+ end
271
+
272
+ desc "Upgrade source in env to latest minor version"
273
+ task :upgrade_source do
274
+
275
+ invoke 'typo3:helper:create_typo3yaml'
276
+ invoke 'typo3:pull_rake_typo3'
277
+
278
+ on roles(:all) do
279
+ execute "cd #{fetch(:deploy_to)} && rake cap:update_typo3_source"
280
+ execute "cd #{fetch(:deploy_to)} && rake cap:link_source"
281
+ execute "cd #{fetch(:deploy_to)} && rake cap:link_source_insides"
282
+ execute "cd #{fetch(:deploy_to)} && rake cap:link_shared_dirs"
283
+ end
284
+
285
+ print "\nsource has been upgraded"
286
+ print "\n\nWARNING: YOU MUST RUN THE UPGRADE SCRIPTS IN BACKEND\n\n"
287
+ end
288
+
289
+ desc "Show environment information"
290
+ task :info do
291
+ on roles(:all) do
292
+ execute "cd #{fetch(:deploy_to)} && rake env:info"
293
+ end
294
+ end
295
+
296
+ ## Migrate typo3 schemas, e.g. after version update
297
+ #desc "Migrate database (typo3 EM migrations)"
298
+ task :db_migrate do
299
+
300
+ invoke 'typo3:helper:create_typo3yaml'
301
+ invoke 'typo3:pull_rake_typo3'
302
+
303
+ on roles(:all) do
304
+ execute "cd #{fetch(:deploy_to)} && rake cap:db_migrate"
305
+ end
306
+ end
307
+
308
+ ## Specific environment migration sql's. E.g. rename all fe-users etc..
309
+ ## migrations should be placed in current/deploy/migrations/
310
+ #desc "Run migrations (sql migrations)"
311
+ task :run_migrations do
312
+ invoke 'typo3:helper:create_typo3yaml'
313
+ invoke 'typo3:pull_rake_typo3'
314
+
315
+ on roles(:all) do
316
+ execute "cd #{fetch(:deploy_to)} && rake cap:run_migrations"
317
+ end
318
+ end
319
+
320
+ # when not in deploy latest ls releases/ -1 | sort -r | head -n 1
321
+ task :current_relative_symlink do
322
+ on roles(:all) do
323
+ execute "rm -f #{current_path}"
324
+ execute "cd #{fetch(:deploy_to)} && ln -s releases/#{File.basename release_path} current"
325
+ end
326
+ end
327
+
328
+ task :after_deploy do
329
+ invoke 'typo3:helper:create_typo3yaml'
330
+ invoke 'typo3:pull_rake_typo3'
331
+
332
+ on roles(:all) do
333
+ execute "cd #{fetch(:deploy_to)} && rake cap:update_localconf_db_credentials"
334
+ execute "cd #{fetch(:deploy_to)} && rake cap:update_localconf_disable_extensions"
335
+ execute "cd #{fetch(:deploy_to)} && rake cap:update_localconf_extconf_settings"
336
+ execute "cd #{fetch(:deploy_to)} && rake cap:run_file_searchreplace_updates"
337
+ execute "cd #{fetch(:deploy_to)} && rake cap:flush_config_cache"
338
+ end
339
+
340
+ invoke 'typo3:upgrade_source'
341
+ invoke 'typo3:db_migrate'
342
+ invoke 'typo3:run_migrations'
343
+
344
+ on roles(:all) do
345
+ execute 'sudo', fetch(:a2restart)
346
+ end
347
+
348
+ invoke 'typo3:current_relative_symlink'
349
+ end
350
+ end
351
+
352
+ namespace :test do
353
+ task :test_pre_setup do
354
+ on roles(:all) do
355
+ # test apache restart is allowed
356
+ # test ssh access to live server is allowed
357
+ # test stage is configured in typo3.yml
358
+ end
359
+ end
360
+
361
+ task :test_post_setup do
362
+ on roles(:all) do
363
+ # test if dummy index.php is readable, correctly linked
364
+ # temp cache files are removed
365
+ end
366
+ end
367
+
368
+ task :test_pre_deploy do
369
+ #if production test if repo is dirty
370
+ on roles(:all) do
371
+ end
372
+ end
373
+ task :test_post_deploy do
374
+ on roles(:all) do
375
+ #test symlinks
376
+ #test source version
377
+ #test database connection
378
+ #test chmods
379
+ #test chowns
380
+ end
381
+ end
382
+
383
+ namespace :depreciated do
384
+
385
+ #desc "Setup a new staged typo3 environment for the first time"
386
+ task :setup_fase1 do
387
+ on roles(:all) do
388
+ execute "rm -Rf #{fetch(:deploy_to)}"
389
+ end
390
+
391
+ invoke 'typo3:install_rake_typo3'
392
+
393
+ #create releases and shared
394
+ invoke 'deploy:check'
395
+ invoke 'deploy:updating'
396
+ invoke 'typo3:current_relative_symlink'
397
+
398
+ on roles(:all) do
399
+ execute "cd #{fetch(:deploy_to)} && mkdir -p shared/fileadmin shared/typo3temp shared/uploads"
400
+ execute "echo '#{fetch(:stage).to_s}' > #{fetch(:deploy_to)}/STAGE"
401
+ end
402
+
403
+ #if keep_git
404
+ on roles(:all) do
405
+ execute "cd #{fetch(:deploy_to)}/current/ && git remote set-url origin #{fetch(:repo_url)}"
406
+ execute "cd #{fetch(:deploy_to)}/current/ && mkdir -p deploy/patches"
407
+ execute "cd #{fetch(:deploy_to)}/current/ && mkdir -p deploy/migrations"
408
+ execute "cd #{fetch(:deploy_to)} && cp config/typo3.sample.yml current/deploy/typo3.yml"
409
+ execute "cd #{fetch(:deploy_to)} && cp config/gitignore current/.gitignore"
410
+ end
411
+
412
+ invoke 'typo3:upgrade_source'
413
+
414
+ print "\ninitial environment has been setup to fase 1. edit current/deploy/typo3.yml\n"
415
+ print "\nand populate current with the dummy\n"
416
+ end
417
+ end
418
+
419
+
420
+
421
+ end
@@ -0,0 +1,5 @@
1
+ module Capistrano
2
+ module Typo3
3
+ VERSION = "0.2.1"
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ require "capistrano/typo3/version"
2
+ require 'yaml' # Built in, no gem required
3
+ load File.expand_path('../tasks/typo3.cap', __FILE__)
4
+ load File.expand_path('../tasks/deploy.cap', __FILE__)
5
+ load File.expand_path('../tasks/git.cap', __FILE__)
metadata ADDED
@@ -0,0 +1,84 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: capistrano-typo3
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.1
5
+ platform: ruby
6
+ authors:
7
+ - Pim Snel
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-11-22 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ description: Capistrano 3 tasks for TYPO3 CMS. Incl. TYPO3 versions 4.5.x ... 6.2.x.
42
+ email:
43
+ - pim@lingewoud.nl
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - .gitignore
49
+ - CHANGELOG.md
50
+ - Gemfile
51
+ - LICENSE.txt
52
+ - README.md
53
+ - Rakefile
54
+ - capistrano-typo3.gemspec
55
+ - lib/capistrano/tasks/deploy.cap
56
+ - lib/capistrano/tasks/git.cap
57
+ - lib/capistrano/tasks/typo3.cap
58
+ - lib/capistrano/typo3.rb
59
+ - lib/capistrano/typo3/version.rb
60
+ homepage: https://github.com/mipmip/capistrano-typo3
61
+ licenses:
62
+ - MIT
63
+ metadata: {}
64
+ post_install_message:
65
+ rdoc_options: []
66
+ require_paths:
67
+ - lib
68
+ required_ruby_version: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - '>='
71
+ - !ruby/object:Gem::Version
72
+ version: '0'
73
+ required_rubygems_version: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ requirements: []
79
+ rubyforge_project:
80
+ rubygems_version: 2.4.2
81
+ signing_key:
82
+ specification_version: 4
83
+ summary: Capistrano 3 tasks for TYPO3 CMS
84
+ test_files: []