fastlane-plugin-json_auth 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/README.md +207 -0
- data/lib/fastlane/plugin/json/actions/download_json_action.rb +81 -0
- data/lib/fastlane/plugin/json/actions/merge_jsons_action.rb +100 -0
- data/lib/fastlane/plugin/json/actions/read_json_action.rb +89 -0
- data/lib/fastlane/plugin/json/actions/write_json_action.rb +86 -0
- data/lib/fastlane/plugin/json/helper/json_helper.rb +16 -0
- data/lib/fastlane/plugin/json/version.rb +5 -0
- data/lib/fastlane/plugin/json.rb +16 -0
- metadata +180 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 91c38fcdde0bd67232329e0f29d9d37893e0c233248e2ce95f24c2cd9d70dc89
|
4
|
+
data.tar.gz: c0aea0900efb7cd4169ba38378123436fa0c4c2023acfe228b69fb825d0d4779
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f4b708fa05c25a1eeeb134c554567203470e142c8b4c03eb003113cdf57cbd690155863f3874651c308c1fe77d7c3dc7cc38a209570656e5fb57543965e8ba94
|
7
|
+
data.tar.gz: b2cb866f1df76cb4867b4022b4759e7bf754d23f43e2fa9b1f73cc36beed297b6ff89c3294f440e82f3ed60e147fc13e1e235ac8d58b3c99c5f16501f4e0eb4e
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2020 Martin Gonzalez <gonzalez.martin90@gmail.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,207 @@
|
|
1
|
+
# Fastlane Json plugin <!-- omit in toc -->
|
2
|
+
|
3
|
+
[![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-json) ![Gem Version](https://badge.fury.io/rb/fastlane-plugin-json.svg) ![](https://ruby-gem-downloads-badge.herokuapp.com/fastlane-plugin-json) [![YourActionName Actions Status](https://github.com/MartinGonzalez/fastlane-plugin-json/workflows/Test-Build-Publish/badge.svg)](https://github.com/MartinGonzalez/fastlane-plugin-json/actions)
|
4
|
+
|
5
|
+
- [Getting Started](#getting-started)
|
6
|
+
- [Actions](#actions)
|
7
|
+
- [read_json](#read_json)
|
8
|
+
- [download_json](#download_json)
|
9
|
+
- [write_json](#write_json)
|
10
|
+
- [merge_jsons](#merge_jsons)
|
11
|
+
- [Example](#example)
|
12
|
+
- [Run tests for this plugin](#run-tests-for-this-plugin)
|
13
|
+
- [Issues and Feedback](#issues-and-feedback)
|
14
|
+
- [Troubleshooting](#troubleshooting)
|
15
|
+
- [Using _fastlane_ Plugins](#using-fastlane-plugins)
|
16
|
+
- [About _fastlane_](#about-fastlane)
|
17
|
+
|
18
|
+
## Getting Started
|
19
|
+
|
20
|
+
This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-json`,
|
21
|
+
add it to your project by running:
|
22
|
+
|
23
|
+
```bash
|
24
|
+
fastlane add_plugin json
|
25
|
+
```
|
26
|
+
|
27
|
+
## Actions
|
28
|
+
|
29
|
+
This plugin provide several actions that will allow you to manipulate and create json files.
|
30
|
+
|
31
|
+
### read_json
|
32
|
+
|
33
|
+
| Key | Description | Env Var | Default |
|
34
|
+
|-----------|-------------------|---------|---------|
|
35
|
+
| json_path | Path to json file | | |
|
36
|
+
| verbose | verbose | | false |
|
37
|
+
|
38
|
+
Read a json file at specific path as a hash object.
|
39
|
+
|
40
|
+
_Having a json file at `path/to/my.json` with the following content:_
|
41
|
+
|
42
|
+
```json
|
43
|
+
{
|
44
|
+
"name": "Martin",
|
45
|
+
"age": 30
|
46
|
+
}
|
47
|
+
```
|
48
|
+
|
49
|
+
```ruby
|
50
|
+
my_json = read_json(
|
51
|
+
json_path: "path/to/my.json"
|
52
|
+
)
|
53
|
+
|
54
|
+
puts my_json[:name]
|
55
|
+
# "Martin"
|
56
|
+
puts my_json[:age]
|
57
|
+
# 30
|
58
|
+
```
|
59
|
+
|
60
|
+
### download_json
|
61
|
+
|
62
|
+
| Key | Description | Env Var | Default |
|
63
|
+
|----------|---------------------------------|---------|---------|
|
64
|
+
| json_url | Url to json file | | |
|
65
|
+
| username | Basic auth username to download | | |
|
66
|
+
| password | Basic auth password to download | | |
|
67
|
+
| verbose | verbose | | false |
|
68
|
+
|
69
|
+
Downloads a json file from server and convert it to a hash object.
|
70
|
+
|
71
|
+
```ruby
|
72
|
+
my_json = download_json(
|
73
|
+
json_url: "https://gist.githubusercontent.com/MartinGonzalez/77b28af666fc2ee844c96cf6c8c221a2/raw/d23feabf25abe39c9c7243fd23f92efa7f50a3fd/someExample.json",
|
74
|
+
username: "admin",
|
75
|
+
password: "admin123"
|
76
|
+
)
|
77
|
+
|
78
|
+
puts my_json[:name]
|
79
|
+
# "Martin Gonzalez"
|
80
|
+
puts my_json[:gender]
|
81
|
+
# "male"
|
82
|
+
puts my_json[:isDev]
|
83
|
+
# true
|
84
|
+
```
|
85
|
+
|
86
|
+
### write_json
|
87
|
+
|
88
|
+
| Key | Description | Env Var | Default |
|
89
|
+
|-----------|-------------------------------------------|---------|---------|
|
90
|
+
| hash | Hash that you want to save as a json file | | |
|
91
|
+
| file_path | Path where you want to save your json | | |
|
92
|
+
| verbose | verbose | | false |
|
93
|
+
|
94
|
+
Creates a json file from a hash.
|
95
|
+
|
96
|
+
```ruby
|
97
|
+
hash_value = {
|
98
|
+
name: "Martin",
|
99
|
+
age: 30,
|
100
|
+
languages: [
|
101
|
+
"English",
|
102
|
+
"Spanish"
|
103
|
+
]
|
104
|
+
}
|
105
|
+
|
106
|
+
write_json(
|
107
|
+
file_path: "#{__dir__}/my_json.json",
|
108
|
+
hash: hash_value
|
109
|
+
)
|
110
|
+
```
|
111
|
+
|
112
|
+
Will create a my_json.json file with the following content:
|
113
|
+
|
114
|
+
```json
|
115
|
+
{
|
116
|
+
"name": "Martin",
|
117
|
+
"age": 30,
|
118
|
+
"languages": [
|
119
|
+
"English",
|
120
|
+
"Spanish"
|
121
|
+
]
|
122
|
+
}
|
123
|
+
```
|
124
|
+
|
125
|
+
### merge_jsons
|
126
|
+
|
127
|
+
| Key | Description | Env Var | Default |
|
128
|
+
|-------------|-------------------------------------------|---------|---------|
|
129
|
+
| jsons_paths | Array of json files paths | | |
|
130
|
+
| output_path | Output path where result will be saved | | |
|
131
|
+
| verbose | verbose | | false |
|
132
|
+
|
133
|
+
Merges several json files into one hash as output. Also you can set the `output_path` to save the merged hash into a
|
134
|
+
json file.
|
135
|
+
|
136
|
+
Having this files:
|
137
|
+
|
138
|
+
`example.json`
|
139
|
+
|
140
|
+
```json
|
141
|
+
{
|
142
|
+
"name": "Martin",
|
143
|
+
"age": 30
|
144
|
+
}
|
145
|
+
```
|
146
|
+
|
147
|
+
`example2.json`
|
148
|
+
|
149
|
+
```json
|
150
|
+
{
|
151
|
+
"lastName": "Gonzalez",
|
152
|
+
"age": 40,
|
153
|
+
"isDev": true
|
154
|
+
}
|
155
|
+
```
|
156
|
+
|
157
|
+
```ruby
|
158
|
+
output_path = "#{__dir__}/tmp/merged.json"
|
159
|
+
|
160
|
+
merged_hash = merge_jsons(
|
161
|
+
jsons_paths: [
|
162
|
+
"path/to/example.json",
|
163
|
+
"path/to/example2.json"
|
164
|
+
],
|
165
|
+
output_path: output_path
|
166
|
+
)
|
167
|
+
|
168
|
+
# {:name=>"Martin", :age=>40, :lastName=>"Gonzalez", :isDev=>true}
|
169
|
+
```
|
170
|
+
|
171
|
+
## Example
|
172
|
+
|
173
|
+
Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plugin. Try it by cloning the repo,
|
174
|
+
running `fastlane install_plugins` and `bundle exec fastlane all`.
|
175
|
+
|
176
|
+
## Run tests for this plugin
|
177
|
+
|
178
|
+
To run both the tests, and code style validation, run
|
179
|
+
|
180
|
+
```
|
181
|
+
rake
|
182
|
+
```
|
183
|
+
|
184
|
+
To automatically fix many of the styling issues, use
|
185
|
+
|
186
|
+
```
|
187
|
+
rubocop -a
|
188
|
+
```
|
189
|
+
|
190
|
+
## Issues and Feedback
|
191
|
+
|
192
|
+
For any other issues and feedback about this plugin, please submit it to this repository.
|
193
|
+
|
194
|
+
## Troubleshooting
|
195
|
+
|
196
|
+
If you have trouble using plugins, check out
|
197
|
+
the [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.
|
198
|
+
|
199
|
+
## Using _fastlane_ Plugins
|
200
|
+
|
201
|
+
For more information about how the `fastlane` plugin system works, check out
|
202
|
+
the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/).
|
203
|
+
|
204
|
+
## About _fastlane_
|
205
|
+
|
206
|
+
_fastlane_ is the easiest way to automate beta deployments and releases for your iOS and Android apps. To learn more,
|
207
|
+
check out [fastlane.tools](https://fastlane.tools).
|
@@ -0,0 +1,81 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "net/http"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module Fastlane
|
7
|
+
module Actions
|
8
|
+
class DownloadJsonAction < Action
|
9
|
+
def self.run(params)
|
10
|
+
json_url = params[:json_url]
|
11
|
+
@is_verbose = params[:verbose]
|
12
|
+
|
13
|
+
uri = URI(json_url)
|
14
|
+
request = Net::HTTP::Get.new uri.request_uri
|
15
|
+
request.basic_auth params[:username], params[:password]
|
16
|
+
|
17
|
+
print_params(params) if @is_verbose
|
18
|
+
puts("Downloading json from #{uri}") if @is_verbose
|
19
|
+
|
20
|
+
begin
|
21
|
+
response = http.request request
|
22
|
+
JSON.parse(response.body, symbolize_names: true)
|
23
|
+
rescue JSON::ParserError
|
24
|
+
puts_error!("Downloaded json has invalid content ❌")
|
25
|
+
rescue => exception
|
26
|
+
puts_error!("Failed to download json. Message: #{exception.message} ❌")
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.puts_error!(message)
|
31
|
+
UI.user_error!(message)
|
32
|
+
raise StandardError, message
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.description
|
36
|
+
"Downloads a json file and expose a hash with symbolized names as result"
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.details
|
40
|
+
"Use this action to download a json file and access to it as Hash with symbolized names"
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.available_options
|
44
|
+
[
|
45
|
+
FastlaneCore::ConfigItem.new(key: :json_url,
|
46
|
+
description: "Url to json file",
|
47
|
+
is_string: true,
|
48
|
+
optional: false,
|
49
|
+
verify_block: proc do |value|
|
50
|
+
UI.user_error!("You must set json_url pointing to a json file") unless value && !value.empty?
|
51
|
+
end),
|
52
|
+
FastlaneCore::ConfigItem.new(key: :verbose,
|
53
|
+
description: "verbose",
|
54
|
+
optional: true,
|
55
|
+
type: Boolean,
|
56
|
+
default_value: false)
|
57
|
+
|
58
|
+
]
|
59
|
+
end
|
60
|
+
|
61
|
+
def self.print_params(options)
|
62
|
+
table_title = "Params for download_json #{Fastlane::Json::VERSION}"
|
63
|
+
FastlaneCore::PrintTable.print_values(config: options,
|
64
|
+
hide_keys: [],
|
65
|
+
title: table_title)
|
66
|
+
end
|
67
|
+
|
68
|
+
def self.return_value
|
69
|
+
"Hash"
|
70
|
+
end
|
71
|
+
|
72
|
+
def self.authors
|
73
|
+
["Martin Gonzalez"]
|
74
|
+
end
|
75
|
+
|
76
|
+
def self.is_supported?(_platform)
|
77
|
+
true
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
@@ -0,0 +1,100 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
|
5
|
+
module Fastlane
|
6
|
+
module Actions
|
7
|
+
class MergeJsonsAction < Action
|
8
|
+
def self.run(params)
|
9
|
+
jsons_paths = params[:jsons_paths]
|
10
|
+
output_path = params[:output_path]
|
11
|
+
@is_verbose = params[:verbose]
|
12
|
+
|
13
|
+
print_params(params) if @is_verbose
|
14
|
+
put_error!("jsons_path cannot be empty ❌") if jsons_paths.empty?
|
15
|
+
|
16
|
+
hashes = jsons_paths.map do |json_path|
|
17
|
+
put_error!("json_path: #{json_path} is not valid ❌") unless File.exist?(json_path)
|
18
|
+
json_content = File.read(File.expand_path(json_path))
|
19
|
+
begin
|
20
|
+
JSON.parse(json_content, symbolize_names: true)
|
21
|
+
rescue
|
22
|
+
put_error!("File at path #{json_path} has invalid content. ❌")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
merged_hash = hashes.reduce({}, :merge)
|
27
|
+
|
28
|
+
write_hash_at(output_path, merged_hash) unless output_path.to_s.empty?
|
29
|
+
|
30
|
+
merged_hash
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.write_hash_at(output_path, hash)
|
34
|
+
file_path_expanded = File.expand_path(output_path)
|
35
|
+
file_dir = File.dirname(file_path_expanded)
|
36
|
+
Dir.mkdir(file_dir) unless File.directory?(file_dir)
|
37
|
+
|
38
|
+
begin
|
39
|
+
File.open(output_path, "w") { |f| f.write(JSON.pretty_generate(hash)) }
|
40
|
+
rescue
|
41
|
+
put_error!("Failed to write json at #{output_path}. ❌")
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def self.put_error!(message)
|
46
|
+
UI.user_error!(message)
|
47
|
+
raise StandardError, message
|
48
|
+
end
|
49
|
+
|
50
|
+
def self.description
|
51
|
+
"Merge a group of jsons files and expose a hash with symbolized names as result. Last json predominate over the rest"
|
52
|
+
end
|
53
|
+
|
54
|
+
def self.details
|
55
|
+
"Use this action to merge jsons files and access to it as Hash with symbolized names. Also you can set the output_path to save the result"
|
56
|
+
end
|
57
|
+
|
58
|
+
def self.available_options
|
59
|
+
[
|
60
|
+
FastlaneCore::ConfigItem.new(key: :jsons_paths,
|
61
|
+
description: "Array of json files paths",
|
62
|
+
type: Array,
|
63
|
+
optional: false,
|
64
|
+
verify_block: proc do |value|
|
65
|
+
UI.user_error!("You must set jsons_paths") unless value && !value.empty?
|
66
|
+
end),
|
67
|
+
FastlaneCore::ConfigItem.new(key: :output_path,
|
68
|
+
description: "Output path where result will be saved",
|
69
|
+
type: String,
|
70
|
+
optional: true),
|
71
|
+
FastlaneCore::ConfigItem.new(key: :verbose,
|
72
|
+
description: "verbose",
|
73
|
+
optional: true,
|
74
|
+
default_value: false,
|
75
|
+
type: Boolean)
|
76
|
+
|
77
|
+
]
|
78
|
+
end
|
79
|
+
|
80
|
+
def self.print_params(options)
|
81
|
+
table_title = "Params for merge_json #{Fastlane::Json::VERSION}"
|
82
|
+
FastlaneCore::PrintTable.print_values(config: options,
|
83
|
+
hide_keys: [],
|
84
|
+
title: table_title)
|
85
|
+
end
|
86
|
+
|
87
|
+
def self.return_value
|
88
|
+
"Hash"
|
89
|
+
end
|
90
|
+
|
91
|
+
def self.authors
|
92
|
+
["Martin Gonzalez"]
|
93
|
+
end
|
94
|
+
|
95
|
+
def self.is_supported?(_platform)
|
96
|
+
true
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
|
5
|
+
module Fastlane
|
6
|
+
module Actions
|
7
|
+
class ReadJsonAction < Action
|
8
|
+
def self.run(params)
|
9
|
+
json_path = params[:json_path]
|
10
|
+
json_string = params[:json_string]
|
11
|
+
@is_verbose = params[:verbose]
|
12
|
+
|
13
|
+
if json_path.nil? && json_string.nil?
|
14
|
+
put_error!("You need to provide a json_path (file to path) or json_string (json as string) ❌")
|
15
|
+
return nil
|
16
|
+
end
|
17
|
+
|
18
|
+
print_params(params) if @is_verbose
|
19
|
+
|
20
|
+
json_content = json_string
|
21
|
+
|
22
|
+
unless json_path.nil?
|
23
|
+
unless File.file?(json_path)
|
24
|
+
put_error!("File at path #{json_path} does not exist. Verify that the path is correct ❌")
|
25
|
+
return nil
|
26
|
+
end
|
27
|
+
|
28
|
+
json_content = File.read(json_path)
|
29
|
+
end
|
30
|
+
|
31
|
+
begin
|
32
|
+
JSON.parse(json_content, symbolize_names: true)
|
33
|
+
rescue
|
34
|
+
put_error!("File at path #{json_path} has invalid content. ❌")
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.put_error!(message)
|
39
|
+
UI.user_error!(message)
|
40
|
+
raise StandardError, message
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.description
|
44
|
+
"Read a json file and expose a hash with symbolized names as result"
|
45
|
+
end
|
46
|
+
|
47
|
+
def self.details
|
48
|
+
"Use this action to read a json file and access to it as Hash with symbolized names"
|
49
|
+
end
|
50
|
+
|
51
|
+
def self.available_options
|
52
|
+
[
|
53
|
+
FastlaneCore::ConfigItem.new(key: :json_path,
|
54
|
+
description: "Path to json file",
|
55
|
+
is_string: true,
|
56
|
+
optional: true),
|
57
|
+
FastlaneCore::ConfigItem.new(key: :json_string,
|
58
|
+
description: "A json as string",
|
59
|
+
is_string: true,
|
60
|
+
optional: true),
|
61
|
+
FastlaneCore::ConfigItem.new(key: :verbose,
|
62
|
+
description: "verbose",
|
63
|
+
optional: true,
|
64
|
+
type: Boolean)
|
65
|
+
|
66
|
+
]
|
67
|
+
end
|
68
|
+
|
69
|
+
def self.print_params(options)
|
70
|
+
table_title = "Params for read_json #{Fastlane::Json::VERSION}"
|
71
|
+
FastlaneCore::PrintTable.print_values(config: options,
|
72
|
+
hide_keys: [],
|
73
|
+
title: table_title)
|
74
|
+
end
|
75
|
+
|
76
|
+
def self.return_value
|
77
|
+
"Hash"
|
78
|
+
end
|
79
|
+
|
80
|
+
def self.authors
|
81
|
+
["Martin Gonzalez"]
|
82
|
+
end
|
83
|
+
|
84
|
+
def self.is_supported?(_platform)
|
85
|
+
true
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
|
5
|
+
module Fastlane
|
6
|
+
module Actions
|
7
|
+
class WriteJsonAction < Action
|
8
|
+
def self.run(params)
|
9
|
+
hash = params[:hash]
|
10
|
+
file_path = params[:file_path]
|
11
|
+
@is_verbose = params[:verbose]
|
12
|
+
print_params(params) if @is_verbose
|
13
|
+
|
14
|
+
put_error!("file_path: value cannot be nil or empty") if file_path.nil? || file_path.empty?
|
15
|
+
put_error!("hash: value cannot be nil") if hash.nil?
|
16
|
+
|
17
|
+
file_path_expanded = File.expand_path(file_path)
|
18
|
+
file_dir = File.dirname(file_path_expanded)
|
19
|
+
Dir.mkdir(file_dir) unless File.directory?(file_dir)
|
20
|
+
|
21
|
+
begin
|
22
|
+
File.open(file_path, "w") do |f|
|
23
|
+
f.write(JSON.pretty_generate(hash))
|
24
|
+
end
|
25
|
+
rescue
|
26
|
+
put_error!("File at path #{json_path} has invalid content. ❌")
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.put_error!(message)
|
31
|
+
UI.user_error!(message)
|
32
|
+
raise StandardError, message
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.description
|
36
|
+
"Write a json file from a hash at the provided path"
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.details
|
40
|
+
"Use this action to serialize a hash into a json file in a provided path."
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.available_options
|
44
|
+
[
|
45
|
+
FastlaneCore::ConfigItem.new(key: :hash,
|
46
|
+
description: "Hash that you want to save as a json file",
|
47
|
+
optional: false,
|
48
|
+
type: Hash,
|
49
|
+
verify_block: proc do |value|
|
50
|
+
UI.user_error!("You must set hash: parameter") unless value && !value.empty?
|
51
|
+
end),
|
52
|
+
FastlaneCore::ConfigItem.new(key: :file_path,
|
53
|
+
description: "Path where you want to save your json",
|
54
|
+
is_string: true,
|
55
|
+
optional: false,
|
56
|
+
verify_block: proc do |value|
|
57
|
+
UI.user_error!("You must set file_path: parameter") unless value && !value.empty?
|
58
|
+
end),
|
59
|
+
FastlaneCore::ConfigItem.new(key: :verbose,
|
60
|
+
description: "verbose",
|
61
|
+
optional: true,
|
62
|
+
type: Boolean)
|
63
|
+
]
|
64
|
+
end
|
65
|
+
|
66
|
+
def self.print_params(options)
|
67
|
+
table_title = "Params for write_json #{Fastlane::Json::VERSION}"
|
68
|
+
FastlaneCore::PrintTable.print_values(config: options,
|
69
|
+
hide_keys: [],
|
70
|
+
title: table_title)
|
71
|
+
end
|
72
|
+
|
73
|
+
def self.return_value
|
74
|
+
"Nothing"
|
75
|
+
end
|
76
|
+
|
77
|
+
def self.authors
|
78
|
+
["Martin Gonzalez"]
|
79
|
+
end
|
80
|
+
|
81
|
+
def self.is_supported?(_platform)
|
82
|
+
true
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'fastlane_core/ui/ui'
|
2
|
+
|
3
|
+
module Fastlane
|
4
|
+
UI = FastlaneCore::UI unless Fastlane.const_defined?("UI")
|
5
|
+
|
6
|
+
module Helper
|
7
|
+
class JsonHelper
|
8
|
+
# class methods that you define here become available in your action
|
9
|
+
# as `Helper::JsonHelper.your_method`
|
10
|
+
#
|
11
|
+
def self.show_message
|
12
|
+
UI.message("Hello from the json plugin helper!")
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'fastlane/plugin/json/version'
|
2
|
+
|
3
|
+
module Fastlane
|
4
|
+
module Json
|
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::Json.all_classes.each do |current|
|
15
|
+
require current
|
16
|
+
end
|
metadata
ADDED
@@ -0,0 +1,180 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fastlane-plugin-json_auth
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.2.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Martin Gonzalez
|
8
|
+
- Thang Nguyen
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2022-05-30 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: pry
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ">="
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '0'
|
21
|
+
type: :development
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '0'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: bundler
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: rspec
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: rspec_junit_formatter
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
63
|
+
type: :development
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: rake
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: rubocop
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - '='
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: 0.49.1
|
91
|
+
type: :development
|
92
|
+
prerelease: false
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - '='
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: 0.49.1
|
98
|
+
- !ruby/object:Gem::Dependency
|
99
|
+
name: rubocop-require_tools
|
100
|
+
requirement: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
type: :development
|
106
|
+
prerelease: false
|
107
|
+
version_requirements: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - ">="
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
112
|
+
- !ruby/object:Gem::Dependency
|
113
|
+
name: simplecov
|
114
|
+
requirement: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - ">="
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '0'
|
119
|
+
type: :development
|
120
|
+
prerelease: false
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - ">="
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: fastlane
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
129
|
+
requirements:
|
130
|
+
- - ">="
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: 2.151.2
|
133
|
+
type: :development
|
134
|
+
prerelease: false
|
135
|
+
version_requirements: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - ">="
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: 2.151.2
|
140
|
+
description:
|
141
|
+
email:
|
142
|
+
- gonzalez.martin90@gmail.com
|
143
|
+
- thang.nguyencao@gmail.com
|
144
|
+
executables: []
|
145
|
+
extensions: []
|
146
|
+
extra_rdoc_files: []
|
147
|
+
files:
|
148
|
+
- LICENSE
|
149
|
+
- README.md
|
150
|
+
- lib/fastlane/plugin/json.rb
|
151
|
+
- lib/fastlane/plugin/json/actions/download_json_action.rb
|
152
|
+
- lib/fastlane/plugin/json/actions/merge_jsons_action.rb
|
153
|
+
- lib/fastlane/plugin/json/actions/read_json_action.rb
|
154
|
+
- lib/fastlane/plugin/json/actions/write_json_action.rb
|
155
|
+
- lib/fastlane/plugin/json/helper/json_helper.rb
|
156
|
+
- lib/fastlane/plugin/json/version.rb
|
157
|
+
homepage: https://github.com/thangnc/fastlane-plugin-json_auth
|
158
|
+
licenses:
|
159
|
+
- MIT
|
160
|
+
metadata: {}
|
161
|
+
post_install_message:
|
162
|
+
rdoc_options: []
|
163
|
+
require_paths:
|
164
|
+
- lib
|
165
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
166
|
+
requirements:
|
167
|
+
- - ">="
|
168
|
+
- !ruby/object:Gem::Version
|
169
|
+
version: '0'
|
170
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
171
|
+
requirements:
|
172
|
+
- - ">="
|
173
|
+
- !ruby/object:Gem::Version
|
174
|
+
version: '0'
|
175
|
+
requirements: []
|
176
|
+
rubygems_version: 3.0.3.1
|
177
|
+
signing_key:
|
178
|
+
specification_version: 4
|
179
|
+
summary: actions related to json files
|
180
|
+
test_files: []
|