开发者

How do I use Applescript to log me in to heroku console and count my users?

My script looks like this, really simple

tell application "Terminal"
    do scrip开发者_如何学运维t "cd myapp"
    do script "heroku console" in window 1
    do script "User.count" in window 1
end tell

But I get an "Error in the AppleEvent Routine". What is wrong with this script? If I type the commands in the Terminal it works.


That's probably not working because heroku console doesn't return you to the shell after it finishes, it starts the interactive console.

What you need is something that will run and return. Fortunately this is totally possible with Heroku:

heroku console 'User.count'

You can call console with a command to run as the argument. Then it returns the result immediately instead of starting up the interactive session. Sounds perfect for you!


This command means nothing... cd myapp. You have to give the full path to myapp like ~/myapp. Also you should run them as 1 command by putting a semicolon between them...

tell application "Terminal"
    do script "cd path/to/myapp; heroku console; User.count"
end tell
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