This repository has been archived by the owner on Sep 2, 2018. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b191071
commit dcba327
Showing
5 changed files
with
3,094 additions
and
1,206 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,65 @@ | |||
# | |||
# Podfile.rb | |||
# PodCreator | |||
# | |||
|
|||
class PodFile | |||
attr_accessor :window | |||
attr_accessor :platformButton | |||
attr_accessor :bridgeSupportCheckBox | |||
attr_accessor :tableView | |||
attr_accessor :arrayController | |||
|
|||
PLATFORM = {'iOS' => ":ios", 'Mac' => ":osx" } | |||
|
|||
def init | |||
@podList = PodList.alloc.init | |||
@podList.delegate = self | |||
end | |||
|
|||
#---------------------------------------- | |||
def showList(sender) | |||
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 | |||
plat = platformButton.titleOfSelectedItem | |||
|
|||
File.open(path, "w") {|f| | |||
f.puts "platform #{PLATFORM[plat]}" | |||
ary = arrayController.arrangedObjects | |||
ary.each do |item| | |||
f.puts "dependency '#{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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,85 @@ | |||
# | |||
# PodSpec.rb | |||
# PodCreator | |||
# | |||
|
|||
class PodSpec | |||
attr_accessor :repoButton | |||
attr_accessor :repoTagCombo | |||
attr_accessor :objectController | |||
|
|||
def create(sender) | |||
objectController.commitEditing | |||
content = objectController.content | |||
|
|||
panel = NSSavePanel.savePanel | |||
panel.setAllowedFileTypes(["podspec"]) | |||
panel.setExtensionHidden(false) | |||
result = panel.runModalForDirectory(NSHomeDirectory(), | |||
file:"") | |||
if(result == NSOKButton) | |||
path = panel.filename | |||
File.open(path, "w") {|f| | |||
@io = f | |||
f.puts "Pod::Spec.new do |s|" | |||
|
|||
content.keys.each do |k| | |||
case k | |||
|
|||
when "author_name" | |||
str = "{ '#{content[k]}' " | |||
str += "=> '#{content['author_mail']}' " if content['author_mail'].length > 0 | |||
str += "}" | |||
out_spec("author", str) | |||
|
|||
when "repo_url" | |||
type = repoButton.titleOfSelectedItem | |||
str = "{ :#{type} => '#{content[k]}'" | |||
i = repoTagCombo.indexOfSelectedItem | |||
str += ", :#{repoTagCombo.itemObjectValueAtIndex(i)} => '#{content['repo_tag']}'" if i >= 0 | |||
str += " }" | |||
out_spec("source", str) | |||
|
|||
when "dep_framework" | |||
out_specs("framework", "frameworks", content[k]) | |||
|
|||
when "dep_library" | |||
out_specs("library", "libraries", content[k]) | |||
|
|||
when "source_files" | |||
out_specs("source_files", "source_files", content[k]) | |||
|
|||
when "require_arc" | |||
out_spec(k, content[k].to_s) | |||
|
|||
when "author_mail", "repo_tag" | |||
# ignore | |||
|
|||
else | |||
out_spec(k, "'#{content[k]}'") | |||
end | |||
end | |||
|
|||
f.puts "end" | |||
} | |||
|
|||
system "open -a TextEdit '#{path}'" | |||
end | |||
end | |||
|
|||
def out_specs(key_s, key_m, data) | |||
ary = data.split(',') | |||
if ary.size > 1 | |||
data = ary.map{ |x| "'#{x.strip}'" }.join(', ') | |||
out_spec(key_m, data) | |||
else | |||
out_spec(key_s, "'#{data.strip}'") | |||
end | |||
end | |||
|
|||
def out_spec(key, data) | |||
@io.puts " s.#{key} = #{data}" | |||
end | |||
|
|||
end | |||
|
Oops, something went wrong.