Module: Roll

Defined in:
lib/roll/command.rb,
lib/roll.rb,
lib/roll/errors.rb,
lib/roll/ledger.rb,
lib/roll/locals.rb,
lib/roll/library.rb,
lib/roll/version.rb,
lib/roll/metadata.rb,
lib/roll/environment.rb

Overview

– TODO: clean command to remove dead directories from environment ++

Defined Under Namespace

Classes: Command, Environment, Ledger, Library, Locals, Metadata, Version, VersionConflict, VersionError

Constant Summary collapse

VERSION =

:till: VERSION = “<%= version %>”

"1.0.0"

Class Method Summary collapse

Class Method Details

.env(name = nil) ⇒ Object

Get environment.



8
9
10
11
12
13
14
15
# File 'lib/roll.rb', line 8

def self.env(name=nil)
  if name
    env = Environment.new(name)
  else
    env = Environment.new
  end
  env
end

.in(path, depth = 3) ⇒ Object

Add path to current environment.



37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/roll.rb', line 37

def self.in(path, depth=3)
  env = Environment.new

  lookup = env.lookup
  lookup.append(path, depth)
  lookup.save

  env.sync
  env.save

  return path, lookup.file
end

.index(name = nil) ⇒ Object



17
18
19
20
21
22
23
24
# File 'lib/roll.rb', line 17

def self.index(name=nil)
  #if name
  #  env = Environment.new(name)
  #else
  #  env = Environment.new
  #end
  env(name).index.to_s
end

.out(path) ⇒ Object

Remove path from current environment.



52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/roll.rb', line 52

def self.out(path)
  env = Environment.new

  lookup = env.lookup
  lookup.delete(path)
  lookup.save

  env.sync
  env.save

  return path, lookup.file
end

.pathObject

Go thru each roll lib and collect bin paths.



67
68
69
70
71
72
73
74
75
76
# File 'lib/roll.rb', line 67

def self.path
  binpaths = []
  Library.list.each do |name|
    lib = Library[name]
    if lib.bindir?
      binpaths << lib.bindir
    end
  end
  binpaths
end

.sync(name = nil) ⇒ Object

Synchronize an environment by name. If a name is not given the current environment is synchronized.



29
30
31
32
33
# File 'lib/roll.rb', line 29

def self.sync(name=nil)
  env = env(name)
  env.sync
  env.save
end

.verify(root = Dir.pwd) ⇒ Object

Verify dependencies are in current environment. – TODO: Instead of Dir.pwd, lookup project root. ++



82
83
84
# File 'lib/roll.rb', line 82

def self.verify(root=Dir.pwd)   
  Library.new(root).verify
end