Skip to content

Instantly share code, notes, and snippets.

@havenwood
Created September 5, 2012 21:53
Show Gist options
  • Select an option

  • Save havenwood/3645626 to your computer and use it in GitHub Desktop.

Select an option

Save havenwood/3645626 to your computer and use it in GitHub Desktop.
Create an OS X .app Executable With Your Choice Of Language For Script
module MacApp
class << self
def new
print 'App Name: '
@name = gets.chomp.split.map(&:capitalize).join << '.app'
print 'File Extension: '
@ext = gets.chomp.delete('.').downcase
print 'Language: '
@lang = gets.chomp.downcase
Dir.mkdir "#{@name}"
Dir.chdir "#{@name}"
Dir.mkdir 'Contents'
Dir.chdir 'Contents'
File.open 'Info.plist', 'w'
Dir.mkdir 'MacOS'
File.open "MacOS/app.#{@ext}", 'w'
Dir.mkdir 'Resources'
File.open "Resources/#{@name}.icns", 'w'
system "open ../../#{@name}"
end
end
end
MacApp.new
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment