Class: Toybox::Txtfile

Inherits:
Object
  • Object
show all
Defined in:
lib/toybox/txtfile.rb

Direct Known Subclasses

Configfile, Exefile, Linkfile

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(p) ⇒ Txtfile

Returns a new instance of Txtfile.



4
5
6
# File 'lib/toybox/txtfile.rb', line 4

def initialize(p)
  self.path = Pathname.new(p)
end

Instance Attribute Details

#pathObject

Returns the value of attribute path.



3
4
5
# File 'lib/toybox/txtfile.rb', line 3

def path
  @path
end

Instance Method Details

#debian_install_cmdObject



22
23
24
# File 'lib/toybox/txtfile.rb', line 22

def debian_install_cmd
  [install_cmd, q(install_src), q(install_dest)].join(' ')
end

#install_cmdObject



13
14
15
# File 'lib/toybox/txtfile.rb', line 13

def install_cmd
    "install -D -m 644"
end

#install_destObject



19
20
21
# File 'lib/toybox/txtfile.rb', line 19

def install_dest
    "#{Toybox::app_fakeroot}/#{path.to_s}"
end

#install_srcObject



16
17
18
# File 'lib/toybox/txtfile.rb', line 16

def install_src
  "$(SRC)/#{path.to_s}"
end

#q(s) ⇒ Object



10
11
12
# File 'lib/toybox/txtfile.rb', line 10

def q(s)
   '"' + s + '"'
end

#to_sObject



7
8
9
# File 'lib/toybox/txtfile.rb', line 7

def to_s
  "#{self.class}: #{path.to_s}"
end