Class: Wordmove::Actions::FilterAndSetupTasksToRun
- Inherits:
-
Object
- Object
- Wordmove::Actions::FilterAndSetupTasksToRun
- Extended by:
- LightService::Action
- Defined in:
- lib/wordmove/actions/filter_and_setup_tasks_to_run.rb
Overview
Given the command line options and given the denied-by-config actions, selects the actions to be run altering the context.
Class Method Summary collapse
-
.execute ⇒ LightService::Context
Action’s context.
Class Method Details
.execute ⇒ LightService::Context
Returns Action’s context.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/wordmove/actions/filter_and_setup_tasks_to_run.rb', line 22 executed do |context| all_tasks = Wordmove::CLI::PullPushShared::WORDPRESS_OPTIONS requested_tasks = all_tasks.select do |task| context.[task] || (context.[:all] && context.[task] != false) end allowed_tasks = requested_tasks.select do |task| context.guardian.allow? task end # Since we `promises` the following variables, we cannot set them as `nil` context.database_task = allowed_tasks.delete(:db) || false context.wordpress_task = allowed_tasks.delete(:wordpress) || false # :db and :wordpress were just removed, so we consider # the reminders as folder tasks. It's a weak assumption # though. context.folder_tasks = allowed_tasks end |