fastlane-plugin-taiwan_number_one 0.1.0 → 0.1.2

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: f1747d4598e6ab056cc1250a135c930e0f551e990c2d9c700a64ec920c393fcd
4
- data.tar.gz: 8cf6b8d22266a4a98cee49e9dce576a9667bb8417b6858adc2be0aead9378651
3
+ metadata.gz: bb753f703cb1ca29144e73ab02075eef0ba777a23005447ae29b71b7851c5469
4
+ data.tar.gz: 8d62b2ac64f6ff3b45adeec927f060e0785ee75f9c0ecb7ca70ac3e7217abc10
5
5
  SHA512:
6
- metadata.gz: 8727b5bf9b93db5fc8315a7106a32f190c2a55076e853f9031dd2dba293d53bc08b64a4a8224482bcb604a82a7aff190282e8b4cda79ab68e4e8d3653a3777e4
7
- data.tar.gz: fe1b47c93f05c3e0427c8342233626d62a6a0224330d5662f0f3d6d737f986ab3f614f7560ba08daa14fc078fe236069ca4a8fcb2c770e7106dc11ef4dc87b44
6
+ metadata.gz: 8ab1d0603fcb11a782a795a50d2c8624428215b16d5132bf1658657ffc0c8eff78c51c19a6e21ae870d6040444f24085a914116c52c1c72e82eab623dced7f9d
7
+ data.tar.gz: 5f947b531a3e54378f787addf6b12af3882d84fcb9b935f9f3d97b0105de5dac820bddfcb5208f100aa5b3319cd27e6e1fcf4b0487eb925c136915ceeac5ca87
data/README.md CHANGED
@@ -33,6 +33,17 @@ https://github.com/fastlane/fastlane/issues/17539
33
33
 
34
34
  ## Usage
35
35
 
