Class: RubyTeamSite::TeamSite
- Inherits:
-
Object
- Object
- RubyTeamSite::TeamSite
- Defined in:
- lib/ruby_teamsite/teamsite.rb
Instance Method Summary collapse
-
#file_state(f) ⇒ Object
Return file state in a hash.
-
#initialize ⇒ TeamSite
constructor
Initialize the TeamSite class.
-
#iwhome ⇒ Object
Return the location that TeamSite is installed in.
-
#lock(f, comment, ownerid = nil) ⇒ Object
Have TeamSite lock a file.
-
#unlock(f) ⇒ Object
Have TeamSite unlock a file.
-
#version ⇒ Object
Return the TeamSite version.
Constructor Details
#initialize ⇒ TeamSite
Initialize the TeamSite class.
5 6 7 8 9 |
# 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 |
Instance Method Details
#file_state(f) ⇒ Object
Return file state in a hash.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# 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 ⇒ Object
Return the location that TeamSite is installed in.
12 13 14 |
# File 'lib/ruby_teamsite/teamsite.rb', line 12 def iwhome return @iw_home end |
#lock(f, comment, ownerid = nil) ⇒ Object
Have TeamSite lock a file. Comment is required but sending a blank is acceptable.
22 23 24 25 |
# 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) ⇒ Object
Have TeamSite unlock a file.
28 29 30 31 |
# File 'lib/ruby_teamsite/teamsite.rb', line 28 def unlock(f) file_lock = `#{@ts_bin}/iwunlock #{f} 2>&1` return file_lock end |
#version ⇒ Object
Return the TeamSite version.
17 18 19 |
# File 'lib/ruby_teamsite/teamsite.rb', line 17 def version return @ts_ver end |