fastlane 1.45.0 → 1.46.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/fastlane/actions/podio_item.rb +198 -0
- data/lib/fastlane/actions/recreate_schemes.rb +36 -0
- data/lib/fastlane/helper/git_helper.rb +12 -4
- data/lib/fastlane/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c932c5b2ee42b209b75410e61ed5e82ba492913e
|
4
|
+
data.tar.gz: ef284ec7b67e28d72707ebc5d7187a6a9e96eef8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1545e73a7ef3dd23250e7b4e074d6fb93f1aa4a279cafa1646b22cf010419493b45ab602bf8edbaf0f83d7704676e3f1bbacfb3b5b1a502a7af75831ffe27f7c
|
7
|
+
data.tar.gz: 4356d2b3d0e65eabe5377cf338194cbbbd897b550c3bd7d9e41e2c8f02f722d65d3db3bad96fa0baeaa7dcf42097e5fdb2c5a3729b88324b69a58a188faef889
|
@@ -0,0 +1,198 @@
|
|
1
|
+
module Fastlane
|
2
|
+
module Actions
|
3
|
+
module SharedValues
|
4
|
+
PODIO_ITEM_URL = :PODIO_ITEM_URL
|
5
|
+
end
|
6
|
+
|
7
|
+
class PodioItemAction < Action
|
8
|
+
AUTH_URL = 'https://podio.com/oauth/token'
|
9
|
+
BASE_URL = 'https://api.podio.com'
|
10
|
+
|
11
|
+
def self.run(params)
|
12
|
+
require 'rest_client'
|
13
|
+
require 'json'
|
14
|
+
require 'uri'
|
15
|
+
|
16
|
+
post_item(params)
|
17
|
+
end
|
18
|
+
|
19
|
+
#####################################################
|
20
|
+
# @!group Documentation
|
21
|
+
#####################################################
|
22
|
+
|
23
|
+
def self.description
|
24
|
+
'Creates or updates an item within your Podio app'
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.details
|
28
|
+
"Use this action to create or update an item within your Podio app
|
29
|
+
(see https://help.podio.com/hc/en-us/articles/201019278-Creating-apps-).
|
30
|
+
Pass in dictionary with field keys and their values.
|
31
|
+
Field key is located under Modify app -> Advanced -> Developer -> External ID
|
32
|
+
(see https://developers.podio.com/examples/items)"
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.available_options
|
36
|
+
[
|
37
|
+
FastlaneCore::ConfigItem.new(key: :client_id,
|
38
|
+
env_name: 'PODIO_ITEM_CLIENT_ID',
|
39
|
+
description: 'Client ID for Podio API (see https://developers.podio.com/api-key)',
|
40
|
+
is_string: true,
|
41
|
+
verify_block: proc do |value|
|
42
|
+
raise "No Client ID for Podio given, pass using `client_id: 'id'`".red unless value && !value.empty?
|
43
|
+
end),
|
44
|
+
FastlaneCore::ConfigItem.new(key: :client_secret,
|
45
|
+
env_name: 'PODIO_ITEM_CLIENT_SECRET',
|
46
|
+
description: 'Client secret for Podio API (see https://developers.podio.com/api-key)',
|
47
|
+
is_string: true,
|
48
|
+
verify_block: proc do |value|
|
49
|
+
raise "No Client Secret for Podio given, pass using `client_secret: 'secret'`".red unless value && !value.empty?
|
50
|
+
end),
|
51
|
+
FastlaneCore::ConfigItem.new(key: :app_id,
|
52
|
+
env_name: 'PODIO_ITEM_APP_ID',
|
53
|
+
description: 'App ID of the app you intend to authenticate with (see https://developers.podio.com/authentication/app_auth)',
|
54
|
+
is_string: true,
|
55
|
+
verify_block: proc do |value|
|
56
|
+
raise "No App ID for Podio given, pass using `app_id: 'id'`".red unless value && !value.empty?
|
57
|
+
end),
|
58
|
+
FastlaneCore::ConfigItem.new(key: :app_token,
|
59
|
+
env_name: 'PODIO_ITEM_APP_TOKEN',
|
60
|
+
description: 'App token of the app you intend to authenticate with (see https://developers.podio.com/authentication/app_auth)',
|
61
|
+
is_string: true,
|
62
|
+
verify_block: proc do |value|
|
63
|
+
raise "No App token for Podio given, pass using `app_token: 'token'`".red unless value && !value.empty?
|
64
|
+
end),
|
65
|
+
FastlaneCore::ConfigItem.new(key: :identifying_field,
|
66
|
+
env_name: 'PODIO_ITEM_IDENTIFYING_FIELD',
|
67
|
+
description: 'String specifying the field key used for identification of an item',
|
68
|
+
is_string: true,
|
69
|
+
verify_block: proc do |value|
|
70
|
+
raise "No Identifying field given, pass using `identifying_field: 'field name'`".red unless value && !value.empty?
|
71
|
+
end),
|
72
|
+
FastlaneCore::ConfigItem.new(key: :identifying_value,
|
73
|
+
description: 'String uniquely specifying an item within the app',
|
74
|
+
is_string: true,
|
75
|
+
verify_block: proc do |value|
|
76
|
+
raise "No Identifying value given, pass using `identifying_value: 'unique value'`".red unless value && !value.empty?
|
77
|
+
end),
|
78
|
+
FastlaneCore::ConfigItem.new(key: :other_fields,
|
79
|
+
description: 'Dictionary of your app fields. Podio supports several field types, see https://developers.podio.com/doc/items',
|
80
|
+
is_string: false,
|
81
|
+
optional: true)
|
82
|
+
]
|
83
|
+
end
|
84
|
+
|
85
|
+
def self.output
|
86
|
+
[
|
87
|
+
['PODIO_ITEM_URL', 'URL to newly created (or updated) Podio item']
|
88
|
+
]
|
89
|
+
end
|
90
|
+
|
91
|
+
def self.authors
|
92
|
+
['pprochazka72, laugejepsen']
|
93
|
+
end
|
94
|
+
|
95
|
+
def self.is_supported?(_platform)
|
96
|
+
true
|
97
|
+
end
|
98
|
+
|
99
|
+
#####################################################
|
100
|
+
# @!group Logic
|
101
|
+
#####################################################
|
102
|
+
|
103
|
+
def self.post_item(options)
|
104
|
+
auth_config = authenticate(options[:client_id],
|
105
|
+
options[:client_secret],
|
106
|
+
options[:app_id],
|
107
|
+
options[:app_token])
|
108
|
+
|
109
|
+
item_id, item_url = get_item(auth_config,
|
110
|
+
options[:identifying_field],
|
111
|
+
options[:identifying_value],
|
112
|
+
options[:app_id])
|
113
|
+
|
114
|
+
unless options[:other_fields].nil?
|
115
|
+
options[:other_fields].each do |key, value|
|
116
|
+
uri = URI.parse(value)
|
117
|
+
if uri.kind_of?(URI::HTTP)
|
118
|
+
link_embed_id = get_embed_id(auth_config, uri)
|
119
|
+
options[:other_fields].merge!(key => link_embed_id)
|
120
|
+
end
|
121
|
+
end
|
122
|
+
update_item(auth_config, item_id, options[:other_fields])
|
123
|
+
end
|
124
|
+
|
125
|
+
Actions.lane_context[SharedValues::PODIO_ITEM_URL] = item_url
|
126
|
+
end
|
127
|
+
|
128
|
+
def self.authenticate(client_id, client_secret, app_id, app_token)
|
129
|
+
auth_response = RestClient.post AUTH_URL, grant_type: 'app',
|
130
|
+
app_id: app_id,
|
131
|
+
app_token: app_token,
|
132
|
+
client_id: client_id,
|
133
|
+
client_secret: client_secret
|
134
|
+
raise 'Failed to authenticate with Podio API' if auth_response.code != 200
|
135
|
+
|
136
|
+
auth_response_dictionary = JSON.parse(auth_response.body)
|
137
|
+
access_token = auth_response_dictionary['access_token']
|
138
|
+
|
139
|
+
{ Authorization: "OAuth2 #{access_token}", content_type: :json, accept: :json }
|
140
|
+
end
|
141
|
+
|
142
|
+
def self.get_item(auth_config, identifying_field, identifying_value, app_id)
|
143
|
+
item_id, item_url = get_existing_item(auth_config, identifying_value, app_id)
|
144
|
+
|
145
|
+
unless item_id
|
146
|
+
item_id, item_url = create_item(auth_config, identifying_field, identifying_value, app_id)
|
147
|
+
end
|
148
|
+
|
149
|
+
[item_id, item_url]
|
150
|
+
end
|
151
|
+
|
152
|
+
def self.get_existing_item(auth_config, identifying_value, app_id)
|
153
|
+
filter_request_body = { query: identifying_value, limit: 1, ref_type: 'item' }.to_json
|
154
|
+
filter_response = RestClient.post "#{BASE_URL}/search/app/#{app_id}/", filter_request_body, auth_config
|
155
|
+
raise "Failed to search for already existing item #{identifying_value}" if filter_response.code != 200
|
156
|
+
|
157
|
+
existing_items = JSON.parse(filter_response.body)
|
158
|
+
existing_item_id = nil
|
159
|
+
existing_item_url = nil
|
160
|
+
if existing_items.length > 0
|
161
|
+
existing_item = existing_items[0]
|
162
|
+
if existing_item['title'] == identifying_value
|
163
|
+
existing_item_id = existing_item['id']
|
164
|
+
existing_item_url = existing_item['link']
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
[existing_item_id, existing_item_url]
|
169
|
+
end
|
170
|
+
|
171
|
+
def self.create_item(auth_config, identifying_field, identifying_value, app_id)
|
172
|
+
item_request_body = { fields: { identifying_field => identifying_value } }.to_json
|
173
|
+
item_response = RestClient.post "#{BASE_URL}/item/app/#{app_id}", item_request_body, auth_config
|
174
|
+
raise "Failed to create item \"#{identifying_value}\"" if item_response.code != 200
|
175
|
+
|
176
|
+
item_response_dictionary = JSON.parse(item_response.body)
|
177
|
+
[item_response_dictionary['item_id'], item_response_dictionary['link']]
|
178
|
+
end
|
179
|
+
|
180
|
+
def self.update_item(auth_config, item_id, fields)
|
181
|
+
if fields.length > 0
|
182
|
+
item_request_body = { fields: fields }.to_json
|
183
|
+
item_response = RestClient.put "#{BASE_URL}/item/#{item_id}", item_request_body, auth_config
|
184
|
+
raise "Failed to update item values \"#{fields}\"" unless item_response.code != 200 || item_response.code != 204
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
188
|
+
def self.get_embed_id(auth_config, url)
|
189
|
+
embed_request_body = { url: url }.to_json
|
190
|
+
embed_response = RestClient.post "#{BASE_URL}/embed/", embed_request_body, auth_config
|
191
|
+
raise "Failed to create embed for link #{link}" if embed_response.code != 200
|
192
|
+
|
193
|
+
embed_response_dictionary = JSON.parse(embed_response.body)
|
194
|
+
embed_response_dictionary['embed_id']
|
195
|
+
end
|
196
|
+
end
|
197
|
+
end
|
198
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module Fastlane
|
2
|
+
module Actions
|
3
|
+
class RecreateSchemesAction < Action
|
4
|
+
def self.run(params)
|
5
|
+
require 'xcodeproj'
|
6
|
+
|
7
|
+
Helper.log.info "Recreate schemes for project: #{params[:project]}"
|
8
|
+
|
9
|
+
project = Xcodeproj::Project.open(params[:project])
|
10
|
+
project.recreate_user_schemes
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.description
|
14
|
+
"Recreate not shared Xcode project schemes"
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.available_options
|
18
|
+
[
|
19
|
+
FastlaneCore::ConfigItem.new(
|
20
|
+
key: :project,
|
21
|
+
env_name: "XCODE_PROJECT",
|
22
|
+
description: "The Xcode project"
|
23
|
+
)
|
24
|
+
]
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.authors
|
28
|
+
"jerolimov"
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.is_supported?(platform)
|
32
|
+
[:ios, :mac].include? platform
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -2,6 +2,8 @@ module Fastlane
|
|
2
2
|
module Actions
|
3
3
|
def self.git_log_between(pretty_format, from, to)
|
4
4
|
Actions.sh("git log --pretty=#{pretty_format} #{from}...#{to}", log: false).chomp
|
5
|
+
rescue
|
6
|
+
nil
|
5
7
|
end
|
6
8
|
|
7
9
|
def self.last_git_tag_name(match_lightweight = true)
|
@@ -9,9 +11,13 @@ module Fastlane
|
|
9
11
|
command << '--tags' if match_lightweight
|
10
12
|
command << '--abbrev=0'
|
11
13
|
Actions.sh(command.join(' '), log: false).chomp
|
14
|
+
rescue
|
15
|
+
nil
|
12
16
|
end
|
13
17
|
|
14
18
|
def self.last_git_commit_dict
|
19
|
+
return nil if last_git_commit_formatted_with('%an').nil?
|
20
|
+
|
15
21
|
{
|
16
22
|
author: last_git_commit_formatted_with('%an'),
|
17
23
|
message: last_git_commit_formatted_with('%B')
|
@@ -22,6 +28,8 @@ module Fastlane
|
|
22
28
|
# pretty format String. See the git-log documentation for valid format placeholders
|
23
29
|
def self.last_git_commit_formatted_with(pretty_format)
|
24
30
|
Actions.sh("git log -1 --pretty=#{pretty_format}", log: false).chomp
|
31
|
+
rescue
|
32
|
+
nil
|
25
33
|
end
|
26
34
|
|
27
35
|
# Get the author email of the last git commit
|
@@ -36,8 +44,6 @@ module Fastlane
|
|
36
44
|
s = last_git_commit_formatted_with('%ae')
|
37
45
|
return s if s.to_s.length > 0
|
38
46
|
return nil
|
39
|
-
rescue
|
40
|
-
return nil
|
41
47
|
end
|
42
48
|
|
43
49
|
# Returns the unwrapped subject and body of the last commit
|
@@ -49,7 +55,7 @@ module Fastlane
|
|
49
55
|
|
50
56
|
# Returns the unwrapped subject and body of the last commit
|
51
57
|
def self.last_git_commit_message
|
52
|
-
s = last_git_commit_formatted_with('%B').strip
|
58
|
+
s = (last_git_commit_formatted_with('%B') || "").strip
|
53
59
|
return s if s.to_s.length > 0
|
54
60
|
nil
|
55
61
|
end
|
@@ -57,9 +63,11 @@ module Fastlane
|
|
57
63
|
# Returns the current git branch - can be replaced using the environment variable `GIT_BRANCH`
|
58
64
|
def self.git_branch
|
59
65
|
return ENV['GIT_BRANCH'] if ENV['GIT_BRANCH'].to_s.length > 0 # set by Jenkins
|
60
|
-
s =
|
66
|
+
s = Actions.sh("git rev-parse --abbrev-ref HEAD", log: false).chomp
|
61
67
|
return s.to_s.strip if s.to_s.length > 0
|
62
68
|
nil
|
69
|
+
rescue
|
70
|
+
nil
|
63
71
|
end
|
64
72
|
end
|
65
73
|
end
|
data/lib/fastlane/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.46.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Felix Krause
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: krausefx-shenzhen
|
@@ -635,12 +635,14 @@ files:
|
|
635
635
|
- lib/fastlane/actions/pem.rb
|
636
636
|
- lib/fastlane/actions/pilot.rb
|
637
637
|
- lib/fastlane/actions/pod_push.rb
|
638
|
+
- lib/fastlane/actions/podio_item.rb
|
638
639
|
- lib/fastlane/actions/produce.rb
|
639
640
|
- lib/fastlane/actions/prompt.rb
|
640
641
|
- lib/fastlane/actions/push_git_tags.rb
|
641
642
|
- lib/fastlane/actions/push_to_git_remote.rb
|
642
643
|
- lib/fastlane/actions/puts.rb
|
643
644
|
- lib/fastlane/actions/read_podspec.rb
|
645
|
+
- lib/fastlane/actions/recreate_schemes.rb
|
644
646
|
- lib/fastlane/actions/register_devices.rb
|
645
647
|
- lib/fastlane/actions/reset_git_repo.rb
|
646
648
|
- lib/fastlane/actions/resign.rb
|