roll 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/HISTORY +28 -4
- data/PACKAGE +6 -0
- data/PROFILE +22 -0
- data/README.rdoc +66 -59
- data/bin/roll +7 -1
- data/lib/oll.rb +1 -1
- data/lib/roll.rb +30 -9
- data/lib/roll/command.rb +40 -177
- data/lib/roll/commands/env.rb +24 -0
- data/lib/roll/commands/help.rb +30 -0
- data/lib/roll/commands/in.rb +26 -0
- data/lib/roll/commands/index.rb +20 -0
- data/lib/roll/commands/list.rb +33 -0
- data/lib/roll/commands/out.rb +22 -0
- data/lib/roll/commands/path.rb +50 -0
- data/lib/roll/commands/sync.rb +29 -0
- data/lib/roll/commands/use.rb +25 -0
- data/lib/roll/commands/verify.rb +22 -0
- data/lib/roll/config.rb +8 -3
- data/lib/roll/environment.rb +84 -42
- data/lib/roll/kernel.rb +9 -2
- data/lib/roll/library.rb +360 -21
- data/lib/roll/metadata.rb +282 -51
- data/lib/roll/original.rb +3 -3
- data/lib/roll/version.rb +6 -7
- data/script/setup +14 -18
- data/script/setup.old +1344 -0
- data/test/{unitcases/version_case.rb → version_case.rb} +1 -1
- metadata +30 -47
- data/TODO +0 -4
- data/lib/roll/errors.rb +0 -13
- data/lib/roll/ledger.rb +0 -299
- data/lib/roll/locals.rb +0 -96
- data/meta/active +0 -1
- data/meta/authors +0 -1
- data/meta/contact +0 -1
- data/meta/created +0 -1
- data/meta/description +0 -5
- data/meta/homepage +0 -1
- data/meta/maintainer +0 -1
- data/meta/name +0 -1
- data/meta/repository +0 -1
- data/meta/ruby +0 -2
- data/meta/suite +0 -1
- data/meta/summary +0 -1
- data/meta/version +0 -1
- data/script/test +0 -23
- data/test/benchmarks/vsgems.rb +0 -11
- data/test/benchmarks/vsgems_bm.rb +0 -17
- data/test/demonstrations/01_library.rdoc +0 -33
- data/test/demonstrations/04_version.rdoc +0 -56
- data/test/fixtures/env.list +0 -1
- data/test/fixtures/inspect.rb +0 -12
- data/test/fixtures/tryme/1.0/lib/tryme.rb +0 -1
- data/test/fixtures/tryme/1.0/meta/homepage +0 -1
- data/test/fixtures/tryme/1.0/meta/name +0 -1
- data/test/fixtures/tryme/1.0/meta/version +0 -1
- data/test/fixtures/tryme/1.1/lib/tryme.rb +0 -1
- data/test/fixtures/tryme/1.1/meta/homepage +0 -1
- data/test/fixtures/tryme/1.1/meta/name +0 -1
- data/test/fixtures/tryme/1.1/meta/version +0 -1
- data/test/unit/version_test.rb +0 -71
data/HISTORY
CHANGED
@@ -1,11 +1,35 @@
|
|
1
1
|
= RELEASE HISTORY
|
2
2
|
|
3
|
+
== 1.2.0 / 2010-06-15
|
4
|
+
|
5
|
+
This release gets roll command working and improves
|
6
|
+
the reliability of the system as a whole, including making
|
7
|
+
metadata lookup more consistant (hint: you want a PACKAGE file).
|
8
|
+
It is even partially compatible with Gem stores now (exceptions
|
9
|
+
being loadpaths other than lib/ and the use of autoload).
|
10
|
+
|
11
|
+
Changes:
|
12
|
+
|
13
|
+
* Reworked metadata system (in line with evolving POM).
|
14
|
+
* Improved search heuristics (usually much faster now).
|
15
|
+
|
16
|
+
|
17
|
+
== 1.1.0 / 2010-03-01
|
18
|
+
|
19
|
+
This release fix a few bugs and makes a few adjustments,
|
20
|
+
but mostly cleans up code behind the scenes.
|
21
|
+
|
22
|
+
Changes:
|
23
|
+
|
24
|
+
* Fix incorrect multi-match and absolute path lookup
|
25
|
+
* Support for Rubinius RUBY_IGNORE_CALLERS
|
26
|
+
|
27
|
+
|
3
28
|
== 1.0.0 / 2010-02-11
|
4
29
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
of package management to the domain of other tools.
|
30
|
+
This release overhauls the underlying system, which is now very
|
31
|
+
fast. It supports customizable library environments, and banashes
|
32
|
+
all traces of package management to the domain of other tools.
|
9
33
|
|
10
34
|
Changes:
|
11
35
|
|
data/PACKAGE
ADDED
data/PROFILE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
---
|
2
|
+
title: Roll
|
3
|
+
suite: proutils
|
4
|
+
summary: Ruby Object-Oriented Library Ledger
|
5
|
+
contact: Trans <transfire@gmail.com>
|
6
|
+
authors: Thomas Sawyer
|
7
|
+
created: 2006-12-10
|
8
|
+
|
9
|
+
description:
|
10
|
+
Roll is a library manager for Ruby. Code repositories
|
11
|
+
can be made visible to Ruby just by setting an
|
12
|
+
environment variable. Rolls effectively trivializes
|
13
|
+
Ruby package management.
|
14
|
+
|
15
|
+
resources:
|
16
|
+
home: http://proutils.github.com/roll
|
17
|
+
repo: git://github.com/proutils/roll.git
|
18
|
+
mail: http://groups.google.com/group/proutils
|
19
|
+
|
20
|
+
copyright:
|
21
|
+
Copyright (c) 2006 Thomas Sawyer
|
22
|
+
|
data/README.rdoc
CHANGED
@@ -15,14 +15,29 @@
|
|
15
15
|
""""........
|
16
16
|
|
17
17
|
* home: http://proutils.github.com/roll
|
18
|
+
* worl: http://github.com/protuils/roll
|
18
19
|
|
19
20
|
|
20
21
|
== DESCRIPTION
|
21
22
|
|
22
|
-
Roll is a library manager for Ruby. With Rolls developers can run
|
23
|
+
Roll is a library manager for Ruby. With Rolls developers can run their
|
23
24
|
programs in real time --no install phase is required for one program
|
24
25
|
to depend on another. This makes it very easy to work on a set of
|
25
|
-
interdependent projects.
|
26
|
+
interdependent projects --without vendering. It also makes easy to
|
27
|
+
create isolated library environments. Yet Rolls does so efficiently
|
28
|
+
--there need only be a single copy of any given version of a library
|
29
|
+
on disc. And libraries can be stored anywhere. There is no special place
|
30
|
+
they must all reside. You simple tell Rolls where they are.
|
31
|
+
|
32
|
+
== STATUS
|
33
|
+
|
34
|
+
Rolls works fairly well. I have used it for development for years, so
|
35
|
+
on the whole it stays in working order. However it is still under
|
36
|
+
heavy development, so configuration is still subject to a fair bit
|
37
|
+
of change. The loading heuristics are quite advanced, which accounts
|
38
|
+
for the speed, but as a trade-off the first library that is not found
|
39
|
+
"early" can initilially slow the system as all of an environments
|
40
|
+
metadata if loaded.
|
26
41
|
|
27
42
|
|
28
43
|
== HOW TO USE
|
@@ -36,7 +51,7 @@ variable.
|
|
36
51
|
|
37
52
|
I suspect you will be using RubyGems too, in which case do:
|
38
53
|
|
39
|
-
$ export RUBYOPT="-
|
54
|
+
$ export RUBYOPT="-roll -rubygems"
|
40
55
|
|
41
56
|
To support executables you will also need to add a line to your startup
|
42
57
|
.bashrc (or equivalent) file.
|
@@ -51,72 +66,57 @@ b/c it has some shortcomings.)
|
|
51
66
|
|
52
67
|
=== Preparing your Projects
|
53
68
|
|
54
|
-
For
|
55
|
-
minimal POM[http://proutils.github.com/pom] setup.
|
56
|
-
the project must
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
directory
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
lib/core
|
74
|
-
lib/more
|
75
|
-
|
76
|
-
$ cat facets/meta/ruby
|
77
|
-
1.8+
|
78
|
-
|
79
|
-
The +ruby+ entry informs Rolls of the particular implementations and versions
|
80
|
-
of Ruby the project should operate under successfully.
|
81
|
-
(NOTE: Rolls doesn't actually do anything with the ruby entry yet.)
|
82
|
-
|
83
|
-
Lastly, an +active+ entry can be set to +false+ to tell Rolls to skip the
|
84
|
-
project when searching for library files. See POM[http://proutils.github.com/pom]
|
85
|
-
for more information.
|
86
|
-
|
69
|
+
For a project to be detected by Rolls it must conform to a
|
70
|
+
minimal POM[http://proutils.github.com/pom] setup. Specifically
|
71
|
+
the project must have a <code>PACKAGE</code> file and it must
|
72
|
+
have at least one <code>lib/*.rb</code> file. In the future this
|
73
|
+
should become a little more flexible, but that is the bare minimum
|
74
|
+
for a project to to be loadable via Rolls as of v1.2. The only
|
75
|
+
exception is for Gem stores. If you point Rolls torwards a gems/
|
76
|
+
location it will attempt to parse the name and version from a
|
77
|
+
library's directory name (e.g. facets-2.8.4/). It does not read
|
78
|
+
the gemspec (that would be slow). So alternate loadpaths are not
|
79
|
+
supported for Gem stores at this time.
|
80
|
+
|
81
|
+
Also, note that #autoload will not work with Rolls. Ruby has a bug
|
82
|
+
that prevents #autoload from using any custom defined #require method.
|
83
|
+
(Why this has never been fixed is both annoying and frustrating
|
84
|
+
to say the least.)
|
85
|
+
|
86
|
+
See POM[http://proutils.github.com/pom] for more information about
|
87
|
+
the POM standard.
|
87
88
|
|
88
89
|
=== Library Management
|
89
90
|
|
90
91
|
Next you need to setup an roll *environment*. The default environment
|
91
|
-
is
|
92
|
+
is called +production+. You can add a library search location to it
|
92
93
|
using +roll in+. Eg.
|
93
94
|
|
94
95
|
$ roll in /opt/ruby/
|
95
96
|
|
96
|
-
As a developer you will
|
97
|
-
To change or add
|
97
|
+
As a developer you will may want to setup a +development+ environment.
|
98
|
+
To change or add an environment use the +use+ command.
|
98
99
|
|
99
|
-
$
|
100
|
+
$ roll use development
|
100
101
|
|
101
102
|
Then you can add the paths you want. For instance my development
|
102
|
-
environment is
|
103
|
+
environment is essentially constructed like this:
|
103
104
|
|
104
105
|
$ roll in ~/programs/proutils
|
105
106
|
$ roll in ~/programs/rubyworks
|
106
|
-
$ roll in ~/programs/
|
107
|
-
$ roll in ~/programs/transcode
|
107
|
+
$ roll in ~/programs/trans
|
108
108
|
|
109
109
|
By default these paths will be searched for POM conforming projects
|
110
110
|
up to a depth of three sub-directories. That's suitable for
|
111
111
|
most needs. You can specify the the depth explicitly with the
|
112
|
-
<tt>--depth</tt> or <tt>-d</tt> option.
|
113
|
-
|
114
|
-
|
115
|
-
|
112
|
+
<tt>--depth</tt> or <tt>-d</tt> option. You can roll in the
|
113
|
+
current working directory by leaving off the path argument.
|
114
|
+
If the current directory has a +VERSION+ file, a depth of +1+
|
115
|
+
will automatically be used.
|
116
116
|
|
117
|
-
$ roll in
|
117
|
+
$ roll in
|
118
118
|
|
119
|
-
|
119
|
+
So that's it. You are *READY-TO-ROLL*!
|
120
120
|
|
121
121
|
|
122
122
|
== LEARNING MORE
|
@@ -128,19 +128,26 @@ it fullest extent, please visit http://proutils.github.org/roll/.
|
|
128
128
|
|
129
129
|
== HOW TO INSTALL
|
130
130
|
|
131
|
-
=== Manual Installation
|
131
|
+
=== Manual Installation (Recommended)
|
132
132
|
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
Once you have setup.rb, download the Roll tarball and install
|
137
|
-
it manually as follows:
|
133
|
+
First you need a copy of the roll tarball (or zip) archive.
|
134
|
+
You will find them here[http://github.com/proutils/roll/download].
|
138
135
|
|
139
136
|
$ tar -xvzf roll-1.0.0
|
137
|
+
|
138
|
+
If you already have Ruby Setup installed on your system you can
|
139
|
+
use it to install Rolls (See: http://setup.rubyforge.org).
|
140
|
+
|
141
|
+
$ cd roll-1.0.0
|
142
|
+
$ sudo setup.rb
|
143
|
+
|
144
|
+
Otherwise, Rolls includes a copy of Ruby Setup that you can
|
145
|
+
use.
|
146
|
+
|
140
147
|
$ cd roll-1.0.0
|
141
|
-
$ sudo setup.
|
148
|
+
$ sudo script/setup.
|
142
149
|
|
143
|
-
On Windows, this last line needs to be 'ruby setup
|
150
|
+
On Windows, this last line needs to be 'ruby script/setup'.
|
144
151
|
|
145
152
|
=== RubyGems Installation
|
146
153
|
|
@@ -151,7 +158,7 @@ install it; and this is a convenient way to try it out.
|
|
151
158
|
gem install roll
|
152
159
|
|
153
160
|
If you like Rolls, then later you can uninstall the gem and
|
154
|
-
install
|
161
|
+
do a proper manual install.
|
155
162
|
|
156
163
|
|
157
164
|
== BY THE WAY
|
@@ -161,7 +168,7 @@ Roll was RubyForge project #1004. She's been around a while! ;)
|
|
161
168
|
|
162
169
|
== LICENSE & COPYRIGHT
|
163
170
|
|
164
|
-
Roll
|
171
|
+
Roll/Rolls Copyright (c) 2006,2007 Thomas Sawyer
|
165
172
|
|
166
173
|
Rolls is distributed under the same terms as Ruby.
|
167
174
|
|
data/bin/roll
CHANGED
data/lib/oll.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
require 'roll'
|
1
|
+
require 'roll' #File.dirname(__FILE__) + '/roll.rb'
|
data/lib/roll.rb
CHANGED
@@ -1,10 +1,11 @@
|
|
1
|
-
require 'roll/
|
1
|
+
require 'roll/config'
|
2
|
+
require 'roll/library'
|
3
|
+
require 'roll/kernel' # require last
|
2
4
|
|
3
5
|
module Roll
|
4
|
-
VERSION = "1.
|
6
|
+
VERSION = "1.2.0" # TODO: make verison reference dynamic
|
5
7
|
|
6
8
|
# Get environment.
|
7
|
-
|
8
9
|
def self.env(name=nil)
|
9
10
|
if name
|
10
11
|
env = Environment.new(name)
|
@@ -14,6 +15,17 @@ module Roll
|
|
14
15
|
env
|
15
16
|
end
|
16
17
|
|
18
|
+
# Change current environment.
|
19
|
+
def self.use(name)
|
20
|
+
Environment.save(name)
|
21
|
+
end
|
22
|
+
|
23
|
+
# Return Array of environment names.
|
24
|
+
def self.list
|
25
|
+
Environment.list
|
26
|
+
end
|
27
|
+
|
28
|
+
#
|
17
29
|
def self.index(name=nil)
|
18
30
|
#if name
|
19
31
|
# env = Environment.new(name)
|
@@ -25,7 +37,6 @@ module Roll
|
|
25
37
|
|
26
38
|
# Synchronize an environment by +name+. If a +name+
|
27
39
|
# is not given the current environment is synchronized.
|
28
|
-
|
29
40
|
def self.sync(name=nil)
|
30
41
|
env = env(name)
|
31
42
|
env.sync
|
@@ -33,7 +44,6 @@ module Roll
|
|
33
44
|
end
|
34
45
|
|
35
46
|
# Add path to current environment.
|
36
|
-
|
37
47
|
def self.in(path, depth=3)
|
38
48
|
env = Environment.new
|
39
49
|
|
@@ -48,7 +58,6 @@ module Roll
|
|
48
58
|
end
|
49
59
|
|
50
60
|
# Remove path from current environment.
|
51
|
-
|
52
61
|
def self.out(path)
|
53
62
|
env = Environment.new
|
54
63
|
|
@@ -63,7 +72,6 @@ module Roll
|
|
63
72
|
end
|
64
73
|
|
65
74
|
# Go thru each roll lib and collect bin paths.
|
66
|
-
|
67
75
|
def self.path
|
68
76
|
binpaths = []
|
69
77
|
Library.list.each do |name|
|
@@ -79,8 +87,21 @@ module Roll
|
|
79
87
|
#--
|
80
88
|
# TODO: Instead of Dir.pwd, lookup project root.
|
81
89
|
#++
|
82
|
-
def self.verify(
|
83
|
-
|
90
|
+
def self.verify(name=nil)
|
91
|
+
if name
|
92
|
+
Library.open(name).verify
|
93
|
+
else
|
94
|
+
Library.new(Dir.pwd).verify
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
# VersionError is raised when a requested version cannot be found.
|
99
|
+
class VersionError < ::RangeError # :nodoc:
|
100
|
+
end
|
101
|
+
|
102
|
+
# VersionConflict is raised when selecting another version
|
103
|
+
# of a library when a previous version has already been selected.
|
104
|
+
class VersionConflict < ::LoadError # :nodoc:
|
84
105
|
end
|
85
106
|
|
86
107
|
end
|
data/lib/roll/command.rb
CHANGED
@@ -1,205 +1,68 @@
|
|
1
|
+
#require File.dirname(File.dirname(__FILE__)) + '/roll.rb'
|
1
2
|
require 'roll'
|
2
|
-
#require 'roll/platform'
|
3
|
-
require 'optparse'
|
4
|
-
|
5
|
-
#--
|
6
|
-
# TODO: clean command to remove dead directories from environment
|
7
|
-
#++
|
8
3
|
|
9
4
|
module Roll
|
10
5
|
|
11
6
|
# = Command-line Interface
|
12
|
-
|
7
|
+
#--
|
8
|
+
# TODO: clean command to remove dead directories from environment
|
9
|
+
#++
|
13
10
|
class Command
|
14
11
|
|
12
|
+
# Command-line arguments.
|
13
|
+
attr :args
|
14
|
+
|
15
|
+
# Command-line options.
|
16
|
+
attr :opts
|
17
|
+
|
18
|
+
# Instance of OptionParser.
|
19
|
+
attr :op
|
20
|
+
|
15
21
|
# Initialize and execute command.
|
16
22
|
def self.main(*argv)
|
17
|
-
|
23
|
+
#cmd = argv.shift
|
24
|
+
idx = argv.index{ |e| e !~ /^\-/ }
|
25
|
+
cmd = idx ? argv.delete_at(idx) : 'help'
|
26
|
+
begin
|
27
|
+
require "roll/commands/#{cmd}"
|
28
|
+
rescue LoadError
|
29
|
+
cmd = 'help'
|
30
|
+
require "roll/commands/#{cmd}"
|
31
|
+
end
|
32
|
+
klass = ::Roll.const_get("Command#{cmd.capitalize}")
|
33
|
+
klass.new(*argv).execute
|
18
34
|
end
|
19
35
|
|
20
36
|
# New Command.
|
21
37
|
def initialize(*argv)
|
22
|
-
|
38
|
+
# only need optparse when command is run
|
39
|
+
require 'optparse'
|
40
|
+
@op = OptionParser.new
|
41
|
+
@args = argv
|
42
|
+
@opts = {}
|
23
43
|
end
|
24
44
|
|
25
45
|
#
|
26
46
|
def execute
|
27
|
-
|
28
|
-
|
29
|
-
options = {}
|
30
|
-
|
31
|
-
parser = OptionParser.new
|
32
|
-
|
33
|
-
parser.banner = "Usage: roll [COMMAND]"
|
47
|
+
setup
|
34
48
|
|
35
|
-
|
36
|
-
|
37
|
-
if !cmd
|
38
|
-
parser.separator "Commands:"
|
39
|
-
parser.separator " in [DIR] " + (" " * 23) + "Roll directory into current environment."
|
40
|
-
parser.separator " out [DIR] " + (" " * 23) + "Remove directory from current environment."
|
41
|
-
parser.separator " env " + (" " * 23) + "Show current environment."
|
42
|
-
parser.separator " index " + (" " * 23) + "Show current environment index."
|
43
|
-
parser.separator " sync " + (" " * 23) + "Synchronize environment indexes."
|
44
|
-
parser.separator " path " + (" " * 23) + "Output bin PATH list."
|
45
|
-
parser.separator " verify " + (" " * 23) + "Verify project dependencies in current environment."
|
46
|
-
parser.separator "Options:"
|
47
|
-
end
|
48
|
-
|
49
|
-
parser.on_tail("--help", "-h", "Display this help message.") do
|
50
|
-
puts parser
|
51
|
-
exit
|
49
|
+
op.on_tail("--warn", "-w", "Show warnings.") do
|
50
|
+
$VERBOSE = true
|
52
51
|
end
|
53
52
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
if cmd
|
59
|
-
__send__(cmd, ARGV, options)
|
60
|
-
else
|
61
|
-
# no command ?
|
53
|
+
op.on_tail("--debug", "Run in debugging mode.") do
|
54
|
+
$DEBUG = true
|
55
|
+
$VERBOSE = true
|
62
56
|
end
|
63
|
-
end
|
64
|
-
|
65
|
-
#
|
66
|
-
def env_optparse(op, options)
|
67
|
-
op.banner = "Usage: roll env [NAME]"
|
68
|
-
op.separator "Show current environment."
|
69
|
-
op
|
70
|
-
end
|
71
|
-
|
72
|
-
#
|
73
|
-
def index_optparse(op, options)
|
74
|
-
op.banner = "Usage: roll index [NAME]"
|
75
|
-
op.separator "Show current environment index."
|
76
|
-
op
|
77
|
-
end
|
78
|
-
|
79
|
-
#
|
80
|
-
def sync_optparse(op, options)
|
81
|
-
op.banner = "Usage: roll sync [NAME]"
|
82
|
-
op.separator "Synchronize ledger(s) to their respective environment(s)."
|
83
|
-
op
|
84
|
-
end
|
85
|
-
|
86
|
-
#
|
87
|
-
def in_optparse(op, options)
|
88
|
-
op.banner = "Usage: roll in [PATH]"
|
89
|
-
op.separator "Insert path into current environment."
|
90
|
-
op.separator "Options:"
|
91
|
-
op.on("--depth", "-d [INTEGER]") do |int|
|
92
|
-
options[:depth] = int
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
#
|
97
|
-
def out_optparse(op, options)
|
98
|
-
op.banner = "Usage: roll out [PATH]"
|
99
|
-
op.separator "Remove path from current environment."
|
100
|
-
op
|
101
|
-
end
|
102
57
|
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
op.separator "Generate executable PATH list."
|
107
|
-
op
|
108
|
-
end
|
109
|
-
|
110
|
-
#
|
111
|
-
def verify_optparse(op, options)
|
112
|
-
op.banner = "Usage: roll verify"
|
113
|
-
op.separator "Verify dependencies in current environment."
|
114
|
-
op
|
115
|
-
end
|
116
|
-
|
117
|
-
# Show/Change current environment.
|
118
|
-
#
|
119
|
-
def env(args, opts)
|
120
|
-
puts Roll.env(*args)
|
121
|
-
end
|
122
|
-
|
123
|
-
# Show/Change current environment.
|
124
|
-
#
|
125
|
-
def index(args, opts)
|
126
|
-
puts Roll.index(*args)
|
127
|
-
end
|
128
|
-
|
129
|
-
# Synchronize ledgers.
|
130
|
-
#
|
131
|
-
def sync(args, opts)
|
132
|
-
name = args.first
|
133
|
-
list = name ? [name] : Environment.list
|
134
|
-
list.each do |name|
|
135
|
-
result = Roll.sync(name)
|
136
|
-
if result
|
137
|
-
puts " saved #{name}"
|
138
|
-
else
|
139
|
-
puts " current #{name}"
|
140
|
-
end
|
58
|
+
op.on_tail("--help", "-h", "Display this help message.") do
|
59
|
+
puts op
|
60
|
+
exit
|
141
61
|
end
|
142
|
-
end
|
143
62
|
|
144
|
-
|
145
|
-
def in(args, opts)
|
146
|
-
path = File.expand_path(args.first || Dir.pwd)
|
147
|
-
depth = opts[:depth]
|
148
|
-
path, file = *Roll.in(path, depth)
|
149
|
-
puts "#{path}"
|
150
|
-
puts " '-> #{file}"
|
151
|
-
end
|
152
|
-
|
153
|
-
#
|
154
|
-
def out(args, opts)
|
155
|
-
path = File.expand_path(args.first || Dir.pwd)
|
156
|
-
path, file = *Roll.out(path)
|
157
|
-
puts "#{file}"
|
158
|
-
puts " '-> #{path} -> [x]"
|
159
|
-
end
|
63
|
+
op.parse!(args)
|
160
64
|
|
161
|
-
|
162
|
-
def verify(args, opts)
|
163
|
-
list = Roll.verify
|
164
|
-
list.each do |(name, constraint)|
|
165
|
-
puts "#{name} #{constraint}"
|
166
|
-
end
|
167
|
-
end
|
168
|
-
|
169
|
-
# This script builds a list of all roll-ready bin locations
|
170
|
-
# and writes that list as an environment setting shell script.
|
171
|
-
# On Linux a call to this to you .bashrc file. Eg.
|
172
|
-
#
|
173
|
-
# if [ -f ~/.rollrc ]; then
|
174
|
-
# . roll
|
175
|
-
# fi
|
176
|
-
#
|
177
|
-
# Currently this only supports bash.
|
178
|
-
#
|
179
|
-
# TODO: It would be better to "install" executables
|
180
|
-
# to an appropriate bin dir, using links (soft if possible).
|
181
|
-
# There could go in ~/.bin or .config/roll/<ledger>.bin/
|
182
|
-
#
|
183
|
-
def path(args, opts)
|
184
|
-
case RUBY_PLATFORM
|
185
|
-
when /mswin/, /wince/
|
186
|
-
div = ';'
|
187
|
-
else
|
188
|
-
div = ':'
|
189
|
-
end
|
190
|
-
env_path = ENV['PATH'].split(/[#{div}]/)
|
191
|
-
# Go thru each roll lib and make sure bin path is in path.
|
192
|
-
binpaths = []
|
193
|
-
Library.list.each do |name|
|
194
|
-
lib = Library[name]
|
195
|
-
if lib.bindir?
|
196
|
-
binpaths << lib.bindir
|
197
|
-
end
|
198
|
-
end
|
199
|
-
#pathenv = (["$PATH"] + binpaths).join(div)
|
200
|
-
pathenv = binpaths.join(div)
|
201
|
-
#puts %{export PATH="#{pathenv}"}
|
202
|
-
puts pathenv
|
65
|
+
call
|
203
66
|
end
|
204
67
|
|
205
68
|
end
|