mina-twist 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5f1b21b4dd64be2eb76c2645ba771c620e709c7f041114aa977aea29828a4b67
4
- data.tar.gz: 83cde60014e0dc64b0ca6bf1e83bd7be5410e7d09411615c4f02c005e977ccd8
3
+ metadata.gz: a7f37ba435fb7f25661c406d2ba7f0e58c52fe02741ceac0d691377dc6afc6a4
4
+ data.tar.gz: 68ffdacfd56d9d6b3015da548dd69299d05ffca8773739a9faa5f1d5b115799b
5
5
  SHA512:
6
- metadata.gz: 90c4bd2e80b5a268ea63c5b73e09c23ac9aecd535f185db33d32b237331d34a5416d7fc1e6277737c1f30af92765dfe9669588543f3b7e1acce4248ec919aec6
7
- data.tar.gz: 04adc77545c356f817d24cdca5bba168613003f0e6df268cb0aefa9a11f77a550f72fdf53000af9b820d5d52ecddf609d1f17119087373920c02058ade2495e9
6
+ metadata.gz: 57d652f6818f0123c86f5c77da777f945af38f15141f3400c1c9b1b2b89a907e644e3c1262acac13dbc979823eb9094b857b34cb1d24be083f63e9c336886f4a
7
+ data.tar.gz: f5c30f6ea86ae96f1795d62a5c362c049e6f2ef05e6eaa80d3944b659cd92c8b455385442d56224c136972ad717945e59e66f703aee3a93335c0705821f1177c
@@ -9,7 +9,7 @@ namespace :twist do
9
9
  set :environment, -> { ENV['to'] }
10
10
 
11
11
  task :starting do
12
- notification = "#{fetch(:author)} is deploying branch #{branch_name} to #{fetch(:environment)}"
12
+ notification = "#{fetch(:author).call} is deploying branch #{branch_name} to #{fetch(:environment).call}"
13
13
  post_twist_thread(notification)
14
14
  set(:start_time, Time.now)
15
15
  end
@@ -19,19 +19,33 @@ namespace :twist do
19
19
  start_time = fetch(:start_time)
20
20
  elapsed = end_time.to_i - start_time.to_i
21
21
 
22
- notification = "#{fetch(:author)} successfully deployed branch #{branch_name} in #{elapsed} seconds."
22
+ notification = "#{fetch(:author).call} successfully deployed branch #{branch_name} in #{elapsed} seconds."
23
+ post_twist_thread(notification)
24
+ end
25
+
26
+ task :starting_restart do
27
+ notification = "#{fetch(:author).call} is restarting #{fetch(:environment).call} servers"
28
+ post_twist_thread(notification)
29
+ set(:start_time, Time.now)
30
+ end
31
+
32
+ task :finished_restart do
33
+ end_time = Time.now
34
+ start_time = fetch(:start_time)
35
+ elapsed = end_time.to_i - start_time.to_i
36
+
37
+ notification = "#{fetch(:author).call} successfully restarted #{fetch(:environment).call} servers in #{elapsed} seconds."
23
38
  post_twist_thread(notification)
24
39
  end
25
40
 
26
41
  def branch_name
27
- "#{fetch(:branch)} (#{fetch(:commit)})"
42
+ "#{fetch(:branch)} (#{fetch(:commit).call})"
28
43
  end
29
44
 
30
45
  def post_twist_thread(message)
31
46
  uri = URI.parse(fetch(:twist_url))
32
47
  http = Net::HTTP.new(uri.host, uri.port)
33
48
  http.use_ssl = true
34
- http.verify_mode = OpenSSL::SSL::VERIFY_NONE
35
49
 
36
50
  payload = {
37
51
  content: message
@@ -43,5 +57,7 @@ namespace :twist do
43
57
 
44
58
  # Call Twist webhook
45
59
  http.request(request)
60
+ rescue => e
61
+ puts "Failed to notify Twist. Error #{e.inspect}"
46
62
  end
47
63
  end
@@ -1,6 +1,6 @@
1
1
 
2
2
  module Mina
3
3
  module Twist
4
- VERSION = '0.3.0'
4
+ VERSION = '0.4.0'
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mina-twist
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rodrigo Coutinho
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-07-29 00:00:00.000000000 Z
11
+ date: 2019-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: 1.0.0
61
+ version: 0.3.8
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: 1.0.0
68
+ version: 0.3.8
69
69
  description: Twist web hook from mina
70
70
  email:
71
71
  - rodrigo.coutinho15@gmail.com