capistrano-typo3 0.2.1 → 0.2.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 76d99608b0dcac5af96531179aaad02982ff4da9
4
- data.tar.gz: 51a3b0b107ec71204c7242ddadc65384dc0bd9ff
3
+ metadata.gz: f6f4f79ab97686028c2f458ef11e64107f51d862
4
+ data.tar.gz: efb8613d2dce1783a1452ca51b304f2a86f3a9ee
5
5
  SHA512:
6
- metadata.gz: 87348a2e0510449b6f107d8f864b3d4ce8e41d067dc5b226bf24356b33546e141b8b78566cac7f13206ebec90a2f2a3904271ee10a69991b344464a075a89f88
7
- data.tar.gz: 2f9a6468c5964730a45e72387a70e9d66b0fc6def9845c78e0f00d4ea28ad55ef5d977fd03d00d20f218543c99e9ff6badbe66f0fe5b03a878ec9fb8b52f5bb6
6
+ metadata.gz: fb2bb758fec52f21fb6734ee3ec211d7d4300c6bdd4f7c03e0b3487ec8492c8dda60f4ad2a70df6caa05f5db684d97268a454f598130599c7690b071737f6b70
7
+ data.tar.gz: b47c5ba25aaf1c2b78b9a02f055ec085f88441e9de51a0b6ce56f9eca13d4c087e6e2f9412a4fe42cc5ef4645ac0b860bc06a045490d3bc097e3ac3c3a4134da
data/CHANGELOG.md CHANGED
@@ -1,12 +1,29 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## capistrano-typo3 0.2.2
4
+ - always use use ./bin/rake
5
+ - always flush content cache after sync
6
+ - always set stage in before hooks
7
+ - renamed and implemented keep_git, now named git_no_cache
8
+ - large refactor
9
+ - reimplement typo3_conf_vars (TYPO3 6.x supported only)
10
+ - more cmd aliases for more compatibility (Now supporting OSX Yosemite)
11
+ - add create yml to info task
12
+ - add pull to info task
13
+ - add capistrano dependency
14
+ - add run sql updated after migrations
15
+ - fix wrong pp requirement
16
+ - removal of breaking debugging code
17
+ - only write yaml when conf arr is available
18
+ - bundle_executable config var
19
+
3
20
  ## capistrano-typo3 0.2.1
4
21
  * new init tasks and rename setup to init
5
22
  * code cleanup
6
23
  * use new rake-typo3 repository in place of deployTYPO3
7
24
 
8
25
  ## capistrano-typo3 0.2.0
9
- * new official name,
26
+ * new official name: capistrano-typo3
10
27
  * publishing to rubygems
11
28
  * add typo3 db migrations
12
29
  * add pre and post tests
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Capistrano::Typo3
1
+ # Capistrano::Typo3 [![Code Climate](https://codeclimate.com/github/mipmip/capistrano-typo3/badges/gpa.svg)](https://codeclimate.com/github/mipmip/capistrano-typo3)
2
2
 
3
3
  **Note: this plugin works only with Capistrano 3.** Please check the capistrano
4
4
  gem version you're using before installing this gem:
@@ -17,9 +17,8 @@ The versions below have been tested with capistrano-typo3
17
17
 
18
18
  ## Configuration
19
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
20
+ At the top of lib/capistrano/tasks/typo3.cap all variables are listed
21
+ and set to a default value.
23
22
 
24
23
  ## Installation
25
24
 
@@ -20,4 +20,5 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_development_dependency "bundler", "~> 1.7"
22
22
  spec.add_development_dependency "rake", "~> 10.0"
23
+ spec.add_runtime_dependency "capistrano", "~> 3.1.0"
23
24
  end
@@ -1,5 +1,6 @@
1
1
  # vim: ft=ruby:sts=2:expandtab
2
2
  namespace :deploy do
3
+
3
4
  desc "display last revision log line"
4
5
  task :last_revision do
5
6
  on roles(:all) do
@@ -7,5 +8,5 @@ namespace :deploy do
7
8
  end
8
9
  end
9
10
 
