The application root directory is defined as the directory containing the core application file.
You can see its definition in the core application file:
There shouldn't be a need to change this, but feel free if it is necessary for your application.
set_root command also generates four helpers.
Eucalypt.root simply returns the full application root directory path as a string.
Eucalypt.path allows for the construction of absolute paths relative to the application root directory.
Eucalypt.path('spec', 'spec_helper.rb')#=> /Users/eonu/ruby/web/apps/my-app/spec/spec_helper.rb
Eucalypt.glob allows for the globbing of files relative to the application root directory. The method works in the same way as
Dir.glob, and also accepts a block that allows you to operate on the globbed files.
Eucalypt.glob('app', 'controllers', '*.rb') do |file|file_name = File.basename file, '.rb'controller_name = file_name.sub /_controller\Z/, ''puts controller_nameend
Eucalypt.require allows for the requiring of multiple files relative to the application root directory. Note that it is not possible to specify the order in which files are required.
Kernel's require method, files must include their extensions.
# Bad - Raises error due to no extension on spec_helper.rbEucalypt.require 'spec', 'spec_helper'# GoodEucalypt.require 'spec', 'spec_helper.rb'Eucalypt.require 'spec', 'support', '**', '*.rb'