Class: DockerJockey::PythonHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/langs/python_helper.rb

Instance Method Summary collapse

Instance Method Details

#run(args, options) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/langs/python_helper.rb', line 5

def run(args, options)
  if args.length < 1
    raise "devo python: invalid args."
  end
  case args[0]
  when 'install', 'vendor'
    # npm install
    DockerJockey.docker_exec("iron/python:2-dev", "pip install -t packages -r requirements.txt", options)
    DockerJockey.exec("chmod -R a+rw packages")
  when 'run'
    DockerJockey.docker_exec("iron/python:2", "python #{args[1]}", options)
  when 'image'
    DockerJockey::ImageHelper.build1('iron/python:2', 'python', args[1..args.length])
  when 'version'
    DockerJockey.docker_exec("iron/python:2", "python --version".split(' '), options)
  else
    raise "Invalid python command: #{args[0]}"
  end

end