Class: Pik::BashFile

Inherits:
ScriptFile show all
Defined in:
lib/pik/scripts/bash_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/bash_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/bash_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/bash_file.rb', line 5

def ruby_dir
  @ruby_dir
end

Instance Method Details

#call(exe) ⇒ Object



17
18
19
20
# File 'lib/pik/scripts/bash_file.rb', line 17

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

#extnameObject



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

def extname
  ".sh"
end

#headerObject



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

def header
  string =  "#!/bin/sh\n"
  string << "#  This bash script generated by Pik, the\n"
  string << "#  Ruby Manager for Windows\n"
end

#set(items) ⇒ Object



22
23
24
25
26
27
# File 'lib/pik/scripts/bash_file.rb', line 22

def set(items)
  items.each{|k,v| 
     v = v.to_bash if v.respond_to? 'to_bash'
    @file_data << "export #{k}='#{v}'" }
  self
end

#unset(items) ⇒ Object



29
30
31
32
# File 'lib/pik/scripts/bash_file.rb', line 29

def unset(items)
  items.each{|k| @file_data << "export #{k}=" }
  self
end