fastlane-plugin-farol 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/fastlane/plugin/farol/actions/farol_action.rb +17 -35
- data/lib/fastlane/plugin/farol/actions/farol_api_action.rb +67 -0
- data/lib/fastlane/plugin/farol/actions/farol_set_version_action.rb +1 -1
- data/lib/fastlane/plugin/farol/lib/farol.rb +12 -4
- data/lib/fastlane/plugin/farol/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 23887dd8ccb110aef1ea34aa89a5d20b895a7c6c
|
4
|
+
data.tar.gz: a2015b806658a45abb5f781debffb3a449cc87bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 412cef2541bce09edae48bb142471193c55239ad2f204087b8d23cc33c568283854c68472ea36097af94bbd190f56bef5f7388f828cf2b6f03766c82a6913f40
|
7
|
+
data.tar.gz: ff2256bac37d7d0a72d6f6ef6d1584dd9152ae298f8a203319f2b00b772eeec580fd8ca712e64deba52a0ffc9d771f33166976f77abe180ea664b174bfe38329
|
@@ -2,48 +2,30 @@ module Fastlane
|
|
2
2
|
module Actions
|
3
3
|
class FarolAction < Action
|
4
4
|
def self.run(params)
|
5
|
-
|
6
|
-
|
7
|
-
targetFolder = baseFolder + 'Target/'
|
5
|
+
base_folder = ''
|
6
|
+
target_folder = base_folder + 'Target/'
|
8
7
|
|
9
8
|
# Reset target folder
|
10
|
-
|
11
|
-
|
9
|
+
FileUtils.rm_rf Dir.glob(target_folder)
|
10
|
+
Dir.mkdir(target_folder)
|
12
11
|
|
13
|
-
|
14
|
-
|
12
|
+
# Create Farol Api
|
13
|
+
api = Farol::Api.new
|
14
|
+
token = params[:token]
|
15
15
|
|
16
|
-
|
17
|
-
|
16
|
+
# Download event content
|
17
|
+
result = api.request(token, 'get', 'event/event')
|
18
|
+
self.save_file('Event', result)
|
18
19
|
|
20
|
+
# Download app content
|
21
|
+
result = api.request(token, 'get', 'app/' + params[:app_id])
|
22
|
+
self.save_file('App', result)
|
19
23
|
end
|
20
24
|
|
21
|
-
def self.
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
url = URI(farolURL + '/' + method)
|
26
|
-
Net::HTTP.start(url.host, url.port,
|
27
|
-
:use_ssl => url.scheme == 'https') do |http|
|
28
|
-
|
29
|
-
if verb == 'post'
|
30
|
-
request = Net::HTTP::Post.new url
|
31
|
-
elsif verb == 'put'
|
32
|
-
request = Net::HTTP::Put.new url
|
33
|
-
else
|
34
|
-
request = Net::HTTP::Get.new url
|
35
|
-
end
|
36
|
-
|
37
|
-
request['authorization'] = params[:token]
|
38
|
-
response = http.request request # Net::HTTPResponse object
|
39
|
-
result = JSON.parse response.read_body
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
def self.saveFile(fileName, result)
|
44
|
-
baseFolder = ''
|
45
|
-
targetFolder = baseFolder + 'Target/'
|
46
|
-
File.open(targetFolder + fileName + '.json', 'w') do |f|
|
25
|
+
def self.save_file(file_name, result)
|
26
|
+
base_folder = ''
|
27
|
+
target_folder = base_folder + 'Target/'
|
28
|
+
File.open(target_folder + file_name + '.json', 'w') do |f|
|
47
29
|
f.puts JSON.pretty_generate(result)
|
48
30
|
end
|
49
31
|
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
module Fastlane
|
2
|
+
module Actions
|
3
|
+
class FarolApiAction < Action
|
4
|
+
def self.run(params)
|
5
|
+
# Create Farol Api
|
6
|
+
api = Farol::Api.new
|
7
|
+
token = params[:token]
|
8
|
+
verb = params[:verb]
|
9
|
+
method = params[:method]
|
10
|
+
form_data = params[:form_data]
|
11
|
+
|
12
|
+
# Download event content
|
13
|
+
api.request(token, verb, method, form_data)
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.description
|
17
|
+
"Enable your app to use Farol Platform services"
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.authors
|
21
|
+
["Felipe Plets"]
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.return_value
|
25
|
+
# If your method provides a return value, you can describe here what it does
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.details
|
29
|
+
# Optional:
|
30
|
+
"Integrate your app with the Farol Platform using services like push notifications"
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.available_options
|
34
|
+
[
|
35
|
+
FastlaneCore::ConfigItem.new(key: :token,
|
36
|
+
env_name: "TOKEN",
|
37
|
+
description: "The token for your Farol App",
|
38
|
+
optional: false,
|
39
|
+
type: String),
|
40
|
+
FastlaneCore::ConfigItem.new(key: :verb,
|
41
|
+
env_name: "VERB",
|
42
|
+
description: "The Farol API operation verb",
|
43
|
+
optional: false,
|
44
|
+
type: String),
|
45
|
+
FastlaneCore::ConfigItem.new(key: :method,
|
46
|
+
env_name: "METHOD",
|
47
|
+
description: "The Method to be performed by the Farol API",
|
48
|
+
optional: false,
|
49
|
+
type: String),
|
50
|
+
FastlaneCore::ConfigItem.new(key: :form_data,
|
51
|
+
env_name: "FORM_DATA",
|
52
|
+
description: "Data to be sent to the Farol API",
|
53
|
+
optional: true,
|
54
|
+
type: String)
|
55
|
+
]
|
56
|
+
end
|
57
|
+
|
58
|
+
def self.is_supported?(platform)
|
59
|
+
# Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
|
60
|
+
# See: https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Platforms.md
|
61
|
+
#
|
62
|
+
# [:ios, :mac, :android].include?(platform)
|
63
|
+
true
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -6,7 +6,7 @@ module Fastlane
|
|
6
6
|
token = params[:token]
|
7
7
|
verb = 'post'
|
8
8
|
method = 'app/version/' + params[:platform]
|
9
|
-
form_data = {"version" => params[:version], "build" => params[:build]}
|
9
|
+
form_data = { "version" => params[:version], "build" => params[:build] }
|
10
10
|
api.request(token, verb, method, form_data)
|
11
11
|
end
|
12
12
|
|
@@ -2,12 +2,12 @@ module Fastlane
|
|
2
2
|
module Farol
|
3
3
|
class Api
|
4
4
|
def request(token, verb, method, form_data = nil)
|
5
|
-
|
5
|
+
farol_url = 'https://frl.io:443'
|
6
6
|
|
7
7
|
# Create Cognito credentials
|
8
|
-
url = URI(
|
8
|
+
url = URI(farol_url + '/' + method)
|
9
9
|
Net::HTTP.start(url.host, url.port,
|
10
|
-
|
10
|
+
use_ssl: url.scheme == 'https') do |http|
|
11
11
|
|
12
12
|
if verb == 'post'
|
13
13
|
request = Net::HTTP::Post.new url
|
@@ -20,9 +20,17 @@ module Fastlane
|
|
20
20
|
|
21
21
|
request['authorization'] = token
|
22
22
|
response = http.request request # Net::HTTPResponse object
|
23
|
-
|
23
|
+
case response
|
24
|
+
when Net::HTTPSuccess
|
24
25
|
return JSON.parse response.read_body
|
26
|
+
when Net::HTTPUnauthorized
|
27
|
+
UI.error("Farol: #{response.message} - is your authorization token correct?")
|
28
|
+
when Net::HTTPServerError
|
29
|
+
UI.error("Farol: #{response.message} - try again later?")
|
30
|
+
else
|
31
|
+
UI.error("Farol: #{response.message}")
|
25
32
|
end
|
33
|
+
return false
|
26
34
|
end
|
27
35
|
end
|
28
36
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-farol
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Felipe Plets
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-07-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|
@@ -104,6 +104,7 @@ files:
|
|
104
104
|
- README.md
|
105
105
|
- lib/fastlane/plugin/farol.rb
|
106
106
|
- lib/fastlane/plugin/farol/actions/farol_action.rb
|
107
|
+
- lib/fastlane/plugin/farol/actions/farol_api_action.rb
|
107
108
|
- lib/fastlane/plugin/farol/actions/farol_get_version_action.rb
|
108
109
|
- lib/fastlane/plugin/farol/actions/farol_set_version_action.rb
|
109
110
|
- lib/fastlane/plugin/farol/helper/farol_helper.rb
|
@@ -129,7 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
129
130
|
version: '0'
|
130
131
|
requirements: []
|
131
132
|
rubyforge_project:
|
132
|
-
rubygems_version: 2.6.
|
133
|
+
rubygems_version: 2.6.12
|
133
134
|
signing_key:
|
134
135
|
specification_version: 4
|
135
136
|
summary: Enable your app to use Farol Platform services
|