Skip to content

Commit

Permalink
Fix the protocol option to work when no host is explicitly given; Oth…
Browse files Browse the repository at this point in the history
…er minor tweaks

* Bumped voog_api version to 0.0.9 due to a bug fix
* Fixed how the protocol option is set when no host is given via the command-line flag
* Finally read overwrite value from config file
* Typo in dtk.rb
  • Loading branch information
mikkpr committed Feb 9, 2016
1 parent 8112ea2 commit 2a7bb0b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 12 deletions.
21 changes: 13 additions & 8 deletions bin/kit
Original file line number Diff line number Diff line change
Expand Up @@ -265,16 +265,20 @@ pre do |global, command, options, args|
api_token = global.fetch(:token, nil) || options.fetch(:token, nil)

# check if protocol is provided with the host URL
matched_protocol = host.match(/^https?:\/\//)
if (matched_protocol)
protocol_string = matched_protocol[0].slice(0, matched_protocol[0].length-3)
if options.fetch(:protocol, '').empty?
protocol = protocol_string
if host
matched_protocol = host.match(/^https?:\/\//)
if (matched_protocol)
protocol_string = matched_protocol[0].slice(0, matched_protocol[0].length-3)
if options.fetch(:protocol, '').empty?
protocol = protocol_string
else
protocol = options.fetch(:protocol)
end
protocol = protocol.empty? ? protocol_string : protocol
host = host.slice(matched_protocol[0].length, host.length)
else
protocol = options.fetch(:protocol)
protocol = options.fetch(:protocol, '').empty? ? 'http' : options.fetch(:protocol)
end
protocol = protocol.empty? ? protocol_string : protocol
host = host.slice(matched_protocol[0].length, host.length)
else
protocol = options.fetch(:protocol, '').empty? ? 'http' : options.fetch(:protocol)
end
Expand Down Expand Up @@ -304,6 +308,7 @@ pre do |global, command, options, args|

host ||= @config[:host]
api_token ||= @config[:api_token]
overwrite ||= @config[:overwrite]

client = Voog::Client.new(host, api_token, protocol: protocol, raise_on_error: true)
@filemanager = Voog::Dtk::FileManager.new(client, {
Expand Down
2 changes: 1 addition & 1 deletion lib/voog/dtk.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'voog/dtk/version'
require 'parseconfig'
require 'prettyprint'
require 'pp'

module Voog
module Dtk
Expand Down
2 changes: 1 addition & 1 deletion lib/voog/dtk/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Voog
module Dtk
VERSION = '0.5.0'
VERSION = '0.5.1'
end
end
4 changes: 2 additions & 2 deletions voog-kit.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'rake'
spec.add_development_dependency 'rspec'
spec.add_development_dependency 'guard-rspec'

spec.add_runtime_dependency 'gli', '2.10.0'

spec.add_runtime_dependency 'pry'
spec.add_runtime_dependency 'listen', '~> 3.0'
spec.add_runtime_dependency 'git'
spec.add_runtime_dependency 'parseconfig'
spec.add_runtime_dependency 'voog_api', '~> 0.0.8'
spec.add_runtime_dependency 'voog_api', '~> 0.0.9'
spec.add_runtime_dependency 'colorize'
spec.add_runtime_dependency 'mime-types', '>= 1.25.1', '< 3.0'
spec.add_runtime_dependency 'rb-readline'
Expand Down

0 comments on commit 2a7bb0b

Please sign in to comment.