Class: CapMailer

Inherits:
ActionMailer::Base
  • Object
show all
Defined in:
lib/cap_mailer.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#configObject

Returns the value of attribute config.



17
18
19
# File 'lib/cap_mailer.rb', line 17

def config
  @config
end

#dateObject

Returns the value of attribute date.



18
19
20
# File 'lib/cap_mailer.rb', line 18

def date
  @date
end

#inferred_commandObject

Returns the value of attribute inferred_command.



18
19
20
# File 'lib/cap_mailer.rb', line 18

def inferred_command
  @inferred_command
end

#optionsObject

Returns the value of attribute options.



17
18
19
# File 'lib/cap_mailer.rb', line 17

def options
  @options
end

#repo_endObject

Returns the value of attribute repo_end.



18
19
20
# File 'lib/cap_mailer.rb', line 18

def repo_end
  @repo_end
end

#task_nameObject

Returns the value of attribute task_name.



18
19
20
# File 'lib/cap_mailer.rb', line 18

def task_name
  @task_name
end

#timeObject

Returns the value of attribute time.



18
19
20
# File 'lib/cap_mailer.rb', line 18

def time
  @time
end

Class Method Details

.configure {|@@default_base_config| ... } ⇒ Object

Yields:

  • (@@default_base_config)


20
21
22
# File 'lib/cap_mailer.rb', line 20

def self.configure(&block)
  yield @@default_base_config
end

.reloadable?Boolean

Returns:

  • (Boolean)


26
# File 'lib/cap_mailer.rb', line 26

def self.reloadable?() false end

Instance Method Details

#notification_email(cap, config = {}, *args) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/cap_mailer.rb', line 28

def notification_email(cap, config = {}, *args)
  @options = { :release_data => {}, :extra_information => {}, :data => {} }.merge(args.extract_options!)
  @config  = default_base_config.merge(config.reverse_merge({
        :rails_env          => cap.rails_env,
        :host               => cap.host,
        :task_name          => cap.task_name,
        :application        => cap.application,
        :repository         => cap.repository,
        :scm                => cap.scm,
        :deploy_via         => cap.deploy_via,
        :deploy_to          => cap.deploy_to,
        :revision           => cap.revision,
        :real_revision      => cap.real_revision,
        :release_name       => cap.release_name,
        :version_dir        => cap.version_dir,
        :shared_dir         => cap.shared_dir,
        :current_dir        => cap.current_dir,
        :releases_path      => cap.releases_path,
        :shared_path        => cap.shared_path,
        :current_path       => cap.current_path,
        :release_path       => cap.release_path,
        :releases           => cap.releases,
        :current_release    => cap.current_release,
        :previous_release   => cap.previous_release,
        :current_revision   => cap.current_revision,
        :latest_revision    => cap.latest_revision,
        :previous_revision  => cap.previous_revision,
        :run_method         => cap.run_method,
        :latest_release     => cap.latest_release,
        :site_url           => cap.site_url
  }))
  
  @date             = Date.today.to_s
  @time             = Time.now.strftime("%I:%M %p").to_s
  @inferred_command = "cap #{@config[:rails_env]} #{@config[:task_name]}"
  @task_name        = @config[:task_name] || "unknown"
  
  repo  = @config[:repository]
  x     = repo.include?('/') ? repo.rindex('/') - 1 : repo.length
  front = repo.slice(0..x)
  back  = repo.sub(front, '')
  unless back == 'trunk'
    x = front.include?('/') ? front.rindex('/') - 1 : front.length
    front = front.slice(0..x)
  end
  @repo_end = repo.sub(front, '')
 
  subject       subject_line
  recipients    @config[:recipient_addresses]
  from          @config[:sender_address]
  content_type  @config[:email_content_type]

  body          body_data_hash
end