Sha256: 3565a45aac228890b3d4ba822443d14a0413232fb7e723c0827f083c999feb4b

Contents?: true

Size: 1.75 KB

Versions: 7

Compression:

Stored size: 1.75 KB

Contents

#!/usr/bin/env ruby

require 'optparse'
require 'methadone'
require 'dhclient.rb'

class App
  include Methadone::Main
  include Methadone::CLILogging

# bin/dhclient load 

  main do |command|
    GETCMD = ["version", "status", "compositions", "publications"]
    POSTCMD = ["load_data", "start_composition", "start_publication"]
    dh = DHClient::Datahub.new(options['url'], options['user'], options['password'])
    if GETCMD.include? command
      puts dh.send(command.to_sym) 
    else
      case command
        when "load_data"
          puts dh.load_data options['file'], options['feed'], options['raw']
        when "start_composition"
          puts dh.start_composition options['pool']
        when "start_publication"
          puts dh.start_publication options['pool'], options['target']
      end
    end
    
  end


  version DHClient::VERSION

  on '--url URL', "Datahub base URL (e.g.: http://localhost:8080/datahub-webapp/v1)."
  on '--user USER', "Datahub user for HTTP Basic Authentication."
  on '--password PASSWORD', "Datahub password for HTTP Basic Authentication."
  on '--file FILE', 'File path with data to be loaded into Datahub for the <load_data> command.'
  on '--feed FEED', 'Feed name where data should be loaded into Datahub for the <load_data> command.'
  on '--raw RAW', 'Raw item name that represents the data that will be loaded using <load_data> command.'
  on '--pool POOL', 'Pool name for <start_composition> and <start_publication> commands.'
  on '--target TARGET', 'Target system name for <start_publication> command.'

  arg :command, "Datahub operation you want to perform: [version | status | compositions | publications | load_data | start_composition | start_publication]."
  
  use_log_level_option :toggle_debug_on_signal => 'USR1'

  go!
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
dhclient-0.1.6 bin/dhclient
dhclient-0.1.5 bin/dhclient
dhclient-0.1.4 bin/dhclient
dhclient-0.1.3 bin/dhclient
dhclient-0.1.2 bin/dhclient
dhclient-0.1.1 bin/dhclient
dhclient-0.1.0 bin/dhclient