Module: Crate

Defined in:
lib/crate/version.rb,
lib/crate.rb,
lib/crate/main.rb,
lib/crate/ruby.rb,
lib/crate/digest.rb,
lib/crate/project.rb,
lib/crate/dependency.rb,
lib/crate/packing_list.rb,
lib/crate/gem_integration.rb

Overview

– Copyright © 2008 Jeremy Hinegardner All rights reserved. See LICENSE and/or COPYING for details ++

Defined Under Namespace

Modules: Version Classes: Dependency, Digest, Error, GemIntegration, Main, PackingList, Project, Ruby

Constant Summary collapse

VERSION =
Version.to_s

Class Method Summary collapse

Class Method Details

.config_path(*args) ⇒ Object

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.



42
43
44
# File 'lib/crate.rb', line 42

def self.config_path(*args)
  self.sub_path("config", *args)
end

.data_path(*args) ⇒ Object

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.



51
52
53
# File 'lib/crate.rb', line 51

def self.data_path(*args)
  self.sub_path("data", *args)
end

.lib_path(*args) ⇒ Object

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.



60
61
62
# File 'lib/crate.rb', line 60

def self.lib_path(*args)
  self.sub_path("lib", *args)
end

.projectObject



69
70
71
# File 'lib/crate.rb', line 69

def self.project
  @project
end

.project=(p) ⇒ Object



73
74
75
# File 'lib/crate.rb', line 73

def self.project=( p )
  @project = p
end

.root_dirObject

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.



28
29
30
31
32
33
34
35
# File 'lib/crate.rb', line 28

def self.root_dir
  unless @root_dir
    path_parts = ::File.expand_path(__FILE__).split(::File::SEPARATOR)
    lib_index  = path_parts.rindex("lib")
    @root_dir = path_parts[0...lib_index].join(::File::SEPARATOR) + ::File::SEPARATOR
  end 
  return @root_dir
end

.rubyObject



77
78
79
# File 'lib/crate.rb', line 77

def self.ruby
  @ruby
end

.ruby=(r) ⇒ Object



80
81
82
# File 'lib/crate.rb', line 80

def self.ruby=( r )
  @ruby = r
end

.sub_path(sub, *args) ⇒ Object



64
65
66
67
# File 'lib/crate.rb', line 64

def self.sub_path(sub,*args)
  sp = ::File.join(root_dir, sub) + File::SEPARATOR
  sp = ::File.join(sp, *args) if args
end