Class: Pik::PsFile

Inherits:
ScriptFile show all
Defined in:
lib/pik/scripts/ps_file.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from ScriptFile

#<<, #echo, #initialize, #path, #remove_line, #to_s, #write

Constructor Details

This class inherits a constructor from Pik::ScriptFile

Instance Attribute Details

#file_dataObject

Returns the value of attribute file_data.



5
6
7
# File 'lib/pik/scripts/ps_file.rb', line 5

def file_data
  @file_data
end

#file_nameObject

Returns the value of attribute file_name.



5
6
7
# File 'lib/pik/scripts/ps_file.rb', line 5

def file_name
  @file_name
end

#ruby_dirObject

Returns the value of attribute ruby_dir.



5
6
7
# File 'lib/pik/scripts/ps_file.rb', line 5

def ruby_dir
  @ruby_dir
end

Instance Method Details

#call(exe) ⇒ Object



16
17
18
19
# File 'lib/pik/scripts/ps_file.rb', line 16

def call(exe)
  @file_data << "#{exe}\n"
  self
end

#extnameObject



7
8
9
# File 'lib/pik/scripts/ps_file.rb', line 7

def extname
  ".ps1"
end

#headerObject



11
12
13
14
# File 'lib/pik/scripts/ps_file.rb', line 11

def header
  string =  "#  This powshell script generated by Pik, the\n"
  string << "#  Ruby Manager for Windows\n"  
end

#set(items) ⇒ Object



21
22
23
24
# File 'lib/pik/scripts/ps_file.rb', line 21

def set(items)
  items.each{|k,v| @file_data << "$ENV:#{k}=\"#{v}\"" }
  self
end

#unset(items) ⇒ Object



26
27
28
29
# File 'lib/pik/scripts/ps_file.rb', line 26

def unset(items)
  items.each{|k| @file_data << "Remove-Item ENV:#{k}" }
  self
end