fastlane-plugin-apphoster 1.0.0 → 1.1.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: 199c4a392b47f503dc39905559c316e791bfe9fd05160ced11f30c4c86b8d719
4
- data.tar.gz: ee1859ec541cd6c1cc2ff6a742ea59fe214685177b8dc74658dc2c092aa51347
3
+ metadata.gz: 7a03b8d07e5f19242514cc9997778c814835fe16ce0044e9420a64b1565030bd
4
+ data.tar.gz: 36d522e4f1811e4aea38b3abb55ea890867c8cd15abd90a954e61591d8341ec9
5
5
  SHA512:
6
- metadata.gz: 55f42bc01161935a45e8a1b3e6628e90f958e726a5bb8b9cf8b30f007cf82a44dd23f2ec32c96ca5aa9d8c759045e71f12a1236144199d676ce746fa656a0276
7
- data.tar.gz: a51150ddc385544ce82dd751f56a33595cb679ec640c9ccfaad8871fed592d697e9fa2b96c04282b94783e02cc11c3ccf29f7b0b267e6e34bad774f8e34db6f7
6
+ metadata.gz: 0fad2f81aa3d4c01aa31b961184f8ca2aa6f4def70d816ff707f95773178bd62d93236d96bdc9124a93923a7c9727133ba4d1065533eb227629717306bfb3efe
7
+ data.tar.gz: a9990a9b20a336697a22d064a4a95c242449922edd33e9a2e9ac649ed268e87d19918b4cd95d664a45e88a4427371bff9f27606df339925571d978cff39237a5
data/README.md CHANGED
@@ -12,15 +12,30 @@ fastlane add_plugin apphoster
12
12
 
13
13
  ## About apphoster
14
14
 
15
- A simple plugin to upload your ipa file to AppHost Server in fastlane.
15
+ A simple plugin to upload your ipa file to [app-host](https://github.com/pluosi/app-host) Server in fastlane.
16
16
 
17
17
  **Note to author:** Add a more detailed description about this plugin here. If your plugin contains multiple actions, make sure to mention them here.
18
18
 
19
19
  ## Example
20
20
 
21
- 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`.
21
+ if youur project use fastlane to build ipa file (just supported iOS file now) , and use app-host sever to upload ipa file to install app.
22
22
 
23
- **Note to author:** Please set up a sample project to make it easy for users to explore what your plugin does. Provide everything that is necessary to try out the plugin in this project (including a sample Xcode/Android project if necessary)
23
+ ```
24
+ fastlane add_plugin apphoster
25
+ ```
26
+
27
+ ```
28
+ lane :beta do
29
+ build_app(export_method: "ad-hoc")
30
+ apphoster(api_host: "https://xxx.com, token: "your app-host token", plat_id: "your plat_id")
31
+ end
32
+ ```
33
+
34
+ ```
35
+ fastlane beta
36
+ ```
37
+
38
+ now you can auto build a ad-hoc ipa file and auto upload to app-host sever
24
39
 
25
40
  ## Run tests for this plugin
26
41
 
@@ -1,5 +1,7 @@
1
1
  require 'fastlane/action'
2
2
  require_relative '../helper/apphoster_helper'
3
+ require 'rest-client'
4
+ require 'json'
3
5
 
4
6
  module Fastlane
5
7
  module Actions
@@ -25,21 +27,38 @@ module Fastlane
25
27
  if file_nick_name.nil?
26
28
  file_nick_name = ""
27
29
  end
28
-
29
- run_script = "curl --form plat_id=36 --form token=#{token} --form file=@#{build_file} #{api_host}"
30
- if file_nick_name != 0
31
- run_script = "curl --form plat_id=36 --form file_nick_name=#{file_nick_name} --form token=#{token} --form file=@#{build_file} #{api_host}"
30
+
31
+ ipa_host = params[:ipa_host]
32
+ if ipa_host.nil?
33
+ ipa_host = ""
32
34
  end
33
35
 
34
- UI.message "Begin run script #{run_script}"
35
36
  UI.message "Start upload #{build_file} to #{api_host}..."
36
-
37
- system(run_script)
38
- # response = JSON.parse(info)
39
- # if response['error'] != 0
40
- # UI.user_error!("Apphost Plugin Error: #{response['error']}")
41
- # end
42
- UI.success "Upload process finish"
37
+
38
+ response = RestClient::Request.execute(
39
+ method: :post,
40
+ url: url,
41
+ payload: {
42
+ token: token,
43
+ plat_id: plat_id,
44
+ :multipart => true,
45
+ :file => File.new(build_file, 'rb')
46
+ },
47
+ )
48
+ json = JSON.parse(response.body)
49
+ error = json["error"]
50
+ if error.nil?
51
+ ipa_id = json["id"]
52
+ name = json["name"]
53
+ install_url = "#{ipa_host}#{ipa_id}"
54
+ if ipa_host.empty?
55
+ UI.success "#{name} upload success install ipa_id is #{ipa_id}"
56
+ else
57
+ UI.success "#{name} upload success install url is #{install_url}"
58
+ end
59
+ else
60
+ UI.user_error!("upload error : #{json["error"]}")
61
+ end
43
62
 
44
63
  end
45
64
 
@@ -82,6 +101,11 @@ module Fastlane
82
101
  description: "Your file nick name",
83
102
  optional: true,
84
103
  type: String),
104
+ FastlaneCore::ConfigItem.new(key: :ipa_host,
105
+ env_name: "Ipa_host",
106
+ description: "ipa host to replace like xxx.com/ipa/pkgs/100 that is your install url",
107
+ optional: true,
108
+ type: String),
85
109
  FastlaneCore::ConfigItem.new(key: :ipa,
86
110
  env_name: "AppHost_IPA",
87
111
  description: "Path to your IPA file",
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module Apphoster
3
- VERSION = "1.0.0"
3
+ VERSION = "1.1.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-apphoster
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - JerryFans