Sha256: b9c7a2f0def222d18fe62bf488f6ae4071e0c4e88f55708c22794301f515e394

Contents?: true

Size: 964 Bytes

Versions: 4

Compression:

Stored size: 964 Bytes

Contents

require "trollop"

module Rjobs
  module CliHelper
    def get_jobs_info(jobs_file)
      jf = JobsFile.new(jobs_file)
      jobs= []
      jf.ids.each_with_index do |jobId,index|
        job = Rjobs::Job.new(jobId, Rjobs::JobHandler.get_job_attributes(jobId))
        job.name = jf.job_names[index]
        jobs << job
      end
      jobs
    end

    def parser(banner_string)
      default_hostname = ENV['XGRID_CONTROLLER_HOSTNAME'].nil? ? "127.0.0.1" : ENV['XGRID_CONTROLLER_HOSTNAME']
      default_password = ENV['XGRID_CONTROLLER_PASSWORD'].nil? ? "xgrid" : ENV['XGRID_CONTROLLER_PASSWORD'] 
      Trollop::Parser.new do
        banner banner_string
        opt :host, "Hostname or IP address of the xgrid controller", 
            :type=> String, 
            :default=> default_hostname
        opt :password, "Password to access the xgrid controller", 
            :type=> String, 
            :default=> default_password 
      end
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rjobs-0.3.3.alpha lib/rjobs/cli_helper.rb
rjobs-0.3.2.alpha lib/rjobs/cli_helper.rb
rjobs-0.3.1.alpha lib/rjobs/cli_helper.rb
rjobs-0.3.0.alpha lib/rjobs/cli_helper.rb