fastlane-plugin-farol 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fb3b6c887a07b6b85f0d6e22af36f99b5ed6e041
4
- data.tar.gz: fd6886b74f1719c34d6a56a42b4b18bcfc169156
3
+ metadata.gz: 84f8d34d89fe0b3fa3a5598fca7f89fab58da1ed
4
+ data.tar.gz: c69ad61cd13e75242e43717a1f90476d34b4f73f
5
5
  SHA512:
6
- metadata.gz: 28ad374721ec0733da3c449a903496cc089e9ae0884b264f0df82f3008a1da0a7bf77a85893b39a9e1519ad673e21d2cb5b55174d1f9630c32cc37f448cd87b2
7
- data.tar.gz: 2495e8135a2aee3751b66e0bbe69fd7b2b1114241fc979eb87aa1396373a7a27d88a7c85722e2e365f42f2f00f9f0e9a20a54741872e7d876f835da4a76547c4
6
+ metadata.gz: 2698cf0a1d0aa33bd57d32a03213be70e9cdad46b8c5253cea0cab9fedfc3bfad85509c80378e15373cb70035466600e1a43a23bcc964cdc48f4198e29573f59
7
+ data.tar.gz: 86169873c9fb721fbddd29c8c19e519c862d3cb1538b192eb2f498285fa5295d44d538e9111739929c66fa3b750bdae6f56bba94fa8aa5d78b5aa3120911585f
@@ -4,7 +4,7 @@ module Fastlane
4
4
  module Farol
5
5
  # Return all .rb files inside the "actions" and "helper" directory
6
6
  def self.all_classes
7
- Dir[File.expand_path('**/{actions,helper}/*.rb', File.dirname(__FILE__))]
7
+ Dir[File.expand_path('**/{actions,helper,lib}/*.rb', File.dirname(__FILE__))]
8
8
  end
9
9
  end
10
10
  end
@@ -2,7 +2,50 @@ module Fastlane
2
2
  module Actions
3
3
  class FarolAction < Action
4
4
  def self.run(params)
5
- UI.message("The farol plugin is working!")
5
+ baseFolder = ''
6
+ fasFolder = baseFolder + '.fas/'
7
+ targetFolder = baseFolder + 'Target/'
8
+
9
+ # Reset target folder
10
+ FileUtils.rm_rf Dir.glob(targetFolder)
11
+ Dir.mkdir(targetFolder)
12
+
13
+ result = self.request(params, 'get', 'event/event')
14
+ self.saveFile('Event', result)
15
+
16
+ result = self.request(params, 'get', 'app/' + params[:app_id])
17
+ self.saveFile('App', result)
18
+
19
+ end
20
+
21
+ def self.request(params, verb, method)
22
+ farolURL = 'https://frl.io:443'
23
+
24
+ # Create Cognito credentials
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|
47
+ f.puts JSON.pretty_generate(result)
48
+ end
6
49
  end
7
50
 
8
51
  def self.description
@@ -24,11 +67,16 @@ module Fastlane
24
67
 
25
68
  def self.available_options
26
69
  [
27
- # FastlaneCore::ConfigItem.new(key: :your_option,
28
- # env_name: "FAROL_YOUR_OPTION",
29
- # description: "A description of your option",
30
- # optional: false,
31
- # type: String)
70
+ FastlaneCore::ConfigItem.new(key: :token,
71
+ env_name: "TOKEN",
72
+ description: "The token for your Farol App",
73
+ optional: false,
74
+ type: String),
75
+ FastlaneCore::ConfigItem.new(key: :app_id,
76
+ env_name: "APP_ID",
77
+ description: "The app id for your Farol App",
78
+ optional: false,
79
+ type: String)
32
80
  ]
33
81
  end
34
82
 
