Class: Plunger::Uploader

Inherits:
Object
  • Object
show all
Defined in:
lib/plunger/uploader.rb

Instance Method Summary collapse

Instance Method Details

#commandObject



4
5
6
# File 'lib/plunger/uploader.rb', line 4

def command
  Config.data['python_bin'] || 'python'
end

#run(options, diff_options = nil) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/plunger/uploader.rb', line 12

def run(options, diff_options = nil)
  argvs = [ script ]

  options.each do |key, value|
    case value
    when true
      argvs << "--#{key}"
    when false
    else
      argvs << "--#{key}" << "#{value}" unless value.to_s.empty?
    end
  end

  diff_options = Array(diff_options)

  unless diff_options.empty?
    argvs << '--'
    argvs += diff_options
  end

  system(command, *argvs)
end

#scriptObject



8
9
10
# File 'lib/plunger/uploader.rb', line 8

def script
  File.expand_path('../../../python/upload.py', __FILE__)
end