fastlane-plugin-fetch_version_code 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 2eb121c283ad3807c24e36bc8807d5e1f5fb0966f1dc06e36fdd1ecce4abc03b
4
+ data.tar.gz: 946ed57c69b433f241abe09bb59c7c2302a89ddf309735bb26d542dd2755d63c
5
+ SHA512:
6
+ metadata.gz: 7ca05885935e5a13541ef7eca124dc7a9d64e0d548093f882232204a088b2688eacca590a765b6b9e35f198c0cdc8de48662c3efad1b9d1c38a0733b1ab0a059
7
+ data.tar.gz: d0b3644ecc8a2d15ec1aacba0e2a28a12e3558b0ebc852de45cb256cc690cb570b7813262febb1eedd2bb50171ea419ce30d6706c5d9bb904bbd95243add7775
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License Copyright (c) 2019-2021 Coorpacademy Tech Team
2
+
3
+ Permission is hereby granted, free
4
+ of charge, to any person obtaining a copy of this software and associated
5
+ documentation files (the "Software"), to deal in the Software without
6
+ restriction, including without limitation the rights to use, copy, modify, merge,
7
+ publish, distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to the
9
+ following conditions:
10
+
11
+ The above copyright notice and this permission notice
12
+ (including the next paragraph) shall be included in all copies or substantial
13
+ portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
16
+ ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
18
+ EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
19
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,60 @@
1
+ # fetch_version_code Fastlane plugin
2
+
3
+ [![Gem](https://img.shields.io/gem/v/fastlane-plugin-fetch_version_code)](https://rubygems.org/gems/fastlane-plugin-fetch_version_code)
4
+ [![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-fetch_version_code)
5
+ [![Build Status](https://travis-ci.com/CoorpAcademy/fastlane-plugin-fetch_version_code.svg?branch=master)](https://travis-ci.com/CoorpAcademy/fastlane-plugin-fetch_version_code)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
7
+
8
+ > _Fastlane plugin_ to help you **fetch version number/code** from some API/HTTP Endpoint
9
+ ## Getting Started
10
+
11
+ This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-fetch_version_code`, add it to your project by running:
12
+
13
+ ```bash
14
+ fastlane add_plugin fetch_version_code
15
+ ```
16
+
17
+ ## Example
18
+
19
+ 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`.
20
+
21
+ Here is how you could use the plugin to fetch version number from some API endpoint.
22
+
23
+ ```ruby
24
+ version_code = fetch_version_code(
25
+ endpoint: "api.whatever.org/api/build/next-build-number",
26
+ method: :post,
27
+ secret_header: 'Api-Secret',
28
+ secret_value: ENV['VERSION_API_SECRET']
29
+ )
30
+ ```
31
+
32
+
33
+ ## Run tests for this plugin
34
+
35
+ To run both the tests, and code style validation, run
36
+
37
+ ```
38
+ rake
39
+ ```
40
+
41
+ To automatically fix many of the styling issues, use
42
+ ```
43
+ rubocop -a
44
+ ```
45
+
46
+ ## Issues and Feedback
47
+
48
+ For any other issues and feedback about this plugin, please submit it to this repository.
49
+
50
+ ## Troubleshooting
51
+
52
+ If you have trouble using plugins, check out the [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.
53
+
54
+ ## Using _fastlane_ Plugins
55
+
56
+ For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/).
57
+
58
+ ## About _fastlane_
59
+
60
+ _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/fetch_version_code/version'
2
+
3
+ module Fastlane
4
+ module FetchVersionCode
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::FetchVersionCode.all_classes.each do |current|
15
+ require current
16
+ end
@@ -0,0 +1,49 @@
1
+ require 'fastlane/action'
2
+ require_relative '../helper/fetch_version_code_helper'
3
+
4
+ module Fastlane
5
+ UI = FastlaneCore::UI unless Fastlane.const_defined?("UI")
6
+
7
+ module Actions
8
+ class FetchVersionCodeAction < Action
9
+ def self.run(params)
10
+ unless params[:host] && params[:path] || params[:endpoint]
11
+ UI.user_error!('Need either :host and :path or :endpoint arguments')
12
+ end
13
+ UI.message("About to fetch a version code")
14
+
15
+ version_code = Helper::FetchVersionCodeHelper.fetch_version_code(params)
16
+ UI.success("Got 'version code': #{version_code}")
17
+
18
+ return version_code
19
+ end
20
+
21
+ def self.description
22
+ 'Fetch (and increment) version code for given platform'
23
+ end
24
+
25
+ def self.authors
26
+ ['AdrieanKhisbe', 'VincentCATILLON']
27
+ end
28
+
29
+ def self.return_value
30
+ 'Version code of given platform'
31
+ end
32
+
33
+ def self.available_options
34
+ [
35
+ FastlaneCore::ConfigItem.new(key: :endpoint, description: 'Version Api endpoint', is_string: true, default_value: ''),
36
+ FastlaneCore::ConfigItem.new(key: :host, description: 'The host hosting the version API', default_value: ''),
37
+ FastlaneCore::ConfigItem.new(key: :path, description: 'The path of the version API', default_value: ''),
38
+ FastlaneCore::ConfigItem.new(key: :method, description: 'The method of the endpoint', is_string: false, default_value: :get),
39
+ FastlaneCore::ConfigItem.new(key: :secret_header, default_value: ''),
40
+ FastlaneCore::ConfigItem.new(key: :secret_value, default_value: '')
41
+ ]
42
+ end
43
+
44
+ def self.is_supported?(platform)
45
+ [:ios, :android].include?(platform)
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,36 @@
1
+ require 'fastlane_core/ui/ui'
2
+ require 'http'
3
+
4
+ module Fastlane
5
+ UI = FastlaneCore::UI unless Fastlane.const_defined?("UI")
6
+
7
+ module Helper
8
+ class FetchVersionCodeHelper
9
+ def self.fetch_version_code(params)
10
+ url = self.get_api_url(params)
11
+ UI.message("Calling API: #{url}")
12
+ method = params[:method] || :get
13
+
14
+ headers = params[:secret_header] ? { params[:secret_header] => params[:secret_value] } : {}
15
+ res = HTTP.headers(headers).send(method, url)
16
+
17
+ if res.status != 200
18
+ UI.error("Some error occureds [status:#{res.status}]: #{res.body}")
19
+ UI.crash!(res.body)
20
+ end
21
+
22
+ return res.body.to_s
23
+ end
24
+
25
+ def self.get_api_url(params)
26
+ if params[:endpoint]
27
+ return params[:endpoint] if params[:endpoint].start_with?("http:", "https:")
28
+ return "https://#{params[:endpoint]}"
29
+ elsif params[:host] && params[:path]
30
+ return "https://#{params[:host]}#{params[:path]}"
31
+ end
32
+ raise ArgumentError, 'No enough params to get api_url'
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,5 @@
1
+ module Fastlane
2
+ module FetchVersionCode
3
+ VERSION = '0.3.0'
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,187 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fastlane-plugin-fetch_version_code
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.0
5
+ platform: ruby
6
+ authors:
7
+ - CoorpAcademy
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2021-02-17 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: http
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 4.4.1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 4.4.1
27
+ - !ruby/object:Gem::Dependency
28
+ name: pry
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: bundler
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: rspec
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: rspec_junit_formatter
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: rake
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: rubocop
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '='
102
+ - !ruby/object:Gem::Version
103
+ version: 0.49.1
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '='
109
+ - !ruby/object:Gem::Version
110
+ version: 0.49.1
111
+ - !ruby/object:Gem::Dependency
112
+ name: rubocop-require_tools
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: simplecov
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: fastlane
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: 2.108.0
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: 2.108.0
153
+ description:
154
+ email: mobile@coorpacademy.com
155
+ executables: []
156
+ extensions: []
157
+ extra_rdoc_files: []
158
+ files:
159
+ - LICENSE
160
+ - README.md
161
+ - lib/fastlane/plugin/fetch_version_code.rb
162
+ - lib/fastlane/plugin/fetch_version_code/actions/fetch_version_code_action.rb
163
+ - lib/fastlane/plugin/fetch_version_code/helper/fetch_version_code_helper.rb
164
+ - lib/fastlane/plugin/fetch_version_code/version.rb
165
+ homepage: https://github.com/CoorpAcademy/fastlane-plugin-fetch_version_code
166
+ licenses: []
167
+ metadata: {}
168
+ post_install_message:
169
+ rdoc_options: []
170
+ require_paths:
171
+ - lib
172
+ required_ruby_version: !ruby/object:Gem::Requirement
173
+ requirements:
174
+ - - "~>"
175
+ - !ruby/object:Gem::Version
176
+ version: '2.4'
177
+ required_rubygems_version: !ruby/object:Gem::Requirement
178
+ requirements:
179
+ - - ">="
180
+ - !ruby/object:Gem::Version
181
+ version: '0'
182
+ requirements: []
183
+ rubygems_version: 3.1.4
184
+ signing_key:
185
+ specification_version: 4
186
+ summary: Fetch (and increment) version code for given platform
187
+ test_files: []