Module: Dkdeploy::Typo3::Cms::Helpers::Cli
- Defined in:
- lib/dkdeploy/typo3/cms/helpers/cli.rb
Overview
TYPO3 cli helpers
Instance Method Summary collapse
-
#capture_script_in_loop(path, script, maximum_loop_count, *cli_params) ⇒ String
Returns the last results of invocations of a script Invocation can be controlled by the result of a given block.
-
#capture_typo3_cli_in_loop(maximum_loop_count, *cli_params, &block) ⇒ String
Returns the last results of invocations of a task typo3/cli_dispatch.phpsh cli_params Invocation can be controlled by the result of a given block.
-
#capture_typo3_cli_in_path_in_loop(path, maximum_loop_count, *cli_params, &block) ⇒ String
Returns the last results of invocations of a task typo3/cli_dispatch.phpsh cli_params Invocation can be controlled by the result of a given block.
-
#capture_typo3_console_in_loop(maximum_loop_count, *cli_params, &block) ⇒ String
Returns the last results of invocations of a a typo3_console task with cli_params Invocation can be controlled by the result of a given block.
-
#capture_typo3_console_in_path_in_loop(path, maximum_loop_count, *cli_params, &block) ⇒ String
Returns the last results of invocations of a typo3_console task with cli_params Invocation can be controlled by the result of a given block.
-
#run_script(path, script, *cli_params) ⇒ Boolean
Execute a script with cli_params in a specific directory.
-
#typo3_cli(*cli_params) ⇒ Boolean
Execute a task typo3/cli_dispatch.phpsh cli_params.
-
#typo3_cli_in_path(path, *cli_params) ⇒ Boolean
Execute a task typo3/cli_dispatch.phpsh cli_params in a specific directory.
-
#typo3_console(*cli_params) ⇒ Boolean
Execute a typo3_console task with cli_params.
-
#typo3_console_in_path(path, *cli_params) ⇒ Boolean
Execute a typo3_console task with cli_params in a specific directory.
Instance Method Details
#capture_script_in_loop(path, script, maximum_loop_count, *cli_params) ⇒ String
Returns the last results of invocations of a script Invocation can be controlled by the result of a given block. True repeats the invocation until maximum_loop_count is reached. False stops invocation regardless of loop count.
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
# File 'lib/dkdeploy/typo3/cms/helpers/cli.rb', line 130 def capture_script_in_loop(path, script, maximum_loop_count, *cli_params) output = nil on primary :backend do |host| within path do unless test "[ -e #{script} ]" error I18n.t('resource.not_exists_on_host', resource: script, host: host.hostname, scope: :dkdeploy) next end loop_counter = 1 while loop_counter <= maximum_loop_count info I18n.t('tasks.cli.show_loop_counter', loop_counter: loop_counter, scope: :dkdeploy) with fetch(:typo3_environment_cli) do output = capture :php, script, *cli_params end if block_given? unless yield(output, loop_counter, self) info I18n.t('tasks.cli.block_yields_false', loop_counter: loop_counter, scope: :dkdeploy) break end end loop_counter += 1 end info I18n.t('tasks.cli.maximum_calls_reached', scope: :dkdeploy) if loop_counter > maximum_loop_count end end output end |
#capture_typo3_cli_in_loop(maximum_loop_count, *cli_params, &block) ⇒ String
Returns the last results of invocations of a task typo3/cli_dispatch.phpsh cli_params Invocation can be controlled by the result of a given block. True repeats the invocation until maximum_loop_count is reached. False stops invocation regardless of loop count.
34 35 36 37 |
# File 'lib/dkdeploy/typo3/cms/helpers/cli.rb', line 34 def capture_typo3_cli_in_loop(maximum_loop_count, *cli_params, &block) path_to_cli_dispatch = File.join(current_path, 'typo3', 'cli_dispatch.phpsh') capture_script_in_loop(current_path, path_to_cli_dispatch, maximum_loop_count, cli_params, &block) end |
#capture_typo3_cli_in_path_in_loop(path, maximum_loop_count, *cli_params, &block) ⇒ String
Returns the last results of invocations of a task typo3/cli_dispatch.phpsh cli_params Invocation can be controlled by the result of a given block. True repeats the invocation until maximum_loop_count is reached. False stops invocation regardless of loop count.
48 49 50 51 |
# File 'lib/dkdeploy/typo3/cms/helpers/cli.rb', line 48 def capture_typo3_cli_in_path_in_loop(path, maximum_loop_count, *cli_params, &block) path_to_cli_dispatch = File.join(path, 'typo3', 'cli_dispatch.phpsh') capture_script_in_loop(path, path_to_cli_dispatch, maximum_loop_count, cli_params, &block) end |
#capture_typo3_console_in_loop(maximum_loop_count, *cli_params, &block) ⇒ String
Returns the last results of invocations of a a typo3_console task with cli_params Invocation can be controlled by the result of a given block. True repeats the invocation until maximum_loop_count is reached. False stops invocation regardless of loop count.
80 81 82 83 |
# File 'lib/dkdeploy/typo3/cms/helpers/cli.rb', line 80 def capture_typo3_console_in_loop(maximum_loop_count, *cli_params, &block) path_to_typo3_console = File.join(current_path, fetch(:path_to_typo3_console)) capture_script_in_loop(current_path, path_to_typo3_console, maximum_loop_count, cli_params, &block) end |
#capture_typo3_console_in_path_in_loop(path, maximum_loop_count, *cli_params, &block) ⇒ String
Returns the last results of invocations of a typo3_console task with cli_params Invocation can be controlled by the result of a given block. True repeats the invocation until maximum_loop_count is reached. False stops invocation regardless of loop count.
94 95 96 97 |
# File 'lib/dkdeploy/typo3/cms/helpers/cli.rb', line 94 def capture_typo3_console_in_path_in_loop(path, maximum_loop_count, *cli_params, &block) path_to_typo3_console = File.join(path, fetch(:path_to_typo3_console)) capture_script_in_loop(path, path_to_typo3_console, maximum_loop_count, cli_params, &block) end |
#run_script(path, script, *cli_params) ⇒ Boolean
Execute a script with cli_params in a specific directory
105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/dkdeploy/typo3/cms/helpers/cli.rb', line 105 def run_script(path, script, *cli_params) on primary :backend do |host| within path do unless test " [ -e #{script} ] " error I18n.t('resource.not_exists_on_host', resource: script, host: host.hostname, scope: :dkdeploy) next end with fetch(:typo3_environment_cli) do execute :php, script, *cli_params end end end end |
#typo3_cli(*cli_params) ⇒ Boolean
Execute a task typo3/cli_dispatch.phpsh cli_params
11 12 13 14 |
# File 'lib/dkdeploy/typo3/cms/helpers/cli.rb', line 11 def typo3_cli(*cli_params) path_to_cli_dispatch = File.join(current_path, 'typo3', 'cli_dispatch.phpsh') run_script(current_path, path_to_cli_dispatch, cli_params) end |
#typo3_cli_in_path(path, *cli_params) ⇒ Boolean
Execute a task typo3/cli_dispatch.phpsh cli_params in a specific directory
21 22 23 24 |
# File 'lib/dkdeploy/typo3/cms/helpers/cli.rb', line 21 def typo3_cli_in_path(path, *cli_params) path_to_cli_dispatch = File.join(path, 'typo3', 'cli_dispatch.phpsh') run_script(path, path_to_cli_dispatch, cli_params) end |
#typo3_console(*cli_params) ⇒ Boolean
Execute a typo3_console task with cli_params
57 58 59 60 |
# File 'lib/dkdeploy/typo3/cms/helpers/cli.rb', line 57 def typo3_console(*cli_params) path_to_typo3_console = File.join(current_path, fetch(:path_to_typo3_console)) run_script(current_path, path_to_typo3_console, cli_params) end |
#typo3_console_in_path(path, *cli_params) ⇒ Boolean
Execute a typo3_console task with cli_params in a specific directory
67 68 69 70 |
# File 'lib/dkdeploy/typo3/cms/helpers/cli.rb', line 67 def typo3_console_in_path(path, *cli_params) path_to_typo3_console = File.join(path, fetch(:path_to_typo3_console)) run_script(path, path_to_typo3_console, cli_params) end |