Sha256: 42b23b3a8db8c0517ffaa5eb7425bf24057af9f55944e3a4ce3fd1de71c22539

Contents?: true

Size: 1.71 KB

Versions: 2

Compression:

Stored size: 1.71 KB

Contents

#!/usr/bin/env ruby

require 'rubygems'
require 'templater'
require ''
require File.join(File.dirname(__FILE__), '..','generators','rhoconnect')
$:.unshift File.join(File.dirname(__FILE__),'..','lib')
require File.join(File.dirname(__FILE__), '..','lib','rhoconnect')

# CONSTANTS

OPTIONS = {'start'   => 'Start the rhoconnect service.',
           'stop'    => 'Stop the rhoconnect service.',
           'restart' => 'Stop and then start the rhoconnect service.'}

# CLASSES

# Stub this method to force 1.8 compatibility (come on templater!)
class Encoding
  def find
    "utf-8"
  end

  def dummy?
    false
  end
end

class String
  def force_encoding(enc)
    return self
  end
  def encoding
    if RUBY_VERSION =~ /1\.8/ and Encoding.responds_to?('new')
      Encoding.new
    else
      Encoding.default_external
    end
  end
end

# METHODS

# check_options
# Verifies that the options passed in are part of the valid options set
# (Only for non-generation operations)
def check_options
  option_names = OPTIONS.keys
  ARGV.each do |opt|
    if !option_names.include? opt
      puts "Unknown option: #{opt}"
      print_usage
      exit
    end #if
  end #do
end #check_options

# print_usage
# Displays usage information for non-generation operations
def print_usage
  usage = "Usage: #{$0} [options]\n\n" +
         "General Options:\n"
  # Compile valid options from OPTIONS hash
  OPTIONS.each do |key, value|
    usage << sprintf("    %-32s %s", key, value)
  end #do
  puts usage
end #print_usage

# SCRIPT

# Determine whether rhoconnect is being used for generation or not 
if !ARGV.include? 'app' and
   !ARGV.include? 'source'
  check_options
  
else
  Rhoconnect.run_cli(Dir.pwd, 'rhoconnect', Rhoconnect::VERSION, ARGV)
end #if

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rhoconnect-3.1.1 bin/thorhoconnect
rhoconnect-3.1.0 bin/thorhoconnect