class RubyTeamSite::TeamSite

Public Class Methods

new() click to toggle source

Initialize the TeamSite class.

# File lib/ruby_teamsite/teamsite.rb, line 5
def initialize
  @iw_home = `iwgethome 2>&1`
  @ts_bin = ts_bin
  @ts_ver = `#{@ts_bin}/iwversion 2>&1`
end

Public Instance Methods

file_state(f) click to toggle source

Return file state in a hash.

# File lib/ruby_teamsite/teamsite.rb, line 34
def file_state(f)
  fstate = `#{ts_bin}/iwfilestate -f script #{f} 2>&1`
  if fstate.include?(':')
    fstate.gsub!(/\n/,'')
    tmp_arr = ['error',fstate]
    fstate_hash = Hash[*tmp_arr.flatten]
  else
    fstate.gsub!(/\n/,':-:')
    fstate.gsub!('=',':-:')
    fstate_arr = fstate.split(":-:")
    fstate_hash = Hash[*fstate_arr.flatten]
  end
  
  return fstate_hash
end
iwhome() click to toggle source

Return the location that TeamSite is installed in.

# File lib/ruby_teamsite/teamsite.rb, line 12
def iwhome
  return @iw_home
end
lock(f,comment,ownerid=nil) click to toggle source

Have TeamSite lock a file. Comment is required but sending a blank is acceptable.

# File lib/ruby_teamsite/teamsite.rb, line 22
def lock(f,comment,ownerid=nil)
  file_lock = `#{@ts_bin}/iwlock #{f} "#{comment}" #{ownerid unless ownerid.nil?} 2>&1`
  return file_lock
end
unlock(f) click to toggle source

Have TeamSite unlock a file.

# File lib/ruby_teamsite/teamsite.rb, line 28
def unlock(f)
  file_lock = `#{@ts_bin}/iwunlock #{f} 2>&1`
  return file_lock
end
version() click to toggle source

Return the TeamSite version.

# File lib/ruby_teamsite/teamsite.rb, line 17
def version
  return @ts_ver
end

Private Instance Methods

ts_bin() click to toggle source

Create the location to the bin directory for TeamSite.

# File lib/ruby_teamsite/teamsite.rb, line 52
def ts_bin
  ts_bin = iwhome + '/bin'
  ts_bin.gsub!(/\n/,'')
  ts_bin.strip!
  return ts_bin
end