Module Amalgalite::Paths
In: lib/amalgalite/paths.rb

Paths contains helpful methods to determine paths of files inside the Amalgalite library

Methods

Public Class methods

returns:[String] The full expanded path of the config directory below root_dir. All parameters passed in are joined onto the result. Trailing File::SEPARATOR is guaranteed if args are not present.

[Source]

    # File lib/amalgalite/paths.rb, line 33
33:     def self.config_path(*args)
34:       self.sub_path("config", *args)
35:     end
returns:[String] The full expanded path of the data directory below root_dir. All parameters passed in are joined onto the result. Trailing File::SEPARATOR is guaranteed if _*args_ are not present.

[Source]

    # File lib/amalgalite/paths.rb, line 42
42:     def self.data_path(*args)
43:       self.sub_path("data", *args)
44:     end
returns:[String] The full expanded path of the ext directory below root_dir. All parameters passed in are joined onto the result. Trailing File::SEPARATOR is guaranteed if _*args_ are not present.

[Source]

    # File lib/amalgalite/paths.rb, line 60
60:     def self.ext_path(*args)
61:       self.sub_path("ext", *args)
62:     end
returns:[String] The full expanded path of the lib directory below root_dir. All parameters passed in are joined onto the result. Trailing File::SEPARATOR is guaranteed if _*args_ are not present.

[Source]

    # File lib/amalgalite/paths.rb, line 51
51:     def self.lib_path(*args)
52:       self.sub_path("lib", *args)
53:     end

The root directory of the project is considered to be the parent directory of the ‘lib’ directory.

returns:[String] The full expanded path of the parent directory of ‘lib’ going up the path from the current file. Trailing File::SEPARATOR is guaranteed.

[Source]

    # File lib/amalgalite/paths.rb, line 19
19:     def self.root_dir
20:       unless @root_dir
21:         path_parts = ::File.expand_path(__FILE__).split(::File::SEPARATOR)
22:         lib_index  = path_parts.rindex("lib")
23:         @root_dir = path_parts[0...lib_index].join(::File::SEPARATOR) + ::File::SEPARATOR
24:       end 
25:       return @root_dir
26:     end

[Source]

    # File lib/amalgalite/paths.rb, line 64
64:     def self.sub_path(sub,*args)
65:       sp = ::File.join(root_dir, sub) + File::SEPARATOR
66:       sp = ::File.join(sp, *args) if args
67:     end

[Validate]