Module: Roll

Defined in:
lib/roll.rb,
lib/roll/command.rb,
lib/roll/library.rb,
lib/roll/version.rb,
lib/roll/metadata.rb,
lib/roll/commands/in.rb,
lib/roll/environment.rb,
lib/roll/commands/env.rb,
lib/roll/commands/out.rb,
lib/roll/commands/use.rb,
lib/roll/commands/help.rb,
lib/roll/commands/list.rb,
lib/roll/commands/path.rb,
lib/roll/commands/sync.rb,
lib/roll/commands/index.rb,
lib/roll/commands/verify.rb

Defined Under Namespace

Classes: Command, CommandEnv, CommandHelp, CommandIn, CommandIndex, CommandList, CommandOut, CommandPath, CommandSync, CommandUse, CommandVerify, Environment, Ledger, Library, Metadata, Version, VersionConflict, VersionError

Constant Summary collapse

VERSION =

TODO: make verison reference dynamic

"1.2.0"

Class Method Summary collapse

Class Method Details

.env(name = nil) ⇒ Object

Get environment.



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

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.



47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/roll.rb', line 47

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



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

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

.listObject

Return Array of environment names.



24
25
26
# File 'lib/roll.rb', line 24

def self.list
  Environment.list
end

.out(path) ⇒ Object

Remove path from current environment.



61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/roll.rb', line 61

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.



75
76
77
78
79
80
81
82
83
84
# File 'lib/roll.rb', line 75

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.



40
41
42
43
44
# File 'lib/roll.rb', line 40

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

.use(name) ⇒ Object

Change current environment.



19
20
21
# File 'lib/roll.rb', line 19

def self.use(name)
  Environment.save(name)
end

.verify(name = nil) ⇒ Object

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



90
91
92
93
94
95
96
# File 'lib/roll.rb', line 90

def self.verify(name=nil)
  if name
    Library.open(name).verify
  else
    Library.new(Dir.pwd).verify
  end
end