fastlane-plugin-redmine_upload 0.2.0 → 0.3.14
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0bfa6c9c8ff32c541655486992fe24751830df14
|
4
|
+
data.tar.gz: 7b56fe7a7683513e9ed58c62b07c0ffcffc690f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 12b35b254345d6fc5ae712f33f982fa8228476951630a291999ca00da631b28635be9e47cd9ed87bee377d87dcebe922434a5fef9c692702d058905c2fc92176
|
7
|
+
data.tar.gz: 69bb96cad2158ae158ede0812b8a2753ffaf8c34f4d1bca174191dee21265172f8f523eb0e2c2534259c489d2b2a4d8ea0a6cc70879fc1c180036e0d6da9d2d5
|
@@ -3,7 +3,6 @@ module Fastlane
|
|
3
3
|
class RedmineFilePostAction < Action
|
4
4
|
def self.run(params)
|
5
5
|
require 'net/http'
|
6
|
-
require 'net/http/uploadprogress'
|
7
6
|
require 'uri'
|
8
7
|
require 'json'
|
9
8
|
|
@@ -13,42 +12,54 @@ module Fastlane
|
|
13
12
|
password = params[:redmine_password]
|
14
13
|
project = params[:redmine_project]
|
15
14
|
token = params[:file_token]
|
15
|
+
file_name = params[:file_name]
|
16
16
|
file_version = params[:file_version]
|
17
17
|
file_description = params[:file_description]
|
18
18
|
|
19
|
-
|
19
|
+
upload_file_uri = URI.parse(redmine_url + "/projects/#{project}/files.json")
|
20
20
|
# prepare request with token previously got from upload
|
21
|
+
|
21
22
|
json_content = {
|
22
|
-
"file" =>
|
23
|
-
"token" => token
|
24
|
-
"filename" => file_name,
|
25
|
-
"version" => file_version,
|
26
|
-
"description" => file_description
|
23
|
+
"file" => {
|
24
|
+
"token" => token
|
27
25
|
}
|
28
26
|
}
|
27
|
+
|
28
|
+
if file_version != nil
|
29
|
+
json_content["file"]["version_id"] = file_version
|
30
|
+
end
|
31
|
+
if file_name != nil
|
32
|
+
json_content["file"]["filename"] = file_name
|
33
|
+
end
|
34
|
+
if file_description != nil
|
35
|
+
json_content["file"]["description"] = file_description
|
36
|
+
end
|
37
|
+
|
29
38
|
file_body = JSON.pretty_generate(json_content)
|
30
39
|
UI.message("File post with content #{file_body}")
|
31
40
|
|
32
41
|
# Create the HTTP objects
|
33
42
|
http_file_post = Net::HTTP.new(upload_file_uri.host, upload_file_uri.port)
|
34
|
-
request_file =
|
43
|
+
request_file = Net::HTTP::Post.new(upload_file_uri.request_uri)
|
35
44
|
|
36
45
|
request_file["Content-Type"] = "application/json"
|
37
46
|
unless api_key.nil?
|
38
|
-
|
47
|
+
request_file["X-Redmine-API-Key"] = api_key.to_s
|
39
48
|
end
|
40
49
|
unless username.nil? || password.nil?
|
41
|
-
|
50
|
+
request_file.basic_auth(username, password)
|
42
51
|
end
|
43
52
|
|
44
|
-
|
53
|
+
request_file.body = file_body
|
54
|
+
# Send the request
|
55
|
+
request_file = http_file_post.request(request_file)
|
56
|
+
|
57
|
+
case request_file
|
45
58
|
when Net::HTTPSuccess
|
46
59
|
UI.success("File uploaded successfully")
|
47
|
-
when Net::HTTPRedirection
|
48
|
-
|
49
60
|
else
|
50
|
-
UI.error(
|
51
|
-
|
61
|
+
UI.error(request_file.value)
|
62
|
+
end
|
52
63
|
end
|
53
64
|
|
54
65
|
def self.description
|
@@ -100,6 +111,11 @@ module Fastlane
|
|
100
111
|
description: "Token of file previously released",
|
101
112
|
optional: false,
|
102
113
|
type: String),
|
114
|
+
FastlaneCore::ConfigItem.new(key: :file_name,
|
115
|
+
env_name: "FILE_NAME",
|
116
|
+
description: "FIle name",
|
117
|
+
optional: false,
|
118
|
+
type: String),
|
103
119
|
FastlaneCore::ConfigItem.new(key: :file_version,
|
104
120
|
env_name: "FILE_VERSION",
|
105
121
|
description: "Version of file",
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-redmine_upload
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mattia Salvetti
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-09-
|
11
|
+
date: 2018-09-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|
@@ -136,6 +136,20 @@ dependencies:
|
|
136
136
|
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: 2.104.0
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: net-http-uploadprogress
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - '='
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: 2.0.0
|
146
|
+
type: :runtime
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - '='
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: 2.0.0
|
139
153
|
description:
|
140
154
|
email: mattia.salvetti3@gmail.it
|
141
155
|
executables: []
|