fastlane-plugin-mattermost 1.2.1 → 1.3

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
  SHA256:
3
- metadata.gz: 4e4a19af0c88fdac502570764d36b1b62d6a28ea1d4239b424be18c23956194f
4
- data.tar.gz: a53f85ef669402763396242fa4820d7debc9107c7a533ded7f5da15cc87dc2a9
3
+ metadata.gz: 93d469bb0a6c1f93e5eae5f264354856fd7e5992adaeed611707b193d7eb070c
4
+ data.tar.gz: cf18eef25c0da701d8a1dcf8459b3ad87c1c033e4cbea6ec68597a9e709e86c6
5
5
  SHA512:
6
- metadata.gz: b5819870bf614328bb235634e342dcebb65b2de6f6dffa61801eddadd8f4deb5d142560c2da697ab27c556b795ba0fb2b5b05f35b8cff2a7bc3c63712aa6a799
7
- data.tar.gz: 8f5662fc68f2cbb8da153110ff15459cce092ccb1d95a6b0e357ed2109d1065406f00434226c21f1472f59a2930c4e4eddc612a078b06233403f8dc261db9141
6
+ metadata.gz: 9693781d6274c9543537557564f2dd0e29f68dd6c4d29c532748095b277e94a612e5d5961fb9d548bd9714d325fb5156cfde56e1fda9e34c39445f7247c694e6
7
+ data.tar.gz: b4b90d029e3658654edc75d67ddc17073b90d79fa9f45d1c491430cc605d976351977164e65684a6550627d7b78e480ede0c0933256fc10a04e8cb437fd4e993
data/README.md CHANGED
@@ -15,7 +15,7 @@
15
15
  fastlane add_plugin mattermost
16
16
  ```
17
17
 
18
- 3. Add `mattermost` to your lane in `Fastfile` whenever you want to upload the file
18
+ 3. Add `mattermost` to your lane in `Fastfile`, for more infomations about incoming webhook's fields read: https://developers.mattermost.com/integrate/incoming-webhooks/
19
19
 
20
20
  ```bash
21
21
  lane :build_android do
@@ -23,12 +23,25 @@ lane :build_android do
23
23
  ...
24
24
 
25
25
  # Push messages to Mattermost
26
+ # Minimum params example
26
27
  mattermost(
27
- url: "https://example.mattermost.com/hooks/xxx-generatedkey-xxx",
28
- text: "Hello, this is some text\nThis is more text. :tada:",
28
+ url: "https://example.mattermost.com/hooks/xxx-generatedkey-xxx", # mandatory
29
+ text: "Hello, this is some text\nThis is more text. :tada:", # mandatory
29
30
  username: "Fastlane Mattermost", # optional
30
31
  icon_url: "https://www.mattermost.org/wp-content/uploads/2016/04/icon.png" # optional
31
32
  )
