app_status_notification 0.9.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +10 -0
  3. data/.rubocop.yml +69 -0
  4. data/Gemfile +18 -0
  5. data/Gemfile.lock +112 -0
  6. data/LICENSE +21 -0
  7. data/README.md +22 -0
  8. data/app_status_notification.gemspec +46 -0
  9. data/config/locales/en.yml +10 -0
  10. data/config/locales/zh.yml +54 -0
  11. data/config/notification.yml +30 -0
  12. data/exe/app_status_notification +5 -0
  13. data/lib/app_status_notification.rb +24 -0
  14. data/lib/app_status_notification/command.rb +64 -0
  15. data/lib/app_status_notification/config.rb +234 -0
  16. data/lib/app_status_notification/connect_api.rb +92 -0
  17. data/lib/app_status_notification/connect_api/auth.rb +44 -0
  18. data/lib/app_status_notification/connect_api/clients/app.rb +46 -0
  19. data/lib/app_status_notification/connect_api/clients/app_store_version.rb +28 -0
  20. data/lib/app_status_notification/connect_api/clients/build.rb +29 -0
  21. data/lib/app_status_notification/connect_api/model.rb +152 -0
  22. data/lib/app_status_notification/connect_api/models/app.rb +27 -0
  23. data/lib/app_status_notification/connect_api/models/app_store_version.rb +84 -0
  24. data/lib/app_status_notification/connect_api/models/app_store_version_submission.rb +15 -0
  25. data/lib/app_status_notification/connect_api/models/build.rb +30 -0
  26. data/lib/app_status_notification/connect_api/models/pre_release_version.rb +16 -0
  27. data/lib/app_status_notification/connect_api/response.rb +102 -0
  28. data/lib/app_status_notification/error.rb +38 -0
  29. data/lib/app_status_notification/helper.rb +16 -0
  30. data/lib/app_status_notification/notification.rb +57 -0
  31. data/lib/app_status_notification/notifications/adapter.rb +25 -0
  32. data/lib/app_status_notification/notifications/dingtalk.rb +59 -0
  33. data/lib/app_status_notification/notifications/slack.rb +62 -0
  34. data/lib/app_status_notification/notifications/wecom.rb +48 -0
  35. data/lib/app_status_notification/runner.rb +409 -0
  36. data/lib/app_status_notification/store.rb +68 -0
  37. data/lib/app_status_notification/version.rb +5 -0
  38. data/lib/app_status_notification/watchman.rb +42 -0
  39. metadata +283 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: c69f877bbe839479390ea0c927984edfba4aa3f71952fda2acacf9766d83356b
