Sha256: 5996ede24c830e0005340576b69b1c4e06d31a93d38102b741084947b7d7cac6
Contents?: true
Size: 1.14 KB
Versions: 3
Compression:
Stored size: 1.14 KB
Contents
require 'json' module DPL class Provider class NPM < Provider NPMRC_FILE = '~/.npmrc' DEFAULT_NPM_REGISTRY = 'registry.npmjs.org' def needs_key? false end def check_app end def setup_auth file = File.open(File.expand_path(NPMRC_FILE), 'w') file.puts("//#{package_registry}/:_authToken=${NPM_API_KEY}") file.flush end def check_auth setup_auth log "Authenticated with email #{option(:email)}" end def push_app log "NPM API key format changed recently. If your deployment fails, check your API key in ~/.npmrc." log "http://docs.travis-ci.com/user/deployment/npm/" context.shell "env NPM_API_KEY=#{option(:api_key)} npm publish" FileUtils.rm(File.expand_path(NPMRC_FILE)) end def package_registry if File.exists?('package.json') data = JSON.parse(File.read('package.json')) if data['publishConfig'] && data['publishConfig']['registry'] return data['publishConfig']['registry'] end end DEFAULT_NPM_REGISTRY end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
dpl-1.7.21.travis.958.4 | lib/dpl/provider/npm.rb |
dpl-1.7.20 | lib/dpl/provider/npm.rb |
dpl-1.7.20.travis.956.4 | lib/dpl/provider/npm.rb |