lib/dpl/providers/npm.rb in dpl-2.0.0.alpha.7 vs lib/dpl/providers/npm.rb in dpl-2.0.0.alpha.8

- old
+ new

@@ -1,9 +1,9 @@ module Dpl module Providers class Npm < Provider - status :alpha + status :beta full_name 'npm' description sq(<<-str) tbd @@ -69,18 +69,22 @@ def npmrc if npm_version =~ /^1/ || auth_method == 'auth' "_auth = #{api_token}\nemail = #{email}" else - "//#{registry.sub('https://', '').sub(%r(/$), '')}/:_authToken=#{api_token}" + "//#{host(registry).sub('https://', '').sub(%r(/$), '')}/:_authToken=#{api_token}" end end def registry return super if super data = package_json url = data && data.fetch('publishConfig', {})['registry'] - url ? URI(url).host : REGISTRY + url ? host(url) : REGISTRY + end + + def host(url) + URI(url).host end def package_json File.exists?('package.json') ? JSON.parse(File.read('package.json')) : {} end