Page 1 of 1

Mac compile and test automator workflow

Posted: Sat May 19, 2012 11:42 am
by onedaysnotice
Dunno if there's one already, but I created a workflow that automates compilation so that you can test if your game is working. It doesn't create a stand-alone executable, but rather a .love file from your game folder that can be run by love2d. The compiled game file deletes itself upon quitting it, so don't save over the master file. :)

All you have to do is:
1. Open the workflow
2. Drag your game folder into the "Get Specified Finder Items" action
3. Save it as whatever you want and change the file format into application (don't save over the master file). I like to save it into the game folder so I don't get them mixed up.
4. Run the automator application and you're done! :D This is the only thing you'll have to do from now on :D Well for this game anyways. If you want to do this for another game, just repeat steps 1-3 to set it up again. :P

Requirements:

-Love2d must be named as "love" without the quotations. Basically, the default title.
-Mac computer? lol. Dunno what the minimum required OS version is.

Re: Mac compile and test automator workflow

Posted: Sat May 19, 2012 1:12 pm
by ljdp
A little tip, open terminal and

Code: Select all

cd 'my_game_directory'
/applications/love.app/contents/macos/love .
It will run the game without needing to create a .love file.
You can create a shortcut to love by opening or creating, if it doesn't exist

Code: Select all

~/.bash_profile
and add in

Code: Select all

alias love=/applications/love.app/contents/macos/love
Cool thing about launching from terminal is you can pass arguments to your love.load function, if I want to start in server mode I just

Code: Select all

love . server

Code: Select all

function love.load( args )
   if args[2] == 'server' then startServer() end
end

Re: Mac compile and test automator workflow

Posted: Sat May 19, 2012 1:29 pm
by coffee
ouch... It's so much easier drag the folder to love.app or a love alias just for run it. :)
as "compile" as .love it takes so little effort zip the files and rename it that I didn't ever care create scripted workflows.

Re: Mac compile and test automator workflow

Posted: Sat May 19, 2012 2:53 pm
by onedaysnotice
ljdp wrote:A little tip, open terminal and

Code: Select all

cd 'my_game_directory'
/applications/love.app/contents/macos/love .
It will run the game without needing to create a .love file.
You can create a shortcut to love by opening or creating, if it doesn't exist

Code: Select all

~/.bash_profile
and add in

Code: Select all

alias love=/applications/love.app/contents/macos/love
Cool thing about launching from terminal is you can pass arguments to your love.load function, if I want to start in server mode I just

Code: Select all

love . server

Code: Select all

function love.load( args )
   if args[2] == 'server' then startServer() end
end
I totally do not understand terminal. Hence, automator xD
coffee wrote:ouch... It's so much easier drag the folder to love.app or a love alias just for run it. :)
as "compile" as .love it takes so little effort zip the files and rename it that I didn't ever care create scripted workflows.
Really? After setting it up (which is just a matter of establishing the folder which it will compile and saving the workflow into that folder, which together can be done in like 10 secs) all you have to do is select the workflow app and press cmd+O for every time you want to test it. No need to continuously zip it and change it to .love and then trash it.

So basically, the workflow reduces like 3 steps into 1. Maybe I'm just rediculously lazy AHAHAHAHAHA.

Re: Mac compile and test automator workflow

Posted: Sat May 19, 2012 2:58 pm
by ljdp
You don't need to understand it. Just copy and paste what i've said.

Press cmd-space, type terminal, press enter, type 'cd' without the quotes and then a space, then drag your folder onto to terminal window and press enter.
Now type '/applications/love.app/contents/macos/love .' without the quotes and your game will run. As long as you keep the terminal window open you only have to do this once. To quickly launch your game press; up, enter.

edit:
An added benefit of using terminal is debugging. If you're unsure cetain parts of your code is being called add a

Code: Select all

print('some message')
in there and it will be printed to the terminal window when it gets called.

Re: Mac compile and test automator workflow

Posted: Sat May 19, 2012 3:07 pm
by onedaysnotice
ljdp wrote:You don't need to understand it. Just copy and paste what i've said.

Press cmd-space, type terminal, press enter, type 'cd' without the quotes and then a space, then drag your folder onto to terminal window and press enter.
Now type '/applications/love.app/contents/macos/love .' without the quotes and your game will run. As long as you keep the terminal window open you only have to do this once. To quickly launch your game press; up, enter.

edit:
An added benefit of using terminal is debugging. If you're unsure cetain parts of your code is being called add a

Code: Select all

print('some message')
in there and it will be printed to the terminal window when it gets called.
Oh wow. That's pretty cool xD Terminal always scares me so I always try to avoid it LOL Thanks for telling me this :) Guess my workflow is obsolete now huh? DX The only thing that my workflow has over this method is that you don't have to retype/re-drag all the stuff when starting terminal and love up again. lol

The debugging aspect is nice to know as well, since goature's tutorials didn't mention how to do it with mac :S well i think so...

Re: Mac compile and test automator workflow

Posted: Sat May 19, 2012 3:50 pm
by Robin
onedaysnotice wrote:Terminal always scares me so I always try to avoid it
The terminal is a rich and powerful way to interact with your computer. Give it a try some time! :)
onedaysnotice wrote:The only thing that my workflow has over this method is that you don't have to retype/re-drag all the stuff when starting terminal and love up again.
If you set up an alias, you only have to type love ., and I'm sure there is something like "Open Terminal in this folder" for OS X (don't use it myself).