Class: DPL::Provider::NPM

Inherits:
DPL::Provider show all
Defined in:
lib/dpl/provider/npm.rb

Constant Summary collapse

NPMRC_FILE =
'~/.npmrc'

Instance Attribute Summary

Attributes inherited from DPL::Provider

#context, #options

Instance Method Summary collapse

Methods inherited from DPL::Provider

apt_get, #cleanup, #commit_msg, context, #create_key, #deploy, #detect_encoding?, #encoding_for, #error, experimental, #initialize, #log, new, npm_g, #option, pip, requires, #run, #setup_git_credentials, #setup_git_ssh, #sha, shell, #uncleanup, #warn

Constructor Details

This class inherits a constructor from DPL::Provider

Instance Method Details

#check_appObject



10
11
# File 'lib/dpl/provider/npm.rb', line 10

def check_app
end

#check_authObject



20
21
22
23
# File 'lib/dpl/provider/npm.rb', line 20

def check_auth
  setup_auth
  log "Authenticated with email #{option(:email)}"
end

#needs_key?Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/dpl/provider/npm.rb', line 6

def needs_key?
  false
end

#push_appObject



25
26
27
# File 'lib/dpl/provider/npm.rb', line 25

def push_app
  context.shell "npm publish"
end

#setup_authObject



13
14
15
16
17
18
# File 'lib/dpl/provider/npm.rb', line 13

def setup_auth
  File.open(File.expand_path(NPMRC_FILE), 'w') do |f|
    f.puts("_auth = #{option(:api_key)}")
    f.puts("email = #{option(:email)}")
  end
end