samson_hipchat 0.1.4 → 0.1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 08682233095d4b9335d6133ae774ecab623de5de
4
- data.tar.gz: 46a38b72fd4c1ee7ba45b38d72c457faafc51e15
3
+ metadata.gz: a9a089b06747f9e57178c11807a6b219e486d545
4
+ data.tar.gz: 51fcf64e2a2e435eb584863abc8a847f4ce7feb3
5
5
  SHA512:
6
- metadata.gz: 32a4b40c54790b44a9d7f0b95288a1f639ab488802bf4ac0db7c9c0e195ef12223992df8c736a5aea541a8bc462395ef1672f7666daa7bb834acf1867205ed07
7
- data.tar.gz: f49f678e836478224ffdf08e79c35dfed5faf59307672fc28365cb1c5efcbc4586d0e2d8bdcc1b87be19e27793d86197013b2ccbf86e2e6e7625799d691148bf
6
+ metadata.gz: 7aefd6954f9d55b83ae29baab0e8a74cd2a3ccb29f025a15c2b51ce9660a419a8756b27cec86b4c4633bc17f56cca08de8d4433d14733089f7bbb9b9b2a7c107
7
+ data.tar.gz: 24abe14fa1630fbf9018081b5b1f56d9327ede1ac4a1105d9e8bba186433adf1897ac2b0b3936e7dc4dd3dab52618f2b2ef73e394fc60808899448643f46444a
@@ -56,13 +56,13 @@ class HipchatNotification
56
56
 
57
57
  def subject
58
58
  if @is_multi_message
59
- subject = "#{@user.name} is <a href='#{deploy_url}'>deploying</a> <strong>#{@project.name}</strong> on <strong>#{@stage.name}</strong><br>"
59
+ subject = "#{@user.name} is <a href='#{deploy_url}'>deploying</a> <strong>#{@project.name}</strong> to <strong>#{@stage.name}</strong><br>"
60
60
 
61
- subject = "#{@user.name} successfully deployed <strong>#{@project.name}</strong> @<a href='#{diff_url}'>#{@deploy.commit}</a> on <strong>#{@stage.name}</strong><br>" if @deploy.job.succeeded?
61
+ subject = "#{@user.name} successfully deployed <strong>#{@project.name}</strong> @<a href='#{diff_url}'>#{@deploy.commit}</a> to <strong>#{@stage.name}</strong><br>" if @deploy.job.succeeded?
62
62
 
63
- subject = "#{@user.name} failed to <a href='#{deploy_url}'>deployed</a> <strong>#{@project.name}</strong> on <strong>#{@stage.name}</strong><br>" if @deploy.job.failed? || @deploy.job.errored?
63
+ subject = "#{@user.name} failed to <a href='#{deploy_url}'>deployed</a> <strong>#{@project.name}</strong> to <strong>#{@stage.name}</strong><br>" if @deploy.job.failed? || @deploy.job.errored?
64
64
 
65
- subject = "#{@user.name} cancelled <a href='#{deploy_url}'>deploy</a> <strong>#{@project.name}</strong> on <strong>#{@stage.name}</strong><br>" if @deploy.job.cancelled?
65
+ subject = "#{@user.name} cancelled <a href='#{deploy_url}'>deploy</a> <strong>#{@project.name}</strong> to <strong>#{@stage.name}</strong><br>" if @deploy.job.cancelled?
66
66
 
67
67
  subject
68
68
  else
@@ -78,7 +78,7 @@ class HipchatNotification
78
78
  def content
79
79
  if @is_multi_message
80
80
  return subject if @deploy.job.succeeded? || @deploy.job.failed? || @deploy.job.errored?
81
- @content ||= HipchatNotificationRenderer.render(@deploy, subject)
81
+ @content ||= HipchatNotificationRenderer.render(@deploy, subject, {is_multi_message: true})
82
82
  else
83
83
  @content ||= HipchatNotificationRenderer.render(@deploy, subject)
84
84
  end
@@ -1,8 +1,8 @@
1
1
  class HipchatNotificationRenderer
2
- def self.render(deploy, subject)
2
+ def self.render(deploy, subject, opt = {})
3
3
  controller = ActionController::Base.new
4
4
  view = ActionView::Base.new(File.expand_path("../../views/samson_hipchat", __FILE__), {}, controller)
5
- locals = { deploy: deploy, changeset: deploy.changeset, subject: subject }
5
+ locals = { deploy: deploy, changeset: deploy.changeset, subject: subject, option: opt }
6
6
  view.render(template: 'notification', locals: locals).chomp
7
7
  end
8
8
  end
@@ -1,10 +1,13 @@
1
1
  <%= subject %>
2
- <p>&nbsp;&nbsp;<%= deploy.try(:message) %> </p>
3
- <% if changeset.commits.count == 0 %>
4
- There are no new commits since last time.
5
- <% else %>
6
- <%= pluralize changeset.commits.count, "commit" %> by <%= changeset.author_names.to_sentence %>.
7
- <br>
2
+ <p>&nbsp;&nbsp;<%= deploy.try(:message).gsub("\n","<br>") %> </p>
3
+
4
+ <% if option[:is_multi_message] %>
5
+ <% if changeset.commits.count == 0 %>
6
+ There are no new commits since last time.
7
+ <% else %>
8
+ <%= pluralize changeset.commits.count, "commit" %> by <%= changeset.author_names.to_sentence %>.
9
+ <br>
10
+ <% end %>
8
11
 
9
12
  <% if false %>
10
13
  <strong>Files changed:</strong>
@@ -15,6 +18,7 @@ There are no new commits since last time.
15
18
  </ul>
16
19
  <% end %>
17
20
 
21
+ <% if option[:is_multi_message] %>
18
22
  <strong>Commits:</strong>
19
23
  <ol>
20
24
  <% changeset.commits.each do |commit| %>
@@ -24,3 +28,5 @@ There are no new commits since last time.
24
28
  <% end %>
25
29
  </ol>
26
30
  <% end %>
31
+
32
+ <% end %>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: samson_hipchat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vinh Nguyen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-13 00:00:00.000000000 Z
11
+ date: 2015-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hipchat