10
- after :finishing, 'typo3:after_deploy'
11
+ after :finishing, 'typo3:hooks:after_deploy'
11
12
  end
@@ -41,4 +41,15 @@ namespace :git do
41
41
  execute "cd #{fetch(:deploy_to)}/current && git log #{githash}..HEAD"
42
42
  end
43
43
  end
44
+
45
+ # restore remote git url for developent environments
46
+ task :set_remote_url_no_cache do
47
+ if(fetch(:git_no_cache)==1)
48
+ on roles(:all) do
49
+ execute "cd #{fetch(:deploy_to)}/current/ && git remote set-url origin #{fetch(:repo_url)}"
50
+ end
51
+ end
52
+ end
53
+
54
+
44
55
  end
@@ -1,104 +1,23 @@
1
1
  # vim: ft=ruby:sts=2:expandtab
2
- lock '3.1.0'
3
- require "PP"
4
2
 
5
- #-----
3
+ # lock '3.1.0'
4
+ # require "pp"
6
5
 
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
6
+ #----- DEFAULT SETTINGS, OVERRIDE WHEN NEEDED
12
7
 
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
8
+ set :git_no_cache, 0
9
+ set :restart_webserver, "sudo /etc/init.d/apache2 restart"
10
+ set :bundle_executable, "/usr/bin/bundle"
11
+ set :rake_executable, "./bin/rake"
12
+ set :rake_mysql_exec_dir, "/usr/bin"
13
+ set :rake_php_executable, "/usr/bin/php"
14
+ set :t3_dont_upgrade_source, 0
65
15
 
66
- set :skip_pull, 1
16
+ #----- INTERNAL VARIABLES, DON'T CHANGE OR OVERRIDE THESE
17
+ set :hooks_before_suite_run, 0
18
+ set :install_or_update_rake_typo3_run, 0
67
19
 
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
20
+ namespace :typo3 do
102
21
 
103
22
  # Empty repository must exist in git remote.
104
23
  # This creates useable fresh skeleton for TYPO3
@@ -110,15 +29,14 @@ namespace :typo3 do
110
29
  task :init1_empty_dummy do
111
30
 
112
31
  invoke 'typo3:helper:rm_deploy_to'
113
- invoke 'typo3:install_rake_typo3'
32
+ invoke 'typo3:hooks:before_suite'
33
+
114
34
  invoke 'deploy:check'
115
35
  invoke 'deploy:updating'
116
- invoke 'typo3:current_relative_symlink'
117
- invoke 'typo3:helper:create_typo3yaml'
36
+ invoke 'typo3:helper:setup_shared_typo3_dirs'
37
+ invoke 'typo3:helper:current_relative_symlink'
118
38
 
119
39
  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
40
  execute "cd #{fetch(:deploy_to)}/current/ && git remote set-url origin #{fetch(:repo_url)}"
123
41
  execute "cd #{fetch(:deploy_to)}/current/ && mkdir -p deploy/patches"
124
42
  execute "cd #{fetch(:deploy_to)}/current/ && touch deploy/patches/.keep"
@@ -129,7 +47,7 @@ namespace :typo3 do
129
47
  execute "cd #{fetch(:deploy_to)} && cp config/gitignore current/.gitignore"
130
48
  end
131
49
 
132
- invoke 'typo3:upgrade_source'
50
+ invoke 'typo3:helper:upgrade_source'
133
51
  print "initial environment has been setup"
134
52
  end
135
53
 
@@ -143,7 +61,7 @@ namespace :typo3 do
143
61
 
144
62
  print "\nNOTE: When this task fails most times there is a problem with your ssh authorized public keys\n\n"
145
63
 
146
- invoke 'typo3:helper:create_typo3yaml'
64
+ invoke 'typo3:hooks:before_suite'
147
65
  invoke 'typo3:sync_from_production'
148
66
 
149
67
  on roles(:all) do
@@ -153,47 +71,37 @@ namespace :typo3 do
153
71
  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
72
  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
73
 
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"
74
+ #TODO do git module magic
75
+ #execute "cd #{fetch(:deploy_to)}/current && find `dummy/typo3conf/ext -name '.git'`"
165
76
  end
