Class: CopyBot::StepFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/copy_bot/step_factory.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(step_name) ⇒ StepFactory

Returns a new instance of StepFactory.

Parameters:

  • step_name (Symbol)


6
7
8
# File 'lib/copy_bot/step_factory.rb', line 6

def initialize(step_name)
  @step_name = step_name
end

Instance Attribute Details

#step_nameObject (readonly)

Returns the value of attribute step_name.



3
4
5
# File 'lib/copy_bot/step_factory.rb', line 3

def step_name
  @step_name
end

Instance Method Details

#buildClass<CopyBot::Steps::BaseStep>

Returns:



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/copy_bot/step_factory.rb', line 11

def build # rubocop:disable Metrics/MethodLength, Metrics/CyclomaticComplexity
  case step_name
  when :download_remote_db_dump
    ::CopyBot::Steps::DownloadRemoteDbDump
  when :create_local_db_backup
    ::CopyBot::Steps::CreateLocalDbBackup
  when :drop_local_db_tables
    ::CopyBot::Steps::DropLocalDbTables
  when :import_remote_db_to_local_db
    ::CopyBot::Steps::ImportRemoteDbToLocalDb
  when :run_migrations_on_local_db
    ::CopyBot::Steps::RunMigrationsOnLocalDb
  when :delete_remote_db_dump
    ::CopyBot::Steps::DeleteRemoteDbDump
  when :execute_custom_command
    ::CopyBot::Steps::ExecuteCustomCommand
  else
    raise ArgumentError
  end
end