dpl 2.0.0.alpha.8 → 2.0.0.alpha.9

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: 8626f9f9647e9b3dd0b9398323d8a3b2a89e017d
4
- data.tar.gz: b23f6733a4989c87abf3e8c01812e686698e0ced
3
+ metadata.gz: 0ffe98f5b9f3ce0ca191cf682cef66a9ce40d9ca
4
+ data.tar.gz: c6f078c0327bdc898dacce86ba58146d40b1c59e
5
5
  SHA512:
6
- metadata.gz: f2d6e4649834d5108f1bd01e8e42cd920c40b4e295099407989ec1919503a863dd3551bd5b8302419ba0a24b8e119ea30218d45d8c0fb2f4f258df245b3faa89
7
- data.tar.gz: 2ceda8a5f92878c9913c337d53f4e8622e8d042155a228f0cb9c17b57ea32cb768f3fd2818a544c399844751c81cdcc4b505b610277216ffeaa452a4787032ab
6
+ metadata.gz: 6ea460e362dc45fde1bc1c6bf2b4712e3e1b33d78720323cbaac8a5168b0bfc69c7fdbc3ae723441ee7f61f881f19d5baadff123da9ea0c1561a572c8a847ad6
7
+ data.tar.gz: '097250f7c7aae96be417e826b5b50ac724b3046dd3cbc5ad38bf4ca7c2e74a8458de1bf8a397696ffc6b5953e0bb2e2265cd922f417c9225dd3e3f56e17b1532'
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dpl (2.0.0.alpha.7)
4
+ dpl (2.0.0.alpha.8)
5
5
  cl (~> 1.0)
6
6
 
7
7
  GEM
@@ -21,7 +21,7 @@ module Dpl
21
21
  opt '--tag TAGS', 'distribution tags to add'
22
22
  opt '--auth_method METHOD', 'Authentication method', enum: %w(auth)
23
23
 
24
- REGISTRY = 'registry.npmjs.org'
24
+ REGISTRY = 'https://registry.npmjs.org'
25
25
  NPMRC = '~/.npmrc'
26
26
 
27
27
  msgs version: 'npm version: %{npm_version}',
@@ -71,15 +71,32 @@ module Dpl
71
71
  if npm_version =~ /^1/ || auth_method == 'auth'
72
72
  "_auth = #{api_token}\nemail = #{email}"
73
73
  else
74
- "//#{host(registry).sub('https://', '').sub(%r(/$), '')}/:_authToken=#{api_token}"
74
+ "//#{auth_endpoint}/:_authToken=#{api_token}"
75
75
  end
76
76
  end
77
77
 
78
+ def auth_endpoint
79
+ str = registry
80
+ str = strip_path(str) if str.include?('npm.pkg.github.com')
81
+ str = strip_protocol(str).sub(%r(/$), '')
82
+ str
83
+ end
84
+
78
85
  def registry
79
- return super if super
80
- data = package_json
81
- url = data && data.fetch('publishConfig', {})['registry']
82
- url ? host(url) : REGISTRY
86
+ super || registry_from_package_json || REGISTRY
87
+ end
88
+
89
+ def registry_from_package_json
90
+ return unless data = package_json
91
+ data && data.fetch('publishConfig', {})['registry']
92
+ end
93
+
94
+ def strip_path(url)
95
+ url.sub(URI(url).path, '')
96
+ end
97
+
98
+ def strip_protocol(url)
99
+ url.sub("#{URI(url).scheme}://", '')
83
100
  end
84
101
 
85
102
  def host(url)
@@ -1,3 +1,3 @@
1
1
  module Dpl
2
- VERSION = '2.0.0.alpha.8'
2
+ VERSION = '2.0.0.alpha.9'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dpl
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.alpha.8
4
+ version: 2.0.0.alpha.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Konstantin Haase
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2019-10-02 00:00:00.000000000 Z
13
+ date: 2019-10-03 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: cl