Module: RailsAssist::Directory::Root::Methods

Included in:
RailsAssist::Directory::Root, RailsAssist::Directory::Root
Defined in:
lib/rails_assist/directory/root.rb

Instance Method Summary collapse

Instance Method Details

#root_dir(options = {}) ⇒ Object



16
17
18
# File 'lib/rails_assist/directory/root.rb', line 16

def root_dir options={}
  root_dirpath(options).dir
end

#root_directoriesObject



4
5
6
# File 'lib/rails_assist/directory/root.rb', line 4

def root_directories
  [:app, :config, :db, :public, :lib, :log, :doc, :test, :spec]
end

#root_dirpath(options = {}) ⇒ Object

Raises:

  • (ArgumentError)


8
9
10
11
12
13
14
# File 'lib/rails_assist/directory/root.rb', line 8

def root_dirpath options={}
  raise ArgumentError, "options argument to root_dir must be a hash, was: #{options.inspect}" if options && !options.kind_of?(Hash)
  dir = options[:root_path] if options
  dir ||= RailsAssist::Directory.rails_root || Rails.root
  raise "You must set the Rails app root dir: RailsAssist::App.root_dir = '/my/root/dir'" if !dir
  dir.to_s.path
end