cap_gun 0.0.2 → 0.0.5
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.
- data/CHANGELOG +6 -0
- data/README.rdoc +2 -2
- data/Rakefile +28 -0
- data/cap_gun.gemspec +20 -32
- data/lib/cap_gun.rb +16 -5
- data/manifest.txt +2 -0
- data/spec/cap_gun_spec.rb +19 -1
- metadata +28 -8
data/CHANGELOG
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
v0.0.5. Fix subject line iv there is no rails_env defined
|
2
|
+
|
3
|
+
v0.0.4. Add dev dependency on echoe; update manifest
|
4
|
+
|
5
|
+
v0.0.3. Don't try to convert the RAILS_ENV if its not set to better support default capistrano deployments
|
6
|
+
|
1
7
|
v0.0.2. Converts the release times to the current time zone; improved docs.
|
2
8
|
|
3
9
|
v0.0.1. Initial release. Rock n roll mcdonalds.
|
data/README.rdoc
CHANGED
@@ -37,7 +37,7 @@ In your Capistrano config file (usually deploy.rb):
|
|
37
37
|
== REQUIREMENTS
|
38
38
|
|
39
39
|
* Capistrano 2+
|
40
|
-
* A Gmail account to send from, or an MTA installed locally to send from
|
40
|
+
* A Gmail account to send from, or an MTA (mail transport agent) installed locally to send from
|
41
41
|
* Something to deploy
|
42
42
|
|
43
43
|
== TODO & KNOWN ISSUES
|
@@ -55,7 +55,7 @@ In your Capistrano config file (usually deploy.rb):
|
|
55
55
|
|
56
56
|
* Log bugs, issues, and suggestions on Trac: http://opensource.thinkrelevance.com/wiki/cap_gun
|
57
57
|
* View source: http://github.com/relevance/cap_gun/tree/master
|
58
|
-
* Git clone
|
58
|
+
* Git: git clone git://github.com/relevance/cap_gun.git
|
59
59
|
* RDocs: http://thinkrelevance.rubyforge.org/cap_gun/
|
60
60
|
|
61
61
|
== LICENSE
|
data/Rakefile
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
begin
|
2
|
+
gem 'technicalpickles-echoe'
|
3
|
+
rescue LoadError => e
|
4
|
+
puts "couldn't find the correct version of echoe - please install from forked version on github: http://github.com/technicalpickles/echoe/"
|
5
|
+
puts "gem sources -a http://gems.github.com"
|
6
|
+
puts "sudo gem install technicalpickles-echoe"
|
7
|
+
end
|
8
|
+
|
9
|
+
require 'rubygems'
|
10
|
+
require 'echoe'
|
11
|
+
require './lib/cap_gun.rb'
|
12
|
+
|
13
|
+
echoe = Echoe.new('cap_gun') do |p|
|
14
|
+
p.rubyforge_name = 'thinkrelevance'
|
15
|
+
p.author = ["Rob Sanheim", "Relevance"]
|
16
|
+
p.email = 'opensource@thinkrelevance.com'
|
17
|
+
p.version = CapGun::VERSION
|
18
|
+
p.summary = "Bang! You're deployed!"
|
19
|
+
p.description = 'Super simple capistrano deployments.'
|
20
|
+
p.url = "http://opensource.thinkrelevance.com/wiki/cap_gun"
|
21
|
+
p.rdoc_pattern = /^(lib|bin|ext)|txt|rdoc|CHANGELOG|MIT-LICENSE$/
|
22
|
+
rdoc_template = `allison --path`.strip << ".rb"
|
23
|
+
p.rdoc_template = rdoc_template
|
24
|
+
p.test_pattern = 'spec/**/*_spec.rb'
|
25
|
+
p.manifest_name = 'manifest.txt'
|
26
|
+
end
|
27
|
+
|
28
|
+
echoe.spec.add_development_dependency "echoe"
|
data/cap_gun.gemspec
CHANGED
@@ -1,48 +1,36 @@
|
|
1
|
-
|
2
|
-
# Gem::Specification for Cap_gun-0.0.2
|
3
|
-
# Originally generated by Echoe
|
4
|
-
|
5
1
|
Gem::Specification.new do |s|
|
6
2
|
s.name = %q{cap_gun}
|
7
|
-
s.version = "0.0.
|
8
|
-
|
9
|
-
s.specification_version = 2 if s.respond_to? :specification_version=
|
3
|
+
s.version = "0.0.5"
|
10
4
|
|
11
|
-
s.required_rubygems_version = Gem::Requirement.new("
|
5
|
+
s.required_rubygems_version = Gem::Requirement.new("= 1.2") if s.respond_to? :required_rubygems_version=
|
12
6
|
s.authors = ["Rob Sanheim, Relevance"]
|
13
|
-
s.date = %q{2008-04
|
7
|
+
s.date = %q{2008-07-04}
|
14
8
|
s.description = %q{Super simple capistrano deployments.}
|
15
9
|
s.email = %q{opensource@thinkrelevance.com}
|
16
10
|
s.extra_rdoc_files = ["CHANGELOG", "lib/cap_gun.rb", "MIT-LICENSE", "README.rdoc"]
|
17
|
-
s.files = ["CHANGELOG", "init.rb", "install.rb", "lib/cap_gun.rb", "manifest.txt", "MIT-LICENSE", "README.rdoc", "spec/cap_gun_spec.rb", "tasks/cap_bot_tasks.rake", "vendor/action_mailer_tls/init.rb", "vendor/action_mailer_tls/lib/smtp_tls.rb", "vendor/action_mailer_tls/README", "vendor/action_mailer_tls/sample/mailer.yml.sample", "vendor/action_mailer_tls/sample/smtp_gmail.rb"
|
11
|
+
s.files = ["cap_gun.gemspec", "CHANGELOG", "init.rb", "install.rb", "lib/cap_gun.rb", "manifest.txt", "MIT-LICENSE", "Rakefile", "README.rdoc", "spec/cap_gun_spec.rb", "tasks/cap_bot_tasks.rake", "vendor/action_mailer_tls/init.rb", "vendor/action_mailer_tls/lib/smtp_tls.rb", "vendor/action_mailer_tls/README", "vendor/action_mailer_tls/sample/mailer.yml.sample", "vendor/action_mailer_tls/sample/smtp_gmail.rb"]
|
18
12
|
s.has_rdoc = true
|
19
13
|
s.homepage = %q{http://opensource.thinkrelevance.com/wiki/cap_gun}
|
20
14
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Cap_gun", "--main", "README.rdoc"]
|
21
15
|
s.require_paths = ["lib"]
|
22
16
|
s.rubyforge_project = %q{thinkrelevance}
|
23
|
-
s.rubygems_version = %q{1.
|
17
|
+
s.rubygems_version = %q{1.2.0}
|
24
18
|
s.summary = %q{Bang! You're deployed!}
|
25
19
|
s.test_files = ["spec/cap_gun_spec.rb"]
|
26
|
-
end
|
27
20
|
|
21
|
+
if s.respond_to? :specification_version then
|
22
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
23
|
+
s.specification_version = 2
|
28
24
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
# p.description = 'Super simple capistrano deployments.'
|
42
|
-
# p.url = "http://opensource.thinkrelevance.com/wiki/cap_gun"
|
43
|
-
# p.rdoc_pattern = /^(lib|bin|ext)|txt|rdoc|CHANGELOG|MIT-LICENSE$/
|
44
|
-
# rdoc_template = `allison --path`.strip << ".rb"
|
45
|
-
# p.rdoc_template = rdoc_template
|
46
|
-
# p.test_pattern = 'spec/**/*_spec.rb'
|
47
|
-
# p.manifest_name = 'manifest.txt'
|
48
|
-
# end
|
25
|
+
if current_version >= 3 then
|
26
|
+
s.add_development_dependency(%q<echoe>, [">= 0"])
|
27
|
+
s.add_development_dependency(%q<echoe>, [">= 0"])
|
28
|
+
else
|
29
|
+
s.add_dependency(%q<echoe>, [">= 0"])
|
30
|
+
s.add_dependency(%q<echoe>, [">= 0"])
|
31
|
+
end
|
32
|
+
else
|
33
|
+
s.add_dependency(%q<echoe>, [">= 0"])
|
34
|
+
s.add_dependency(%q<echoe>, [">= 0"])
|
35
|
+
end
|
36
|
+
end
|
data/lib/cap_gun.rb
CHANGED
@@ -27,7 +27,7 @@ require File.join(File.dirname(__FILE__), *%w[.. vendor action_mailer_tls lib sm
|
|
27
27
|
#
|
28
28
|
# See README for full install/config instructions.
|
29
29
|
module CapGun
|
30
|
-
VERSION = '0.0.
|
30
|
+
VERSION = '0.0.5'
|
31
31
|
|
32
32
|
module Helper
|
33
33
|
|
@@ -53,6 +53,7 @@ module CapGun
|
|
53
53
|
# This assumes Capistrano uses UTC for its date/timestamped directories, and converts to the local
|
54
54
|
# machine timezone.
|
55
55
|
def humanize_release_time(path)
|
56
|
+
return unless path
|
56
57
|
match = path.match(/(\d+)$/)
|
57
58
|
return unless match
|
58
59
|
local = convert_from_utc(match[1])
|
@@ -83,11 +84,12 @@ module CapGun
|
|
83
84
|
class Mailer < ActionMailer::Base
|
84
85
|
include CapGun::Helper
|
85
86
|
DEFAULT_SENDER = %("CapGun" <cap_gun@example.com>)
|
86
|
-
DEFAULT_EMAIL_PREFIX = "[DEPLOY]
|
87
|
+
DEFAULT_EMAIL_PREFIX = "[DEPLOY]"
|
87
88
|
|
88
89
|
adv_attr_accessor :email_prefix
|
90
|
+
attr_accessor :summary
|
89
91
|
|
90
|
-
# Grab the options for
|
92
|
+
# Grab the options for emailing from cap_gun_email_envelope (should be set in your deploy file)
|
91
93
|
#
|
92
94
|
# Valid options:
|
93
95
|
# :recipients (required) an array or string of email address(es) that should get notifications
|
@@ -102,16 +104,25 @@ module CapGun
|
|
102
104
|
# Do the actual email
|
103
105
|
def deployment_notification(capistrano)
|
104
106
|
init(capistrano[:cap_gun_email_envelope])
|
107
|
+
self.summary = create_summary(capistrano)
|
105
108
|
|
106
109
|
content_type "text/plain"
|
107
|
-
subject "#{email_prefix} #{capistrano[:application]}
|
110
|
+
subject "#{email_prefix} #{capistrano[:application]} #{deployed_to(capistrano)}"
|
108
111
|
body create_body(capistrano)
|
109
112
|
end
|
110
113
|
|
114
|
+
def create_summary(capistrano)
|
115
|
+
%[#{capistrano[:application]} was deployed#{" to " << capistrano[:rails_env] if capistrano[:rails_env]} by #{current_user} at #{humanize_release_time(capistrano[:current_release])}.]
|
116
|
+
end
|
117
|
+
|
118
|
+
def deployed_to(capistrano)
|
119
|
+
returning(s = "deployed") { s += " to #{capistrano[:rails_env]}" if capistrano[:rails_env] }
|
120
|
+
end
|
121
|
+
|
111
122
|
# Create the body of the message using a bunch of values from Capistrano
|
112
123
|
def create_body(capistrano)
|
113
124
|
<<-EOL
|
114
|
-
#{
|
125
|
+
#{summary}
|
115
126
|
|
116
127
|
Comment: #{capistrano[:comment] || "[none given]"}
|
117
128
|
|
data/manifest.txt
CHANGED
data/spec/cap_gun_spec.rb
CHANGED
@@ -59,7 +59,7 @@ describe "CapGun" do
|
|
59
59
|
end
|
60
60
|
|
61
61
|
describe "handling release time" do
|
62
|
-
|
62
|
+
include CapGun::Helper
|
63
63
|
|
64
64
|
before do # make DateTime act as if local timezone is EDT
|
65
65
|
stubs(:local_timezone).returns("EDT")
|
@@ -112,4 +112,22 @@ describe "CapGun" do
|
|
112
112
|
end
|
113
113
|
end
|
114
114
|
|
115
|
+
describe "creating body" do
|
116
|
+
it "has a friendly summary line" do
|
117
|
+
CapGun::Mailer.any_instance.stubs(:current_user).returns("jdoe")
|
118
|
+
capistrano = { :application => "my app", :rails_env => "staging", :current_release => "/data/foo/releases/20080227120000", :cap_gun_email_envelope => { :from => "booyakka!@example.com", :recipients => ["foo@here.com", "bar@here.com"] } }
|
119
|
+
mail = CapGun::Mailer.create_deployment_notification capistrano
|
120
|
+
mail.body.split("\n").first.should == "my app was deployed to staging by jdoe at February 27th, 2008 8:00 AM EDT."
|
121
|
+
end
|
122
|
+
|
123
|
+
it "does not include rails env in summary if not defined" do
|
124
|
+
CapGun::Mailer.any_instance.stubs(:current_user).returns("jdoe")
|
125
|
+
capistrano = { :application => "my app", :current_release => "/data/foo/releases/20080227120000", :cap_gun_email_envelope => { :from => "booyakka!@example.com", :recipients => ["foo@here.com", "bar@here.com"] } }
|
126
|
+
mail = CapGun::Mailer.create_deployment_notification capistrano
|
127
|
+
mail.subject.should == "[DEPLOY] my app deployed"
|
128
|
+
mail.body.split("\n").first.should == "my app was deployed by jdoe at February 27th, 2008 8:00 AM EDT."
|
129
|
+
end
|
130
|
+
|
131
|
+
end
|
132
|
+
|
115
133
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cap_gun
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rob Sanheim, Relevance
|
@@ -9,10 +9,29 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-04
|
12
|
+
date: 2008-07-04 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
|
-
dependencies:
|
15
|
-
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: echoe
|
17
|
+
type: :development
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "0"
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: echoe
|
27
|
+
type: :development
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: "0"
|
34
|
+
version:
|
16
35
|
description: Super simple capistrano deployments.
|
17
36
|
email: opensource@thinkrelevance.com
|
18
37
|
executables: []
|
@@ -25,12 +44,14 @@ extra_rdoc_files:
|
|
25
44
|
- MIT-LICENSE
|
26
45
|
- README.rdoc
|
27
46
|
files:
|
47
|
+
- cap_gun.gemspec
|
28
48
|
- CHANGELOG
|
29
49
|
- init.rb
|
30
50
|
- install.rb
|
31
51
|
- lib/cap_gun.rb
|
32
52
|
- manifest.txt
|
33
53
|
- MIT-LICENSE
|
54
|
+
- Rakefile
|
34
55
|
- README.rdoc
|
35
56
|
- spec/cap_gun_spec.rb
|
36
57
|
- tasks/cap_bot_tasks.rake
|
@@ -39,7 +60,6 @@ files:
|
|
39
60
|
- vendor/action_mailer_tls/README
|
40
61
|
- vendor/action_mailer_tls/sample/mailer.yml.sample
|
41
62
|
- vendor/action_mailer_tls/sample/smtp_gmail.rb
|
42
|
-
- cap_gun.gemspec
|
43
63
|
has_rdoc: true
|
44
64
|
homepage: http://opensource.thinkrelevance.com/wiki/cap_gun
|
45
65
|
post_install_message:
|
@@ -60,14 +80,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
60
80
|
version:
|
61
81
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
62
82
|
requirements:
|
63
|
-
- - "
|
83
|
+
- - "="
|
64
84
|
- !ruby/object:Gem::Version
|
65
|
-
version: "
|
85
|
+
version: "1.2"
|
66
86
|
version:
|
67
87
|
requirements: []
|
68
88
|
|
69
89
|
rubyforge_project: thinkrelevance
|
70
|
-
rubygems_version: 1.
|
90
|
+
rubygems_version: 1.2.0
|
71
91
|
signing_key:
|
72
92
|
specification_version: 2
|
73
93
|
summary: Bang! You're deployed!
|