fastlane-plugin-clean_testflight_testers 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 079d6ebd3b925a1a16f1a3deb2feb1b1f99d8ffe
4
+ data.tar.gz: 63d3d0d9f7c6ad2fe306892579796cb00339f929
5
+ SHA512:
6
+ metadata.gz: 40a58312425ba5f38209fe8e0aec998b8354feeaffa052e6331187693b20ab0d9e9df202b222ba5bac99038db2570050e6fa6401c8efb0dc8b8a596ef0d8ed41
7
+ data.tar.gz: 643924bf6c1daae84efac0126b398d821b8e7b0d2e05adfa748a5d2416b62e9a8c31c1a7b77909818ef18cdc004c590d24c580dafb7385e4b378e98cd583f666
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Felix Krause <krausefx@gmail.com>
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,72 @@
1
+ # clean_testflight_testers plugin
2
+
3
+ [![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-clean_testflight_testers)
4
+
5
+ ## Getting Started
6
+
7
+ This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-clean_testflight_testers`, add it to your project by running:
8
+
9
+ ```bash
10
+ fastlane add_plugin clean_testflight_testers
11
+ ```
12
+
13
+ ## About clean_testflight_testers
14
+
15
+ #### Note: This plugin isn't available to use yet
16
+
17
+ Please wait until https://github.com/fastlane/fastlane/pull/10186 is merged and shipped, which should be in a few days or so.
18
+
19
+ ![screenshot.png](screenshot.png)
20
+
21
+ > Automatically remove TestFlight testers that are not actually testing your app
22
+
23
+ Just add the following to your `fastlane/Fastfile`
24
+
25
+ ```ruby
26
+ # Default setup
27
+ lane :clean do
28
+ clean_testflight_testers
29
+ end
30
+
31
+ # This won't delete out inactive testers, but just print them
32
+ lane :clean do
33
+ clean_testflight_testers(dry_run: true)
34
+ end
35
+
36
+ # Specify a custom number for what's "inactive"
37
+ lane :clean do
38
+ clean_testflight_testers(days_of_inactivity: 120) # 120 days, so about 4 months
39
+ end
40
+
41
+ # Provide custom app identifier / username
42
+ lane :clean do
43
+ clean_testflight_testers(username: "apple@krausefx.com", app_identifier: "best.lane"")
44
+ end
45
+ ```
46
+
47
+ The plugin will remove all testers that either:
48
+
49
+ - Received a TestFlight email, but didn't accept the invite within the last 30 days
50
+ - Installed the app within the last 30 days, but didn't launch it once
51
+
52
+ Unfortunately the iTunes Connect UI/API doesn't expose the timestamp of the last user session, so we can't really detect the last time someone used the app. The above rules will still help you, remove a big part of inactive testers.
53
+
54
+ This plugin could also be smarter, and compare the time stamp of the last build, and compare it with the latest tester activity, feel free to submit a PR for this feature 👍
55
+
56
+ ## Issues and Feedback
57
+
58
+ Make sure to update to the latest _fastlane_.
59
+
60
+ For any other issues and feedback about this plugin, please submit it to this repository.
61
+
62
+ ## Troubleshooting
63
+
64
+ If you have trouble using plugins, check out the [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.
65
+
66
+ ## Using _fastlane_ Plugins
67
+
68
+ For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/).
69
+
70
+ ## About _fastlane_
71
+
72
+ _fastlane_ is the easiest way to automate beta deployments and releases for your iOS and Android apps. To learn more, check out [fastlane.tools](https://fastlane.tools).
@@ -0,0 +1,16 @@
1
+ require 'fastlane/plugin/clean_testflight_testers/version'
2
+
3
+ module Fastlane
4
+ module CleanTestflightTesters
5
+ # Return all .rb files inside the "actions" and "helper" directory
6
+ def self.all_classes
7
+ Dir[File.expand_path('**/{actions,helper}/*.rb', File.dirname(__FILE__))]
8
+ end
9
+ end
10
+ end
11
+
12
+ # By default we want to import all available actions and helpers
13
+ # A plugin can contain any number of actions and plugins
14
+ Fastlane::CleanTestflightTesters.all_classes.each do |current|
15
+ require current
16
+ end
@@ -0,0 +1,129 @@
1
+ module Fastlane
2
+ module Actions
3
+ class CleanTestflightTestersAction < Action
4
+ def self.run(params)
5
+ ENV["SPACESHIP_DEBUG"] = 1.to_s
6
+ require 'spaceship'
7
+
8
+ UI.message("Login to iTunes Connect (#{params[:username]})")
9
+ Spaceship::Tunes.login(params[:username])
10
+ Spaceship::Tunes.select_team
11
+ UI.message("Login successful")
12
+
13
+ UI.message("Fetching all TestFlight testers, this might take a few minutes, depending on the number of testers")
14
+
15
+ # Convert from bundle identifier to app ID
16
+ spaceship_app ||= Spaceship::Application.find(params[:app_identifier])
17
+ UI.user_error!("Couldn't find app '#{params[:app_identifier]}' on the account of '#{params[:username]}' on iTunes Connect") unless spaceship_app
18
+ app_id = spaceship_app.apple_id
19
+
20
+ all_testers = Spaceship::TestFlight::Tester.all(app_id: app_id)
21
+ counter = 0
22
+
23
+ all_testers.each do |current_tester|
24
+ days_since_status_change = (Time.now - current_tester.status_mod_time) / 60.0 / 60.0 / 24.0
25
+
26
+ if current_tester.status == "invited"
27
+ if days_since_status_change > params[:days_of_inactivity]
28
+ remove_tester(current_tester, app_id, params[:dry_run]) # user got invited, but never installed a build... why would you do that?
29
+ counter += 1
30
+ end
31
+ else
32
+ # We don't really have a good way to detect whether the user is active unfortunately
33
+ # So we can just delete users that had no sessions
34
+ if days_since_status_change > params[:days_of_inactivity] && current_tester.session_count == 0
35
+ # User had no sessions in the last e.g. 30 days, let's get rid of them
36
+ remove_tester(current_tester, app_id, params[:dry_run])
37
+ counter += 1
38
+ end
39
+ end
40
+ end
41
+
42
+ if params[:dry_run]
43
+ UI.success("Didn't delete any testers, but instead only printed them out (#{counter}), disable `dry_run` to actually delete them 🦋")
44
+ else
45
+ UI.success("Successfully removed #{counter} testers 🦋")
46
+ end
47
+ end
48
+
49
+ def self.remove_tester(tester, app_id, dry_run)
50
+ if dry_run
51
+ UI.message("TestFlight tester #{tester.email} seems to be inactive for app ID #{app_id}")
52
+ else
53
+ UI.message("Removing tester #{tester.email} due to inactivity from app ID #{app_id}...")
54
+ tester.remove_from_app!(app_id: app_id)
55
+ raise 'yolo'
56
+ end
57
+ end
58
+
59
+ def self.description
60
+ "Automatically remove TestFlight testers that are not actually testing your app"
61
+ end
62
+
63
+ def self.authors
64
+ ["KrauseFx"]
65
+ end
66
+
67
+ def self.details
68
+ "Automatically remove TestFlight testers that are not actually testing your app"
69
+ end
70
+
71
+ def self.available_options
72
+ user = CredentialsManager::AppfileConfig.try_fetch_value(:itunes_connect_id)
73
+ user ||= CredentialsManager::AppfileConfig.try_fetch_value(:apple_id)
74
+
75
+ [
76
+ FastlaneCore::ConfigItem.new(key: :username,
77
+ short_option: "-u",
78
+ env_name: "CLEAN_TESTFLIGHT_TESTERS_USERNAME",
79
+ description: "Your Apple ID Username",
80
+ default_value: user),
81
+ FastlaneCore::ConfigItem.new(key: :app_identifier,
82
+ short_option: "-a",
83
+ env_name: "CLEAN_TESTFLIGHT_TESTERS_APP_IDENTIFIER",
84
+ description: "The bundle identifier of the app to upload or manage testers (optional)",
85
+ optional: true,
86
+ default_value: ENV["TESTFLIGHT_APP_IDENTITIFER"] || CredentialsManager::AppfileConfig.try_fetch_value(:app_identifier)),
87
+ FastlaneCore::ConfigItem.new(key: :team_id,
88
+ short_option: "-q",
89
+ env_name: "CLEAN_TESTFLIGHT_TESTERS_TEAM_ID",
90
+ description: "The ID of your iTunes Connect team if you're in multiple teams",
91
+ optional: true,
92
+ is_string: false, # as we also allow integers, which we convert to strings anyway
93
+ default_value: CredentialsManager::AppfileConfig.try_fetch_value(:itc_team_id),
94
+ verify_block: proc do |value|
95
+ ENV["FASTLANE_ITC_TEAM_ID"] = value.to_s
96
+ end),
97
+ FastlaneCore::ConfigItem.new(key: :team_name,
98
+ short_option: "-r",
99
+ env_name: "CLEAN_TESTFLIGHT_TESTERS_TEAM_NAME",
100
+ description: "The name of your iTunes Connect team if you're in multiple teams",
101
+ optional: true,
102
+ default_value: CredentialsManager::AppfileConfig.try_fetch_value(:itc_team_name),
103
+ verify_block: proc do |value|
104
+ ENV["FASTLANE_ITC_TEAM_NAME"] = value.to_s
105
+ end),
106
+ FastlaneCore::ConfigItem.new(key: :days_of_inactivity,
107
+ short_option: "-k",
108
+ env_name: "CLEAN_TESTFLIGHT_TESTERS_WAIT_PROCESSING_INTERVAL",
109
+ description: "Numbers of days a tester has to be inactive for (no build uses) for them to be removed",
110
+ default_value: 30,
111
+ type: Integer,
112
+ verify_block: proc do |value|
113
+ UI.user_error!("Please enter a valid positive number of days") unless value.to_i > 0
114
+ end),
115
+ FastlaneCore::ConfigItem.new(key: :dry_run,
116
+ short_option: "-d",
117
+ env_name: "CLEAN_TESTFLIGHT_TESTERS_DRY_RUN",
118
+ description: "Only print inactive users, don't delete them",
119
+ default_value: false,
120
+ is_string: false)
121
+ ]
122
+ end
123
+
124
+ def self.is_supported?(platform)
125
+ platform == :ios
126
+ end
127
+ end
128
+ end
129
+ end
@@ -0,0 +1,6 @@
1
+ module Fastlane
2
+ module Helper
3
+ class CleanTestflightTestersHelper
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ module Fastlane
2
+ module CleanTestflightTesters
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,149 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fastlane-plugin-clean_testflight_testers
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Felix Krause
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-09-15 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: pry
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rubocop
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: simplecov
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: fastlane
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: 2.56.0
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: 2.56.0
111
+ description:
112
+ email: krausefx@gmail.com
113
+ executables: []
114
+ extensions: []
115
+ extra_rdoc_files: []
116
+ files:
117
+ - LICENSE
118
+ - README.md
119
+ - lib/fastlane/plugin/clean_testflight_testers.rb
120
+ - lib/fastlane/plugin/clean_testflight_testers/actions/clean_testflight_testers_action.rb
121
+ - lib/fastlane/plugin/clean_testflight_testers/helper/clean_testflight_testers_helper.rb
122
+ - lib/fastlane/plugin/clean_testflight_testers/version.rb
123
+ homepage:
124
+ licenses:
125
+ - MIT
126
+ metadata: {}
127
+ post_install_message:
128
+ rdoc_options: []
129
+ require_paths:
130
+ - lib
131
+ required_ruby_version: !ruby/object:Gem::Requirement
132
+ requirements:
133
+ - - ">="
134
+ - !ruby/object:Gem::Version
135
+ version: '0'
136
+ required_rubygems_version: !ruby/object:Gem::Requirement
137
+ requirements:
138
+ - - ">="
139
+ - !ruby/object:Gem::Version
140
+ version: '0'
141
+ requirements: []
142
+ rubyforge_project:
143
+ rubygems_version: 2.6.10
144
+ signing_key:
145
+ specification_version: 4
146
+ summary: Automatically remove TestFlight testers that are not actually testing your
147
+ app
148
+ test_files: []
149
+ has_rdoc: