fastlane-plugin-mobile_common 0.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4ec68c605fa1814ceb2c574e02d76a0f12e4a799
4
+ data.tar.gz: c4f8082a22038d952ed0757f60ab605f8c769965
5
+ SHA512:
6
+ metadata.gz: ea4984ec99b0c5a344f7fc3e41d49ae67102b507ae7708361b81315bfc043492ad3f4fc057a02e97328a2a69ad8dd85b2ebe0729548bf2e8de3452eff723c3e3
7
+ data.tar.gz: c4b39a8f5ddd49b1d2bbadd0e125ae05b27113295e1ca77b7953a4999cd60ae7ce5932d7050685288b37b9a09234a13e145ffb7114b130f56dc747bfd3ba5cea
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Alexander Semenov <alexs@2kgroup.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.
@@ -0,0 +1,58 @@
1
+ # mobile_common plugin
2
+
3
+ [![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-mobile_common)
4
+
5
+ ## Getting Started
6
+
7
+ This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-mobile_common`, add it to your project by running:
8
+
9
+ ```bash
10
+ fastlane add_plugin mobile_common
11
+ ```
12
+
13
+ ## About mobile_common
14
+
15
+ Collection of common CI actions for Android, iOS and MacOSX projects - like unit tests, app publishing, version increment, screenshots, etc.
16
+
17
+ **Note to author:** Add a more detailed description about this plugin here. If your plugin contains multiple actions, make sure to mention them here.
18
+
19
+ ## Actions
20
+ * __update_changelog__ - gets contents of CHANGELOG_CURRENT.md and appends them to CHANGELOG.md, adding app version and current date
21
+ * __commit_changelog__ - commits and pushes to repo changes, made by `update_changelog` action
22
+ * __ios_publish_beta__ - publishes already built iOS binary to itunes connect, bumps version, performs much of other automation, see description
23
+ * __prepare_git_repository__ - pulls all changes from given branch and sets up local branch to track remote one. Useful for jenkins
24
+ * __push_version_changes__ - commits target version changes to repository and pushes created commit
25
+ * __prepare_snapfiles__ - creates individual Snapfile for each given device/locale combination, to let run snapshot on each of them individually, and have individual report
26
+
27
+ ## Example
28
+
29
+ Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plugin. Try it by cloning the repo, running `fastlane install_plugins` and `bundle exec fastlane test`.
30
+
31
+ ## Run tests for this plugin
32
+
33
+ To run both the tests, and code style validation, run
34
+
35
+ ```
36
+ rake
37
+ ```
38
+
39
+ To automatically fix many of the styling issues, use
40
+ ```
41
+ rubocop -a
42
+ ```
43
+
44
+ ## Issues and Feedback
45
+
46
+ For any other issues and feedback about this plugin, please submit it to this repository.
47
+
48
+ ## Troubleshooting
49
+
50
+ If you have trouble using plugins, check out the [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.
51
+
52
+ ## Using _fastlane_ Plugins
53
+
54
+ For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/).
55
+
56
+ ## About _fastlane_
57
+
58
+ _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,9 @@
1
+ # The name of the scheme which contains the UI Tests
2
+ scheme 'IOSClient'
3
+
4
+ configuration 'UITesting'
5
+
6
+ clear_previous_screenshots # remove the '#' to clear all previously generated screenshots before creating new ones
7
+
8
+ # For more information about all available options run
9
+ # snapshot --help
@@ -0,0 +1,16 @@
1
+ require 'fastlane/plugin/mobile_common/version'
2
+
3
+ module Fastlane
4
+ module MobileCommon
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::MobileCommon.all_classes.each do |current|
15
+ require current
16
+ end
@@ -0,0 +1,49 @@
1
+ module Fastlane
2
+ module Actions
3
+ module SharedValues
4
+ end
5
+
6
+ class CommitChangelogAction < Action
7
+ def self.run(params)
8
+ # fastlane will take care of reading in the parameter and fetching the environment variable:
9
+ app_suffix = params[:app_suffix]
10
+ changelog_filename_suffix = "_#{app_suffix}" unless app_suffix.to_s == ''
11
+
12
+ # ensure we have not staged anything except changelog
13
+ sh("git reset HEAD")
14
+ # adding changed files, we need to add uplevel because this code is executed inside 'fastlane' folder
15
+ sh("git add CHANGELOG#{changelog_filename_suffix}.md")
16
+ sh("git add CHANGELOG_CURRENT#{changelog_filename_suffix}.md")
17
+ sh("git commit -m \"Changelog update #{app_suffix}\"")
18
+ end
19
+
20
+ #####################################################
21
+ # @!group Documentation
22
+ #####################################################
23
+
24
+ def self.description
25
+ "Commits changelog changes to git, which were made by 'update_changelog' action"
26
+ end
27
+
28
+ def self.available_options
29
+ [
30
+ FastlaneCore::ConfigItem.new(key: :app_suffix,
31
+ env_name: "FL_COMMIT_CHANGELOG_APP_SUFFIX", # The name of the environment variable
32
+ description: "Suffix, added to changelog filenames, used to split changelogs for different app flavors in same repository", # a short description of this parameter
33
+ is_string: true,
34
+ default_value: "",
35
+ optional: true)
36
+ ]
37
+ end
38
+
39
+ def self.authors
40
+ # So no one will ever forget your contribution to fastlane :) You are awesome btw!
41
+ ["SemenovAlexander"]
42
+ end
43
+
44
+ def self.is_supported?(platform)
45
+ true
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,204 @@
1
+ module Fastlane
2
+ module Actions
3
+ module SharedValues
4
+ DEPLOYED_BUILD_NUMBER = :DEPLOYED_BUILD_NUMBER
5
+ NEW_BUILD_NUMBER = :NEW_BUILD_NUMBER
6
+ end
7
+
8
+ class IosPublishBetaAction < Action
9
+ def self.run(params)
10
+ # this is required for
11
+ require 'fastlane/plugin/versioning'
12
+ require 'fastlane/plugin/get_product_bundle_id'
13
+
14
+ # read params
15
+ git_branch = params[:git_branch]
16
+ artifacts_directory = params[:artifacts_directory]
17
+ build_targets = Array(params[:build_targets])
18
+ build_targets_version_increment = Array(params[:build_targets_version_increment])
19
+ build_targets_version_increment = build_targets if build_targets_version_increment.empty? || build_targets_version_increment.nil?
20
+
21
+ app_suffix = params[:app_suffix]
22
+ app_suffix = "" unless app_suffix # if suffix was not passed - use empty string
23
+ xcodeproj = params[:xcodeproj]
24
+ ipa_dir = params[:ipa_source_directory]
25
+
26
+ distribute_external = params[:distribute_external]
27
+ external_groups = Array(params[:groups])
28
+
29
+ # removing old artifacts to be sure, we are building from scratch
30
+ sh("mkdir -p #{artifacts_directory}") # first - we need to ensure, we have artifacts directory
31
+
32
+ sh("rm -rf #{artifacts_directory}/*.*")
33
+
34
+ # copy artifacts to for jenkins
35
+ sh("cp -r *.ipa #{artifacts_directory}")
36
+ sh("cp -r *.dSYM.zip #{artifacts_directory}")
37
+
38
+ build_number = other_action.get_build_number_from_plist(
39
+ target: build_targets.first,
40
+ xcodeproj: xcodeproj
41
+ )
42
+
43
+ version_number = other_action.get_version_number_from_plist(
44
+ target: build_targets.first,
45
+ xcodeproj: xcodeproj
46
+ )
47
+
48
+ changelog_filename_suffix = "_#{app_suffix}" unless app_suffix.to_s == ''
49
+ changelog = other_action.update_changelog(
50
+ version: "#{version_number} (#{build_number})",
51
+ current_log_filename: "CHANGELOG_CURRENT#{changelog_filename_suffix}.md",
52
+ log_filename: "CHANGELOG#{changelog_filename_suffix}.md"
53
+ )
54
+ Actions.lane_context[SharedValues::UPDATE_CHANGELOG_CURRENT] = changelog
55
+
56
+ # for now pilot doesn't see submitted binary even after processing is complete.
57
+ # Probably some issue in TestFlight, so we deploy build to testers manually on each new version.
58
+ build_targets.each do |build_target|
59
+ bundle_id = other_action.get_product_bundle_id(project_filepath: xcodeproj, scheme: build_target)
60
+ ipa_path = File.join(Dir.pwd, ipa_dir, "#{build_target}.ipa")
61
+ UI.message "Uploading ipa #{ipa_path} for bunlde id #{bundle_id}"
62
+ other_action.pilot(
63
+ skip_submission: false,
64
+ ipa: ipa_path,
65
+ skip_waiting_for_build_processing: false,
66
+ changelog: changelog,
67
+ app_identifier: bundle_id,
68
+ distribute_external: distribute_external,
69
+ groups: external_groups
70
+ )
71
+ end
72
+ other_action.commit_changelog(
73
+ app_suffix: app_suffix
74
+ )
75
+
76
+ git_tag_folder_prefix = app_suffix.downcase
77
+ # add separator between prefix and `beta` word in tag folder if we have app suffix
78
+ git_tag_folder_prefix += '_' unless git_tag_folder_prefix == ''
79
+ other_action.add_git_tag(
80
+ tag: "builds/#{git_tag_folder_prefix}beta/#{build_number}"
81
+ )
82
+
83
+ Actions.lane_context[SharedValues::DEPLOYED_BUILD_NUMBER] = build_number
84
+ build_targets_version_increment.each do |build_target|
85
+ other_action.increment_build_number_in_plist(
86
+ xcodeproj: xcodeproj,
87
+ target: build_target
88
+ )
89
+ end
90
+
91
+ new_build_number = Actions.lane_context[SharedValues::BUILD_NUMBER]
92
+ new_version_number = version_number
93
+ Actions.lane_context[SharedValues::NEW_BUILD_NUMBER] = new_build_number
94
+
95
+ other_action.push_version_changes(
96
+ commit_message: "NO-TRACK Version Code Bump #{new_build_number} #{app_suffix} [ci skip]",
97
+ xcodeproj: xcodeproj,
98
+ git_branch: git_branch
99
+ )
100
+ # this action adds build number to props file for jenkins. this will be added as version to Jira
101
+ sh "echo JIRA_NEXT_VERSION=#{new_version_number}.#{new_build_number} > fastlane/version.props"
102
+ UI.important "Don't forget to check TestFlight build availability in Itunes Connect!!!"
103
+ end
104
+
105
+ #####################################################
106
+ # @!group Documentation
107
+ #####################################################
108
+
109
+ def self.output
110
+ # Define the shared values you are going to provide
111
+ # Example
112
+ [
113
+ ['UPDATE_CHANGELOG_CURRENT', 'Current version changelog string representation, you can send it to slack, for instance'],
114
+ ['DEPLOYED_BUILD_NUMBER', 'Build number of build, which was deployed to ITunesConnect'],
115
+ ['NEW_BUILD_NUMBER', 'Build number after increment']
116
+ ]
117
+ end
118
+
119
+ def self.description
120
+ "Builds new app version and deploys it to Apple TestFlight. Also updates app changelog."
121
+ end
122
+
123
+ def self.details
124
+ "Action does following for each given target:
125
+ * increment build number by 1
126
+ * uploads newly built build to Apple TestFlight
127
+ * copies current changelog to common one
128
+ * commits version bump
129
+ * pushes all changes
130
+
131
+ IMPORTANT! You should build and archive app before calling this action."
132
+ end
133
+
134
+ def self.available_options
135
+ [
136
+ FastlaneCore::ConfigItem.new(key: :git_branch,
137
+ env_name: "FL_IOS_PUBLISH_BETA_GIT_BRANCH",
138
+ description: "Git branch to push back changelog and version updates",
139
+ default_value: "master"),
140
+ FastlaneCore::ConfigItem.new(key: :build_targets,
141
+ env_name: "FL_IOS_PUBLISH_BETA_TARGETS",
142
+ description: "Array of Xcode targets to publish. Project should have dedicated scheme for each target",
143
+ type: Array,
144
+ verify_block: proc do |value|
145
+ UI.user_error!("XCode targets to publish not specified, pass using `build_targets: ['target_name1', 'target_name2']`") unless value and !value.empty?
146
+ end),
147
+ FastlaneCore::ConfigItem.new(key: :build_targets_version_increment,
148
+ env_name: "FL_IOS_PUBLISH_BETA_TARGETS_VERSION_INCREMENT",
149
+ description: "Array of Xcode targets to increment build number, if nil - build_targets will be used. Project should have dedicated scheme for each target",
150
+ type: Array,
151
+ optional: true,
152
+ verify_block: proc do |value|
153
+ UI.user_error!("XCode targets to increment build number not specified, pass using `build_targets: ['target_name1', 'target_name2']`") unless value and !value.empty?
154
+ end),
155
+ FastlaneCore::ConfigItem.new(key: :xcodeproj,
156
+ env_name: "FL_IOS_PUBLISH_BETA_XCODEPROJ",
157
+ description: "Path to Xcode project to find targets",
158
+ verify_block: proc do |value|
159
+ UI.user_error!("Please pass the path to the project, not the workspace") if value.end_with? ".xcworkspace"
160
+ UI.user_error!("Could not find Xcode project at path '#{File.expand_path(value)}'") unless File.exist?(value)
161
+ end),
162
+ FastlaneCore::ConfigItem.new(key: :artifacts_directory,
163
+ env_name: "FL_IOS_PUBLISH_BETA_ARTIFACTS_DIRECTORY",
164
+ description: "Directory to store build artifacts like IPA files",
165
+ default_value: "artifacts"),
166
+ FastlaneCore::ConfigItem.new(key: :ipa_source_directory,
167
+ env_name: "FL_IOS_PUBLISH_BETA_IPA_SOURCE_DIRECTORY",
168
+ description: "Directory with IPA files for each target, which should be uploaded to itunesconnect. By default - root dir is used",
169
+ default_value: ""),
170
+ FastlaneCore::ConfigItem.new(key: :app_suffix,
171
+ env_name: "FL_IOS_PUBLISH_BETA_APP_SUFFIX",
172
+ description: "Suffix, added to changelog filenames, used to split changelogs for different app flavors in same repository",
173
+ default_value: "",
174
+ is_string: true,
175
+ optional: true),
176
+ FastlaneCore::ConfigItem.new(key: :distribute_external,
177
+ env_name: "FL_IOS_PUBLISH_BETA_APP_DISTRIBUTE_EXTERNAL",
178
+ description: "Should the build be distributed to external testers?. By default - false",
179
+ is_string: false,
180
+ default_value: false,
181
+ optional: true),
182
+ FastlaneCore::ConfigItem.new(key: :groups,
183
+ env_name: "FL_IOS_PUBLISH_BETA_APP_GROUPS",
184
+ description: "Names/ids of groups of external testers. By default - used one group 'External'",
185
+ type: Array,
186
+ default_value: ["External"],
187
+ optional: true,
188
+ verify_block: proc do |value|
189
+ UI.user_error!("External test groups to assosiate testers not specified, pass using `groups: ['tester_group1', 'tester_group2']`") unless value and !value.empty?
190
+ end)
191
+ ]
192
+ end
193
+
194
+ def self.authors
195
+ # So no one will ever forget your contribution to fastlane :) You are awesome btw!
196
+ ["SemenovAlexander"]
197
+ end
198
+
199
+ def self.is_supported?(platform)
200
+ platform == :ios
201
+ end
202
+ end
203
+ end
204
+ end
@@ -0,0 +1,59 @@
1
+ module Fastlane
2
+ module Actions
3
+ module SharedValues
4
+ end
5
+
6
+ class PrepareGitRepositoryAction < Action
7
+ def self.run(params)
8
+ git_branch = params[:branch]
9
+ remote = params[:remote]
10
+ sh("git checkout #{git_branch}")
11
+ sh("git remote set-branches --add #{remote} #{git_branch}")
12
+ sh("git branch --set-upstream-to=refs/remotes/#{remote}/#{git_branch} #{git_branch}")
13
+ other_action.git_pull
14
+ end
15
+
16
+ #####################################################
17
+ # @!group Documentation
18
+ #####################################################
19
+
20
+ def self.description
21
+ "Prepares repo for fastlane to work"
22
+ end
23
+
24
+ def self.details
25
+ # Optional:
26
+ # this is your chance to provide a more detailed description of this action
27
+ "You can use this action to do cool things..."
28
+ end
29
+
30
+ def self.available_options
31
+ [
32
+ FastlaneCore::ConfigItem.new(key: :branch,
33
+ env_name: "FL_PREPARE_GIT_REPOSITORY_BRANCH",
34
+ description: "Git branch to checkout and track for rest of fastlane",
35
+ default_value: "master",
36
+ verify_block: proc do |value|
37
+ UI.user_error!("No branch for PrepareGitRepositoryAction given, pass using `branch: 'branch'`") unless value and !value.empty?
38
+ end),
39
+ FastlaneCore::ConfigItem.new(key: :remote,
40
+ env_name: "FL_PREPARE_GIT_REPOSITORY_REMOTE",
41
+ description: "Git remote name to checkout and track for rest of fastlane",
42
+ default_value: "origin",
43
+ verify_block: proc do |value|
44
+ UI.user_error!("No git remote for PrepareGitRepositoryAction given, pass using `remote: 'origin'`") unless value and !value.empty?
45
+ end)
46
+ ]
47
+ end
48
+
49
+ def self.authors
50
+ # So no one will ever forget your contribution to fastlane :) You are awesome btw!
51
+ ["SemenovAlexander"]
52
+ end
53
+
54
+ def self.is_supported?(platform)
55
+ true
56
+ end
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,129 @@
1
+ module Fastlane
2
+ module Actions
3
+ module SharedValues
4
+ PREPARE_SNAPFILES_FILES_PATHS = :PREPARE_SNAPFILES_FILES_PATHS
5
+ end
6
+
7
+ # To share this integration with the other fastlane users:
8
+ # - Fork https://github.com/KrauseFx/fastlane
9
+ # - Clone the forked repository
10
+ # - Move this integration into lib/fastlane/actions
11
+ # - Commit, push and submit the pull request
12
+
13
+ class PrepareSnapfilesAction < Action
14
+ def self.run(params)
15
+ require 'fileutils'
16
+ Dir.chdir(FastlaneCore::FastlaneFolder.path) do
17
+ if params[:snapfile_template_path].to_s != ''
18
+ snapfile_template_path = params[:snapfile_template_path]
19
+ else
20
+ lib_path = File.join(Helper.gem_path('fastlane-plugin-mobile_common'), "lib")
21
+ snapfile_template_path = File.join(lib_path, "assets/Snapfile-template")
22
+ end
23
+
24
+ template = File.read(snapfile_template_path)
25
+
26
+ devices = params[:devices]
27
+ langs = params[:languages]
28
+ base_path = params[:screenshots_path]
29
+ result_paths = []
30
+ ios_version = params[:ios_version]
31
+ langs.each do |item|
32
+ language = item
33
+ devices.each do |device|
34
+ path = base_path + '/' + language + '/' + device
35
+ path += " (#{ios_version})" unless ios_version.empty?
36
+ FileUtils.mkdir_p path
37
+ File.open(path + '/Snapfile', 'w') do |fo|
38
+ fo.puts template
39
+ fo.puts "\n"
40
+ fo.puts "output_directory \"fastlane/#{path}\""
41
+ fo.puts "\n"
42
+ fo.puts "devices([\"#{device}\"])"
43
+ fo.puts "\n"
44
+ fo.puts "languages([\"#{language}\"])"
45
+ fo.puts "\n"
46
+ fo.puts "ios_version '#{ios_version}'" unless ios_version.empty?
47
+ end
48
+ result_paths << path
49
+ end
50
+ end
51
+ Actions.lane_context[SharedValues::PREPARE_SNAPFILES_FILES_PATHS] = result_paths
52
+ return result_paths
53
+ end
54
+ end
55
+
56
+ #####################################################
57
+ # @!group Documentation
58
+ #####################################################
59
+
60
+ def self.description
61
+ 'Generates snapfile from template in each language/device folder combination'
62
+ end
63
+
64
+ def self.details
65
+ # Optional:
66
+ # this is your change to provide a more detailed description of this action
67
+ 'You can use this action to generate individual snapshot report for each language/device combination. Just run snapshot for each path, returned in PREPARE_SNAPFILES_FILES_PATHS shared value'
68
+ end
69
+
70
+ def self.available_options
71
+ # Define all options your action supports.
72
+
73
+ # Below a few examples
74
+ [
75
+ FastlaneCore::ConfigItem.new(key: :devices,
76
+ env_name: 'FL_PREPARE_SNAPFILES_DEVICES', # The name of the environment variable
77
+ description: 'Array with names of simulator devices to use', # a short description of this parameter
78
+ is_string: false,
79
+ verify_block: proc do |value|
80
+ UI.user_error!("No Devices for PrepareSnapfilesAction given, pass using `devices: ['iPhone 4s', 'iPhone 6',...]`") unless value && !value.empty?
81
+ # UI.user_error!("Invalid devices passed: #{value}. Please, pass array of devices!") unless value.kind_of?(Array)
82
+ end),
83
+ FastlaneCore::ConfigItem.new(key: :languages,
84
+ env_name: 'FL_PREPARE_SNAPFILES_LANGUAGES', # The name of the environment variable
85
+ description: 'Array with names of langugages to use', # a short description of this parameter
86
+ is_string: false,
87
+ verify_block: proc do |value|
88
+ UI.user_error!("No languages for PrepareSnapfilesAction given, pass using `languages: ['en-US', 'ru-RU']`") unless value && !value.empty?
89
+ # UI.user_error!("Invalid languages passed: #{value}. Please, pass array of languages!") unless value.kind_of?(Array)
90
+ end),
91
+ FastlaneCore::ConfigItem.new(key: :snapfile_template_path,
92
+ env_name: 'FL_PREPARE_SNAPFILES_TEMPLATE_PATH', # The name of the environment variable
93
+ description: 'path for template snapfile, to which info will be added', # a short description of this parameter
94
+ optional: true),
95
+ FastlaneCore::ConfigItem.new(key: :screenshots_path,
96
+ env_name: 'FL_PREPARE_SNAPFILES_SCREENSHOTS_PATH', # The name of the environment variable
97
+ description: 'Base directory for screenshots, from where action will separate snapfiles through language dirs', # a short description of this parameter
98
+ default_value: 'screenshots-ui-test'),
99
+ FastlaneCore::ConfigItem.new(key: :ios_version,
100
+ env_name: 'FL_PREPARE_SNAPFILES_IOS_VERSION', # The name of the environment variable
101
+ description: 'Optional ios version to be added in generated snapfile as param', # a short description of this parameter
102
+ default_value: '')
103
+
104
+ ]
105
+ end
106
+
107
+ def self.output
108
+ # Define the shared values you are going to provide
109
+ # Example
110
+ [
111
+ ['PREPARE_SNAPFILES_FILES_PATHS', 'Array with paths to generated Snapfiles']
112
+ ]
113
+ end
114
+
115
+ def self.return_value
116
+ 'Returns array of paths to generated Snapfiles'
117
+ end
118
+
119
+ def self.authors
120
+ # So no one will ever forget your contribution to fastlane :) You are awesome btw!
121
+ ['SemenovAlexander']
122
+ end
123
+
124
+ def self.is_supported?(platform)
125
+ [:ios, :mac].include? platform
126
+ end
127
+ end
128
+ end
129
+ end
@@ -0,0 +1,66 @@
1
+ module Fastlane
2
+ module Actions
3
+ module SharedValues
4
+ end
5
+
6
+ class PushVersionChangesAction < Action
7
+ def self.run(params)
8
+ git_branch = params[:git_branch]
9
+
10
+ # remove all files from index
11
+ sh("git reset")
12
+
13
+ other_action.commit_version_bump(
14
+ force: true,
15
+ message: params[:commit_message],
16
+ xcodeproj: params[:xcodeproj]
17
+ )
18
+ other_action.push_to_git_remote(
19
+ local_branch: git_branch
20
+ )
21
+ end
22
+
23
+ #####################################################
24
+ # @!group Documentation
25
+ #####################################################
26
+
27
+ def self.description
28
+ "Commits target version changes to repository and pushes created commit"
29
+ end
30
+
31
+ def self.available_options
32
+ [
33
+ FastlaneCore::ConfigItem.new(key: :commit_message,
34
+ env_name: "FL_PUSH_VERSION_CHANGES_COMMIT_MESSAGE",
35
+ description: "Commit message for version bump",
36
+ verify_block: proc do |value|
37
+ UI.user_error!("No CommitMessage for PushVersionChangesAction given, pass using `commit_message: 'message'`") unless value and !value.empty?
38
+ end),
39
+ FastlaneCore::ConfigItem.new(key: :git_branch,
40
+ env_name: "FL_PUSH_VERSION_CHANGES_GIT_BRANCH",
41
+ description: "Branch to push changes",
42
+ verify_block: proc do |value|
43
+ UI.user_error!("No Git branch for PushVersionChangesAction given, pass using `git_branch: 'branch'`") unless value and !value.empty?
44
+ end),
45
+ FastlaneCore::ConfigItem.new(key: :xcodeproj,
46
+ env_name: "FL_PUSH_VERSION_CHANGES_XCODEPROJ",
47
+ description: "If you have multiple Xcode project files, you must specify your main project here",
48
+ optional: true,
49
+ verify_block: proc do |value|
50
+ UI.user_error!("Please pass the path to the project, not the workspace") if value.end_with? ".xcworkspace"
51
+ UI.user_error!("Could not find Xcode project at path '#{File.expand_path(value)}'") unless File.exist?(value)
52
+ end)
53
+ ]
54
+ end
55
+
56
+ def self.authors
57
+ # So no one will ever forget your contribution to fastlane :) You are awesome btw!
58
+ ["SemenovAlexander"]
59
+ end
60
+
61
+ def self.is_supported?(platform)
62
+ [:ios, :mac].include?(platform)
63
+ end
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,105 @@
1
+ module Fastlane
2
+ module Actions
3
+ module SharedValues
4
+ UPDATE_CHANGELOG_CURRENT = :UPDATE_CHANGELOG_CURRENT
5
+ end
6
+
7
+ # To share this integration with the other fastlane users:
8
+ # - Fork https://github.com/KrauseFx/fastlane
9
+ # - Clone the forked repository
10
+ # - Move this integration into lib/fastlane/actions
11
+ # - Commit, push and submit the pull request
12
+
13
+ class UpdateChangelogAction < Action
14
+ CHANGELOG_TEMPLATE_LEGACY = "### Fixed\n*\n\n### Added\n*\n\n### Removed\n*".freeze
15
+ CHANGELOG_TEMPLATE = '* Put your changes here one by one, you can use markdown syntax'.freeze
16
+
17
+ def self.run(params)
18
+ changelog_filename = params[:log_filename]
19
+ current_changelog_filename = params[:current_log_filename]
20
+
21
+ version = params[:version]
22
+
23
+ current_changelog = File.read(current_changelog_filename).to_s.strip
24
+ changelog_error_message = params[:current_log_error_message]
25
+ raise changelog_error_message unless CHANGELOG_TEMPLATE.to_s != current_changelog.to_s
26
+ raise changelog_error_message unless CHANGELOG_TEMPLATE_LEGACY.to_s != current_changelog.to_s
27
+ global_changelog = File.read(changelog_filename)
28
+ # prepending contents of current changelog to existing file
29
+ File.open(changelog_filename, 'w') do |fo|
30
+ current_date = Time.now.strftime('%Y-%m-%d')
31
+ fo.puts "## #{version} - #{current_date}"
32
+ fo.puts current_changelog
33
+ fo.puts "\n"
34
+ fo.puts global_changelog
35
+ end
36
+ # deleting current changelog file to make it clean for next releases
37
+ File.open(current_changelog_filename, 'w') do |fo|
38
+ fo.puts CHANGELOG_TEMPLATE
39
+ end
40
+
41
+ Actions.lane_context[SharedValues::UPDATE_CHANGELOG_CURRENT] = current_changelog
42
+ current_changelog
43
+ end
44
+
45
+ #####################################################
46
+ # @!group Documentation
47
+ #####################################################
48
+
49
+ def self.description
50
+ 'Reads current changelog and appends it to global one'
51
+ end
52
+
53
+ def self.details
54
+ # Optional:
55
+ # this is your change to provide a more detailed description of this action
56
+ 'You can use this action to provide change log for olg version and update global one with it. You must have CHANGELOG_CURRENT.md file with changes for current version. You can use standard markdown. It then be moved to CHANGELOG.md as changes for current version and cleaned'
57
+ end
58
+
59
+ def self.available_options
60
+ [
61
+ FastlaneCore::ConfigItem.new(key: :version,
62
+ env_name: 'FL_UPDATE_CHANGELOG_VERSION', # The name of the environment variable
63
+ description: 'Complete version string, which will be added as current version to changelog', # a short description of this parameter
64
+ verify_block: proc do |value|
65
+ raise "No new app version for UpdateChangeLog given, pass using `version: 'token'`, e.g. `version: '1.2 (258)'`".red unless value && !value.empty?
66
+ end),
67
+ FastlaneCore::ConfigItem.new(key: :log_filename,
68
+ env_name: 'FL_CHANGELOG_FILE_NAME', # The name of the environment variable
69
+ description: 'Optional file name of general changelog', # a short description of this parameter
70
+ default_value: 'CHANGELOG.md'),
71
+ FastlaneCore::ConfigItem.new(key: :current_log_filename,
72
+ env_name: 'FL_CURRENT_CHANGELOG_FILE_NAME', # The name of the environment variable
73
+ description: 'Optional file name of current changelog', # a short description of this parameter
74
+ default_value: 'CHANGELOG_CURRENT.md'),
75
+ FastlaneCore::ConfigItem.new(key: :current_log_error_message,
76
+ env_name: 'FL_CUSTOM_ERROR_MESSAGE', # The name of the environment variable
77
+ description: 'Optional custom message to be shown if current changelog is not valid', # a short description of this parameter
78
+ default_value: 'You have not provided changelog for build. Please, fill in file CHANGELOG_CURRENT.md')
79
+ ]
80
+ # Define all options your action supports.
81
+ end
82
+
83
+ def self.output
84
+ # Define the shared values you are going to provide
85
+ # Example
86
+ [
87
+ ['UPDATE_CHANGELOG_CURRENT', 'Current version changelog string representation, you can send it to slack, for instance']
88
+ ]
89
+ end
90
+
91
+ def self.return_value
92
+ 'Returns value of UPDATE_CHANGELOG_CURRENT shared value'
93
+ end
94
+
95
+ def self.authors
96
+ # So no one will ever forget your contribution to fastlane :) You are awesome btw!
97
+ ['SemenovAlexander']
98
+ end
99
+
100
+ def self.is_supported?(platform)
101
+ [:ios, :mac, :android].include? platform
102
+ end
103
+ end
104
+ end
105
+ end
@@ -0,0 +1,12 @@
1
+ module Fastlane
2
+ module Helper
3
+ class MobileCommonHelper
4
+ # class methods that you define here become available in your action
5
+ # as `Helper::MobileCommonHelper.your_method`
6
+ #
7
+
8
+ def self.prepare_repository(options)
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,29 @@
1
+ module Fastlane
2
+ # This class is used to call other actions from within actions
3
+ # We use a separate class so that we can easily identify when
4
+ # we have dependencies between actions
5
+ class OtherAction
6
+ # Allows the user to call an action from an action
7
+ def method_missing(method_sym, *arguments, &_block)
8
+ # We have to go inside the fastlane directory
9
+ # since in the fastlane runner.rb we do the following
10
+ # custom_dir = ".."
11
+ # Dir.chdir(custom_dir) do
12
+ # this goes one folder up, since we're inside the "fastlane"
13
+ # folder at that point
14
+ # Since we call an action from an action we need to go inside
15
+ # the fastlane folder too
16
+
17
+ # FIXME: because of changes in fastlane runner - we can't just pass fastlane folder - action will be called in fastlane folder
18
+ # for now this is a workaround - pass current folder, so fastlane will switch nowhere
19
+ # FIXME: create an issue in official fastlane repo
20
+ # Now fastlane runner switches to upper level folder only if nil was passed:
21
+ # custom_dir ||= ".."
22
+
23
+ self.runner.trigger_action_by_name(method_sym,
24
+ '.',
25
+ true,
26
+ *arguments)
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,5 @@
1
+ module Fastlane
2
+ module MobileCommon
3
+ VERSION = "0.4.4"
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,169 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fastlane-plugin-mobile_common
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.4.4
5
+ platform: ruby
6
+ authors:
7
+ - Alexander Semenov
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-11-14 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: fastlane
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: 2.38.1
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: 2.38.1
97
+ - !ruby/object:Gem::Dependency
98
+ name: fastlane-plugin-versioning
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: fastlane-plugin-get_product_bundle_id
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ description:
126
+ email: alexs@2kgroup.com
127
+ executables: []
128
+ extensions: []
129
+ extra_rdoc_files: []
130
+ files:
131
+ - LICENSE
132
+ - README.md
133
+ - lib/assets/Snapfile-template
134
+ - lib/fastlane/plugin/mobile_common.rb
135
+ - lib/fastlane/plugin/mobile_common/actions/commit_changelog.rb
136
+ - lib/fastlane/plugin/mobile_common/actions/ios_publish_beta.rb
137
+ - lib/fastlane/plugin/mobile_common/actions/prepare_git_repository.rb
138
+ - lib/fastlane/plugin/mobile_common/actions/prepare_snapfiles.rb
139
+ - lib/fastlane/plugin/mobile_common/actions/push_version_changes.rb
140
+ - lib/fastlane/plugin/mobile_common/actions/update_changelog.rb
141
+ - lib/fastlane/plugin/mobile_common/helper/mobile_common_helper.rb
142
+ - lib/fastlane/plugin/mobile_common/helper/other_action_hotfix.rb
143
+ - lib/fastlane/plugin/mobile_common/version.rb
144
+ homepage:
145
+ licenses:
146
+ - MIT
147
+ metadata: {}
148
+ post_install_message:
149
+ rdoc_options: []
150
+ require_paths:
151
+ - lib
152
+ required_ruby_version: !ruby/object:Gem::Requirement
153
+ requirements:
154
+ - - ">="
155
+ - !ruby/object:Gem::Version
156
+ version: '0'
157
+ required_rubygems_version: !ruby/object:Gem::Requirement
158
+ requirements:
159
+ - - ">="
160
+ - !ruby/object:Gem::Version
161
+ version: '0'
162
+ requirements: []
163
+ rubyforge_project:
164
+ rubygems_version: 2.6.14
165
+ signing_key:
166
+ specification_version: 4
167
+ summary: Collection of common CI actions for Android, iOS and MacOSX projects - like
168
+ unit tests, app publishing, version increment, screenshots, etc.
169
+ test_files: []