Hey Corey,
I've ran into the same problem in my setup of an app I'm doing now. What I had to do, was a two-fold process.
The first step in the process, is to add my "Classes" folder to my Project as a Folder Reference, so that the folder would get copied over. This allows me to keep the folder structure that I want in the final .app folder, with the code files where I wanted them.
The second step in the process, is to add a new group, called "Classes", and import all the files that I need access to in IB in there. Ofcourse, cause of the structure and way XCode does the bundling of .app's, I also need to go into the Main Target, and under the Copy Bundle Resources, remove the references to the ruby files from there, so that they don't get double copied into the root of the .app folder.
This is the only method in which I have been able to keep a clean, and structured layout to my .app folder. Also, if you plan to use macruby-deploy, you will find that the compile option won't recursively go through subfolders of your .app folder, and compile the ruby objects. For that, I took the code from macruby-deploy, and did some changes, and created a rakefile to do that for me. The code is below:
Rakefile:
BASE_DIR = Dir.pwd
BUILD_DIR = File.join(BASE_DIR,"build")
DEBUG_DIR = File.join(BUILD_DIR,"Debug")
RELEASE_DIR = File.join(BUILD_DIR,"Release")
APP_FOLDER = "MusixBox.app"
RESOURCES_FOLDER = File.join("Contents","Resources")
desc "Compiles all rb files into rbo code"
task :compile, :version do |t, args|
if args.version.downcase == "debug"
target = DEBUG_DIR
puts "Compiling Debug version..."
else
target = RELEASE_DIR
puts "Compiling Release version..."
end
target = File.join(target,APP_FOLDER,RESOURCES_FOLDER)
Dir.glob(File.join(target,"*","**","*.rb")).each do |source|
base = File.basename(source, ".rb")
next if base == 'rb_main'
obj = File.join(File.dirname(source),base + '.rbo')
if !File.exist?(obj) or File.mtime(source) > File.mtime(obj)
puts "Compiling #{source} to #{base + ".rbo"}..."
`macrubyc -C '#{source}' -o '#{obj}'`
end
rm_rf(source)
end
end
The last change I had to do, was to rb_main.rb file, to tell it where to find the Source code files, to load, which mine looks like this:
# Require all class code
Dir.glob(File.join(dir_path, 'Classes', '*.{rb,rbo}')).map { |x| File.basename(x, File.extname(x)) }.uniq.each do |path|
if path != main
require(File.join(dir_path, 'Classes', path))
end
end
Hope this helps you out,
Mario
On Mon, Oct 18, 2010 at 4:34 PM, corey johnson
<probablycorey.spam@gmail.com> wrote:
I'm trying to get IB to recognize files i've added to xcode, but it
fails unless they are added with the "Recursively create groups for
any added folders" and not with "Create Folder References for any
added folders"
I added some logging to rb_nibtool and it seems like files added with
"Create Folder References for any added folders" never get parsed.
That is as far as I got debugging it since I'm assuming the rest of
the code resides on IB or Xcode.
The alternative is to add all my rb files into a flat directory
structure in the bundle, but I don't have to do this. Am I missing
something, is there a better way to get IB to recognize files in
nested directories?
Thanks,
Corey
_______________________________________________
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
--
Mario Steele
Lieutenant Commander 3
XO - Geo 99
XO - STO IFT Fleet
http://www.trekfederation.com