Skip to content
This repository was archived by the owner on Jan 30, 2024. It is now read-only.

Commit c57889c

Browse files
authored
Merge pull request #16 from yeldiRium/feature/remote-path
[TASK] use remote_web_root_path for path construction
2 parents 5c639eb + 0ecc1d9 commit c57889c

5 files changed

Lines changed: 67 additions & 40 deletions

File tree

lib/dkdeploy/typo3/cms/helpers/cli.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module Cli
1010
# @return [Boolean] returns true/false as success of execution
1111
def typo3_cli(*cli_params)
1212
path_to_cli_dispatch = File.join(current_path, fetch(:path_to_typo3_cli))
13-
run_script(current_path, path_to_cli_dispatch, cli_params)
13+
run_script(File.join(current_path), path_to_cli_dispatch, cli_params)
1414
end
1515

1616
# Execute a task typo3/cli_dispatch.phpsh cli_params in a specific directory
@@ -33,7 +33,7 @@ def typo3_cli_in_path(path, *cli_params)
3333
# @return [String] returns the last result of executing task
3434
def capture_typo3_cli_in_loop(maximum_loop_count, *cli_params, &block)
3535
path_to_cli_dispatch = File.join(current_path, fetch(:path_to_typo3_cli))
36-
capture_script_in_loop(current_path, path_to_cli_dispatch, maximum_loop_count, cli_params, &block)
36+
capture_script_in_loop(File.join(current_path), path_to_cli_dispatch, maximum_loop_count, cli_params, &block)
3737
end
3838