77
+
78
+ invoke 'typo3:hooks:after_suite'
166
79
  end
167
80
 
168
81
  desc "Setup a new production environment. Manually sync content from old production"
169
82
  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'
83
+ invoke 'typo3:helper:rm_deploy_to'
84
+ invoke 'typo3:hooks:before_suite'
85
+ invoke 'typo3:helper:setup_shared_typo3_dirs'
179
86
  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"
87
+ invoke('typo3:hooks:after_suite') #FIXME Only run it init3_setup_new_stage_no_sync is called
88
+ print "environment has been setup, you do need to sync content from old production"
185
89
  end
186
90
 
187
91
  desc "Setup a new staged typo3 environment when a it's already in model"
188
92
  task :init3_setup_new_stage_sync do
189
- invoke 'init3_setup_new_stage_no_sync'
190
- invoke 'typo3:sync_from_production'
93
+ invoke 'typo3:helper:rm_deploy_to'
94
+ invoke 'typo3:hooks:before_suite'
95
+ invoke 'typo3:helper:setup_shared_typo3_dirs'
96
+ invoke 'deploy'
97
+ invoke 'typo3:sync_from_production' # SAME BUT THIS ONE
98
+ invoke('typo3:hooks:after_suite')
191
99
  end
192
100
 
193
101
  desc 'merge with [remote_branch]'
194
- task :merge_with , :remotebranch do |t, args|
102
+ task :merge_with, :remotebranch do |t, args|
195
103
 
196
- invoke 'typo3:helper:create_typo3yaml'
104
+ invoke 'typo3:hooks:before_suite'
197
105
  invoke 'deploy'
198
106
 
199
107
  on roles(:all) do
@@ -204,151 +112,275 @@ namespace :typo3 do
204
112
  execute "cd #{fetch(:deploy_to)}/current && git checkout #{branch}"
205
113
  execute "cd #{fetch(:deploy_to)}/current && git checkout master"
206
114
  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
115
  end
216
116
 
217
- invoke 'typo3:db_migrate'
218
- invoke 'typo3:run_migrations'
219
- #invoke 'typo3:after_deploy' not working, why?
220
- invoke 'typo3:current_relative_symlink'
117
+ invoke('typo3:hooks:after_suite')
118
+ end
119
+
120
+ desc "deploy the typo3 way"
121
+ task :deploy do
122
+ invoke 'typo3:hooks:before_suite'
123
+ invoke 'deploy'
124
+ invoke('typo3:hooks:after_suite')
221
125
  end
222
126
 
223
127
  desc "sync db & files and then deploy. Typically for Continuous Integration"
224
128
  task :sync_n_deploy do
225
-
226
- invoke 'typo3:helper:create_typo3yaml'
129
+ invoke 'typo3:hooks:before_suite'
227
130
  invoke 'typo3:sync_from_production'
228
131
  invoke 'deploy'
229
- invoke 'typo3:flush_content_cache'
132
+ invoke('typo3:hooks:after_suite')
230
133
  end
231
134
 
232
135
  # desc "Run site presuite rspecs"
233
136
  task :rspec_pre_suite do
234
137
  on roles(:all) do
235
- execute "cd #{fetch(:deploy_to)} && rake env:rspec_pre_suite"
138
+ execute "cd #{fetch(:deploy_to)} && #{fetch(:rake_executable)} env:rspec_pre_suite"
236
139
  end
237
140
  end
238
141
 
239
142
  # desc "Run site post browser rspecs"
240
143
  task :rspec_post_browser do
241
144
  on roles(:all) do
242
- execute "cd #{fetch(:deploy_to)} && rake env:rspec_post_browser"
145
+ execute "cd #{fetch(:deploy_to)} && #{fetch(:rake_executable)} env:rspec_post_browser"
243
146
  end
244
147
  end
245
148
 
