Reputation: 37
I have a program that reads the data in a file, changes certain elements, and creates a new file. The code looks like this:
lines = IO.readlines('single_before_CAP.txt').map do |line|
a = line.split.each { |i| i.capitalize! }
a2 = a.join(" ")
File.open('single_after_CAP.txt', 'w') do |file|
file.puts lines
end
How can I use Xcode and MacRuby to get this program to run as a GUI app? If not Xcode and MacRuby, is there another simple task I can do to make this a standalone GUI app?
Upvotes: 2
Views: 1007
Reputation: 257
If you just want to run a headless ruby application, you can use Automator. Simply create a new workflow, add a line to execute your application, and save it as a ".app". I can give you more specific instructions if you like.
@jmitchell1009
Specific Instructions: If you don't need to input anything to your program (like files or arguments) the simplest way would be to:
If you have any issues, let me know.
Upvotes: 1
Reputation: 237010
It sounds like what you want is basically a simple wrapper app that runs your script when double-clicked, rather than a full GUI. Platypus is the easiest way to do that. You just give it your script, set up a couple of parameters (e.g. whether your script wants a file as an argument) and it'll give you a double-clickable app that optionally includes a simple interface such as a progress bar or text output.
Upvotes: 2
Reputation: 2235
One good way to do it:
Sample application:
https://github.com/MacRuby/MacRuby/wiki/Creating-a-simple-application
Upvotes: 3