@@ -0,0 +1,53 @@
1
+ module Fastlane
2
+ module Actions
3
+ class FarolGetVersionAction < Action
4
+ def self.run(params)
5
+ api = Farol::Api.new
6
+ token = params[:token]
7
+ verb = 'get'
8
+ method = 'app/version/' + params[:platform]
9
+ api.request(token, verb, method)
10
+ end
11
+
12
+ def self.description
13
+ "Enable your app to use Farol Platform services"
14
+ end
15
+
16
+ def self.authors
17
+ ["Felipe Plets"]
18
+ end
19
+
20
+ def self.return_value
21
+ # If your method provides a return value, you can describe here what it does
22
+ end
23
+
24
+ def self.details
25
+ # Optional:
26
+ "Integrate your app with the Farol Platform using services like push notifications"
27
+ end
28
+
29
+ def self.available_options
30
+ [
31
+ FastlaneCore::ConfigItem.new(key: :token,
32
+ env_name: "TOKEN",
33
+ description: "The token for your Farol App",
34
+ optional: false,
35
+ type: String),
36
+ FastlaneCore::ConfigItem.new(key: :platform,
37
+ env_name: "PLATFORM",
38
+ description: "The platform you want to get the version",
39
+ optional: false,
40
+ type: String)
41
+ ]
42
+ end
43
+
44
+ def self.is_supported?(platform)
45
+ # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
46
+ # See: https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Platforms.md
47
+ #
48
+ # [:ios, :mac, :android].include?(platform)
49
+ true
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,64 @@
1
+ module Fastlane
2
+ module Actions
3
+ class FarolSetVersionAction < Action
4
+ def self.run(params)
5
+ api = Farol::Api.new
6
+ token = params[:token]
7
+ verb = 'post'
8
+ method = 'app/version/' + params[:platform]
9
+ form_data = {"version" => params[:version], "build" => params[:build]}
10
+ api.request(token, verb, method, form_data)
11
+ end
12
+
13
+ def self.description
14
+ "Enable your app to use Farol Platform services"
15
+ end
16
+
17
+ def self.authors
18
+ ["Felipe Plets"]
19
+ end
20
+
21
+ def self.return_value
22
+ # If your method provides a return value, you can describe here what it does
23
+ end
24
+
25
+ def self.details
26
+ # Optional:
27
+ "Integrate your app with the Farol Platform using services like push notifications"
28
+ end
29
+
30
+ def self.available_options
31
+ [
32
+ FastlaneCore::ConfigItem.new(key: :token,
33
+ env_name: "TOKEN",
34
+ description: "The token for your Farol App",
35
+ optional: false,
36
+ type: String),
37
+ FastlaneCore::ConfigItem.new(key: :platform,
38
+ env_name: "PLATFORM",
39
+ description: "The platform you want to get the version",
40
+ optional: false,
41
+ type: String),
42
+ FastlaneCore::ConfigItem.new(key: :version,
43
+ env_name: "VERSION",
44
+ description: "The new version for your app",
45
+ optional: false,
46
+ type: String),
47
+ FastlaneCore::ConfigItem.new(key: :build,
48
+ env_name: "BUILD",
49
+ description: "The new build number for your app",
50
+ optional: false,
51
+ type: Numeric)
52
+ ]
53
+ end
54
+
55
+ def self.is_supported?(platform)
56
+ # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
57
+ # See: https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Platforms.md
58
+ #
59
+ # [:ios, :mac, :android].include?(platform)
60
+ true
61
+ end
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,30 @@
1
+ module Fastlane
2
+ module Farol
3
+ class Api
4
+ def request(token, verb, method, form_data = nil)
5
+ farolURL = 'https://frl.io:443'
6
+
7
+ # Create Cognito credentials
8
+ url = URI(farolURL + '/' + method)
9
+ Net::HTTP.start(url.host, url.port,
10
+ :use_ssl => url.scheme == 'https') do |http|
11
+
12
+ if verb == 'post'
13
+ request = Net::HTTP::Post.new url
14
+ request.set_form_data(form_data)
15
+ elsif verb == 'put'
16
+ request = Net::HTTP::Put.new url
17
+ else
18
+ request = Net::HTTP::Get.new url
19
+ end
20
+
21
+ request['authorization'] = token
22
+ response = http.request request # Net::HTTPResponse object
23
+ if verb == 'get'
24
+ return JSON.parse response.read_body
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module Farol
3
- VERSION = "0.1.0"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  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.1.0
4
+ version: 0.2.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-05-02 00:00:00.000000000 Z
11
+ date: 2017-05-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry
@@ -104,7 +104,10 @@ 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_get_version_action.rb
108
+ - lib/fastlane/plugin/farol/actions/farol_set_version_action.rb
107
109
  - lib/fastlane/plugin/farol/helper/farol_helper.rb
110
+ - lib/fastlane/plugin/farol/lib/farol.rb
108
111
  - lib/fastlane/plugin/farol/version.rb
109
112
  homepage: https://github.com/menvia/fastlane-plugin-farol
110
113
  licenses: