fastlane-plugin-import_from_url 0.1.5 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b0fb88e9c5b461a841b6eefe5fab4a3db2ef1394fd86138a83fe90b655f12ab4
4
- data.tar.gz: 680a26aec79a96e0862536111abf4a4aa502c44c6060c4c05ef7ff9e10040941
3
+ metadata.gz: 2eac70ee1c368f97c08131a9df3a074c1ed573dc1096b1398bbbe88c45c4c6a0
4
+ data.tar.gz: de8e31fc344683f7ae55156af2fe8768ee7cd47a83c9ec9b51d1fffaccdbad47
5
5
  SHA512:
6
- metadata.gz: 9c3775b8dd6bbcdf63b0ed9d61b363e94cacd50deb421c8e2898530e432468d9428bedca5769f326c9c1101c38e1a28b39c8579fa1bc19b50f00f04b6b8321f5
7
- data.tar.gz: 814b2f8426279a04cfa8614494ef9af9c5acf17bd528715ba795e5f4d1ce3abd4dcf2bb5bec1df05973c9ca05dbce5bb6ee4f87ab5c75b9c8ed3e681b5e0fa74
6
+ metadata.gz: 53fb8b0838d9638d2d71adad05289c09871a6160b01274be3ef1d989cdee2a088b9768b01323f3f3197fcfb48584dc55707c01ecabe6081e55cf3997f60d8c13
7
+ data.tar.gz: 985e1260f38f3558bad6ada1250e2bc582f6cf00e43bb7c51b304fdf8681b26ddc3cb9be07aa6b1ac4c1f2070ddfcb14cdf5b46077959dce8ad18be10dabdbce
data/README.md CHANGED
@@ -1,8 +1,9 @@
1
1
  # import_from_url plugin
2
2
 