36
+ ##### install plugin for fastlane
37
+ [install instructions](https://docs.fastlane.tools/plugins/using-plugins/)
38
+ ```
39
+ bundle exce fastlane add_plugin taiwan_number_one
40
+ ```
41
+ but I personally prefer adding plugin in `Gemfile` like this to avoid additional `Pluginfile` in ~'your_ios_project_dir'/fastlane
42
+
43
+ ```
44
+ bundle add fastlane-plugin-taiwan_number_one
45
+ ```
46
+
36
47
  ##### Show info
37
48
 
38
49
  ```
@@ -1,5 +1,5 @@
1
1
  require "fastlane/action"
2
- require "Spaceship/client"
2
+ require "Spaceship"
3
3
  require_relative "../helper/taiwan_number_one_helper"
4
4
 
5
5
  module Fastlane
@@ -11,9 +11,12 @@ module Fastlane
11
11
  end
12
12
 
13
13
  def self.run(params)
14
- require "spaceship"
15
-
16
- app_id = params[:app_identifier]
14
+ app_id = params.fetch(:app_identifier)
15
+ username = params.fetch(:username)
16
+ unless app_id && username
17
+ UI.message("Could not find app_id and username.")
18
+ return
19
+ end
17
20
 
18
21
  # Prompts select team if multiple teams and none specified
19
22
  UI.message("Login to App Store Connect (#{params[:username]})")
@@ -35,8 +38,6 @@ module Fastlane
35
38
  app = Spaceship::ConnectAPI::App.find(app_id)
36
39
  version = app.get_app_store_versions.first
37
40
  UI.message("app_store_state is #{version.app_store_state}")
38
- UI.message("version string is #{version.version_string}")
39
- UI.message("pending version is #{version}")
40
41
  client ||= Spaceship::ConnectAPI
41
42
  platform ||= Spaceship::ConnectAPI::Platform::IOS
42
43
  filter = {
@@ -49,72 +50,70 @@ module Fastlane
49
50
  .sort_by { |v| Gem::Version.new(v.version_string) }
50
51
  .last
51
52
  if app_store_version
52
- UI.message("app_store_version is #{app_store_version}")
53
- state = app_store_version.app_store_state
54
- UI.message("state is #{state}")
55
-
56
53
  version_string = app_store_version.version_string
57
- UI.message("version_string is #{version_string}")
54
+ state = app_store_version.app_store_state
55
+ UI.message("version #{version_string} is #{state}")
58
56
  unless state == Spaceship::ConnectAPI::AppStoreVersion::AppStoreState::PENDING_DEVELOPER_RELEASE
59
57
  UI.message("AppStoreState is not PENDING_DEVELOPER_RELEASE")
60
58
  return
61
59
  end
62
60
  decision = params[:app_decision]
63
- decision ||= get_decision
61
+ decision ||= fetch_decision
64
62
  case decision
65
63
  when DicisionType::RELEASE
66
64
  UI.message("decision is release")
65
+ release_version_if_possible(app: application, app_store_version: app_store_version)
67
66
  when DicisionType::REJECT
68
67
  UI.message("decision is reject")
68
+ reject_version_if_possible(app: app, app_store_version: app_store_version)
69
69
  else
70
- decision ||= get_decision
70
+ decision ||= fetch_decision
71
71
  end
72
- release_version_if_possible(app: application, app_store_version: app_store_version) if decision == "release"
73
- reject_version_if_possible(app: application) if decision == "reject"
74
-
75
- UI.message("The taiwan_number_one plugin is finished!")
76
72
  else
77
73
  UI.message("no pending release version exist.")
78
74
  end
79
-
75
+ UI.message("The taiwan_number_one plugin action is finished!")
80
76
  end
81
77
 
82
- def self.get_decision()
78
+ def self.fetch_decision
83
79
  decision = nil
84
80
  until ["release", "reject"].include?(decision)
85
81
  decision = UI.input("Please enter the app's release decision (release, reject): ")
86
82
  UI.message("App's decision must be release or reject")
87
83
  end
88
84
  # return decision
85
+ UI.message("return type #{decision}")
89
86
  if decision == DicisionType::RELEASE
90
- UI.message("return type #{decision}")
91
87
  return DicisionType::RELEASE
92
88
  else
93
- UI.message("return type #{decision}")
94
89
  return DicisionType::REJECT
95
90
  end
96
91
  end
97
-
98
- def self.reject_version_if_possible(app: nil)
92
+
93
+ def self.release_version_if_possible(app: nil, app_store_version: Spaceship::ConnectAPI::AppStoreVersion)
99
94
  unless app
100
95
  UI.user_error!("Could not find app with bundle identifier '#{params[:app_identifier]}' on account #{params[:username]}")
101
96
  end
102
- if app.reject_version_if_possible!
103
- UI.success("Successfully rejected previous version!")
97
+
98
+ begin
99
+ app_store_version.create_app_store_version_release_request
100
+ UI.message("release version #{app_store_version.version_string} successfully!")
101
+ rescue => e
102
+ UI.user_error!("An error occurred while releasing version #{app_store_version}")
103
+ UI.error("#{e.message}\n#{e.backtrace.join("\n")}") if FastlaneCore::Globals.verbose?
104
104
  end
105
105
  end
106
106
 
107
- def self.release_version_if_possible(app: nil, app_store_version: Spaceship::ConnectAPI::AppStoreVersion)
107
+ def self.reject_version_if_possible(app: nil, app_store_version: Spaceship::ConnectAPI::AppStoreVersion)
108
108
  unless app
109
109
  UI.user_error!("Could not find app with bundle identifier '#{params[:app_identifier]}' on account #{params[:username]}")
110
110
  end
111
- model = app_store_version.create_app_store_version_release_request
112
- UI.success("response model is #{model}")
113
-
114
- # release(version_id: version_id)
115
- # if
116
- UI.success("Successfully released previous version!")
117
- # end
111
+
112
+ if app_store_version.reject!
113
+ UI.success("rejected version #{app_store_version} Successfully!")
114
+ else
115
+ UI.user_error!("An error occurred while rejected version #{app_store_version}")
116
+ end
118
117
  end
119
118
 
120
119
  def self.description
@@ -139,7 +138,6 @@ module Fastlane
139
138
  user ||= CredentialsManager::AppfileConfig.try_fetch_value(:apple_id)
140
139
  [
141
140
  FastlaneCore::ConfigItem.new(key: :app_decision,
142
- short_option: "-d",
143
141
  env_name: "app_decision",
144
142
  description: "A description of your decision, should be release or reject",
145
143
  optional: false,
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module TaiwanNumberOne
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-taiwan_number_one
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - andrew54068
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-03 00:00:00.000000000 Z
11
+ date: 2021-03-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry