crapapult 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/Rakefile +4 -4
  2. data/VERSION +1 -0
  3. data/lib/crapapult.rb +29 -0
  4. metadata +28 -19
data/Rakefile CHANGED
@@ -10,10 +10,10 @@ Jeweler::Tasks.new do |gem|
10
10
  gem.description = %Q{Yammer's Capistrano-based deploy crap.}
11
11
  gem.email = "coda.hale@gmail.com"
12
12
  gem.authors = ["Coda Hale"]
13
- gem.version = "0.0.2"
14
13
 
15
- gem.add_runtime_dependency "json", ">= 1.2.4"
16
- gem.add_runtime_dependency "capistrano", ">= 2.5.9"
17
- gem.add_runtime_dependency "erubis", "2.6.6"
14
+ gem.add_runtime_dependency "json"
15
+ gem.add_runtime_dependency "capistrano"
16
+ gem.add_runtime_dependency "erubis"
17
+ gem.add_runtime_dependency "always_verify_ssl_certificates"
18
18
  end
19
19
  Jeweler::RubygemsDotOrgTasks.new
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.3
data/lib/crapapult.rb CHANGED
@@ -1,6 +1,8 @@
1
1
  require "rubygems"
2
+ require "always_verify_ssl_certificates"
2
3
  require "capistrano"
3
4
  require "net/http"
5
+ require "net/https"
4
6
  require "json"
5
7
  require "erubis"
6
8
 
@@ -125,6 +127,33 @@ Capistrano::Configuration.instance(:must_exist).load do
125
127
  run "#{sudo} ln -sf /lib/init/upstart-job /etc/init.d/#{application_name}"
126
128
  end
127
129
 
130
+ # Post a message to your Yammer network when you deploy.
131
+ def yammer(token, opts={})
132
+ opts = { :host => "www.yammer.com",
133
+ :body => %Q{The <%= current_branch %> branch of <%= application_name %> (<%= last_ref[0..5] %>) was just deployed to the <%= current_environment %> environment by @<%= `whoami` %>.}
134
+ }.merge(opts)
135
+
136
+ after :deploy do
137
+ puts "> Sending notification to Yammer"
138
+
139
+ http = Net::HTTP.new(opts.delete(:host), 443)
140
+ http.use_ssl = true
141
+
142
+ opts[:body] = Erubis::Eruby.new(opts[:body]).result(binding)
143
+ opts[:access_token] = token
144
+
145
+ request = Net::HTTP::Post.new("/api/v1/messages.json")
146
+ request.set_form_data(opts)
147
+
148
+ response = http.request(request)
149
+ if response.is_a? Net::HTTPSuccess
150
+ puts "> Sent!"
151
+ else
152
+ puts "! Error sending notification: #{response.code} #{response.message}"
153
+ end
154
+ end
155
+ end
156
+
128
157
  ##############################################################################
129
158
  #################################### Tasks ###################################
130
159
  ##############################################################################
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crapapult
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 3
10
+ version: 0.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Coda Hale
@@ -26,12 +26,10 @@ dependencies:
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- hash: 23
29
+ hash: 3
30
30
  segments:
31
- - 1
32
- - 2
33
- - 4
34
- version: 1.2.4
31
+ - 0
32
+ version: "0"
35
33
  type: :runtime
36
34
  version_requirements: *id001
37
35
  - !ruby/object:Gem::Dependency
@@ -42,12 +40,10 @@ dependencies:
42
40
  requirements:
43
41
  - - ">="
44
42
  - !ruby/object:Gem::Version
45
- hash: 9
43
+ hash: 3
46
44
  segments:
47
- - 2
48
- - 5
49
- - 9
50
- version: 2.5.9
45
+ - 0
46
+ version: "0"
51
47
  type: :runtime
52
48
  version_requirements: *id002
53
49
  - !ruby/object:Gem::Dependency
@@ -56,16 +52,28 @@ dependencies:
56
52
  requirement: &id003 !ruby/object:Gem::Requirement
57
53
  none: false
58
54
  requirements:
59
- - - "="
55
+ - - ">="
60
56
  - !ruby/object:Gem::Version
61
- hash: 27
57
+ hash: 3
62
58
  segments:
63
- - 2
64
- - 6
65
- - 6
66
- version: 2.6.6
59
+ - 0
60
+ version: "0"
67
61
  type: :runtime
68
62
  version_requirements: *id003
63
+ - !ruby/object:Gem::Dependency
64
+ name: always_verify_ssl_certificates
65
+ prerelease: false
66
+ requirement: &id004 !ruby/object:Gem::Requirement
67
+ none: false
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ hash: 3
72
+ segments:
73
+ - 0
74
+ version: "0"
75
+ type: :runtime
76
+ version_requirements: *id004
69
77
  description: Yammer's Capistrano-based deploy crap.
70
78
  email: coda.hale@gmail.com
71
79
  executables: []
@@ -80,6 +88,7 @@ files:
80
88
  - LICENSE.txt
81
89
  - README.md
82
90
  - Rakefile
91
+ - VERSION
83
92
  - lib/crapapult.rb
84
93
  has_rdoc: true
85
94
  homepage: http://github.com/yammer/crapapult