Created
September 5, 2012 21:53
-
-
Save havenwood/3645626 to your computer and use it in GitHub Desktop.
Revisions
-
havenwood revised this gist
Sep 7, 2012 . 1 changed file with 6 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -44,6 +44,12 @@ def create_files xml.instruct! :xml, encoding: 'utf-8' xml.declare! :DOCTYPE, :plist, :PUBLIC, '-//Apple//DTD PLIST 1.0//EN', 'http://www.apple.com/DTDs/PropertyList-1.0.dtd' xml.plist version: '1.0' do |plist| plist.dict do |dict| dict.key 'CFBundlePackageType' -
havenwood revised this gist
Sep 7, 2012 . 1 changed file with 46 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,5 @@ require 'builder' module MacApp class << self def new @@ -21,12 +23,12 @@ def ask_name def ask_file_extension print 'File Extension: ' @file_extension = gets.chomp.delete('.').downcase end def ask_language print 'Language: ' @language = gets.chomp.downcase end def create_directories @@ -37,8 +39,48 @@ def create_directories end def create_files File.open "#@name/Contents/Info.plist", 'w' do |file| xml = Builder::XmlMarkup.new indent: 2 xml.instruct! :xml, encoding: 'utf-8' xml.plist version: '1.0' do |plist| plist.dict do |dict| dict.key 'CFBundlePackageType' dict.string 'APPL' dict.key 'CFBundleInfoDictionaryVersion' dict.string '6.0' dict.key 'CFBundleIconFile' dict.string "#@name.icns" dict.key 'CFBundleName' dict.string "#@name by Orchid Technologies" dict.key 'CFBundleExecutable' dict.string "app.#@file_extension" dict.key 'CFBundleIdentifier' dict.string @name dict.key 'CFBundleVersion' dict.string '0.1' dict.key 'NSHumanReadableCopyright' dict.string 'Author Copyright 2012' end end file << xml end File.open "#@name/Contents/MacOS/app.#@file_extension", 'w' do |file| file << "#!/usr/bin/env #@language\n# Code goes here..." end File.chmod 0755, "#@name/Contents/MacOS/app.#@file_extension" File.open "#@name/Contents/Resources/#@name.icns", 'w' end end -
havenwood revised this gist
Sep 7, 2012 . 1 changed file with 29 additions and 10 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,26 +1,45 @@ module MacApp class << self def new ask_name ask_file_extension ask_language create_directories create_files end def run system "open #@name" end private def ask_name print 'App Name: ' @name = gets.chomp.split.map(&:capitalize).join << '.app' end def ask_file_extension print 'File Extension: ' @ext = gets.chomp.delete('.').downcase end def ask_language print 'Language: ' @lang = gets.chomp.downcase end def create_directories Dir.mkdir @name Dir.mkdir "#@name/Contents" Dir.mkdir "#@name/Contents/MacOS" Dir.mkdir "#@name/Contents/Resources" end def create_files File.open "#@name/Contents/Info.plist", 'w' File.open "#@name/Contents/MacOS/app.#@ext", 'w' File.open "#@name/Contents/Resources/#@name.icns", 'w' end end end -
havenwood revised this gist
Sep 5, 2012 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -10,8 +10,8 @@ def new print 'Language: ' @lang = gets.chomp.downcase Dir.mkdir @name Dir.chdir @name Dir.mkdir 'Contents' Dir.chdir 'Contents' File.open 'Info.plist', 'w' -
havenwood created this gist
Sep 5, 2012 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,28 @@ 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