246
- # desc "flush content cache"
247
- task :flush_content_cache do
149
+ desc "Make db & files in env. identical to production"
150
+ task :sync_from_production do
151
+ invoke 'typo3:hooks:before_suite'
152
+ invoke 'typo3:helper:sync_files_from_production'
153
+ invoke 'typo3:helper:sync_db_from_production'
154
+ invoke 'typo3:helper:flush_content_cache'
155
+ end
156
+
157
+ desc "Show environment information"
158
+ task :info do
159
+ invoke 'typo3:hooks:before_suite'
248
160
  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"
161
+ execute "cd #{fetch(:deploy_to)} && #{fetch(:rake_executable)} env:info"
252
162
  end
253
163
  end
254
164
 
255
- desc "Make db & files in env. identical to production"
256
- task :sync_from_production do
165
+ # Suite are large combined tasks like init3_setup_new_stage_sync
166
+ # Suite hooks are run only one time per session
167
+ namespace :hooks do
257
168
 
258
- invoke 'typo3:helper:create_typo3yaml'
259
- invoke 'typo3:pull_rake_typo3'
169
+ task :before_suite do
170
+ if(fetch(:hooks_before_suite_run)==0)
260
171
 
261
- on roles(:devtest,:syncfiles) do
262
- execute "cd #{fetch(:deploy_to)} && rake cap:sync_files_from_production"
172
+ set :hooks_before_suite_run, 1
173
+ invoke 'typo3:helper:install_or_update_rake_typo3'
174
+ invoke 'typo3:helper:create_typo3yaml'
175
+ invoke 'typo3:helper:set_stage'
176
+ end
177
+ end
178
+
179
+ task :after_deploy do
180
+ invoke 'git:set_remote_url_no_cache'
263
181
  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
182
 
268
- print "environment has been synced"
183
+ task :after_suite do
184
+ invoke 'typo3:helper:run_filesearchandreplace'
185
+ invoke 'typo3:helper:update_localconf'
186
+ invoke 'typo3:helper:upgrade_source'
187
+ invoke 'typo3:helper:db_em_migrations'
188
+ invoke 'typo3:helper:run_migrations'
189
+ invoke 'typo3:helper:current_relative_symlink'
190
+ invoke 'typo3:helper:restart_webserver'
269
191
  end
270
192
  end
271
193
 
272
- desc "Upgrade source in env to latest minor version"
273
- task :upgrade_source do
194
+ namespace :helper do
274
195
 
275
- invoke 'typo3:helper:create_typo3yaml'
276
- invoke 'typo3:pull_rake_typo3'
196
+ task :sync_files_from_production do
197
+ on roles(:devtest,:syncfiles) do
198
+ execute "cd #{fetch(:deploy_to)} && #{fetch(:rake_executable)} cap:sync_files_from_production"
199
+ end
200
+ end
277
201
 
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"
202
+ task :sync_db_from_production do
203
+ on roles(:devtest,:syncdb) do
204
+ execute "cd #{fetch(:deploy_to)} && #{fetch(:rake_executable)} cap:sync_db_from_production"
205
+ execute "cd #{fetch(:deploy_to)} && #{fetch(:rake_executable)} cap:run_sql_updates"
206
+ end
283
207
  end
284
208
 
285
- print "\nsource has been upgraded"
286
- print "\n\nWARNING: YOU MUST RUN THE UPGRADE SCRIPTS IN BACKEND\n\n"
287
- end
209
+ # Truncate tables with content cache
210
+ task :flush_content_cache do
211
+ on roles(:all) do
212
+ execute "cd #{fetch(:deploy_to)} && #{fetch(:rake_executable)} env:truncate_cache_tables"
213
+ execute "cd #{fetch(:deploy_to)} && #{fetch(:rake_executable)} env:truncate_session_tables"
214
+ end
215
+ end
288
216
 
289
- desc "Show environment information"
290
- task :info do
291
- on roles(:all) do
292
- execute "cd #{fetch(:deploy_to)} && rake env:info"
217
+ # remove deploy_to directory
218
+ task :rm_deploy_to do
219
+ on roles(:all) do
220
+ execute "rm -Rf #{fetch(:deploy_to)}"
221
+ end
293
222
  end
294
- end
295
223
 
