#!/usr/bin/env ruby =begin @vendor Chorke Academia, Inc. @web https://cdn.chorke.org/docs/academia @version 1.0.00 @since 1.0.00 =end # https://github.com/mehul90/swift_republic require 'swift_republic' require 'fileutils' # process model data srcModel = ARGV[0] desModel = "~/.chorke/academia/tmp/swift/#{srcModel}" desPath = "#{File.expand_path(desModel)}" srcPath = "#{Dir.pwd}/#{srcModel}" def swifty_gen_public(src, des) File.delete(des) if File.exist?(des) FileUtils.mkdir_p(File.dirname(des)) if !File.exist?(File.dirname(des)) make_models_public(src, des) end def copy_with_path(src, des) File.delete(des) if File.exist?(des) FileUtils.mkdir_p(File.dirname(des)) if !File.exist?(File.dirname(des)) FileUtils.cp(src, des) if File.exist?(src) end def swifty_gen(src, des) if File.extname(src) == ".swift" swifty_gen_public(src, des) if File.exist?(src) copy_with_path(des, src) File.delete(des) if File.exist?(des) else puts "#{src}, is not a valid swift file" end end <<-DOC sudo gem install swift_republic ruby <(curl -s 'https://cdn.chorke.org/repo/ios/swiftygen.rb.txt') Gender.swift bash <(curl -s 'https://cdn.chorke.org/repo/ios/swiftygen.sh.txt') swiftygen Gender.swift DOC swifty_gen(srcPath, desPath) __END__