capistrano-stride 0.0.1 → 0.1.0

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: 666372ae1ccc23611acdea1764010c6e7ee10680
4
- data.tar.gz: f42d2da5b60e41a6282894f884061469318fdc10
3
+ metadata.gz: 694c8d1218a5de2361515628fb3179266393b356
4
+ data.tar.gz: 955dee4dcde5a6cb2ff6953cf2738b054956cfeb
5
5
  SHA512:
6
- metadata.gz: 3757aece67c2e198de1a2238f35987a29b5ecf01bcce65043e1b261b8f4d8f095652f533eadd92c64d7eda5005ac29bfb03d5cbf5928faaaf17379f712e1735c
7
- data.tar.gz: 9c4a1600e66895618473b595624e3279aaf64934fa5f8b5e98e00147b77237deffc43180514eff50fa6cae5548ab3adbcf886e76ab7a4ba9c2b2e7e982874a83
6
+ metadata.gz: b50541b445213df1c3a3ec2749b04f3dd13734ce27f2fa0b0b13663e75037c09b8dfe8a4564b9f5bda0f33401c40d73bd739098a174bea0c5044a738d206b36a
7
+ data.tar.gz: bafed133d2af67a483e736ac309e1616ae9b3eaa85a4719410a14a102555363e125621f39a24355beaf6530ab66d29c0b13ce642217d6b815fd923d85a196f84
data/.gitignore CHANGED
@@ -1,2 +1,3 @@
1
+ *.gem
1
2
  Gemfile.lock
2
3
  .idea