3
3
  [![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-import_from_url)
4
- [![Build Status](https://github.com/dorukkangal/fastlane-plugin-import_from_url/workflows/build/badge.svg)](https://github.com/dorukkangal/fastlane-plugin-import_from_url/actions)
5
- [![Build Status](https://travis-ci.com/dorukkangal/fastlane-plugin-import_from_url.svg?branch=master)](https://travis-ci.com/dorukkangal/fastlane-plugin-import_from_url)
4
+ [![Github Actions](https://github.com/dorukkangal/fastlane-plugin-import_from_url/workflows/build/badge.svg)](https://github.com/dorukkangal/fastlane-plugin-import_from_url/actions)
5
+ [![CircleCi](https://circleci.com/gh/circleci/circleci-docs.svg?style=shield)](https://app.circleci.com/pipelines/github/dorukkangal/fastlane-plugin-import_from_url/)
6
+ [![Travis](https://travis-ci.com/dorukkangal/fastlane-plugin-import_from_url.svg?branch=master)](https://travis-ci.com/dorukkangal/fastlane-plugin-import_from_url)
6
7
 
7
8
  ## Getting Started
8
9
 
@@ -1,113 +1,116 @@
1
1
  require 'fastlane/action'
2
- require_relative '../helper/import_from_url_helper'
3
2
  require 'uri'
4
3
  require 'open-uri'
5
4
  require 'fileutils'
5
+ require_relative '../helper/import_from_url_helper'
6
6
 
7
7
  module Fastlane
8
8
  module Actions
9
9
  class ImportFromUrlAction < Action
10
- def self.run(params)
11
- url_address ||= params[:url]
12
- download_path ||= params[:path]
13
- file_name ||= params[:file_name]
14
-
15
- if valid_url(url_address)
16
- file_path = download_fast_file(url_address, download_path, file_name)
17
- # Fastlane::Actions::ImportAction.run(file_path)
18
- Fastlane::FastFile.new.import(file_path)
19
- else
20
- UI.user_error!("The url address #{url_address} is not valid.")
10
+ attr_reader :url_address, :download_path, :file_name, :file_path
11
+
12
+ class << self
13
+ def run(params)
14
+ new(params).import
15
+ end
16
+
17
+ def available_options
18
+ [
19
+ FastlaneCore::ConfigItem.new(
20
+ key: :url,
21
+ env_name: "IMPORT_FROM_URL",
22
+ description: "The url address of the Fastfile to use its lanes",
23
+ optional: false,
24
+ type: String
25
+ ),
26
+
27
+ FastlaneCore::ConfigItem.new(
28
+ key: :file_name,
29
+ env_name: "IMPORT_FROM_FILE_NAME",
30
+ description: "The name of the file to be downloaded",
31
+ optional: true,
32
+ type: String
33
+ ),
34
+
35
+ FastlaneCore::ConfigItem.new(
36
+ key: :path,
37
+ env_name: "IMPORT_FROM_FILE_NAME",
38
+ description: "The path of the file to be downloaded",
39
+ optional: true,
40
+ type: String
41
+ )
42
+ ]
43
+ end
44
+
45
+ def authors
46
+ ["Doruk Kangal"]
47
+ end
48
+
49
+ def description
50
+ "Import another Fastfile from given url to use its lanes"
51
+ end
52
+
53
+ def details
54
+ "This is useful if you have shared lanes across multiple apps and you want to store a Fastfile in a url"
55
+ end
56
+
57
+ def example_code
58
+ "import_from_url(
59
+ url: '<the url of the Fastfile to be downloaded>', # Required and cannot be empty,
60
+ path: '<the path of the Fastfile to be downloaded>', # Optional and default is fastlane/.cache
61
+ file_name: '<the name of the Fastfile to be downloaded>' # Optional and default is DownloadedFastfile
62
+ )"
21
63
  end
22
64
  end
23
65
 
24
- def self.download_fast_file(url_address, download_path, file_name)
66
+ def initialize(params)
67
+ @url_address = params[:url]
68
+ @download_path = params[:path]
69
+ @file_name = params[:file_name]
70
+ end
71
+
72
+ def import
73
+ return UI.user_error!("The url address #{url_address} is not valid.") unless url_valid?
74
+
75
+ download_fast_file
76
+ import_to_fastlane
77
+ end
78
+
79
+ private
80
+
81
+ def import_to_fastlane
82
+ Fastlane::FastFile.new.import(file_path)
83
+ end
84
+
85
+ def download_fast_file
25
86
  puts("Downloading from #{url_address}")
26
87
 
27
- download_path = 'fastlane/.cache' if download_path.nil? || download_path.empty?
28
- file_name = 'DownloadedFastfile' if file_name.nil? || file_name.empty?
88
+ download_path ||= 'fastlane/.cache'
89
+ file_name ||= 'DownloadedFastfile'
29
90
 
30
91
  Dir.mkdir(download_path) unless Dir.exist?(download_path)
31
92
  download_dir = Dir.open(download_path)
32
- file_path = File.join(Dir.pwd, download_dir.path, file_name)
93
+ @file_path = File.join(Dir.pwd, download_dir.path, file_name)
33
94
 
34
95
  begin
35
96
  download = open(url_address)
36
97
  IO.copy_stream(download, file_path)
37
- file_path
38
98
  rescue => err
39
99
  UI.user_error!("An exception occurred while downloading Fastfile from #{url_address} -> #{err}")
40
100
  err
41
101
  end
42
102
  end
43
103
 
44
- def self.valid_url(url)
45
- if url.nil? || url.empty?
46
- false
47
- end
104
+ def url_valid?
105
+ return false if url_address.nil?
48
106
 
49
107
  begin
50
- uri = URI.parse(url)
108
+ uri = URI.parse(url_address)
51
109
  uri.host && uri.kind_of?(URI::HTTP)
52
110
  rescue URI::InvalidURIError
53
111
  false
54
112
  end
55
113
  end
56
-
57
- def self.available_options
58
- [
59
- FastlaneCore::ConfigItem.new(key: :url,
60
- env_name: "IMPORT_FROM_URL",
61
- description: "The url address of the Fastfile to use its lanes",
62
- optional: false,
63
- type: String),
64
-
65
- FastlaneCore::ConfigItem.new(key: :file_name,
66
- env_name: "IMPORT_FROM_FILE_NAME",
67
- description: "The name of the file to be downloaded",
68
- optional: true,
69
- type: String),
70
-
71
- FastlaneCore::ConfigItem.new(key: :path,
72
- env_name: "IMPORT_FROM_FILE_NAME",
73
- description: "The path of the file to be downloaded",
74
- optional: true,
75
- type: String)
76
- ]
77
- end
78
-
79
- def self.description
80
- "Import another Fastfile from given url to use its lanes"
81
- end
82
-
83
- def self.authors
84
- ["Doruk Kangal"]
85
- end
86
-
87
- def self.return_value
88
- # If your method provides a return value, you can describe here what it does
89
- end
90
-
91
- def self.details
92
- # Optional:
93
- "This is useful if you have shared lanes across multiple apps and you want to store a Fastfile in a url"
94
- end
95
-
96
- def self.is_supported?(platform)
97
- # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
98
- # See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
99
- #
100
- # [:ios, :mac, :android].include?(platform)
101
- true
102
- end
103
-
104
- def self.example_code
105
- "import_from_url(
106
- url: '<the url of the Fastfile to be downloaded>', # Required and cannot be empty,
107
- path: '<the path of the Fastfile to be downloaded>', # Optional and default is fastlane/.cache
108
- file_name: '<the name of the Fastfile to be downloaded>' # Optional and default is DownloadedFastfile
109
- )"
110
- end
111
114
  end
112
115
  end
113
116
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module ImportFromUrl
3
- VERSION = "0.1.5"
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-import_from_url
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Doruk Kangal
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-01 00:00:00.000000000 Z
11
+ date: 2020-11-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry