An easy way to add .rb files to Xcode build automatically?
I usually write all of my Ruby code in Vim, but I'm using Xcode to keep my project organized and to build/debug/etc. Whenever I create a new file in Vim I have to go into my Xcode project and add the files to the "Classes" group manually. Is there a good way to set up a folder reference in Xcode that will automatically keep track of my new .rb files and copy them to the project root when I build? Or do I always have to add them manually? I tried adding a folder to the root of my project called "Classes" in which I put all of my Ruby code. I then added that folder reference to the project. However, when I build the project the files are copied to a "Classes" folder in the build instead of to the project root where they can be found by main.rb. -- Michael Jackson http://mjijackson.com @mjijackson
On Jul 27, 2010, at 10:25 , Michael Jackson wrote:
I usually write all of my Ruby code in Vim, but I'm using Xcode to keep my project organized and to build/debug/etc. Whenever I create a new file in Vim I have to go into my Xcode project and add the files to the "Classes" group manually. Is there a good way to set up a folder reference in Xcode that will automatically keep track of my new .rb files and copy them to the project root when I build? Or do I always have to add them manually?
I tried adding a folder to the root of my project called "Classes" in which I put all of my Ruby code. I then added that folder reference to the project. However, when I build the project the files are copied to a "Classes" folder in the build instead of to the project root where they can be found by main.rb.
That's better than finally wound up with. I was planning on having a gem structured project with your above setup and then adjust LOAD_PATH accordingly from rb_main to include the build dir's lib. I guess I missed the second step of the reference to the folder in the project or something.
I was planning on having a gem structured project with your above setup and then adjust LOAD_PATH accordingly from rb_main to include the build dir's lib. I guess I missed the second step of the reference to the folder in the project or something.
Yeah, the folder reference will keep the files in sync automatically. But it seems that even with a folder reference I'm still going to need to add the "Classes" directory to my LOAD_PATH unless I can figure out a way to set up the build to do it automatically. -- Michael Jackson http://mjijackson.com @mjijackson
On 27 Jul 2010, at 18:25, Michael Jackson wrote:
I tried adding a folder to the root of my project called "Classes" in which I put all of my Ruby code. I then added that folder reference to the project. However, when I build the project the files are copied to a "Classes" folder in the build instead of to the project root where they can be found by main.rb.
Hi Michael, In the XCode project tree, does your 'Classes' folder have a blue or yellow icon? There are two types of folders that you can add to the source tree. Blue folders (folder references) are 'physical' in the sense that the structure will be preserved when copied to the Resources folder of your application's bundle. Yellow folders (groups) are more like logical folders for partitioning your project files within XCode. They don't strictly enforce or correspond to any structure on disk unless you specifically set it up that way, and anything under these folders will become flattened into the final Resources destination folder. Within my current MacRuby project, I only use the blue folder references for any packaged gems that I want to include. All normal ruby project files are in yellow group folders. There's a good post about it at http://iphonedevelopertips.com/xcode/xcode-folders-and-the-file-system-part-... Nick
I've tried both. With the yellow icon (a "group") I need to manually add .rb files to the project when I create them in Vim. However, the upside is that the files are copied to the correct place in the build (the project root), so they are correctly found by rb_main.rb at runtime. With the blue icon (the "folder reference") the files are automatically added to the project when I create them in Vim, but the entire folder is actually copied to the build which means that rb_main.rb doesn't find them when it tries to include everything. Ideally, what I'd like to do is use a folder reference and then just set up some build script that will copy everything to the project root when I build. -- Michael Jackson http://mjijackson.com @mjijackson On Wed, Jul 28, 2010 at 5:03 PM, Nick Ludlam <nick@recoil.org> wrote:
On 27 Jul 2010, at 18:25, Michael Jackson wrote:
I tried adding a folder to the root of my project called "Classes" in which I put all of my Ruby code. I then added that folder reference to the project. However, when I build the project the files are copied to a "Classes" folder in the build instead of to the project root where they can be found by main.rb.
Hi Michael, In the XCode project tree, does your 'Classes' folder have a blue or yellow icon? There are two types of folders that you can add to the source tree. Blue folders (folder references) are 'physical' in the sense that the structure will be preserved when copied to the Resources folder of your application's bundle.
Yellow folders (groups) are more like logical folders for partitioning your project files within XCode. They don't strictly enforce or correspond to any structure on disk unless you specifically set it up that way, and anything under these folders will become flattened into the final Resources destination folder.
Within my current MacRuby project, I only use the blue folder references for any packaged gems that I want to include. All normal ruby project files are in yellow group folders.
There's a good post about it at http://iphonedevelopertips.com/xcode/xcode-folders-and-the-file-system-part-...
Nick
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
The problem with a folder reference is that it does sync the class info with IB. I have CLI generators, rails like, which add the rb files to the xcodeproj. The xcodeproj is just a plist after all :) If interested, I can try to do a first release of my lib with just the generator part. Because I haven't had the time yet to extract test helpers and other support libs from my app. On 27 jul. 2010, at 19:25, Michael Jackson <mjijackson@gmail.com> wrote:
I usually write all of my Ruby code in Vim, but I'm using Xcode to keep my project organized and to build/debug/etc. Whenever I create a new file in Vim I have to go into my Xcode project and add the files to the "Classes" group manually. Is there a good way to set up a folder reference in Xcode that will automatically keep track of my new .rb files and copy them to the project root when I build? Or do I always have to add them manually?
I tried adding a folder to the root of my project called "Classes" in which I put all of my Ruby code. I then added that folder reference to the project. However, when I build the project the files are copied to a "Classes" folder in the build instead of to the project root where they can be found by main.rb.
-- Michael Jackson http://mjijackson.com @mjijackson _______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
participants (4)
-
Eloy Duran
-
Michael Jackson
-
Nick Ludlam
-
Ryan Davis