fastlane 1.38.1 → 1.39.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/appetize.rb +117 -0
- data/lib/fastlane/actions/appledoc.rb +198 -0
- data/lib/fastlane/actions/clean_build_artifacts.rb +1 -0
- data/lib/fastlane/actions/copy_artifacts.rb +70 -0
- data/lib/fastlane/actions/reset_git_repo.rb +36 -3
- data/lib/fastlane/fast_file.rb +3 -1
- data/lib/fastlane/version.rb +1 -1
- metadata +7 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c17042efc66650368a9a373243e0409aeb8b5b95
|
4
|
+
data.tar.gz: c94e6360b80a8aafa1d4ed23f4a827f4aef2a539
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 64ebadfcbd3f245d34e29296e2b089b5b121752ac8b04148b37294047e4423df59dc53b9a58fc74772692c97f26b8be865b46a49657982157d4be98f9a266008
|
7
|
+
data.tar.gz: 0a5eed734d8c8da48650cdc225138086f065bead935f7e7b02486dfff533cba74791d6cbeeecc9e2718e38e4a48e945c42e6e3880612cd9dc5decd366a7fc4f3
|
@@ -0,0 +1,117 @@
|
|
1
|
+
module Fastlane
|
2
|
+
module Actions
|
3
|
+
module SharedValues
|
4
|
+
APPETIZE_PRIVATE_KEY = :APPETIZE_PRIVATE_KEY
|
5
|
+
APPETIZE_PUBLIC_KEY = :APPETIZE_PUBLIC_KEY
|
6
|
+
APPETIZE_APP_URL = :APPETIZE_APP_URL
|
7
|
+
APPETIZE_MANAGE_URL = :APPETIZE_MANAGE_URL
|
8
|
+
end
|
9
|
+
|
10
|
+
class AppetizeAction < Action
|
11
|
+
APPETIZE_URL_BASE = 'https://api.appetize.io/v1/app/update'
|
12
|
+
|
13
|
+
def self.is_supported?(platform)
|
14
|
+
platform == :ios
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.run(options)
|
18
|
+
require 'net/http'
|
19
|
+
require 'uri'
|
20
|
+
require 'json'
|
21
|
+
|
22
|
+
uri = URI.parse(APPETIZE_URL_BASE)
|
23
|
+
https = Net::HTTP.new(uri.host, uri.port)
|
24
|
+
https.use_ssl = true
|
25
|
+
|
26
|
+
req = Net::HTTP::Post.new(uri.request_uri, initheader: {'Content-Type' => 'application/json'})
|
27
|
+
params = {
|
28
|
+
token: options[:api_token],
|
29
|
+
url: options[:url],
|
30
|
+
platform: 'ios'
|
31
|
+
}
|
32
|
+
|
33
|
+
params.merge!(privateKey: options[:private_key]) unless options[:private_key].nil?
|
34
|
+
req.body = JSON.generate(params)
|
35
|
+
response = https.request(req)
|
36
|
+
|
37
|
+
raise 'Error when trying to upload ipa to Appetize.io'.red unless parse_response(response)
|
38
|
+
Helper.log.info "App URL: #{Actions.lane_context[SharedValues::APPETIZE_APP_URL]}"
|
39
|
+
Helper.log.info "Manage URL: #{Actions.lane_context[SharedValues::APPETIZE_MANAGE_URL]}"
|
40
|
+
Helper.log.info "App Private Key: #{Actions.lane_context[SharedValues::APPETIZE_PRIVATE_KEY]}"
|
41
|
+
Helper.log.info "Build successfully uploaded to Appetize.io".green
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.parse_response(response)
|
45
|
+
body = JSON.parse(response.body)
|
46
|
+
app_url = body['appURL']
|
47
|
+
manage_url = body['manageURL']
|
48
|
+
private_key = body['privateKey']
|
49
|
+
public_key = body['publicKey']
|
50
|
+
|
51
|
+
Actions.lane_context[SharedValues::APPETIZE_PRIVATE_KEY] = private_key
|
52
|
+
Actions.lane_context[SharedValues::APPETIZE_PUBLIC_KEY] = public_key
|
53
|
+
Actions.lane_context[SharedValues::APPETIZE_APP_URL] = app_url
|
54
|
+
Actions.lane_context[SharedValues::APPETIZE_MANAGE_URL] = manage_url
|
55
|
+
return true
|
56
|
+
rescue
|
57
|
+
Helper.log.fatal "Error uploading to Appetize.io: #{response.body}".red
|
58
|
+
help_message(response)
|
59
|
+
return false
|
60
|
+
end
|
61
|
+
private_class_method :parse_response
|
62
|
+
|
63
|
+
def self.help_message(response)
|
64
|
+
message =
|
65
|
+
case response.body
|
66
|
+
when 'Invalid token'
|
67
|
+
'Invalid API Token specified.'
|
68
|
+
when 'Error downloading zip file'
|
69
|
+
'URL should be wrong'
|
70
|
+
when 'No app with specified privateKey found'
|
71
|
+
'Invalid privateKey specified'
|
72
|
+
end
|
73
|
+
Helper.log.error message.red if message
|
74
|
+
end
|
75
|
+
private_class_method :help_message
|
76
|
+
|
77
|
+
def self.description
|
78
|
+
"Create or Update apps on Appetize.io"
|
79
|
+
end
|
80
|
+
|
81
|
+
def self.available_options
|
82
|
+
[FastlaneCore::ConfigItem.new(key: :api_token,
|
83
|
+
env_name: "APPETIZE_API_TOKEN",
|
84
|
+
description: "Appetize.io API Token",
|
85
|
+
is_string: true,
|
86
|
+
verify_block: proc do |value|
|
87
|
+
raise "No API Token for Appetize.io given, pass using `api_token: 'token'`".red unless value.to_s.length > 0
|
88
|
+
end),
|
89
|
+
FastlaneCore::ConfigItem.new(key: :url,
|
90
|
+
env_name: "APPETIZE_URL",
|
91
|
+
description: "Target url of the zipped build",
|
92
|
+
is_string: true,
|
93
|
+
verify_block: proc do |value|
|
94
|
+
raise "No URL of your zipped build".red unless value.to_s.length > 0
|
95
|
+
end),
|
96
|
+
FastlaneCore::ConfigItem.new(key: :private_key,
|
97
|
+
env_name: "APPETIZE_PRIVATEKEY",
|
98
|
+
description: "privateKey which specify each applications",
|
99
|
+
optional: true)
|
100
|
+
]
|
101
|
+
end
|
102
|
+
|
103
|
+
def self.output
|
104
|
+
[
|
105
|
+
['APPETIZE_PRIVATE_KEY', 'a string that is used to prove "ownership" of your app - save this so that you may subsequently update the app'],
|
106
|
+
['APPETIZE_PUBLIC_KEY', 'a public identiifer for your app'],
|
107
|
+
['APPETIZE_APP_URL', 'a page to test and share your app'],
|
108
|
+
['APPETIZE_MANAGE_URL', 'a page to manage your app']
|
109
|
+
]
|
110
|
+
end
|
111
|
+
|
112
|
+
def self.author
|
113
|
+
"giginet"
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
@@ -0,0 +1,198 @@
|
|
1
|
+
module Fastlane
|
2
|
+
module Actions
|
3
|
+
module SharedValues
|
4
|
+
APPLEDOC_DOCUMENTATION_OUTPUT = :APPLEDOC_DOCUMENTATION_OUTPUT
|
5
|
+
end
|
6
|
+
|
7
|
+
class AppledocAction < Action
|
8
|
+
ARGS_MAP = {
|
9
|
+
input: "",
|
10
|
+
output: "--output",
|
11
|
+
templates: "--templates",
|
12
|
+
docset_install_path: "--docset-install-path",
|
13
|
+
include: "--include",
|
14
|
+
ignore: "--ignore",
|
15
|
+
exclude_output: "--exclude-output",
|
16
|
+
index_desc: "--index-desc",
|
17
|
+
project_name: "--project-name",
|
18
|
+
project_version: "--project-version",
|
19
|
+
project_company: "--project-company",
|
20
|
+
company_id: "--company-id",
|
21
|
+
create_html: "--create-html",
|
22
|
+
create_docset: "--create-docset",
|
23
|
+
install_docset: "--install-docset",
|
24
|
+
publish_docset: "--publish-docset",
|
25
|
+
html_anchors: "--html-anchors",
|
26
|
+
clean_output: "--clean-output",
|
27
|
+
docset_bundle_id: "--docset-bundle-id",
|
28
|
+
docset_bundle_name: "--docset-bundle-name",
|
29
|
+
docset_desc: "--docset-desc",
|
30
|
+
docset_copyright: "--docset-copyright",
|
31
|
+
docset_feed_name: "--docset-feed-name",
|
32
|
+
docset_feed_url: "--docset-feed-url",
|
33
|
+
docset_feed_formats: "--docset-feed-formats",
|
34
|
+
docset_package_url: "--docset-package-url",
|
35
|
+
docset_fallback_url: "--docset-fallback-url",
|
36
|
+
docset_publisher_id: "--docset-publisher-id",
|
37
|
+
docset_publisher_name: "--docset-publisher-name",
|
38
|
+
docset_min_xcode_version: "--docset-min-xcode-version",
|
39
|
+
docset_platform_family: "--docset-platform-family",
|
40
|
+
docset_cert_issuer: "--docset-cert-issuer",
|
41
|
+
docset_cert_signer: "--docset-cert-signer",
|
42
|
+
docset_bundle_filename: "--docset-bundle-filename",
|
43
|
+
docset_atom_filename: "--docset-atom-filename",
|
44
|
+
docset_xml_filename: "--docset-xml-filename",
|
45
|
+
docset_package_filename: "--docset-package-filename",
|
46
|
+
options: "",
|
47
|
+
crossref_format: "--crossref-format",
|
48
|
+
exit_threshold: "--exit-threshold",
|
49
|
+
docs_section_title: "--docs-section-title",
|
50
|
+
warnings: "",
|
51
|
+
logformat: "--logformat",
|
52
|
+
verbose: "--verbose"
|
53
|
+
}
|
54
|
+
|
55
|
+
def self.run(params)
|
56
|
+
unless Helper.test?
|
57
|
+
Helper.log.info "Install using `brew install homebrew/boneyard/appledoc`"
|
58
|
+
raise "appledoc not installed".red if `which appledoc`.length == 0
|
59
|
+
end
|
60
|
+
|
61
|
+
params_hash = params.values
|
62
|
+
|
63
|
+
# Check if an output path was given
|
64
|
+
if params_hash[:output]
|
65
|
+
Actions.lane_context[SharedValues::APPLEDOC_DOCUMENTATION_OUTPUT] = File.expand_path(params_hash[:output])
|
66
|
+
create_output_dir_if_not_exists(params_hash[:output])
|
67
|
+
end
|
68
|
+
|
69
|
+
# Maps parameter hash to CLI args
|
70
|
+
appledoc_args = params_hash_to_cli_args(params_hash)
|
71
|
+
Helper.log.info "Generating documentation.".green
|
72
|
+
cli_args = appledoc_args.join(' ')
|
73
|
+
command = "appledoc #{cli_args}".strip + " \"#{params_hash[:input]}\""
|
74
|
+
Helper.log.debug command
|
75
|
+
Actions.sh command
|
76
|
+
end
|
77
|
+
|
78
|
+
def self.params_hash_to_cli_args(params)
|
79
|
+
# Remove nil and false value params
|
80
|
+
params = params.delete_if { |_, v| v.nil? || v == false}
|
81
|
+
|
82
|
+
cli_args = []
|
83
|
+
params.each do |key, value|
|
84
|
+
args = ARGS_MAP[key]
|
85
|
+
if args.empty?
|
86
|
+
if key != :input
|
87
|
+
cli_args << value
|
88
|
+
end
|
89
|
+
else
|
90
|
+
if value.kind_of?(Array)
|
91
|
+
value.each do |v|
|
92
|
+
cli_args << cli_param(args, v)
|
93
|
+
end
|
94
|
+
else
|
95
|
+
cli_args << cli_param(args, value)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
return cli_args
|
101
|
+
end
|
102
|
+
|
103
|
+
def self.cli_param(k, v)
|
104
|
+
value = (v != true && v.to_s.length > 0 ? "\"#{v}\"" : "")
|
105
|
+
"#{k} #{value}".strip
|
106
|
+
end
|
107
|
+
|
108
|
+
def self.create_output_dir_if_not_exists(output_path)
|
109
|
+
output_dir = File.dirname(output_path)
|
110
|
+
|
111
|
+
# If the output directory doesn't exist, create it
|
112
|
+
unless Dir.exist? output_dir
|
113
|
+
FileUtils.mkpath output_dir
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
def self.description
|
118
|
+
"Runs `appledoc [OPTIONS] <paths to source dirs or files>` for the project"
|
119
|
+
end
|
120
|
+
|
121
|
+
def self.available_options
|
122
|
+
[
|
123
|
+
# PATHS
|
124
|
+
FastlaneCore::ConfigItem.new(key: :input, env_name: "FL_APPLEDOC_INPUT", description: "Path to source files", is_string: true),
|
125
|
+
FastlaneCore::ConfigItem.new(key: :output, env_name: "FL_APPLEDOC_OUTPUT", description: "Output path", is_string: true, optional: true),
|
126
|
+
FastlaneCore::ConfigItem.new(key: :templates, env_name: "FL_APPLEDOC_TEMPLATES", description: "Template files path", is_string: true, optional: true),
|
127
|
+
FastlaneCore::ConfigItem.new(key: :docset_install_path, env_name: "FL_APPLEDOC_DOCSET_INSTALL_PATH", description: "DocSet installation path", is_string: true, optional: true),
|
128
|
+
FastlaneCore::ConfigItem.new(key: :include, env_name: "FL_APPLEDOC_INCLUDE", description: "Include static doc(s) at path", is_string: true, optional: true),
|
129
|
+
FastlaneCore::ConfigItem.new(key: :ignore, env_name: "FL_APPLEDOC_IGNORE", description: "Ignore given path", is_string: false, optional: true),
|
130
|
+
FastlaneCore::ConfigItem.new(key: :exclude_output, env_name: "FL_APPLEDOC_EXCLUDE_OUTPUT", description: "Exclude given path from output", is_string: false, optional: true),
|
131
|
+
FastlaneCore::ConfigItem.new(key: :index_desc, env_name: "FL_APPLEDOC_INDEX_DESC", description: "File including main index description", is_string: true, optional: true),
|
132
|
+
|
133
|
+
# PROJECT INFO
|
134
|
+
FastlaneCore::ConfigItem.new(key: :project_name, env_name: "FL_APPLEDOC_PROJECT_NAME", description: "Project name", is_string: true),
|
135
|
+
FastlaneCore::ConfigItem.new(key: :project_version, env_name: "FL_APPLEDOC_PROJECT_VERSION", description: "Project version", is_string: true, optional: true),
|
136
|
+
FastlaneCore::ConfigItem.new(key: :project_company, env_name: "FL_APPLEDOC_PROJECT_COMPANY", description: "Project company", is_string: true),
|
137
|
+
FastlaneCore::ConfigItem.new(key: :company_id, env_name: "FL_APPLEDOC_COMPANY_ID", description: "Company UTI (i.e. reverse DNS name)", is_string: true, optional: true),
|
138
|
+
|
139
|
+
# OUTPUT GENERATION
|
140
|
+
FastlaneCore::ConfigItem.new(key: :create_html, env_name: "FL_APPLEDOC_CREATE_HTML", description: "Create HTML", is_string: false, default_value: false),
|
141
|
+
FastlaneCore::ConfigItem.new(key: :create_docset, env_name: "FL_APPLEDOC_CREATE_DOCSET", description: "Create documentation set", is_string: false, default_value: false),
|
142
|
+
FastlaneCore::ConfigItem.new(key: :install_docset, env_name: "FL_APPLEDOC_INSTALL_DOCSET", description: "Install documentation set to Xcode", is_string: false, default_value: false),
|
143
|
+
FastlaneCore::ConfigItem.new(key: :publish_docset, env_name: "FL_APPLEDOC_PUBLISH_DOCSET", description: "Prepare DocSet for publishing", is_string: false, default_value: false),
|
144
|
+
FastlaneCore::ConfigItem.new(key: :html_anchors, env_name: "FL_APPLEDOC_HTML_ANCHORS", description: "The html anchor format to use in DocSet HTML", is_string: true, optional: true),
|
145
|
+
FastlaneCore::ConfigItem.new(key: :clean_output, env_name: "FL_APPLEDOC_CLEAN_OUTPUT", description: "Remove contents of output path before starting", is_string: false, default_value: false),
|
146
|
+
|
147
|
+
# DOCUMENTATION SET INFO
|
148
|
+
FastlaneCore::ConfigItem.new(key: :docset_bundle_id, env_name: "FL_APPLEDOC_DOCSET_BUNDLE_ID", description: "DocSet bundle identifier", is_string: true, optional: true),
|
149
|
+
FastlaneCore::ConfigItem.new(key: :docset_bundle_name, env_name: "FL_APPLEDOC_DOCSET_BUNDLE_NAME", description: "DocSet bundle name", is_string: true, optional: true),
|
150
|
+
FastlaneCore::ConfigItem.new(key: :docset_desc, env_name: "FL_APPLEDOC_DOCSET_DESC", description: "DocSet description", is_string: true, optional: true),
|
151
|
+
FastlaneCore::ConfigItem.new(key: :docset_copyright, env_name: "FL_APPLEDOC_DOCSET_COPYRIGHT", description: "DocSet copyright message", is_string: true, optional: true),
|
152
|
+
FastlaneCore::ConfigItem.new(key: :docset_feed_name, env_name: "FL_APPLEDOC_DOCSET_FEED_NAME", description: "DocSet feed name", is_string: true, optional: true),
|
153
|
+
FastlaneCore::ConfigItem.new(key: :docset_feed_url, env_name: "FL_APPLEDOC_DOCSET_FEED_URL", description: "DocSet feed URL", is_string: true, optional: true),
|
154
|
+
FastlaneCore::ConfigItem.new(key: :docset_feed_formats, env_name: "FL_APPLEDOC_DOCSET_FEED_FORMATS", description: "DocSet feed formats. Separated by a comma [atom,xml]", is_string: true, optional: true),
|
155
|
+
FastlaneCore::ConfigItem.new(key: :docset_package_url, env_name: "FL_APPLEDOC_DOCSET_PACKAGE_URL", description: "DocSet package (.xar) URL", is_string: true, optional: true),
|
156
|
+
FastlaneCore::ConfigItem.new(key: :docset_fallback_url, env_name: "FL_APPLEDOC_DOCSET_FALLBACK_URL", description: "DocSet fallback URL", is_string: true, optional: true),
|
157
|
+
FastlaneCore::ConfigItem.new(key: :docset_publisher_id, env_name: "FL_APPLEDOC_DOCSET_PUBLISHER_ID", description: "DocSet publisher identifier", is_string: true, optional: true),
|
158
|
+
FastlaneCore::ConfigItem.new(key: :docset_publisher_name, env_name: "FL_APPLEDOC_DOCSET_PUBLISHER_NAME", description: "DocSet publisher name", is_string: true, optional: true),
|
159
|
+
FastlaneCore::ConfigItem.new(key: :docset_min_xcode_version, env_name: "FL_APPLEDOC_DOCSET_MIN_XCODE_VERSION", description: "DocSet min. Xcode version", is_string: true, optional: true),
|
160
|
+
FastlaneCore::ConfigItem.new(key: :docset_platform_family, env_name: "FL_APPLEDOC_DOCSET_PLATFORM_FAMILY", description: "DocSet platform familiy", is_string: true, optional: true),
|
161
|
+
FastlaneCore::ConfigItem.new(key: :docset_cert_issuer, env_name: "FL_APPLEDOC_DOCSET_CERT_ISSUER", description: "DocSet certificate issuer", is_string: true, optional: true),
|
162
|
+
FastlaneCore::ConfigItem.new(key: :docset_cert_signer, env_name: "FL_APPLEDOC_DOCSET_CERT_SIGNER", description: "DocSet certificate signer", is_string: true, optional: true),
|
163
|
+
FastlaneCore::ConfigItem.new(key: :docset_bundle_filename, env_name: "FL_APPLEDOC_DOCSET_BUNDLE_FILENAME", description: "DocSet bundle filename", is_string: true, optional: true),
|
164
|
+
FastlaneCore::ConfigItem.new(key: :docset_atom_filename, env_name: "FL_APPLEDOC_DOCSET_ATOM_FILENAME", description: "DocSet atom feed filename", is_string: true, optional: true),
|
165
|
+
FastlaneCore::ConfigItem.new(key: :docset_xml_filename, env_name: "FL_APPLEDOC_DOCSET_XML_FILENAME", description: "DocSet xml feed filename", is_string: true, optional: true),
|
166
|
+
FastlaneCore::ConfigItem.new(key: :docset_package_filename, env_name: "FL_APPLEDOC_DOCSET_PACKAGE_FILENAME", description: "DocSet package (.xar,.tgz) filename", is_string: true, optional: true),
|
167
|
+
|
168
|
+
# OPTIONS
|
169
|
+
FastlaneCore::ConfigItem.new(key: :options, env_name: "FL_APPLEDOC_OPTIONS", description: "Documentation generation options", is_string: true, optional: true),
|
170
|
+
FastlaneCore::ConfigItem.new(key: :crossref_format, env_name: "FL_APPLEDOC_OPTIONS_CROSSREF_FORMAT", description: "Cross reference template regex", is_string: true, optional: true),
|
171
|
+
FastlaneCore::ConfigItem.new(key: :exit_threshold, env_name: "FL_APPLEDOC_OPTIONS_EXIT_THRESHOLD", description: "Exit code threshold below which 0 is returned", is_string: false, default_value: 2, optional: true),
|
172
|
+
FastlaneCore::ConfigItem.new(key: :docs_section_title, env_name: "FL_APPLEDOC_OPTIONS_DOCS_SECTION_TITLE", description: "Title of the documentation section (defaults to \"Programming Guides\"", is_string: true, optional: true),
|
173
|
+
|
174
|
+
# WARNINGS
|
175
|
+
FastlaneCore::ConfigItem.new(key: :warnings, env_name: "FL_APPLEDOC_WARNINGS", description: "Documentation generation warnings", is_string: true, optional: true),
|
176
|
+
|
177
|
+
# MISCELLANEOUS
|
178
|
+
FastlaneCore::ConfigItem.new(key: :logformat, env_name: "FL_APPLEDOC_LOGFORMAT", description: "Log format [0-3]", is_string: false, optional: true),
|
179
|
+
FastlaneCore::ConfigItem.new(key: :verbose, env_name: "FL_APPLEDOC_VERBOSE", description: "Log verbosity level [0-6,xcode]", is_string: false, optional: true)
|
180
|
+
]
|
181
|
+
end
|
182
|
+
|
183
|
+
def self.output
|
184
|
+
[
|
185
|
+
['APPLEDOC_DOCUMENTATION_OUTPUT', 'Documentation set output path']
|
186
|
+
]
|
187
|
+
end
|
188
|
+
|
189
|
+
def self.authors
|
190
|
+
["alexmx"]
|
191
|
+
end
|
192
|
+
|
193
|
+
def self.is_supported?(platform)
|
194
|
+
[:ios, :mac].include?(platform)
|
195
|
+
end
|
196
|
+
end
|
197
|
+
end
|
198
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
module Fastlane
|
2
|
+
module Actions
|
3
|
+
class CopyArtifactsAction < Action
|
4
|
+
def self.run(params)
|
5
|
+
# we want to make sure that our target folder exist already
|
6
|
+
target_folder_command = 'mkdir -p ' + params[:target_path]
|
7
|
+
Actions.sh(target_folder_command)
|
8
|
+
|
9
|
+
# construct the main command that will do the copying/moving for us
|
10
|
+
base_command = params[:keep_original] ? 'cp' : 'mv'
|
11
|
+
options = []
|
12
|
+
options << '-f'
|
13
|
+
options << '-r' if params[:keep_original] # we only want the -r flag for the cp command, which we get when the user asks to keep the original
|
14
|
+
options << params[:artifacts].map { |e| e.tr(' ', '\ ') }
|
15
|
+
options << params[:target_path]
|
16
|
+
|
17
|
+
command = ([base_command] + options).join(' ')
|
18
|
+
|
19
|
+
# if we don't want to fail on missing files, then we need to swallow the error from our command, by ORing with the nil command, guaranteeing a 0 status code
|
20
|
+
command += ' || :' unless params[:fail_on_missing]
|
21
|
+
|
22
|
+
# call our command
|
23
|
+
Actions.sh(command)
|
24
|
+
|
25
|
+
Helper.log.info 'Build artifacts sucesfully copied!'.green
|
26
|
+
end
|
27
|
+
|
28
|
+
#####################################################
|
29
|
+
# @!group Documentation
|
30
|
+
#####################################################
|
31
|
+
|
32
|
+
def self.description
|
33
|
+
"Small action to save your build artifacts. Useful when you use reset_git_repo"
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.available_options
|
37
|
+
[
|
38
|
+
FastlaneCore::ConfigItem.new(key: :keep_original,
|
39
|
+
description: "Set this to true if you want copy, rather than move, semantics",
|
40
|
+
is_string: false,
|
41
|
+
optional: true,
|
42
|
+
default_value: true),
|
43
|
+
FastlaneCore::ConfigItem.new(key: :target_path,
|
44
|
+
description: "The directory in which you want your artifacts placed",
|
45
|
+
is_string: false,
|
46
|
+
optional: false,
|
47
|
+
default_value: 'artifacts'),
|
48
|
+
FastlaneCore::ConfigItem.new(key: :artifacts,
|
49
|
+
description: "An array of file patterns of the files/folders you want to preserve",
|
50
|
+
is_string: false,
|
51
|
+
optional: false,
|
52
|
+
default_value: []),
|
53
|
+
FastlaneCore::ConfigItem.new(key: :fail_on_missing,
|
54
|
+
description: "Fail when a source file isn't found",
|
55
|
+
is_string: false,
|
56
|
+
optional: true,
|
57
|
+
default_value: false)
|
58
|
+
]
|
59
|
+
end
|
60
|
+
|
61
|
+
def self.authors
|
62
|
+
["lmirosevic"]
|
63
|
+
end
|
64
|
+
|
65
|
+
def self.is_supported?(platform)
|
66
|
+
true
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'shellwords'
|
2
|
+
|
1
3
|
module Fastlane
|
2
4
|
module Actions
|
3
5
|
# Does a hard reset and clean on the repo
|
@@ -10,7 +12,21 @@ module Fastlane
|
|
10
12
|
|
11
13
|
if (paths || []).count == 0
|
12
14
|
Actions.sh('git reset --hard HEAD')
|
13
|
-
|
15
|
+
|
16
|
+
clean_options = ['q', 'f', 'd']
|
17
|
+
clean_options << 'x' if params[:disregard_gitignore]
|
18
|
+
clean_command = 'git clean' + ' -' + clean_options.join
|
19
|
+
|
20
|
+
# we want to make sure that we have an array of patterns, and no nil values
|
21
|
+
unless params[:exclude].kind_of?(Enumerable)
|
22
|
+
params[:exclude] = [params[:exclude]].compact
|
23
|
+
end
|
24
|
+
|
25
|
+
# attach our exclude patterns to the command
|
26
|
+
clean_command += ' ' + params[:exclude].map { |exclude| '-e ' + exclude.shellescape }.join(' ') unless params[:exclude].count == 0
|
27
|
+
|
28
|
+
Actions.sh(clean_command) unless params[:skip_clean]
|
29
|
+
|
14
30
|
Helper.log.info 'Git repo was reset and cleaned back to a pristine state.'.green
|
15
31
|
else
|
16
32
|
paths.each do |path|
|
@@ -31,6 +47,7 @@ module Fastlane
|
|
31
47
|
def self.details
|
32
48
|
[
|
33
49
|
"This action will reset your git repo to a clean state, discarding any uncommitted and untracked changes. Useful in case you need to revert the repo back to a clean state, e.g. after the fastlane run.",
|
50
|
+
"Untracked files like `.env` will also be deleted, unless `:skip_clean` is true.",
|
34
51
|
"It's a pretty drastic action so it comes with a sort of safety latch. It will only proceed with the reset if either of these conditions are met:",
|
35
52
|
"You have called the ensure_git_status_clean action prior to calling this action. This ensures that your repo started off in a clean state, so the only things that will get destroyed by this action are files that are created as a byproduct of the fastlane run."
|
36
53
|
].join(' ')
|
@@ -40,7 +57,7 @@ module Fastlane
|
|
40
57
|
[
|
41
58
|
FastlaneCore::ConfigItem.new(key: :files,
|
42
59
|
env_name: "FL_RESET_GIT_FILES",
|
43
|
-
description: "Array of files the changes should be discarded
|
60
|
+
description: "Array of files the changes should be discarded. If not given, all files will be discarded",
|
44
61
|
optional: true,
|
45
62
|
is_string: false,
|
46
63
|
verify_block: proc do |value|
|
@@ -50,7 +67,23 @@ module Fastlane
|
|
50
67
|
env_name: "FL_RESET_GIT_FORCE",
|
51
68
|
description: "Skip verifying of previously clean state of repo. Only recommended in combination with `files` option",
|
52
69
|
is_string: false,
|
53
|
-
default_value: false)
|
70
|
+
default_value: false),
|
71
|
+
FastlaneCore::ConfigItem.new(key: :skip_clean,
|
72
|
+
env_name: "FL_RESET_GIT_SKIP_CLEAN",
|
73
|
+
description: "Skip 'git clean' to avoid removing untracked files like `.env`. Defaults to false",
|
74
|
+
is_string: false,
|
75
|
+
default_value: false),
|
76
|
+
FastlaneCore::ConfigItem.new(key: :disregard_gitignore,
|
77
|
+
env_name: "FL_RESET_GIT_DISREGARD_GITIGNORE",
|
78
|
+
description: "Setting this to true will clean the whole repository, ignoring anything in your local .gitignore. Set this to true if you want the equivalent of a fresh clone, and for all untracked and ignore files to also be removed",
|
79
|
+
is_string: false,
|
80
|
+
optional: true,
|
81
|
+
default_value: true),
|
82
|
+
FastlaneCore::ConfigItem.new(key: :exclude,
|
83
|
+
env_name: "FL_RESET_GIT_EXCLUDE",
|
84
|
+
description: "You can pass a string, or array of, file pattern(s) here which you want to have survive the cleaning process, and remain on disk. E.g. to leave the `artifacts` directory you would specify `exclude: 'artifacts'`. Make sure this pattern is also in your gitignore! See the gitignore documentation for info on patterns",
|
85
|
+
is_string: false,
|
86
|
+
optional: true)
|
54
87
|
]
|
55
88
|
end
|
56
89
|
|
data/lib/fastlane/fast_file.rb
CHANGED
@@ -216,12 +216,14 @@ module Fastlane
|
|
216
216
|
raise "Please pass a path to the `import_from_git` action".red if url.to_s.length == 0
|
217
217
|
|
218
218
|
Actions.execute_action('import_from_git') do
|
219
|
+
require 'tmpdir'
|
220
|
+
|
219
221
|
collector.did_launch_action(:import_from_git)
|
220
222
|
|
221
223
|
# Checkout the repo
|
222
224
|
repo_name = url.split("/").last
|
223
225
|
|
224
|
-
tmp_path =
|
226
|
+
tmp_path = Dir.mktmpdir("fl_clone")
|
225
227
|
clone_folder = File.join(tmp_path, repo_name)
|
226
228
|
|
227
229
|
branch_option = ""
|
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.39.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-11-
|
11
|
+
date: 2015-11-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: krausefx-shenzhen
|
@@ -216,7 +216,7 @@ dependencies:
|
|
216
216
|
requirements:
|
217
217
|
- - ">="
|
218
218
|
- !ruby/object:Gem::Version
|
219
|
-
version: 0.
|
219
|
+
version: 0.14.0
|
220
220
|
- - "<"
|
221
221
|
- !ruby/object:Gem::Version
|
222
222
|
version: 1.0.0
|
@@ -226,7 +226,7 @@ dependencies:
|
|
226
226
|
requirements:
|
227
227
|
- - ">="
|
228
228
|
- !ruby/object:Gem::Version
|
229
|
-
version: 0.
|
229
|
+
version: 0.14.0
|
230
230
|
- - "<"
|
231
231
|
- !ruby/object:Gem::Version
|
232
232
|
version: 1.0.0
|
@@ -589,6 +589,8 @@ files:
|
|
589
589
|
- lib/fastlane/actions/README.md
|
590
590
|
- lib/fastlane/actions/actions_helper.rb
|
591
591
|
- lib/fastlane/actions/add_git_tag.rb
|
592
|
+
- lib/fastlane/actions/appetize.rb
|
593
|
+
- lib/fastlane/actions/appledoc.rb
|
592
594
|
- lib/fastlane/actions/appstore.rb
|
593
595
|
- lib/fastlane/actions/artifactory.rb
|
594
596
|
- lib/fastlane/actions/backup_file.rb
|
@@ -603,6 +605,7 @@ files:
|
|
603
605
|
- lib/fastlane/actions/clipboard.rb
|
604
606
|
- lib/fastlane/actions/cocoapods.rb
|
605
607
|
- lib/fastlane/actions/commit_version_bump.rb
|
608
|
+
- lib/fastlane/actions/copy_artifacts.rb
|
606
609
|
- lib/fastlane/actions/crashlytics.rb
|
607
610
|
- lib/fastlane/actions/create_keychain.rb
|
608
611
|
- lib/fastlane/actions/debug.rb
|