296
- ## Migrate typo3 schemas, e.g. after version update
297
- #desc "Migrate database (typo3 EM migrations)"
298
- task :db_migrate do
224
+ # TODO move to typo3-rake?
225
+ # create typo3 dirs in shared
226
+ task :setup_shared_typo3_dirs do
227
+ on roles(:all) do
228
+ execute "cd #{fetch(:deploy_to)} && mkdir -p shared/fileadmin shared/typo3temp shared/uploads"
229
+ end
230
+ end
299
231
 
300
- invoke 'typo3:helper:create_typo3yaml'
301
- invoke 'typo3:pull_rake_typo3'
232
+ # set stage
233
+ task :set_stage do
234
+ on roles(:all) do
235
+ execute "echo '#{fetch(:stage).to_s}' > #{fetch(:deploy_to)}/STAGE"
236
+ end
237
+ end
302
238
 
303
- on roles(:all) do
304
- execute "cd #{fetch(:deploy_to)} && rake cap:db_migrate"
239
+ # install rake-typo3 from github
240
+ task :install_or_update_rake_typo3 do
241
+
242
+ if(fetch(:install_or_update_rake_typo3_run)==0)
243
+
244
+ on roles(:all) do
245
+
246
+ gitexist = capture "if [ -e '#{fetch(:deploy_to)}/.git/config' ]; then echo -n 'true'; fi"
247
+
248
+ if(gitexist.chomp=='true')
249
+
250
+ #remove old deployTYPO3 version
251
+ remote = capture "cd #{fetch(:deploy_to)} && git remote -v"
252
+ if remote.include?('deploy')
253
+ print "removing old repository"
254
+ 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"
255
+ execute "git clone https://github.com/Lingewoud/rake-typo3.git #{fetch(:deploy_to)}/.clone"
256
+ execute "cd #{fetch(:deploy_to)}/.clone && mv ./* ../"
257
+ execute "cd #{fetch(:deploy_to)}/.clone && mv .bundle .git .gitignore .rspec .travis.yml ../"
258
+ end
259
+
260
+ execute "cd #{fetch(:deploy_to)} && git pull"
261
+ execute "cd #{fetch(:deploy_to)} && #{fetch(:bundle_executable)} install --binstubs"
262
+
263
+ else
264
+ execute "rm -Rf #{fetch(:deploy_to)}"
265
+ execute "git clone https://github.com/Lingewoud/rake-typo3.git #{fetch(:deploy_to)}"
266
+ execute "cd #{fetch(:deploy_to)} && #{fetch(:bundle_executable)} install --binstubs"
267
+ print "rake-typo3 has been installed"
268
+ end
269
+
270
+ set :install_or_update_rake_typo3_run, 1
271
+
272
+ end
273
+
274
+ end
305
275
  end
306
- end
307
276
 
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'
277
+ # remove deploy_to directory
278
+ task "create_typo3yaml" do
314
279
 
