class SwingSet::SwingSet
The primary class for swingset, representing the completed project
Attributes
frameworks[R]
name[R]
platform[R]
Public Class Methods
new(name = 'SwingSet', platform = :ios)
click to toggle source
# File lib/swingset/swingset.rb, line 12 def initialize(name = 'SwingSet', platform = :ios) @name = name @platform = platform @frameworks = [] end
Public Instance Methods
add_framework(path)
click to toggle source
# File lib/swingset/swingset.rb, line 18 def add_framework(path) @frameworks << path if Dir.exist?(path) end
write_swingset(path)
click to toggle source
# File lib/swingset/swingset.rb, line 22 def write_swingset(path) epath = File.expand_path(path) FileUtils.mkdir_p(epath) proj_path = write_project(epath, platform) pg_path = write_playground(epath, platform, name) write_workspace(epath, name, [proj_path, pg_path]) end
Private Instance Methods
write_playground(path, platform, name)
click to toggle source
# File lib/swingset/swingset.rb, line 39 def write_playground(path, platform, name) pg_path = File.join(path, name + '.playground') pg = Xcplayground::Playground.new(pg_path, platform) pg.save pg.path end
write_project(path, platform)
click to toggle source
# File lib/swingset/swingset.rb, line 32 def write_project(path, platform) framework_provider = FrameworkProvider.new(path, platform) frameworks.each { |f| framework_provider.add_framework(f) } framework_provider.write framework_provider.path end
write_workspace(path, name, contents)
click to toggle source
# File lib/swingset/swingset.rb, line 46 def write_workspace(path, name, contents) ws = Xcodeproj::Workspace.new([]) contents.each { |c| ws << c } ws.save_as(File.join(path, name + '.xcworkspace')) end