Class: Euston::PipelineRakeTask

Inherits:
Daemons::RakeTask show all
Defined in:
lib/euston-daemons/pipeline/rake_task.rb

Instance Attribute Summary collapse

Attributes inherited from Daemons::RakeTask

#bundler_groups, #daemon_class, #log_filename, #name, #pid_filename, #post_setup_callback, #verbose

Instance Method Summary collapse

Constructor Details

#initialize(environment) ⇒ PipelineRakeTask

Returns a new instance of PipelineRakeTask.



11
12
13
# File 'lib/euston-daemons/pipeline/rake_task.rb', line 11

def initialize environment
  super(environment, :pipeline_daemon)
end

Instance Attribute Details

#amqp_config_pathObject

Returns the value of attribute amqp_config_path.



3
4
5
# File 'lib/euston-daemons/pipeline/rake_task.rb', line 3

def amqp_config_path
  @amqp_config_path
end

#app_rootObject

Returns the value of attribute app_root.



3
4
5
# File 'lib/euston-daemons/pipeline/rake_task.rb', line 3

def app_root
  @app_root
end

#command_handler_namespacesObject

Returns the value of attribute command_handler_namespaces.



3
4
5
# File 'lib/euston-daemons/pipeline/rake_task.rb', line 3

def command_handler_namespaces
  @command_handler_namespaces
end

#daemon_config_pathObject

Returns the value of attribute daemon_config_path.



3
4
5
# File 'lib/euston-daemons/pipeline/rake_task.rb', line 3

def daemon_config_path
  @daemon_config_path
end

#event_handler_namespacesObject

Returns the value of attribute event_handler_namespaces.



3
4
5
# File 'lib/euston-daemons/pipeline/rake_task.rb', line 3

def event_handler_namespaces
  @event_handler_namespaces
end

#mongo_config_pathObject

Returns the value of attribute mongo_config_path.



3
4
5
# File 'lib/euston-daemons/pipeline/rake_task.rb', line 3

def mongo_config_path
  @mongo_config_path
end

#user_defined_componentsObject

Returns the value of attribute user_defined_components.



3
4
5
# File 'lib/euston-daemons/pipeline/rake_task.rb', line 3

def user_defined_components
  @user_defined_components
end

Instance Method Details

#before_creating_taskObject



15
16
17
18
# File 'lib/euston-daemons/pipeline/rake_task.rb', line 15

def before_creating_task
  @daemon_path = File.expand_path(File.dirname __FILE__) + File::SEPARATOR
  @daemon_class = 'Euston::Daemons::Pipeline::Daemon'
end

#initialize_settingsObject



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/euston-daemons/pipeline/rake_task.rb', line 24

def initialize_settings
  @logger.debug "AMQP config path: #{@amqp_config_path}"
  @data[:amqp_config_path] = @amqp_config_path

  @logger.debug "Command handler namespaces: #{@command_handler_namespaces}"
  @data[:command_handler_namespaces] = @command_handler_namespaces

  @logger.debug "Daemon config path: #{@daemon_config_path}"

  @logger.debug "Event handler namespaces: #{@event_handler_namespaces}"
  @data[:event_handler_namespaces] = @event_handler_namespaces

  @logger.debug "Mongo config path: #{@mongo_config_path}"
  @data[:mongo_config_path] = @mongo_config_path

  @logger.debug "User-defined components: #{@user_defined_components.count}"
  @data[:user_defined_components] = @user_defined_components.to_a.flatten

  @logger.debug "App root: #{@app_root}"
  @data[:app_root] = @app_root
end

#load_daemon_config_fileObject



20
21
22
# File 'lib/euston-daemons/pipeline/rake_task.rb', line 20

def load_daemon_config_file
  @data[:daemon_config] = ErbYaml.read @daemon_config_path, @data[:environment]
end

#load_environmentObject



46
47
48
49
50
51
# File 'lib/euston-daemons/pipeline/rake_task.rb', line 46

def load_environment
  @logger.debug "Loading environment"
  require 'euston-daemons/pipeline/config/environment'

  Euston::Daemons::Pipeline::DaemonEnvironment.new(@data).setup
end