I am trying to change the "Make" Bundle's "Run" command. I create projects in folders and I want to execute an executable (in my case, I am writing apps with the extension .prg for a Commodore 64 to be run inside an emulator).
Currently, I am using a line like this: open "$TM_PROJECT_DIRECTORY/myapp.prg"
The problem is I don't want the apps to all be called myapp.prg. What I would like is something more like: open "$TM_PROJECT_DIRECTORY".sub( /(.*)?/(.*)$/, "\1/\2\2.prg" ) (I don't actually know Ruby but I used an online ruby regex explorer). Translated, this means that I want to use the last component of TM_PROJECT_DIRECTORY as the filename, appended to the directory and then append .prg to the end of that.
I tried the code below: ----------- #!/usr/bin/env ruby
require ENV["TM_SUPPORT_PATH"] + "/lib/tm/executor"
TM_RUN = "open "+ENV['TM_PROJECT_DIRECTORY'].gsub( /(.*)?/(.*)$/, "\1/\2/\2.prg" ) flags = ""
Dir.chdir(File.dirname(ENV["TM_PROJECT_DIRECTORY"])) TextMate::Executor.run(TM_RUN, flags, :verb => "Running") do |line, type| end -----------
This didn't work. 2 Things are wrong. 1) the regex replace didn't work - I am guessing that the return from ENV isn't something you can call .sub on? -- and 2) the Executor.run says it wants the path added to the path variable (I know that by feeding it a hard-coded line to an existing .prg file).
Can someone maybe help me figure out how to make this go?
Thank you Stefan