4
+ data.tar.gz: fc0d57cc1ede26be67a5e2f7da9893ee109d02e16ae63a162205361c8adfb644
5
+ SHA512:
6
+ metadata.gz: 978d4297fdd21d8618d77aca5bb12112ad17032a9cd3d30fb12c42576ef065a40dcb5594be48b293e406f250d2c9594e13749b3c7ce93231d6bd02e6dd2c9481
7
+ data.tar.gz: 0f2bcd8c18a6d4555e9764a9c21a42f5ab7f2df4c449fcd5efcd383185101991a809c34a0a075c1f3b8cf84ac079ec75c280ac337d9b2e13235690e991836c86
data/.gitignore ADDED
@@ -0,0 +1,10 @@
1
+ .vscode/
2
+ bin/
3
+ stores/
4
+ pkg/
5
+ .bundle/
6
+ *.log
7
+ status.json
8
+ config/*.local.yml
9
+ config/*.p8
10
+ main.rb
data/.rubocop.yml ADDED
@@ -0,0 +1,69 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.6
3
+ DisabledByDefault: true
4
+
5
+ Style/FrozenStringLiteralComment:
6
+ Enabled: true
7
+
8
+ Layout/LineLength:
9
+ Max: 120
10
+
11
+ Metrics/MethodLength:
12
+ Max: 60
13
+
14
+ Metrics/ClassLength:
15
+ Max: 150
16
+
17
+ Metrics/ModuleLength:
18
+ Max: 150
19
+
20
+ # Raise complexity metrics
21
+ Metrics/AbcSize:
22
+ Max: 20
23
+
24
+ Style/Alias:
25
+ EnforcedStyle: prefer_alias_method
26
+
27
+ Style/AsciiComments:
28
+ Enabled: false
29
+
30
+ Style/Documentation:
31
+ Enabled: false
32
+
33
+ Style/SpecialGlobalVars:
34
+ Enabled: false
35
+
36
+ Style/ClassAndModuleChildren:
37
+ Enabled: false
38
+
39
+ # We do not need to support Ruby 1.9, so this is good to use.
40
+ Style/SymbolArray:
41
+ Enabled: true
42
+
43
+ Lint/EmptyWhen:
44
+ Enabled: false
45
+
46
+ Style/EmptyMethod:
47
+ Enabled: false
48
+
49
+ # Disable %w or %W instead for an array of words
50
+ Style/WordArray:
51
+ Enabled: false
52
+
53
+ Naming/AccessorMethodName:
54
+ Enabled: true
55
+
56
+ Style/RescueStandardError:
57
+ Enabled: false
58
+
59
+ Lint/AssignmentInCondition:
60
+ Enabled: false
61
+
62
+ Style/TrailingCommaInHashLiteral:
63
+ Enabled: false
64
+
65
+ Naming/PredicateName:
66
+ Enabled: true
67
+
68
+ Layout/HashAlignment:
69
+ Enabled: false
data/Gemfile ADDED
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gemspec
6
+
7
+ # gem 'app_store_connect', '~> 0.23'
8
+ # gem 'mini_magick', '~> 4.10.1'
9
+ # gem 'anyway_config', '~> 2.0.0'
10
+ # gem 'sentry-raven'
11
+ # gem 'faraday'
12
+ # gem 'faraday_middleware'
13
+
14
+ group :development do
15
+ # gem 'awesome_print'
16
+ gem 'debase'
17
+ gem 'ruby-debug-ide'
18
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,112 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ app_status_notification (0.9.0.beta1)
5
+ activesupport (>= 6.0.3.1)
6
+ anyway_config (>= 2.0.0)
7
+ faraday (>= 1.0.1)
8
+ faraday_middleware (>= 1.0.0)
9
+ gli (~> 2.20.0)
10
+ i18n (~> 1.8.5)
11
+ jwt (>= 1.4, <= 2.2.1)
12
+ sentry-raven
13
+
14
+ GEM
15
+ remote: https://rubygems.org/
16
+ specs:
17
+ activesupport (6.1.3)
18
+ concurrent-ruby (~> 1.0, >= 1.0.2)
19
+ i18n (>= 1.6, < 2)
20
+ minitest (>= 5.1)
21
+ tzinfo (~> 2.0)
22
+ zeitwerk (~> 2.3)
23
+ anyway_config (2.1.0)
24
+ ruby-next-core (>= 0.11.0)
25
+ ast (2.4.2)
26
+ awesome_print (2.0.0.pre2)
27
+ byebug (11.1.3)
28
+ coderay (1.1.3)
29
+ concurrent-ruby (1.1.8)
30
+ debase (0.2.4.1)
31
+ debase-ruby_core_source (>= 0.10.2)
32
+ debase-ruby_core_source (0.10.12)
33
+ diff-lcs (1.4.4)
34
+ faraday (1.3.0)
35
+ faraday-net_http (~> 1.0)
36
+ multipart-post (>= 1.2, < 3)
37
+ ruby2_keywords
38
+ faraday-net_http (1.0.1)
39
+ faraday_middleware (1.0.0)
40
+ faraday (~> 1.0)
41
+ gli (2.20.0)
42
+ i18n (1.8.9)
43
+ concurrent-ruby (~> 1.0)
44
+ jwt (2.2.1)
45
+ method_source (1.0.0)
46
+ minitest (5.14.4)
47
+ multipart-post (2.1.1)
48
+ parallel (1.20.1)
49
+ parser (3.0.0.0)
50
+ ast (~> 2.4.1)
51
+ pry (0.13.1)
52
+ coderay (~> 1.1)
53
+ method_source (~> 1.0)
54
+ pry-byebug (3.9.0)
55
+ byebug (~> 11.0)
56
+ pry (~> 0.13.0)
57
+ rainbow (3.0.0)
58
+ rake (13.0.3)
59
+ regexp_parser (2.1.1)
60
+ rexml (3.2.4)
61
+ rspec (3.10.0)
62
+ rspec-core (~> 3.10.0)
63
+ rspec-expectations (~> 3.10.0)
64
+ rspec-mocks (~> 3.10.0)
65
+ rspec-core (3.10.1)
66
+ rspec-support (~> 3.10.0)
67
+ rspec-expectations (3.10.1)
68
+ diff-lcs (>= 1.2.0, < 2.0)
69
+ rspec-support (~> 3.10.0)
70
+ rspec-mocks (3.10.2)
71
+ diff-lcs (>= 1.2.0, < 2.0)
72
+ rspec-support (~> 3.10.0)
73
+ rspec-support (3.10.2)
74
+ rubocop (1.1.0)
75
+ parallel (~> 1.10)
76
+ parser (>= 2.7.1.5)
77
+ rainbow (>= 2.2.2, < 4.0)
78
+ regexp_parser (>= 1.8)
79
+ rexml
80
+ rubocop-ast (>= 1.0.1)
81
+ ruby-progressbar (~> 1.7)
82
+ unicode-display_width (>= 1.4.0, < 2.0)
83
+ rubocop-ast (1.4.1)
84
+ parser (>= 2.7.1.5)
85
+ ruby-debug-ide (0.7.2)
86
+ rake (>= 0.8.1)
87
+ ruby-next-core (0.12.0)
88
+ ruby-progressbar (1.11.0)
89
+ ruby2_keywords (0.0.4)
90
+ sentry-raven (3.1.1)
91
+ faraday (>= 1.0)
92
+ tzinfo (2.0.4)
93
+ concurrent-ruby (~> 1.0)
94
+ unicode-display_width (1.7.0)
95
+ zeitwerk (2.4.2)
96
+
97
+ PLATFORMS
98
+ ruby
99
+
100
+ DEPENDENCIES
101
+ app_status_notification!
102
+ awesome_print (~> 2.0.0.pre2)
103
+ bundler (~> 2.1)
104
+ debase
105
+ pry-byebug (~> 3.9.0)
106
+ rake (~> 13.0)
107
+ rspec (~> 3.10)
108
+ rubocop (~> 1.1.0)
109
+ ruby-debug-ide
110
+
111
+ BUNDLED WITH
112
+ 2.2.4
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 icyleaf
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,22 @@
1
+ # app_status_notification
2
+
3
+ 🎉 Quick deliver your app(s) review status with your team for mostly platforms like Slack, Dingtalk, WeChat work etc
4
+
5
+ ## Features
6
+
7
+ - Using App Store Connect official API
8
+ - Support multi account from appstoreconnect
9
+ - Support multi application
10
+ - Built-in mostly SNS platforms: Slack, Dingtalk, Wechat work, more is comming
11
+
12
+ ## Configuration
13
+
14
+ > TODO
15
+
16
+ ## Deploy
17
+
18
+ > TODO
19
+
20
+ ## Many Thanks
21
+
22
+ - [spaceship](https://github.com/fastlane/fastlane/tree/master/spaceship) from fastlane
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('lib', __dir__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require 'app_status_notification/version'
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = 'app_status_notification'
9
+ spec.version = AppStatusNotification::VERSION
10
+ spec.authors = ['icyleaf']
11
+ spec.email = ['icyleaf.cn@gmail.com']
12
+
13
+ spec.summary = 'Get those App Store Connect notifications delivered directly to Slack.'
14
+ spec.homepage = 'https://github.com/icyleaf/app_status_notification'
15
+ spec.license = 'MIT'
16
+
17
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
18
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
19
+ end
20
+
21
+ spec.require_paths = ['lib']
22
+ spec.bindir = 'exe'
23
+ spec.executables << 'app_status_notification'
24
+
25
+ spec.add_dependency 'faraday', '>= 1.0.1'
26
+ spec.add_dependency 'faraday_middleware', '>= 1.0.0'
27
+ spec.add_dependency 'jwt', '>= 1.4', '<= 2.2.1'
28
+ spec.add_dependency 'anyway_config', '>= 2.0.0'
29
+ spec.add_dependency 'activesupport', '>= 6.0.3.1'
30
+ spec.add_dependency 'gli', '~> 2.20.0'
31
+ spec.add_dependency 'i18n', '~> 1.8.5'
32
+ spec.add_dependency 'sentry-raven'
33
+
34
+ spec.add_development_dependency 'awesome_print', '~> 2.0.0.pre2'
35
+ spec.add_development_dependency 'bundler', '~> 2.1'
36
+ # spec.add_development_dependency 'factory_bot', '~> 5.0.2'
37
+ # spec.add_development_dependency 'guard-rspec', '~> 4.7.3'
38
+ spec.add_development_dependency 'pry-byebug', '~> 3.9.0'
39
+ spec.add_development_dependency 'rake', '~> 13.0'
40
+ spec.add_development_dependency 'rspec', '~> 3.10'
41
+ spec.add_development_dependency 'rubocop', '~> 1.1.0'
42
+ # spec.add_development_dependency 'semantic', '~> 1.5'
43
+ # spec.add_development_dependency 'simplecov', '~> 0.16.1'
44
+ # spec.add_development_dependency 'timecop', '~> 0.9.1'
45
+ # spec.add_development_dependency 'webmock', '~> 3.6.0'
46
+ end
@@ -0,0 +1,10 @@
1
+ ---
2
+ en:
3
+ messages:
4
+ app_version_created: '【%{app}】Create a new version: %{version}, current status: %{status}'
5
+ app_version_changed: ''
6
+ app_was_on_sale: '%{app} v%{version} 版本已经发布到 App Store 撒花!!!'
7
+ app_store_status_changes: '%{app} v%{version} 状态变更为:**%{status}**'
8
+ app_store_status_changes_with_todo: '%{app} v%{version} 状态变更为:**%{status}**。确认事项:%{todo}'
9
+ app_status:
10
+ READY_FOR_SALE: 'Ready For Sale'
@@ -0,0 +1,54 @@
1
+ zh:
2
+ messages:
3
+ app_version_created: '%{app} 创建了新版本: %{version},当前状态 %{status}'
4
+ app_version_changed: '%{app} 提交版本号变更: **%{current_version}** => **%{new_version}**,当前状态 %{status}'
5
+ app_build_received: '%{app} %{version} 接收到新构建版本 **%{build}**,等待苹果预处理 ...'
6
+ app_build_processed: '%{app} %{version} 构建版本 **%{build}** 处理完毕,请手动登录网页上选中此构建版本'
7
+ app_build_selected: '%{app} %{version} 构建版本 **%{build}** 选中完毕,物料准备好就可以提交审核'
8
+ app_build_removed: '%{app} %{version} 构建版本 **%{build}** 已经被取消选中,请确认是否有新构建版本或重新登录网页上选中已上传构建版本'
9
+ app_build_changed: '%{app} %{version} 当前选中构建版本 **%{old_build}**,最新上传构建版本 %{new_build},请确认选择正确的构建版本。'
10
+ app_build_failed: '%{app} %{version} 构建版本 **%{build}** 处理失败 %{status},请手动登录网页上选中此构建版本'
11
+ app_was_on_sale: '%{app} %{version} 版本已经发布到 App Store 撒花!!!'
12
+
13
+ app_store_status_changes: '%{app} %{version} 状态变更为:**%{status}**'
14
+ app_store_status_changes_with_todo: '%{app} %{version} 状态变更为:**%{status}**。确认事项:%{todo}'
15
+
16
+ select_appstoreversion_build_from_another_source: '%{app} %{version} 从其他渠道选中 %{build} 构建版本'
17
+ prepare_appstoreversion_build: '%{app} %{version} 尝试选中 **%{build}** 构建版本,请等待结果'
18
+ success_select_appstoreversion_build: '%{app} %{version} 成功选中 %{build} 构建版本,物料准备好就可以提交审核'
19
+ failed_select_appstoreversion_build: '%{app} %{version} 选中 **%{build}** 失败了,请手动登录网页上选中此构建版本'
20
+ app_store_status:
21
+ ready_for_sale: '发布至应用商店'
22
+ processing_for_app_store: '上架应用商店预处理中'
23
+ pending_developer_release: '等待手动发布新版本'
24
+ in_review: '审核中'
25
+ waiting_for_review: '等待审核'
26
+ developer_rejected: '用户撤回'
27
+ rejected: '审核驳回,请去网页或 Connect App 查看被拒原因'
28
+ prepare_for_submission: '等待提交审核'
29
+ metadata_rejected: '元数据驳回,请去网页或 Connect App 查看被拒原因'
30
+ invalid_binary: '无效的二进制包'
31
+ todo:
32
+ ready_for_sale:
33
+ processing_for_app_store:
34
+ pending_developer_release:
35
+ in_review:
36
+ waiting_for_review:
37
+ developer_rejected:
38
+ rejected:
39
+ prepare_for_submission:
40
+ metadata_rejected:
41
+ invalid_binary:
42
+
43
+ logger:
44
+ current_env: '当前运行环境: %{name}, 版本: %{version}'
45
+ setup_accounts: '开始初始化 %{numbers} 个账户'
46
+ setup_apps: '配置账户 %{issuer_id} 下的 %{apps} 个应用'
47
+ found_app: '找到匹配应用 %{id} - %{name} (%{bundle_id})'
48
+ not_found_edit_version: '没有找到编辑版本,当前现在版本是 %{version}'
49
+
50
+ send_notification: '[%{name}] 发送消息:%{message}'
51
+
52
+ wait_next_loop: '等待下次查询,刷新时长 %{interval} 秒'
53
+ raise_error: '捕捉异常错误 %{message}'
54
+ interrupt: 人为退出程序
@@ -0,0 +1,30 @@
1
+ refresh_interval: 60
2
+ locale: zh
3
+
4
+ accounts:
5
+ - issuer_id:
6
+ key_id:
7
+ key_path:
8
+ apps:
9
+ # Enable all notifications
10
+ - 123456789
11
+
12
+ - issuer_id:
13
+ key_id:
14
+ key_path:
15
+ apps:
16
+ - id:
17
+ # Enable wecom only
18
+ notifications:
19
+ - wecom
20
+
21
+ notifications:
22
+ wecom:
23
+ type: wecom
24
+ webhook_url:
25
+ dingding:
26
+ type: dingding
27
+ webhook_url:
28
+ slack:
29
+ type: slack
30
+ webhook_url:
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'app_status_notification'
4
+
5
+ AppStatusNotification.run
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'app_status_notification/error'
4
+ require 'app_status_notification/helper'
5
+ require 'app_status_notification/config'
6
+ require 'app_status_notification/store'
7
+ require 'app_status_notification/connect_api'
8
+ require 'app_status_notification/notification'
9
+ require 'app_status_notification/watchman'
10
+ require 'app_status_notification/command'
11
+
12
+ module AppStatusNotification
13
+ def self.run(params = ARGV)
14
+ AppStatusNotification::Command.run(params)
15
+ end
16
+
17
+ def self.watch(config_file = nil)
18
+ AppStatusNotification::Watchman.run(config_file)
19
+ end
20
+
21
+ def self.development(enabled = false)
22
+ Anyway::Settings.use_local_files = !!enabled
23
+ end
24
+ end