33
+ # Full params example
34
+ mattermost(
35
+ url: "https://example.mattermost.com/hooks/xxx-generatedkey-xxx", # mandatory
36
+ text: "Hello, this is some text\nThis is more text. :tada:", # mandatory
37
+ username: "Fastlane Mattermost", # optional
38
+ icon_url: "https://www.mattermost.org/wp-content/uploads/2016/04/icon.png", # optional
39
+ channel: ... , # optional
40
+ icon_emoji: ... , # optional
41
+ attachments: ... , # optional
42
+ props: ... , # optional
43
+ type: ... # optional
44
+ )
32
45
  ```
33
46
 
34
47
  ## About mattermost
@@ -1,6 +1,15 @@
1
1
  require 'fastlane/action'
2
2
  require_relative '../helper/mattermost_helper'
3
3
 
4
+ DEFAULT_USERNAME = "Fastlane Mattermost"
5
+ DEFAULT_ICON_URL = "https://www.mattermost.org/wp-content/uploads/2016/04/icon.png"
6
+
7
+ def is_blank? variable
8
+ str_variable = variable
9
+ str_variable = variable.strip if variable.class.to_s == "String"
10
+ str_variable.nil? || str_variable.empty?
11
+ end
12
+
4
13
  module Fastlane
5
14
  module Actions
6
15
  class MattermostAction < Action
@@ -17,9 +26,14 @@ module Fastlane
17
26
  }
18
27
  body = {
19
28
  'text': params[:text],
20
- 'username': ((params[:username].nil? || params[:username].strip.empty?) ? "Fastlane Mattermost" : params[:username]),
21
- 'icon_url': ((params[:icon_url].nil? || params[:icon_url].strip.empty?) ? "https://www.mattermost.org/wp-content/uploads/2016/04/icon.png" : params[:icon_url])
29
+ 'username': (is_blank?(params[:username]) ? DEFAULT_USERNAME : params[:username]),
30
+ 'icon_url': (is_blank?(params[:icon_url]) ? DEFAULT_ICON_URL : params[:icon_url])
22
31
  }
32
+ body.merge!('channel': params[:channel]) if is_blank?(params[:channel])
33
+ body.merge!('icon_emoji': params[:icon_emoji]) if is_blank?(params[:icon_emoji])
34
+ body.merge!('attachments': params[:attachments]) if is_blank?(params[:attachments])
35
+ body.merge!('props': params[:props]) if is_blank?(params[:props])
36
+ body.merge!('type': params[:type]) if is_blank?(params[:type])
23
37
  http = Net::HTTP.new(uri.host, uri.port)
24
38
  http.use_ssl = (uri.scheme == 'https')
25
39
  request = Net::HTTP::Post.new(uri.request_uri, header)
@@ -65,7 +79,27 @@ module Fastlane
65
79
  FastlaneCore::ConfigItem.new(key: :icon_url,
66
80
  env_name: "MATTERMOST_WEBHOOKS_ICON_URL",
67
81
  optional: true,
68
- description: "Mattermost Incoming Webhooks Icon URL")
82
+ description: "Mattermost Incoming Webhooks Icon URL"),
83
+ FastlaneCore::ConfigItem.new(key: :channel,
84
+ env_name: "MATTERMOST_WEBHOOKS_CHANNEL",
85
+ optional: true,
86
+ description: "Mattermost Incoming Webhooks Channel"),
87
+ FastlaneCore::ConfigItem.new(key: :icon_emoji,
88
+ env_name: "MATTERMOST_WEBHOOKS_ICON_EMOJI",
89
+ optional: true,
90
+ description: "Mattermost Incoming Webhooks Icon Emoji"),
91
+ FastlaneCore::ConfigItem.new(key: :attachments,
92
+ env_name: "MATTERMOST_WEBHOOKS_ATTACHMENTS",
93
+ optional: true,
94
+ description: "Mattermost Incoming Webhooks Attachments"),
95
+ FastlaneCore::ConfigItem.new(key: :props,
96
+ env_name: "MATTERMOST_WEBHOOKS_PROPS",
97
+ optional: true,
98
+ description: "Mattermost Incoming Webhooks Properties"),
99
+ FastlaneCore::ConfigItem.new(key: :type,
100
+ env_name: "MATTERMOST_WEBHOOKS_TYPE",
101
+ optional: true,
102
+ description: "Mattermost Incoming Webhooks Type")
69
103
  ]
70
104
  end
71
105
 
@@ -84,6 +118,17 @@ module Fastlane
84
118
  text: "Hello, this is some text\nThis is more text. :tada:",
85
119
  username: "Fastlane Mattermost",
86
120
  icon_url: "https://www.mattermost.org/wp-content/uploads/2016/04/icon.png"
121
+ )',
122
+ 'mattermost(
123
+ url: "https://example.mattermost.com/hooks/xxx-generatedkey-xxx",
124
+ text: "Hello, this is some text\nThis is more text. :tada:",
125
+ username: "Fastlane Mattermost",
126
+ icon_url: "https://www.mattermost.org/wp-content/uploads/2016/04/icon.png",
127
+ channel: ... ,
128
+ icon_emoji: ... ,
129
+ attachments: ... ,
130
+ props: ... ,
131
+ type: ...
87
132
  )'
88
133
  ]
89
134
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module Mattermost
3
- VERSION = "1.2.1"
3
+ VERSION = "1.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-mattermost
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: '1.3'
5
5
  platform: ruby
6
6
  authors:
7
7
  - cpfriend1721994
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-01 00:00:00.000000000 Z
11
+ date: 2020-07-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry