gemfury 0.12.0.rc1 → 0.12.0.rc2

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
  SHA256:
3
- metadata.gz: fa1399aeab2f739da48ef55e4a7a6654ce9bb8527d722a9b7ce022ac082f2c2f
4
- data.tar.gz: 176541eb909afc8610b8a4f94b3653dece97f898518a69fc137a7bd46533df25
3
+ metadata.gz: e6949b37b97e02f4d02cc09710a8f29c7bb73bc0cf11202e973472caeb304abb
4
+ data.tar.gz: 56f2d03905bb253df4aface03aeb4b2fb197c8cfd1078e5cb049653c23d30eb3
5
5
  SHA512:
6
- metadata.gz: c69342a8284196e6e43b9a3dc3bead88cfe17b2ae098db213d5055314d703aefada6e5df8f4cd3d08a8c6a413bc27f211bd8f8be3dd802f4a8000f3c35121666
7
- data.tar.gz: ed29f372dbec0526a614d2d8bb4ca8982ab47114a0c3d42857c4f06a480db690f7d9c898221b3be654b1e177f5d20f78382aa2069318a732b2a1ee08fb2ea71c
6
+ metadata.gz: b69e76e7cb6f0d3648d8f493c96e4f15c13b05d03d38a51021bbe20524e83f3eb5895cb15f049a6727d42b8908f78e62a7fd70af7b1041c5afcca0bcc49ad6f0
7
+ data.tar.gz: 3d2bbef2c9c9517db2a9b9ddc865baee2a8fa0929cedf9fb6450a945d9f6244923ef19708ba8ff0843063d099263ef63210662f7315329612b3f2f8ae33a942f
data/bin/fury CHANGED
@@ -7,4 +7,8 @@ require 'rubygems'
7
7
  require 'gemfury'
8
8
  require 'gemfury/command'
9
9
 
10
+ if defined?(Warning) && Warning.respond_to?('[]')
11
+ Warning[:deprecated] = !!ENV['DEBUG']
12
+ end
13
+
10
14
  Gemfury::Command::App.start
@@ -5,10 +5,23 @@ module Faraday
5
5
  # @private
6
6
  class Request::MultipartWithFile < Faraday::Middleware
7
7
  def call(env)
8
+
8
9
  if env[:body].is_a?(Hash)
10
+
11
+ # Check for IO (and IO-like objects, like Zip::InputStream) in the request,
12
+ # which represent data to be uploaded. Replace these with Faraday
9
13
  env[:body].each do |key, value|
10
- if value.is_a?(File)
11
- env[:body][key] = Faraday::UploadIO.new(value, mime_type(value), value.path)
14
+
15
+ # Faraday seems to expect a few IO methods to be available, but that's all:
16
+ # https://github.com/lostisland/faraday/blob/master/lib/faraday/file_part.rb
17
+ # :length seems to be an optional one
18
+ #
19
+ # UploadIO also seems to do a duck typing check for :read, with :path optional
20
+ # https://www.rubydoc.info/gems/multipart-post/2.0.0/UploadIO:initialize
21
+ #
22
+ # We attempt to make our duck typing compatible with their duck typing
23
+ if value.respond_to?(:read) && value.respond_to?(:rewind) && value.respond_to?(:close)
24
+ env[:body][key] = Faraday::UploadIO.new(value, mime_type(value))
12
25
  end
13
26
  end
14
27
  end
@@ -19,6 +32,9 @@ module Faraday
19
32
  private
20
33
 
21
34
  def mime_type(file)
35
+ default = 'application/octet-stream'
36
+ return default unless file.respond_to?(:path)
37
+
22
38
  case file.path
23
39
  when /\.jpe?g/i
24
40
  'image/jpeg'
@@ -27,7 +43,7 @@ module Faraday
27
43
  when /\.png$/i
28
44
  'image/png'
29
45
  else
30
- 'application/octet-stream'
46
+ default
31
47
  end
32
48
  end
33
49
  end
@@ -10,6 +10,9 @@ class Gemfury::Command::App < Thor
10
10
  class_option :as, :desc => 'Access an account other than your own'
11
11
  class_option :api_token, :desc => 'API token to use for commands'
12
12
 
13
+ # Make sure we retain the default exit behaviour of 0 even on argument errors
14
+ def self.exit_on_failure?; false; end
15
+
13
16
  map "-v" => :version
14
17
  desc "version", "Show Gemfury version", :hide => true
15
18
  def version
@@ -198,7 +201,7 @@ class Gemfury::Command::App < Thor
198
201
  end
199
202
  end
200
203
 
201
- desc "git:rename", "Rename a Git repository"
204
+ desc "git:rename REPO_NAME NEW_NAME", "Rename a Git repository"
202
205
  def git_rename(repo, new_name)
203
206
  with_checks_and_rescues do
204
207
  client.git_update(repo, :repo => { :name => new_name })
@@ -206,7 +209,7 @@ class Gemfury::Command::App < Thor
206
209
  end
207
210
  end
208
211
 
209
- desc "git:reset", "Remove a Git repository"
212
+ desc "git:reset REPO_NAME", "Remove a Git repository"
210
213
  def git_reset(repo)
211
214
  with_checks_and_rescues do
212
215
  client.git_reset(repo)
@@ -214,7 +217,7 @@ class Gemfury::Command::App < Thor
214
217
  end
215
218
  end
216
219
 
217
- desc "git:rebuild", "Rebuild a Git repository"
220
+ desc "git:rebuild REPO_NAME", "Rebuild a Git repository"
218
221
  method_options %w(revision -r) => :string
219
222
  def git_rebuild(repo)
220
223
  with_checks_and_rescues do
@@ -229,7 +232,7 @@ class Gemfury::Command::App < Thor
229
232
  map 'git:config:set' => 'git_config_set'
230
233
  map 'git:config:unset' => 'git_config_unset'
231
234
 
232
- desc "git:config", "List Git repository's build environment"
235
+ desc "git:config REPO_NAME", "List Git repository's build environment"
233
236
  def git_config(repo)
234
237
  with_checks_and_rescues do
235
238
  vars = client.git_config(repo)['config_vars']
@@ -240,7 +243,7 @@ class Gemfury::Command::App < Thor
240
243
  end
241
244
  end
242
245
 
243
- desc "git:config:set", "Update Git repository's build environment"
246
+ desc "git:config:set REPO_NAME KEY=VALUE ...", "Update Git repository's build environment"
244
247
  def git_config_set(repo, *vars)
245
248
  with_checks_and_rescues do
246
249
  updates = Hash[vars.map { |v| v.split("=", 2) }]
@@ -249,7 +252,7 @@ class Gemfury::Command::App < Thor
249
252
  end
250
253
  end
251
254
 
252
- desc "git:config:unset", "Remove variables from Git repository's build environment"
255
+ desc "git:config:unset REPO_NAME KEY ...", "Remove variables from Git repository's build environment"
253
256
  def git_config_unset(repo, *vars)
254
257
  with_checks_and_rescues do
255
258
  updates = Hash[vars.map { |v| [v, nil] }]
@@ -1,3 +1,3 @@
1
1
  module Gemfury
2
- VERSION = '0.12.0.rc1'
2
+ VERSION = '0.12.0.rc2'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gemfury
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.0.rc1
4
+ version: 0.12.0.rc2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Rykov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-08 00:00:00.000000000 Z
11
+ date: 2020-08-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_json