Bugs: Browse | Submit New | Admin

[#26295] Folder assumption flaws

Date:
2009-06-20 11:07
Priority:
3
Submitted By:
William Mason (william)
Assigned To:
Nobody (None)
Category:
Interface (example)
State:
Open
Summary:
Folder assumption flaws

Detailed description
Greetings,

I have been looking at the "iowa_hello_world" example, to get it running and take a look at IOWA framework
(on Ruby 1.8, windows/XP using NetBeans IDE).  I mention this because you can tell this is a virgin ramp-up.

It has taken me a good chunk of the afternoon to 'discover' that the configuration file load and the 'Iowa.config[ ]'
settings make assumptions about the folder structure that I think may cause problems in a business or web context. 
There's also a small side-effect with the NetBeans IDE Ruby debugger

    Fast Debugger (ruby-debug-ide 0.3.1) listens on localhost:3356

Which runs out of the Ruby/bin folder; so that the line (iowa.rb, self.run_check_started(*args), line #480):

   File.basename($0) is:  "C:/bin/ruby/v1.8/bin/rdebug-ide"

In my case, I have a folder tree like this:

   hello_world/
     |
     +--- log/
     |      
     |
     +--- src/
     |      |
     |      +--- public/
     |      |      |
     |      |      +--- css/
     |      |      |
     |      |      +--- js/
     |      |
     |      +--- iowa_hello_world.cnf
     |      |
     |      +--- iowa_hello_world.rb
     |      |
     |      +--- mapfile.cnf
     |      
     +--- web/

The project is running in the web/ folder. So that the basename (as above)

   File.basename($0) is:  "$ hello_world/web/"

The config and map files are in:   "$ hello_world/src/"



 Problem:
----------
The search path for configuration and mapping files depends on assumptions about the current directory (Dir.pwd) path.

This is exacerbated because the exception messages don't indicate that the problem is with the path location of the
file but due to missing directories or folders that are not found (say) to open the log file using default configuration
values.  These errors create a little bit of misdirection.


 Suggestions:
--------------
  1. (a) Add a base config directory at start.
     (b) Make the default path to use something like the __DIR__ 
         constant defined in Facets.

  2. Can you set things up so that the defaults work from where 
     ever a programme is run or the paths used.  Something like a 
     working directory that can be reported at start-up?

  3. Change message on log file open:
     iowa.rb, self.cc_logging_errors( ), line #163 ... As follows.

    raise "The logging basedir (#{@config[Clogging][Cbasedir]}) must be an *existing directory*." unless
FileTest.directory? @config[Clogging][Cbasedir]  #wm001


 Other:
--------

I don't really have much documentation, so perhaps this is not an ideal way to make the IOWA package work.  Also, it
I've got version 0.99.2.17 so may be there are improvements, the web page mentions a git repository.

On the topic of folder structure, I'm more comfortable if the program runs from a sandbox area, like the "web/"
folder used with the project.  Additionally some IDE-s like NetBeans 'force one' to keep source code, etc separate from
tests and project files.

I took some of that folder structure from the "Ramaze create" or Rails.  I like it that I can map a URL to
a folder that's not accessible from the web with Apache, etc.

And for other readers (not project people) .... I only just found the old site with some old documentation.

   http://enigo.com/projects/iowa/index.html

It might help you.

Cheers,
        Will.

Add A Comment: Notepad

Please login


Followup

No Followups Have Been Posted

Attached Files:

Name Description Download
No Files Currently Attached

Changes:

No Changes Have Been Made to This Item