data/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  # Capistrano::Stride
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/capistrano-stride.svg)](https://badge.fury.io/rb/capistrano-stride)
3
4
  [![Maintainability](https://api.codeclimate.com/v1/badges/2aa1419d1454294270fb/maintainability)](https://codeclimate.com/github/ArsenBespalov/capistrano-stride/maintainability)
4
5
  [![Build Status](https://travis-ci.org/ArsenBespalov/capistrano-stride.svg?branch=master)](https://travis-ci.org/ArsenBespalov/capistrano-stride)
5
6
 
@@ -21,6 +21,7 @@ Gem::Specification.new do |spec|
21
21
  spec.require_paths = ["lib"]
22
22
 
23
23
  spec.add_dependency "capistrano", "~> 3.2"
24
+ spec.add_dependency "stride"
24
25
  spec.add_development_dependency "bundler", "~> 1.3"
25
26
  spec.add_development_dependency "rake"
26
27
  end
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module Stride
3
- VERSION = "0.0.1"
3
+ VERSION = "0.1.0"
4
4
  end
5
5
  end
@@ -2,82 +2,103 @@ namespace :stride do
2
2
  task :notify_deploy_failed do
3
3
  message = "#{fetch(:local_user, local_user).strip} cancelled deployment of #{fetch(:application)} to #{fetch(:stage)}."
4
4
 
5
- request = fetch(:request)
6
- body = {
7
- body: {
8
- version: 1,
9
- type: "doc",
10
- content: [
11
- {
12
- type: "paragraph",
13
- content: [
14
- {
15
- type: "text",
16
- text: message
17
- }
18
- ]
19
- }
20
- ]
21
- }
5
+ message_body = {
6
+ version: 1,
7
+ type: "doc",
8
+ content: [
9
+ {
10
+ type: "panel",
11
+ attrs: {
12
+ panelType: "warning"
13
+ },
14
+ content: [
15
+ {
16
+ type: "paragraph",
17
+ content: [
18
+ {
19
+ type: "text",
20
+ text: message
21
+ }
22
+ ]
23
+ }
24
+ ]
25
+ }
26
+ ]
22
27
  }
23
- request.body = body.to_json
24
28
 
25
- fetch(:http).request(request)
29
+ fetch(:client).send_message(message_body)
26
30
  end
27
31
 
28
32
  task :notify_deploy_started do
29
33
  commits = `git log --no-color --max-count=5 --pretty=format:' - %an: %s' --abbrev-commit --no-merges #{fetch(:previous_revision, "HEAD")}..#{fetch(:current_revision, "HEAD")}`
30
- commits.gsub!("\n", "<br />")
34
+ # commits.gsub!("\n", "<br />")
31
35
  message = "#{fetch(:local_user, local_user).strip} is deploying #{fetch(:application)} to #{fetch(:stage)} <br />"
32
- message << commits
33
36
 
34
- request = fetch(:request)
35
- body = {
36
- body: {
37
- version: 1,
38
- type: "doc",
39
- content: [
40
- {
41
- type: "paragraph",
42
- content: [
43
- {
44
- type: "text",
45
- text: message
46
- }
47
- ]
48
- }
49
- ]
50
- }
37
+ message_body = {
38
+ version: 1,
39
+ type: "doc",
40
+ content: [
41
+ {
42
+ type: "panel",
43
+ attrs: {
44
+ panelType: "info"
45
+ },
46
+ content: [
47
+ {
48
+ type: "paragraph",
49
+ content: [
50
+ {
51
+ type: "text",
52
+ text: message
53
+ },
54
+ {
55
+ type: "text",
56
+ text: commits,
57
+ marks: [
58
+ {
59
+ type: "code"
60
+ }
61
+ ]
62
+ }
63
+ ]
64
+ }
65
+ ]
66
+ }
67
+ ]
51
68
  }
52
- request.body = body.to_json
53
69
 
54
- fetch(:http).request(request)
70
+ fetch(:client).send_message(message_body)
55
71
  end
56
72
 
57
73
  task :notify_deploy_finished do
58
74
  message = "#{fetch(:local_user, local_user).strip} finished deploying #{fetch(:application)} to #{fetch(:stage)}."
59
75
 
60
- request = fetch(:request)
61
- body = {
62
- body: {
63
- version: 1,
64
- type: "doc",
65
- content: [
66
- {
67
- type: "paragraph",
68
- content: [
69
- {
70
- type: "text",
71
- text: message
72
- }
73
- ]
74
- }
75
- ]
76
- }
76
+ message_body = {
77
+ version: 1,
78
+ type: "doc",
79
+ content: [
80
+ {
81
+ type: "panel",
82
+ attrs: {
83
+ panelType: "note"
84
+ },
85
+ content: [
86
+ {
87
+ type: "paragraph",
88
+ content: [
89
+ {
90
+ type: "text",
91
+ text: message
92
+ }
93
+ ]
94
+ }
95
+ ]
96
+
97
+ }
98
+ ]
77
99
  }
78
- request.body = body.to_json
79
100
 
80
- fetch(:http).request(request)
101
+ fetch(:client).send_message(message_body)
81
102
  end
82
103
 
83
104
  before "deploy:updated", "stride:notify_deploy_started"
@@ -87,18 +108,8 @@ end
87
108
 
88
109
  namespace :load do
89
110
  task :defaults do
90
- require 'net/http'
91
- require 'uri'
92
- require 'json'
93
-
94
- uri = URI.parse(fetch(:stride_url))
95
-
96
- header = {
97
- 'Content-Type': 'text/json',
98
- 'Authorization': "Bearer #{fetch(:stride_token)}"
99
- }
111
+ require 'stride'
100
112
 
101
- set(:http, -> { Net::HTTP.new(uri.host, uri.port) })
102
- set(:request, -> { Net::HTTP::Post.new(uri.request_uri, header) })
113
+ set(:client, -> {Stride::Client.new(fetch(:cloud_id), fetch(:conversation_id))})
103
114
  end
104
115
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-stride
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arsen Bespalov
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '3.2'
27
+ - !ruby/object:Gem::Dependency
28
+ name: stride
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'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: bundler
29
43
  requirement: !ruby/object:Gem::Requirement