This repository has been archived by the owner on Sep 2, 2018. It is now read-only.
/
PodFile.rb
66 lines (55 loc) · 1.64 KB
/
PodFile.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#
# Podfile.rb
# PodCreator
#
class PodFile
attr_accessor :window
attr_accessor :platformButton
attr_accessor :bridgeSupportCheckBox
attr_accessor :tableView
attr_accessor :arrayController
def init
@podList = PodList.alloc.init
@podList.delegate = self
end
#----------------------------------------
def showList(sender)
plat = PodUtil::getSelectedPlatform(platformButton.titleOfSelectedItem)
@podList.setPlatform(plat[1..-1].to_sym)
NSApp.beginSheet(@podList.window,
modalForWindow:window,
modalDelegate:self,
didEndSelector:nil,
contextInfo:nil)
NSApp.endSheet(@podList.window)
end
def remove(sender)
index = arrayController.selectionIndexes
arrayController.removeObjectsAtArrangedObjectIndexes(index)
end
def create(sender)
panel = NSSavePanel.savePanel
panel.setCanChooseDirectories(true)
result = panel.runModalForDirectory(NSHomeDirectory(),
file:"Podfile")
if(result == NSOKButton)
path = panel.filename
File.open(path, "w") {|f|
plat = PodUtil::getSelectedPlatform(platformButton.titleOfSelectedItem)
f.puts "platform #{plat}"
ary = arrayController.arrangedObjects
ary.each do |item|
f.puts "pod '#{item['name']}'"
end
if bridgeSupportCheckBox.state == NSOnState
f.puts "generate_bridge_support!"
end
}
system "open -a TextEdit '#{path}'"
end
end
#----------------------------------------
def addPod(pod)
arrayController.addObject(pod.dup)
end
end