Class: Appify::App

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

Instance Method Summary collapse

Constructor Details

#initializeApp

Returns a new instance of App.



17
18
# File 'lib/appify.rb', line 17

def initialize
end

Instance Method Details

#runObject



20
# File 'lib/appify.rb', line 20

def run; @run; end

#run=(cont) ⇒ Object



21
22
23
24
# File 'lib/appify.rb', line 21

def run=(cont)
  raise Appify::FileTooShortError.new if cont.length < 28
  @run = cont
end

#runfile=(file) ⇒ Object



25
26
27
28
29
# File 'lib/appify.rb', line 25

def runfile=(file)
  file = Pathname.new(file) unless file.is_a? Pathname
  raise Appify::FileTooShortError.new if file.size < 28
  @run = file.read
end

#write(path) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/appify.rb', line 31

def write(path)
  path = Pathname.new(path) unless path.is_a? Pathname
  path.rmtree if path.exist?
  path.mkpath
  
  runfl = path.join "Contents", "MacOS", "run.sh"
  infop = path.join "Contents", "Info.plist"
  resrc = path.join "Contents", "Resources"
  runfl.dirname.mkpath
  resrc.mkpath
  
  IO.write infop, Appify.info
  IO.write runfl, @run
  runfl.chmod 0755
  
  return path
end