315
- on roles(:all) do
316
- execute "cd #{fetch(:deploy_to)} && rake cap:run_migrations"
280
+ on roles(:all) do
281
+
282
+ if(fetch(:t3_main_version))
283
+ t3yaml = {}
284
+ t3yaml['all'] = {}
285
+ t3yaml['all']['TYPO3_MAIN_VERSION'] = fetch(:t3_main_version)
286
+ t3yaml['all']['SYNCLIVE'] = {}
287
+ t3yaml['all']['SYNCLIVE']['SYNCCMDS'] = fetch(:t3_live_sync)['filesync']
288
+ t3yaml['all']['SYNCLIVE']['SSH_DB_SERVER'] = fetch(:t3_live_sync)['dbsync']['ssh_server']
289
+ t3yaml['all']['SYNCLIVE']['SSH_DB_USER'] = fetch(:t3_live_sync)['dbsync']['ssh_user']
290
+ t3yaml['all']['SYNCLIVE']['DB'] = fetch(:t3_live_sync)['dbsync']
291
+ t3yaml['all']['MYSQLEXECDIR'] = fetch(:rake_mysql_exec_dir)
292
+ t3yaml['all']['PHP_EXECUTABLE'] = fetch(:rake_php_executable)
293
+
294
+ stage = fetch(:stage).to_s
295
+
296
+ t3yaml[stage] = {}
297
+ t3yaml[stage]['DB'] = {}
298
+ t3yaml[stage]['DB']['dbname'] = fetch(:dbname)
299
+ t3yaml[stage]['DB']['dbuser'] = fetch(:dbuser)
300
+ t3yaml[stage]['DB']['dbpass'] = fetch(:dbpass)
301
+ t3yaml[stage]['DB']['dbhost'] = fetch(:dbhost)
302
+
303
+ t3yaml[stage]['SQL_UPDATES'] = fetch(:t3_sql_updates)
304
+ t3yaml[stage]['TYPO3_CONF_VARS'] = fetch(:t3_conf_vars)
305
+ t3yaml[stage]['TYPO3_CONF_VARS_EXT_EXTCONF'] = fetch(:t3_conf_vars_ext_extconf)
306
+ t3yaml[stage]['TYPO3_SOURCE_PATCHES'] = fetch(:t3_source_patches)
307
+ t3yaml[stage]['DISABLE_EXTENSIONS'] = fetch(:t3_disable_extensions)
308
+ t3yaml[stage]['FILE_SEARCH_REPLACE'] = fetch(:t3_file_search_replace)
309
+
310
+ contents = StringIO.new(t3yaml.to_yaml)
311
+ upload! contents, "#{fetch(:deploy_to)}/typo3.yml"
312
+ end
313
+
314
+ end
317
315
  end
318
- end
319
316
 
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"
317
+ # when not in deploy latest ls releases/ -1 | sort -r | head -n 1
318
+ task :current_relative_symlink do
319
+ on roles(:all) do
320
+ execute "rm -f #{current_path}"
321
+ execute "cd #{fetch(:deploy_to)} && ln -s releases/#{File.basename release_path} current"
322
+ end
325
323
  end
326
- end
327
324
 
328
- task :after_deploy do
329
- invoke 'typo3:helper:create_typo3yaml'
330
- invoke 'typo3:pull_rake_typo3'
325
+ task :update_localconf do
326
+ on roles(:all) do
327
+ execute "cd #{fetch(:deploy_to)} && #{fetch(:rake_executable)} cap:update_localconf_db_credentials"
328
+ execute "cd #{fetch(:deploy_to)} && #{fetch(:rake_executable)} cap:update_localconf_typo3conf_vars"
329
+ execute "cd #{fetch(:deploy_to)} && #{fetch(:rake_executable)} cap:update_localconf_disable_extensions"
330
+ execute "cd #{fetch(:deploy_to)} && #{fetch(:rake_executable)} cap:update_localconf_extconf_settings"
331
+ execute "cd #{fetch(:deploy_to)} && #{fetch(:rake_executable)} cap:flush_config_cache"
332
+ end
333
+ end
331
334
 
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"
335
+ # Migrate database (typo3 Extension Manager migrations)
336
+ task :db_em_migrations do
337
+ on roles(:all) do
338
+ execute "cd #{fetch(:deploy_to)} && #{fetch(:rake_executable)} cap:db_migrate"
339
+ end
340
+ end
341
+
342
+ # Run search and replace
343
+ task :run_filesearchandreplace do
344
+ on roles(:all) do
345
+ execute "cd #{fetch(:deploy_to)} && #{fetch(:rake_executable)} cap:run_file_searchreplace_updates"
346
+ end
338
347
  end
339
348
 
340
- invoke 'typo3:upgrade_source'
341
- invoke 'typo3:db_migrate'
342
- invoke 'typo3:run_migrations'
349
+ # Specific environment migration sql's. E.g. rename all fe-users etc..
350
+ # migrations should be placed in current/deploy/migrations/
351
+ # Run migrations (sql migrations)
352
+ task :run_migrations do
343
353
 
