class DeployDply::Venv

Attributes

helper[W]

Public Instance Methods

build(system_site_packages: false, pip_version: "8.1.2", setuptools_version: "28.7.1") { || ... } click to toggle source
# File lib/deploy_dply/venv.rb, line 14
def build(system_site_packages: false, pip_version: "8.1.2", setuptools_version: "28.7.1", &block)
  FileUtils.mkdir_p "tmp/venv"
  helper.sh "ln -sf tmp/venv -T venv"
  init
  update_pip_setuptools(pip_version, setuptools_version)
  yield if block_given?
  pip_install
  helper.sh "virtualenv-relocate -s venv"
end
install() { || ... } click to toggle source
# File lib/deploy_dply/venv.rb, line 7
def install(&block)
  init
  update_pip_setuptools
  yield if block_given?
  pip_install
end
unpack() click to toggle source
# File lib/deploy_dply/venv.rb, line 24
def unpack
  helper.sh "virtualenv-relocate -d venv"
end

Private Instance Methods

helper() click to toggle source
# File lib/deploy_dply/venv.rb, line 51
def helper
  @helper ||= Helper.new
end
init(system_site_packages: false) click to toggle source
# File lib/deploy_dply/venv.rb, line 30
def init(system_site_packages: false)
  return if File.exist? "venv/.setup_done"
  system_flag = system_site_packages ? "--system-site-packages" : ""
  helper.sh "virtualenv #{system_flag} venv"
  FileUtils.touch "venv/.setup_done"
end
pip_install() click to toggle source
# File lib/deploy_dply/venv.rb, line 37
def pip_install
  helper.sh "venv/bin/pip install -r requirements.txt"
end
python(command) click to toggle source
# File lib/deploy_dply/venv.rb, line 41
def python(command)
  helper.sh "venv/bin/python #{command}"
end
update_pip_setuptools(pip_version, setuptools_version) click to toggle source
# File lib/deploy_dply/venv.rb, line 45
def update_pip_setuptools(pip_version, setuptools_version)
  helper.sh "venv/bin/pip install pip==#{pip_version}"
  helper.sh "venv/bin/pip install setuptools==#{setuptools_version}"
  helper.sh "venv/bin/pip install urllib3[secure]"
end