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

#cleanup, context, #create_key, #deploy, #error, experimental, #initialize, #log, new, npm_g, #option, pip, requires, #run, #setup_git_ssh, #sha, shell, #uncleanup

Constructor Details

This class inherits a constructor from DPL::Provider

Instance Method Details

#check_appObject



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

def check_app
end

#check_authObject



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

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

#needs_key?Boolean

Returns:

  • (Boolean)


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

def needs_key?
  false
end

#push_appObject



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

def push_app
  context.shell "npm publish --force"
end

#setup_authObject



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

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