344
- on roles(:all) do
345
- execute 'sudo', fetch(:a2restart)
354
+ on roles(:all) do
355
+ execute "cd #{fetch(:deploy_to)} && #{fetch(:rake_executable)} cap:run_migrations"
356
+ execute "cd #{fetch(:deploy_to)} && #{fetch(:rake_executable)} cap:run_sql_updates"
357
+ end
358
+ end
359
+
360
+ #desc "Upgrade TYPO3 source in environment to latest minor version"
361
+ task :upgrade_source do
362
+
363
+ if(fetch(:t3_dont_upgrade_source)!=1)
364
+
365
+ on roles(:all) do
366
+ execute "cd #{fetch(:deploy_to)} && #{fetch(:rake_executable)} cap:update_typo3_source"
367
+ end
368
+
369
+ print "\nsource has been upgraded"
370
+ print "\n\nWARNING: YOU MUST RUN THE UPGRADE SCRIPTS IN BACKEND\n\n"
371
+ end
372
+ end
373
+
374
+ task :restart_webserver do
375
+ on roles(:all) do
376
+ execute fetch(:restart_webserver)
377
+ end
346
378
  end
347
379
 
348
- invoke 'typo3:current_relative_symlink'
349
380
  end
350
381
  end
351
382
 
383
+
352
384
  namespace :test do
353
385
  task :test_pre_setup do
354
386
  on roles(:all) do
@@ -388,12 +420,12 @@ namespace :test do
388
420
  execute "rm -Rf #{fetch(:deploy_to)}"
389
421
  end
390
422
 
391
- invoke 'typo3:install_rake_typo3'
423
+ invoke 'typo3:helper:install_or_update_rake_typo3'
392
424
 
393
425
  #create releases and shared
394
426
  invoke 'deploy:check'
395
427
  invoke 'deploy:updating'
396
- invoke 'typo3:current_relative_symlink'
428
+ invoke 'typo3:helper:current_relative_symlink'
397
429
 
398
430
  on roles(:all) do
399
431
  execute "cd #{fetch(:deploy_to)} && mkdir -p shared/fileadmin shared/typo3temp shared/uploads"
@@ -409,13 +441,11 @@ namespace :test do
409
441
  execute "cd #{fetch(:deploy_to)} && cp config/gitignore current/.gitignore"
410
442
  end
411
443
 
412
- invoke 'typo3:upgrade_source'
444
+ invoke 'typo3:helper:upgrade_source'
413
445
 
414
446
  print "\ninitial environment has been setup to fase 1. edit current/deploy/typo3.yml\n"
415
447
  print "\nand populate current with the dummy\n"
416
448
  end
417
449
  end
418
450
 
419
-
420
-
421
451
  end
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module Typo3
3
- VERSION = "0.2.1"
3
+ VERSION = "0.2.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,43 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-typo3
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pim Snel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-22 00:00:00.000000000 Z
11
+ date: 2014-12-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.7'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.7'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '10.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: capistrano
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 3.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: 3.1.0
41
55
  description: Capistrano 3 tasks for TYPO3 CMS. Incl. TYPO3 versions 4.5.x ... 6.2.x.
42
56
  email:
43
57
  - pim@lingewoud.nl
@@ -45,7 +59,7 @@ executables: []
45
59
  extensions: []
46
60
  extra_rdoc_files: []
47
61
  files:
48
- - .gitignore
62
+ - ".gitignore"
49
63
  - CHANGELOG.md
50
64
  - Gemfile
51
65
  - LICENSE.txt
@@ -67,17 +81,17 @@ require_paths:
67
81
  - lib
68
82
  required_ruby_version: !ruby/object:Gem::Requirement
69
83
  requirements:
70
- - - '>='
84
+ - - ">="
71
85
  - !ruby/object:Gem::Version
72
86
  version: '0'
73
87
  required_rubygems_version: !ruby/object:Gem::Requirement
74
88
  requirements:
75
- - - '>='
89
+ - - ">="
76
90
  - !ruby/object:Gem::Version
77
91
  version: '0'
78
92
  requirements: []
79
93
  rubyforge_project:
80
- rubygems_version: 2.4.2
94
+ rubygems_version: 2.4.3
81
95
  signing_key:
82
96
  specification_version: 4
83
97
  summary: Capistrano 3 tasks for TYPO3 CMS