fastlane-plugin-app47 0.1.0

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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 42cae5631632eb3152f6f4b28aac79e70d9c91f398115406a0d3ac1d33269022
4
+ data.tar.gz: 26b7a069bbc2ee4a77ae4cc66b27ec1ebcec8d70192f753337768d59878908e4
5
+ SHA512:
6
+ metadata.gz: f93ca710f1b16884c31bc317bd5101f15ee3b830d7e3318b1d49a43333926dbf0dda1fc75cc9c14f6798bfbd6a56da91ae1880dea1a2f6bea3cc662c4075dcad
7
+ data.tar.gz: 712d7e435d52a992f527c9296345e93868ab87ec6d1fb3d59221fbb5f1d2c85540e8da39b5884127b55261a32bb631158d598815472429a3077c7fd4af5fbf77
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021 Shannon Hicks <shan@iotashan.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,52 @@
1
+ # app47 plugin
2
+
3
+ [![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-app47)
4
+
5
+ ## Getting Started
6
+
7
+ This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-app47`, add it to your project by running:
8
+
9
+ ```bash
10
+ fastlane add_plugin app47
11
+ ```
12
+
13
+ ## About app47
14
+
15
+ Fastlane plugin for uploading builds to App47
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
+ ## Example
20
+
21
+ 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`.
22
+
23
+ **Note to author:** Please set up a sample project to make it easy for users to explore what your plugin does. Provide everything that is necessary to try out the plugin in this project (including a sample Xcode/Android project if necessary)
24
+
25
+ ## Run tests for this plugin
26
+
27
+ To run both the tests, and code style validation, run
28
+
29
+ ```
30
+ rake
31
+ ```
32
+
33
+ To automatically fix many of the styling issues, use
34
+ ```
35
+ rubocop -a
36
+ ```
37
+
38
+ ## Issues and Feedback
39
+
40
+ For any other issues and feedback about this plugin, please submit it to this repository.
41
+
42
+ ## Troubleshooting
43
+
44
+ If you have trouble using plugins, check out the [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.
45
+
46
+ ## Using _fastlane_ Plugins
47
+
48
+ For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/).
49
+
50
+ ## About _fastlane_
51
+
52
+ _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/app47/version'
2
+
3
+ module Fastlane
4
+ module App47
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::App47.all_classes.each do |current|
15
+ require current
16
+ end
@@ -0,0 +1,148 @@
1
+ require 'fastlane/action'
2
+ require_relative '../helper/APP47_helper'
3
+
4
+ module Fastlane
5
+ module Actions
6
+ module SharedValues
7
+ end
8
+
9
+ class UploadToApp47Action < Action
10
+ def self.run(params)
11
+ build = {}
12
+
13
+ build[:token] = (params[:account_token]).to_s
14
+ build[:app_id] = (params[:app_id]).to_s
15
+ build[:path] = (params[:ipa_path]).to_s
16
+ build[:environment] = params[:environment]
17
+ build[:release_notes] = params[:release_notes]
18
+ build[:notify_users_on_activation] = params[:notify_users_on_activation]
19
+ build[:make_active] = params[:make_active]
20
+ build[:reset_bundle_identifier] = params[:reset_bundle_identifier]
21
+ build[:reuse_version] = params[:reuse_version]
22
+ build[:update_app_icon] = params[:update_app_icon]
23
+ build[:update_app_name] = params[:update_app_name]
24
+
25
+ UI.message("Uploading `#{params[:ipa_path]}` to App47 for app ID #{params[:app_id]} for #{params[:environment]} environment")
26
+
27
+ response = Helper::App47Helper.upload(build)
28
+
29
+ # if distributed_release
30
+ # UI.success("Release '#{release_id}' (#{distributed_release['short_version']}) was successfully distributed to #{destination_type} \"#{destination_name}\"")
31
+ # else
32
+ # UI.error("App47 Upload #{response}")
33
+ # end
34
+ end
35
+
36
+ def self.description
37
+ "Upload IPA to Simple MDM"
38
+ end
39
+
40
+ def self.authors
41
+ ["iotashan"]
42
+ end
43
+
44
+ def self.details
45
+ # Optional:
46
+ "When using App47 for iOS app distribution, this provides an automate way to send updates directly to App47"
47
+ end
48
+
49
+ def self.available_options
50
+ [
51
+ FastlaneCore::ConfigItem.new(key: :account_token,
52
+ type: String,
53
+ env_name: "APP47_ACCOUNT_TOKEN",
54
+ description: "API Token for App47"),
55
+ FastlaneCore::ConfigItem.new(key: :app_id,
56
+ type: String,
57
+ env_name: "APP47_APP_ID",
58
+ description: "The App47 App ID that will be uploaded"),
59
+ FastlaneCore::ConfigItem.new(key: :ipa_path,
60
+ type: String,
61
+ env_name: "APP47_IPA_PATH",
62
+ description: "The the path to the IPA",
63
+ default_value: Actions.lane_context[SharedValues::IPA_OUTPUT_PATH],
64
+ verify_block: proc do |value|
65
+ UI.user_error!("Couldn't find ipa file at path '#{value}'") unless File.exist?(value)
66
+ end),
67
+ FastlaneCore::ConfigItem.new(key: :environment,
68
+ type: String,
69
+ env_name: "APP47_ENVIRONMENT",
70
+ description: "Environment for the build",
71
+ verify_block: proc do |value|
72
+ accepted_formats = ["Production", "Test"]
73
+ UI.user_error!("Only \"Production\" or \"Test\" values are allowed, you provided \"#{value}\"") unless accepted_formats.include? value
74
+ end),
75
+ FastlaneCore::ConfigItem.new(key: :release_notes,
76
+ type: String,
77
+ env_name: "APP47_RELEASE_NOTES",
78
+ optional: true,
79
+ description: "Release notes for build"),
80
+ FastlaneCore::ConfigItem.new(key: :notify_users_on_activation,
81
+ env_name: "APP47_NOTIFY_USERS_ON_ACTIVATION",
82
+ optional: true,
83
+ default_value: false,
84
+ is_string: false,
85
+ description: "Notify users when the build is made active",
86
+ verify_block: proc do |value|
87
+ accepted_formats = [true, false]
88
+ UI.user_error!("Only true or false values are allowed, you provided \"#{value}\"") unless accepted_formats.include? value
89
+ end),
90
+ FastlaneCore::ConfigItem.new(key: :make_active,
91
+ env_name: "APP47_MAKE_ACTIVE", # The name of the environment variable
92
+ optional: true,
93
+ default_value: false,
94
+ is_string: false,
95
+ description: "Notify users when the build is made active",
96
+ verify_block: proc do |value|
97
+ accepted_formats = [true, false]
98
+ UI.user_error!("Only true or false values are allowed, you provided \"#{value}\"") unless accepted_formats.include? value
99
+ end),
100
+ FastlaneCore::ConfigItem.new(key: :reset_bundle_identifier,
101
+ env_name: "APP47_RESET_BUNDLE_IDENTIFIER", # The name of the environment variable
102
+ optional: true,
103
+ default_value: false,
104
+ is_string: false,
105
+ description: "Reset the build identifier if it has changed",
106
+ verify_block: proc do |value|
107
+ accepted_formats = [true, false]
108
+ UI.user_error!("Only true or false values are allowed, you provided \"#{value}\"") unless accepted_formats.include? value
109
+ end),
110
+ FastlaneCore::ConfigItem.new(key: :reuse_version,
111
+ env_name: "APP47_REUSE_VERSION",
112
+ optional: true,
113
+ default_value: false,
114
+ is_string: false,
115
+ description: "Reuse the version number if it is already present in the environment",
116
+ verify_block: proc do |value|
117
+ accepted_formats = [true, false]
118
+ UI.user_error!("Only true or false values are allowed, you provided \"#{value}\"") unless accepted_formats.include? value
119
+ end),
120
+ FastlaneCore::ConfigItem.new(key: :update_app_icon,
121
+ env_name: "APP47_UPDATE_APP_ICON",
122
+ optional: true,
123
+ default_value: false,
124
+ is_string: false,
125
+ description: "Reuse the version number if it is already present in the environment",
126
+ verify_block: proc do |value|
127
+ accepted_formats = [true, false]
128
+ UI.user_error!("Only true or false values are allowed, you provided \"#{value}\"") unless accepted_formats.include? value
129
+ end),
130
+ FastlaneCore::ConfigItem.new(key: :update_app_name,
131
+ env_name: "APP47_UPDATE_APP_NAME",
132
+ optional: true,
133
+ default_value: false,
134
+ is_string: false,
135
+ description: "Reuse the version number if it is already present in the environment",
136
+ verify_block: proc do |value|
137
+ accepted_formats = [true, false]
138
+ UI.user_error!("Only true or false values are allowed, you provided \"#{value}\"") unless accepted_formats.include? value
139
+ end)
140
+ ]
141
+ end
142
+
143
+ def self.is_supported?(platform)
144
+ true
145
+ end
146
+ end
147
+ end
148
+ end
@@ -0,0 +1,76 @@
1
+ require 'rest_client'
2
+ require 'json'
3
+ require 'fastlane_core/ui/ui'
4
+
5
+ module Fastlane
6
+ UI = FastlaneCore::UI unless Fastlane.const_defined?("UI")
7
+
8
+ module Helper
9
+ class App47Helper
10
+ # class methods that you define here become available in your action
11
+ # as `Helper::App47Helper.your_method`
12
+ #
13
+
14
+ #
15
+ # Perform the upload to the server
16
+ #
17
+ def self.upload(build)
18
+ app_id = build.delete(:app_id)
19
+ token = build.delete(:token)
20
+ load_file(build)
21
+ binary = build.delete(:build_upload)
22
+
23
+ UI.message("uploading file")
24
+ response = RestClient::Request.execute(method: :post,
25
+ url: "https://cirrus.app47.com/api/v2/upload_file",
26
+ payload: {
27
+ multipart: true,
28
+ file: binary
29
+ },
30
+ headers: {
31
+ 'Access-Token': token
32
+ },
33
+ raw_response: true)
34
+
35
+ UI.user_error!("Error response '#{response.code}'") unless response.code === 200
36
+ hash = JSON.parse(response.to_s)
37
+ build[:build_upload_file_id] = hash['results']['file_id']
38
+ UI.message("uploaded fileID #{hash['results']['file_id']}")
39
+ UI.message("adding build to #{app_id}")
40
+ resp = RestClient.send( :post,
41
+ "https://cirrus.app47.com/api/v2/apps/#{app_id}/builds",
42
+ {
43
+ build: build
44
+ },
45
+ {
46
+ 'Access-Token': token
47
+ })
48
+ UI.user_error!("Error response '#{resp.code}'") unless resp.code === 200
49
+ hash = JSON.parse(resp.to_s)
50
+ puts hash.to_yaml
51
+
52
+ return hash
53
+ end
54
+
55
+ #
56
+ # Load file for processing, making sure it exists
57
+ #
58
+ def self.load_file(options)
59
+ file_path = options.delete(:path)
60
+ raise "File not found: #{file_path}" unless File.exist?(file_path)
61
+
62
+ options[:build_upload] = File.new(file_path, 'rb')
63
+ extension = file_path.split('.').last
64
+ options[:platform] = case extension
65
+ when 'ipa'
66
+ 'iOS'
67
+ when 'apk'
68
+ 'Android'
69
+ else
70
+ 'Windows'
71
+ end
72
+ options
73
+ end
74
+ end
75
+ end
76
+ end
@@ -0,0 +1,5 @@
1
+ module Fastlane
2
+ module App47
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,202 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fastlane-plugin-app47
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Shannon Hicks
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2021-08-06 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rest-client
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '2.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '2.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: fastlane
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: 2.188.0
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: 2.188.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: pry
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: rake
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: rspec
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: rspec_junit_formatter
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
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: rubocop
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - '='
116
+ - !ruby/object:Gem::Version
117
+ version: 1.12.1
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - '='
123
+ - !ruby/object:Gem::Version
124
+ version: 1.12.1
125
+ - !ruby/object:Gem::Dependency
126
+ name: rubocop-performance
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: rubocop-require_tools
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: simplecov
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ description:
168
+ email: shan@iotashan.com
169
+ executables: []
170
+ extensions: []
171
+ extra_rdoc_files: []
172
+ files:
173
+ - LICENSE
174
+ - README.md
175
+ - lib/fastlane/plugin/app47.rb
176
+ - lib/fastlane/plugin/app47/actions/upload_to_app47_action.rb
177
+ - lib/fastlane/plugin/app47/helper/app47_helper.rb
178
+ - lib/fastlane/plugin/app47/version.rb
179
+ homepage: https://github.com/latitude-digital/fastlane-plugin-app47
180
+ licenses:
181
+ - MIT
182
+ metadata: {}
183
+ post_install_message:
184
+ rdoc_options: []
185
+ require_paths:
186
+ - lib
187
+ required_ruby_version: !ruby/object:Gem::Requirement
188
+ requirements:
189
+ - - ">="
190
+ - !ruby/object:Gem::Version
191
+ version: '2.5'
192
+ required_rubygems_version: !ruby/object:Gem::Requirement
193
+ requirements:
194
+ - - ">="
195
+ - !ruby/object:Gem::Version
196
+ version: '0'
197
+ requirements: []
198
+ rubygems_version: 3.0.1
199
+ signing_key:
200
+ specification_version: 4
201
+ summary: Fastlane plugin for uploading builds to App47
202
+ test_files: []