Class: DPL::Provider::PyPI
Constant Summary
collapse
- DEFAULT_SERVER =
'http://www.python.org/pypi'
- PYPIRC_FILE =
'~/.pypirc'
Instance Attribute Summary
#context, #options
Class Method Summary
collapse
Instance Method Summary
collapse
#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
Class Method Details
7
8
9
|
# File 'lib/dpl/provider/pypi.rb', line 7
def self.install_setuptools
shell 'wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py -O - | sudo python'
end
|
Instance Method Details
#check_app ⇒ Object
52
53
|
# File 'lib/dpl/provider/pypi.rb', line 52
def check_app
end
|
#check_auth ⇒ Object
47
48
49
50
|
# File 'lib/dpl/provider/pypi.rb', line 47
def check_auth
write_config
log "Authenticated as #{option(:user)}"
end
|
#config ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/dpl/provider/pypi.rb', line 13
def config
{
:header => '[distutils]',
:servers_line => 'index-servers =',
:servers => {
'pypi' => [
"repository: #{options[:server] || DEFAULT_SERVER}",
"username: #{option(:user)}",
"password: #{option(:password)}",
]
}
}
end
|
#needs_key? ⇒ Boolean
55
56
57
|
# File 'lib/dpl/provider/pypi.rb', line 55
def needs_key?
false
end
|
#push_app ⇒ Object
59
60
61
62
63
|
# File 'lib/dpl/provider/pypi.rb', line 59
def push_app
context.shell "python setup.py register -r #{options[:server] || 'pypi'}"
context.shell "python setup.py #{options[:distributions] || 'sdist'} upload -r #{options[:server] || 'pypi'}"
context.shell "python setup.py upload_docs --upload-dir #{options[:docs_dir] || 'build/docs'}"
end
|
#write_config ⇒ Object
38
39
40
41
42
43
44
45
|
# File 'lib/dpl/provider/pypi.rb', line 38
def write_config
File.open(File.expand_path(PYPIRC_FILE), 'w') do |f|
config.each do |key, val|
f.puts(val) if val.is_a? String or val.is_a? Array
end
write_servers(f)
end
end
|
#write_servers(f) ⇒ Object
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/dpl/provider/pypi.rb', line 27
def write_servers(f)
config[:servers].each do |key, val|
f.puts " " * 4 + key
end
config[:servers].each do |key, val|
f.puts "[#{key}]"
f.puts val
end
end
|