3939
# Returns the last results of invocations of a task typo3/cli_dispatch.phpsh cli_params
@@ -56,7 +56,7 @@ def capture_typo3_cli_in_path_in_loop(path, maximum_loop_count, *cli_params, &bl
5656
# @return [Boolean] returns true/false as success of execution
5757
def typo3_console(*cli_params)
5858
path_to_typo3_console = File.join(current_path, fetch(:path_to_typo3_console))
59-
run_script(current_path, path_to_typo3_console, cli_params)
59+
run_script(File.join(current_path), path_to_typo3_console, cli_params)
6060
end
6161

6262
# Execute a typo3_console task with cli_params in a specific directory
@@ -79,7 +79,7 @@ def typo3_console_in_path(path, *cli_params)
7979
# @return [String] returns the last result of executing task
8080
def capture_typo3_console_in_loop(maximum_loop_count, *cli_params, &block)
8181
path_to_typo3_console = File.join(current_path, fetch(:path_to_typo3_console))
82-
capture_script_in_loop(current_path, path_to_typo3_console, maximum_loop_count, cli_params, &block)
82+
capture_script_in_loop(File.join(current_path), path_to_typo3_console, maximum_loop_count, cli_params, &block)
8383
end
8484

8585
# Returns the last results of invocations of a typo3_console task with cli_params

lib/dkdeploy/typo3/cms/tasks/cache.rake

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ namespace :typo3 do
55
namespace :cache do
66
desc 'Clear TYPO3 file cache directory'
77
task :clear_file_cache do |task|
8+
remote_web_root_path = fetch(:remote_web_root_path, '.')
9+
810
on release_roles :app do
9-
cache_path = File.join release_path, 'typo3temp', 'var', 'Cache'
11+
cache_path = File.join release_path, remote_web_root_path, 'typo3temp', 'var', 'Cache'
1012
execute :rm, '-rf', cache_path if test "[ -d #{cache_path} ]"
1113
end
1214

lib/dkdeploy/typo3/cms/tasks/typo3.rake

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,18 @@ namespace :typo3 do
2020
namespace :cms do
2121
desc 'Clear typo3temp directory'
2222
task :clear_typo3temp do
23+
remote_web_root_path = fetch(:remote_web_root_path, '.')
24+
2325
on release_roles :app do
2426
info I18n.t('tasks.clear_temp.clear', scope: :dkdeploy)
25-
execute :rm, '-rf', File.join(release_path, 'typo3temp', '*')
27+
execute :rm, '-rf', File.join(release_path, remote_web_root_path, 'typo3temp', '*')
2628
end
2729
end
2830

2931
desc 'Disable TYPO3 install tool'
3032
task :disable_install_tool do
31-
flag = File.join(current_path, 'typo3conf', 'ENABLE_INSTALL_TOOL')
33+
remote_web_root_path = fetch(:remote_web_root_path, '.')
34+
flag = File.join(current_path, remote_web_root_path, 'typo3conf', 'ENABLE_INSTALL_TOOL')
3235

3336
on release_roles :app do
3437
if test "[ -f #{flag} ]"
@@ -40,10 +43,12 @@ namespace :typo3 do
4043

4144
desc 'Enable TYPO3 install tool'
4245
task :enable_install_tool do
46+
remote_web_root_path = fetch(:remote_web_root_path, '.')
47+
4348
on release_roles :app do
4449
info I18n.t('tasks.install_tool.enable', scope: :dkdeploy)
45-
execute :mkdir, '-p', File.join(current_path, 'typo3conf')
46-
execute :touch, File.join(current_path, 'typo3conf', 'ENABLE_INSTALL_TOOL')
50+
execute :mkdir, '-p', File.join(current_path, remote_web_root_path, 'typo3conf')
51+
execute :touch, File.join(current_path, remote_web_root_path, 'typo3conf', 'ENABLE_INSTALL_TOOL')
4752
end
4853
end
4954

@@ -78,14 +83,17 @@ namespace :typo3 do
7883

7984
desc 'Download extension to local workspace'
8085
task :fetch_extension, :extension do |_, args|
81-
extension = ask_variable(args, :extension, 'tasks.fetch_extension.extension_name')
86+
local_web_root_path = ask_array_variable(args, :local_web_root_path, 'questions.local_web_root_path')
87+
remote_web_root_path = fetch(:remote_web_root_path, '.')
88+
extension = ask_variable(args, :extension, 'tasks.fetch_extension.extension_name')
89+
8290
FileUtils.mkdir_p File.join('temp', 'extensions')
8391
FileUtils.remove_dir File.join('temp', 'extensions', extension), true
84-
source = File.join(current_path, 'typo3conf', 'ext', extension)
92+
source = File.join(current_path, remote_web_root_path, 'typo3conf', 'ext', extension)
8593
target = File.join('temp', 'extensions')
8694

8795
on primary(:backend) do
88-
if test "[ -d #{File.join(current_path, 'typo3conf', 'ext', extension)} ]"
96+
if test "[ -d #{File.join(current_path, remote_web_root_path, 'typo3conf', 'ext', extension)} ]"
8997
# download to temp
9098
info I18n.t('tasks.fetch_extension.download', extension: extension, scope: :dkdeploy)
9199
download! source, target, via: :scp, recursive: true
@@ -103,7 +111,7 @@ namespace :typo3 do
103111
rsync_exclude_directories.each do |exclude|
104112
rsync_excludes << '--exclude=' + exclude
105113
end
106-
execute :rsync, '-vrS', '--force', '-C', '--delete', rsync_excludes, File.join('temp', 'extensions', extension, '/'), File.join('htdocs', 'typo3conf', 'ext', extension, '/')
114+
execute :rsync, '-vrS', '--force', '-C', '--delete', rsync_excludes, File.join('temp', 'extensions', extension, '/'), File.join(local_web_root_path, 'typo3conf', 'ext', extension, '/')
107115
end
108116
end
109117

@@ -221,6 +229,7 @@ namespace :typo3 do
221229

222230
desc 'Remove not needed extensions'
223231
task :remove_extensions do
232+
remote_web_root_path = fetch(:remote_web_root_path, '.')
224233
installed_extensions = (capture_typo3_console_in_loop 1, 'extension:list', '--active', '--raw').split("\n")
225234

226235
run_locally do
@@ -232,13 +241,13 @@ namespace :typo3 do
232241

233242
on roles :app do
234243
# Get extensions from typo3conf/ext directory
235-
remote_list = capture(:ls, '-x', File.join(current_path, 'typo3conf', 'ext')).split
244+
remote_list = capture(:ls, '-x', File.join(current_path, remote_web_root_path, 'typo3conf', 'ext')).split
236245

237246
extensions_to_remove = (remote_list - installed_extensions)
238247
unless extensions_to_remove.empty?
239248
info I18n.t('tasks.typo3.cms.v6.remove_extensions.info', scope: :dkdeploy, removed_extensions: extensions_to_remove.join(', '))
240249
extensions_to_remove.each do |extension|
241-
execute :rm, '-rf', "#{release_path}/typo3conf/ext/#{extension}"
250+
execute :rm, '-rf', File.join(release_path, remote_web_root_path, 'typo3conf/ext', extension)
242251
end
243252
end
244253
end
@@ -260,8 +269,9 @@ namespace :typo3 do
260269

261270
desc 'Sets up the TYPO3 6+ specific configuration for each stage'
262271
task :setup_additional_configuration, :additional_configuration_template do |_, args|
272+
remote_web_root_path = fetch(:remote_web_root_path, '.')
263273
configuration_template = ask_variable(args, :additional_configuration_template, 'questions.additional_configuration_template')
264-
remote_configuration_file = File.join(release_path, 'typo3conf', 'AdditionalConfiguration.php')
274+
remote_configuration_file = File.join(release_path, remote_web_root_path, 'typo3conf', 'AdditionalConfiguration.php')
265275
unless File.exist?(configuration_template)
266276
run_locally do
267277
raise I18n.t('tasks.typo3.cms.v6.setup_additional_configuration.upload_info', configuration_template: configuration_template, scope: :dkdeploy)

0 commit comments

Comments
 (0)