capistrano-mailnote 0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ OGE3MjAzMThhNTM2NzViY2UwMThmOWQ0NDM3NDFkYzg4MjAwMmNjYg==
5
+ data.tar.gz: !binary |-
6
+ M2JiMTkwNDUzOTFjNDNhNTI3ZTQ0YTRjOWM5NzczMTYyMDFmMjdiNQ==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ MjFlNWIxNTA1NDJmYzU3NDUzMTEwMDk3MDlkNWY2M2QxN2ExYjk5OTc3NzQ3
10
+ NWM0NjUyNzBkNGM3NzRkODc1ZWFjYTU3OWY5OWM3NTQyN2VhZjU0NmIzMTU5
11
+ NjU1ZjRmYzAzN2Y0NTJmM2YyZGE5ZDk3ZGI2NTcwZDhjMjQ2YTg=
12
+ data.tar.gz: !binary |-
13
+ ZTFjODIyYTRjNDJhOWVlODc3NmY4MjdlOTQ3ZTllMTMwNzIyMGM2MTk2OGIz
14
+ YWU0YTM5OGZhOThjYWEyNjRhZWMzMzc2ZWMzYWVlNmMxMjkxNTk0ZmY2Y2Y5
15
+ YjhmOGY5NWU5MzI1MWRjYjUyZTUwYWJkYzY1ZDNjM2I0OTkyZTY=
data/.gitignore ADDED
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .idea
4
+ .bundle
5
+ .config
6
+ .yardoc
7
+ Gemfile.lock
8
+ InstalledFiles
9
+ _yardoc
10
+ coverage
11
+ doc/
12
+ lib/bundler/man
13
+ pkg
14
+ rdoc
15
+ spec/reports
16
+ test/tmp
17
+ test/version_tmp
18
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'rails'
4
+ gem 'markerb'
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 robpe
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Robert Pozoga
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
File without changes
data/Rakefile ADDED
File without changes
@@ -0,0 +1,23 @@
1
+ # -*- encoding: utf-8 -*-
2
+ Gem::Specification.new do |s|
3
+ s.name = 'capistrano-mailnote'
4
+ s.version = '0.1'
5
+ s.date = '2014-11-18'
6
+ s.summary = "Hola!"
7
+ s.description = "A gem for Capistrano email release note."
8
+ s.authors = ["Robert Pozoga"]
9
+ s.email = 'robert.pozoga@gmail.com'
10
+ s.homepage = 'https://github.com/robpe/capistrano-mailnote'
11
+
12
+ s.files = `git ls-files`.split($/)
13
+ s.test_files = s.files.grep(%r{^(test|spec|features)/})
14
+ s.require_paths = ["lib"]
15
+
16
+ s.add_runtime_dependency 'rails', '~> 4.1.8'
17
+ s.add_runtime_dependency 'actionmailer'
18
+ s.add_runtime_dependency 'markerb'
19
+ s.add_runtime_dependency 'redcarpet', '>= 2.0'
20
+
21
+ s.homepage = ''
22
+ s.license = 'MIT'
23
+ end
@@ -0,0 +1,17 @@
1
+ require 'action_mailer'
2
+ require 'rails'
3
+ require 'markerb'
4
+
5
+ require 'capistrano/mailnote/mailer'
6
+ require 'capistrano/mailnote/configuration'
7
+
8
+
9
+ module Capistrano
10
+ module Mailnote
11
+
12
+ end
13
+ end
14
+
15
+ Markerb.processing_options = { tables: true, autolink: true }
16
+
17
+ load File.expand_path("tasks/mailnote.rake", File.dirname(__FILE__))
@@ -0,0 +1,38 @@
1
+ module Capistrano
2
+ module Mailnote
3
+ class Configuration
4
+
5
+ DEFAULT_WHITELIST = [
6
+ :mailnote_from,
7
+ :mailnote_to,
8
+ :mailnote_subject,
9
+ :release_notes,
10
+ :release_path,
11
+ :release_time,
12
+ :previous_revision,
13
+ :current_revision,
14
+ :application,
15
+ :application_url,
16
+ :env,
17
+ :stage,
18
+ :repo_url,
19
+ :branch
20
+ ].freeze
21
+
22
+ #
23
+ # Sets up mailer configuration (delivery_method, smtp) as well as filters
24
+ # environmental variables passed to the mailnote mailer template.
25
+ #
26
+ def self.read(config, whitelist=[])
27
+
28
+ ActionMailer::Base.delivery_method = config.fetch(:mailnote_method, :sendmail)
29
+ ActionMailer::Base.smtp_settings = config.fetch(:mailnote_smtp, {})
30
+
31
+ whitelist.concat(DEFAULT_WHITELIST).inject({}) do |result, key|
32
+ result[key] = config.fetch(key, '') ; result
33
+ end
34
+ end
35
+
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,22 @@
1
+ module Capistrano
2
+ module Mailnote
3
+ class Mailer < ActionMailer::Base
4
+
5
+ prepend_view_path File.expand_path('../../../views', File.dirname(__FILE__))
6
+
7
+ def note(config)
8
+ config.each { |k,v| instance_variable_set("@#{k}", v) }
9
+
10
+ mail(
11
+ to: @mailnote_to,
12
+ from: @mailnote_from,
13
+ subject: @mailnote_subject
14
+ ) do |format|
15
+ format.text
16
+ format.html
17
+ end
18
+ end
19
+
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,43 @@
1
+
2
+ namespace :deploy do
3
+
4
+ desc 'Show deployment mailnote.'
5
+ task 'mailnote:show' do
6
+ on roles(:app) do
7
+ configuration = Capistrano::Mailnote::Configuration.read(self)
8
+ info Capistrano::Mailnote::Mailer.note(configuration)
9
+ end
10
+ end
11
+
12
+ desc 'Send deployment mail note'
13
+ task :mailnote do
14
+ on roles(:app) do
15
+ configuration = Capistrano::Mailnote::Configuration.read(self)
16
+ info "[deploy:mailnote] Sending deployment mail note."
17
+ Capistrano::Mailnote::Mailer.note(configuration).deliver
18
+ end
19
+ end
20
+
21
+ task :set_release_notes do
22
+ desc "Set and show release notes."
23
+ task :release_notes do
24
+ on release_roles :app do
25
+ within repo_path do
26
+ with fetch(:git_environmental_variables) do
27
+ git_commits_range = "#{fetch(:previous_revision).strip}..#{fetch(:current_revision).strip}"
28
+ git_log = capture :git, "log #{fetch(:branch)} --pretty=oneline --abbrev-commit #{git_commits_range} |cat"
29
+ set :release_notes, git_log
30
+ info git_log
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
36
+
37
+ after 'deploy:finished', 'deploy:mailnote'
38
+ before 'deploy:mailnote', 'deploy:set_release_notes'
39
+ before 'deploy:mailnote', 'set_release_time' do
40
+ set :release_time, Time.now
41
+ end
42
+
43
+ end
@@ -0,0 +1,30 @@
1
+ <%= @application.capitalize %>: [<%= @stage.upcase %>] [/<%= @repo_url.split('/').last %>]
2
+ ========================================================================================
3
+
4
+ Deployment
5
+ ----------
6
+
7
+ |Property |Data
8
+ |---------|----------
9
+ |Deployed at | <%= (@release_time.empty? ? Time.now : @release_time).strftime("%A, %d %b %Y %l:%M %p") %>
10
+ |Stage | <%= @stage %>
11
+ |Current revision | <%= @current_revision %>
12
+ |Previous revision | <%= @previous_revision %>
13
+ |Application url | <%= @application_url %>
14
+ |Branch | <%= @branch %>
15
+ |Release path | <%= @release_path %>
16
+
17
+
18
+ Release Notes
19
+ -------------
20
+ <% if @release_notes.empty? %>
21
+ *No Changes since last deploy.*
22
+ <% else %>
23
+ |Commit | Message
24
+ |-------|----------
25
+ <% @release_notes.split("\n").each do |line| %>
26
+ <% commit, *message = line.split(' ') %>
27
+ |<%= commit %> | <%= message.join(' ') %>
28
+ <% end %>
29
+
30
+ <% end %>
metadata ADDED
@@ -0,0 +1,112 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: capistrano-mailnote
3
+ version: !ruby/object:Gem::Version
4
+ version: '0.1'
5
+ platform: ruby
6
+ authors:
7
+ - Robert Pozoga
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-11-18 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: 4.1.8
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: 4.1.8
27
+ - !ruby/object:Gem::Dependency
28
+ name: actionmailer
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: markerb
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: redcarpet
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '2.0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ! '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '2.0'
69
+ description: A gem for Capistrano email release note.
70
+ email: robert.pozoga@gmail.com
71
+ executables: []
72
+ extensions: []
73
+ extra_rdoc_files: []
74
+ files:
75
+ - .gitignore
76
+ - Gemfile
77
+ - LICENSE
78
+ - LICENSE.txt
79
+ - README.md
80
+ - Rakefile
81
+ - capistrano-mailnote.gemspec
82
+ - lib/capistrano/mailnote.rb
83
+ - lib/capistrano/mailnote/configuration.rb
84
+ - lib/capistrano/mailnote/mailer.rb
85
+ - lib/capistrano/tasks/mailnote.rake
86
+ - views/capistrano/mailnote/mailer/note.markerb
87
+ homepage: ''
88
+ licenses:
89
+ - MIT
90
+ metadata: {}
91
+ post_install_message:
92
+ rdoc_options: []
93
+ require_paths:
94
+ - lib
95
+ required_ruby_version: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ! '>='
98
+ - !ruby/object:Gem::Version
99
+ version: '0'
100
+ required_rubygems_version: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ! '>='
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ requirements: []
106
+ rubyforge_project:
107
+ rubygems_version: 2.0.6
108
+ signing_key:
109
+ specification_version: 4
110
+ summary: Hola!
111
+ test_files: []
112
+ has_rdoc: