class SwingSet::Command

Represents the CLI associated with swingset

Public Instance Methods

create(platform) click to toggle source
# File lib/swingset/command.rb, line 11
def create(platform)
  name = options[:name] || 'SwingSet'
  swingset = SwingSet.new(name, platform.to_sym)
  import_frameworks(swingset, options[:framework_path], platform.to_sym)
  write_swingset(swingset, options[:path])
end

Private Instance Methods

import_frameworks(swingset, framework_path, platform) click to toggle source
# File lib/swingset/command.rb, line 20
def import_frameworks(swingset, framework_path, platform)
  if framework_path
    puts 'Importing frameworks from provided directory'
    FrameworkDirectory.new(swingset, framework_path)
  elsif Dir.exist?('Carthage')
    puts 'Importing frameworks from Carthage'
    FrameworkDirectory.carthage_frameworks(swingset, platform)
  else
    puts 'You either need to provide a framework_path or use with Carthage'
    return
  end
end
write_swingset(swingset, path) click to toggle source
# File lib/swingset/command.rb, line 33
def write_swingset(swingset, path)
  path ||= File.join(Dir.pwd, 'swingset')
  puts 'Writing swingset'
  swingset.write_swingset(path)
end