rumodule 0.0.3
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.
- checksums.yaml +7 -0
- data/CHANGELOG.rdoc +11 -0
- data/LICENSE +20 -0
- data/README.rdoc +218 -0
- data/bin/rumodule +1069 -0
- data/doc/CmdAdd.html +837 -0
- data/doc/CmdDisplay.html +260 -0
- data/doc/CmdHelp.html +304 -0
- data/doc/CmdList.html +258 -0
- data/doc/CmdRm.html +832 -0
- data/doc/CmdSadd.html +300 -0
- data/doc/CmdSlist.html +258 -0
- data/doc/CmdSrm.html +283 -0
- data/doc/CmdWhich.html +258 -0
- data/doc/EnvVar.html +1351 -0
- data/doc/Rumodule.html +841 -0
- data/doc/RumoduleCommon.html +151 -0
- data/doc/RumoduleMod.html +202 -0
- data/doc/Utility.html +1403 -0
- data/doc/_index.html +202 -0
- data/doc/class_list.html +58 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +57 -0
- data/doc/css/style.css +339 -0
- data/doc/file.CHANGELOG.html +87 -0
- data/doc/file.README.html +303 -0
- data/doc/file_list.html +63 -0
- data/doc/frames.html +26 -0
- data/doc/index.html +303 -0
- data/doc/js/app.js +219 -0
- data/doc/js/full_list.js +181 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +423 -0
- data/doc/top-level-namespace.html +130 -0
- data/lib/version.rb +6 -0
- data/test/run_fish +3 -0
- data/test/run_zsh_sh_bash +3 -0
- data/test/test_fish +70 -0
- data/test/test_fish.log +60 -0
- data/test/test_golden.log +60 -0
- data/test/test_rumodule.rb +39 -0
- data/test/test_zsh_sh_bash +72 -0
- data/test/test_zsh_sh_bash.log +60 -0
- metadata +110 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 629f75332cb09b41f0e24e6244b8af378cd605ee
|
4
|
+
data.tar.gz: 52774f5c22e5612227237808dffd73c995ea5701
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0e4082e662b81a31c26cde73ff7a65eb085e07c3f3a96ffa0ff6e38dbad2d64f8e1cf24cc0f529eb3ec5cd42552a9411710c0831742a03e7ae65f1c47d282839
|
7
|
+
data.tar.gz: 7d34d9599221ae347db10aa844527e20c9f0f2892d2467dff00b65ee6cc423850422b4e5c6be3e15113806fc9336f9172309275efd69eba34a9700fcf5f1f63a
|
data/CHANGELOG.rdoc
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
= Version history
|
2
|
+
|
3
|
+
[0.0.3] Added tests.
|
4
|
+
Improvements in documentation.
|
5
|
+
Non-inverted module registration list.
|
6
|
+
Fix for unset-set sequence corner case.
|
7
|
+
|
8
|
+
[0.0.2] Support for separation of normal and system modules.
|
9
|
+
Support for submodules (added from another module).
|
10
|
+
|
11
|
+
[0.0.1] Initial version.
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2013 tero.isannainen@gmail.com
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,218 @@
|
|
1
|
+
|
2
|
+
= Content
|
3
|
+
|
4
|
+
* Introduction
|
5
|
+
* Command Line Usage
|
6
|
+
* Rumodule File Commands
|
7
|
+
* Shell Function
|
8
|
+
* Environment Setup
|
9
|
+
* Summary
|
10
|
+
|
11
|
+
|
12
|
+
= Introduction
|
13
|
+
|
14
|
+
Rumodule is used to manage shell environment variables by
|
15
|
+
adding/removing modules. By adding a module using Rumodule, for
|
16
|
+
example the PATH environment variable can be setup so that the
|
17
|
+
executable is found.
|
18
|
+
|
19
|
+
Modules exist per tool or per tool version. Rumodule makes it easy
|
20
|
+
to maintain and provide tool setups between multiple users.
|
21
|
+
|
22
|
+
The commands are called User Commands. Modules are called Rumodule
|
23
|
+
files and they include Rumodule File Commands.
|
24
|
+
|
25
|
+
Rumodule refers to modules through RUMODULE environment
|
26
|
+
variable. RUMODULE includes a list of directories where Rumodule
|
27
|
+
Files reside.
|
28
|
+
|
29
|
+
Rumodule command is not convenient to be used directly. The user
|
30
|
+
should setup a shell function which is used to utilize Rumodule.
|
31
|
+
Recommended name is "rumo". See: Shell Function.
|
32
|
+
|
33
|
+
Supported shells: zsh, sh, bash, fish
|
34
|
+
|
35
|
+
|
36
|
+
= Command Line Usage
|
37
|
+
|
38
|
+
== Overview
|
39
|
+
|
40
|
+
The most common User Commands are: "add" and "rm". "add" adds
|
41
|
+
modules content to the shell environment and "rm" removes the same
|
42
|
+
content (or its effects).
|
43
|
+
|
44
|
+
Execution examples:
|
45
|
+
rumo add my_module
|
46
|
+
rumo rm my_module
|
47
|
+
|
48
|
+
Other common commands are "list" and "avail". "list" displays a list
|
49
|
+
of loaded modules and "avail" lists all modules found, defined by
|
50
|
+
the RUMODULE env variable.
|
51
|
+
|
52
|
+
|
53
|
+
== List of User Commands
|
54
|
+
|
55
|
+
* add: add (load) one or many modules
|
56
|
+
* sadd: add (load) one or many system modules
|
57
|
+
* rm: remove (unload) one or many modules
|
58
|
+
* srm: remove (unload) one or many system modules
|
59
|
+
* list: list loaded modules
|
60
|
+
* slist: list loaded system modules
|
61
|
+
* which: display module that would be selected from module directory
|
62
|
+
* display: display module content
|
63
|
+
* avail: list all available modules
|
64
|
+
* savail: list all available modules (including system modules)
|
65
|
+
* help: display rumodule commands or module help if module given
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
= Rumodule File Commands
|
70
|
+
|
71
|
+
== Overview
|
72
|
+
|
73
|
+
The Rumodule files include commands to setup a tool for
|
74
|
+
usage. Rumodule files are normal Ruby files, except a set of
|
75
|
+
Rumodule commands are available in the top namespace. The Rumodule
|
76
|
+
File Commands are semantically defined for the "add" command. For
|
77
|
+
"rm" they have the opposite meaning.
|
78
|
+
|
79
|
+
The most common commands are "setenv", "append_path", and
|
80
|
+
"prepend_path".
|
81
|
+
|
82
|
+
"append_path" adds an entry to the end of existing env variable (or
|
83
|
+
new is created). "prepend_path" adds an entry to the beginning of
|
84
|
+
existing env variable. New var is created if it doesn't exist.
|
85
|
+
|
86
|
+
New env variable is created with "setenv" command. Existing env
|
87
|
+
var can be removed with "unsetenv" command.
|
88
|
+
|
89
|
+
Rumodule example:
|
90
|
+
help( "This module is used for tool" )
|
91
|
+
tool_path = ENV['TOOL_PATH']
|
92
|
+
append_path( 'PATH', "#{tool_path}/bin" )
|
93
|
+
add( "tool_setup" )
|
94
|
+
|
95
|
+
|
96
|
+
== List of Rumodule File Commands
|
97
|
+
|
98
|
+
[ setenv( var, value ) ]
|
99
|
+
Set env var "var" to "value".
|
100
|
+
|
101
|
+
[ unsetenv( var ) ]
|
102
|
+
Unset env var "var".
|
103
|
+
|
104
|
+
[ append_path( var, value ) ]
|
105
|
+
Append "value" to env var "var".
|
106
|
+
|
107
|
+
[ prepend_path( var, value ) ]
|
108
|
+
Prepend "value" to env var "var".
|
109
|
+
|
110
|
+
[ remove_path( var, value ) ]
|
111
|
+
Remove "value" from env var "var".
|
112
|
+
|
113
|
+
[ pushenv( var, value ) ]
|
114
|
+
Set env var "var" to "value" and save the old value of "var" for
|
115
|
+
future. When module is removed, the old value is returned.
|
116
|
+
|
117
|
+
[ prereq( mod ) ]
|
118
|
+
Check that module "mod" is loaded, or abort. It is recommended to
|
119
|
+
check for other modules before performing any other operation
|
120
|
+
within the module command. Otherwise the Shell Function should
|
121
|
+
check for "rumodule" return codes, and prevent shell env changes
|
122
|
+
when aborting.
|
123
|
+
|
124
|
+
[ conflict( mod ) ]
|
125
|
+
Check that module "mod" is not loaded, or abort. See "prereq"
|
126
|
+
usage recommendations.
|
127
|
+
|
128
|
+
[ is_loaded( mod ) ]
|
129
|
+
Check if module "mod" is loaded.
|
130
|
+
|
131
|
+
[ add( mod ) ]
|
132
|
+
Add a module "mod" from Rumodule file.
|
133
|
+
|
134
|
+
|
135
|
+
|
136
|
+
= Shell Function
|
137
|
+
|
138
|
+
== Overview
|
139
|
+
|
140
|
+
Rumodule user must setup a shell function to use Rumodule
|
141
|
+
easily. Recommended name for the function is "rumo". The purpose of
|
142
|
+
the function is to map user arguments to "rumodule" command and pass
|
143
|
+
"rumodule" output to shell for evaluation. This enables the user
|
144
|
+
command to change the shell environment variable contents.
|
145
|
+
|
146
|
+
NOTE: If you are using a Ruby version which takes a long time to
|
147
|
+
load into memory, please consider referencing directly into suitable
|
148
|
+
Ruby version in "rumo".
|
149
|
+
|
150
|
+
|
151
|
+
== Shell Function examples
|
152
|
+
|
153
|
+
Setup "rumo" command for sh, zsh, or bash shells:
|
154
|
+
rumo () {
|
155
|
+
cmd=$1
|
156
|
+
shift
|
157
|
+
if test $# -gt 0; then
|
158
|
+
eval `rumodule -s zsh -c $cmd -m $*`
|
159
|
+
else
|
160
|
+
eval `rumodule -c $cmd`
|
161
|
+
fi
|
162
|
+
}
|
163
|
+
|
164
|
+
Setup "rumo" command for fish shell:
|
165
|
+
function rumo
|
166
|
+
if test (count $argv) -gt 1
|
167
|
+
set cmd (rumodule -s fish -c $argv[1] -m $argv[2..-1])
|
168
|
+
else
|
169
|
+
set cmd (rumodule -s fish -c $argv[1])
|
170
|
+
end
|
171
|
+
eval $cmd
|
172
|
+
end
|
173
|
+
|
174
|
+
|
175
|
+
= Environment Setup
|
176
|
+
|
177
|
+
Rumodule requires the RUMODULE env var to be set to the root
|
178
|
+
directory or directories where the Rumodule Files reside.
|
179
|
+
|
180
|
+
Lets assume the "$HOME/usr/share/rumodule" directory is used to
|
181
|
+
store the modules.
|
182
|
+
|
183
|
+
The directory content could be the following:
|
184
|
+
tool1
|
185
|
+
tool2
|
186
|
+
tool3/1.2.3
|
187
|
+
/1.2.6
|
188
|
+
tool4
|
189
|
+
system-
|
190
|
+
|
191
|
+
"tool1,2,4" are module files and "tool3" is a subdirectory including
|
192
|
+
module files "1.2.3" and "1.2.6". "system-" is a system module file,
|
193
|
+
which is visible only with "savail" command. System module files are
|
194
|
+
used to separate between compulsory module files vs user selectable.
|
195
|
+
|
196
|
+
"tool3" has two versions and it could be referred for example with:
|
197
|
+
rumo add tool3
|
198
|
+
rumo add tool3/1.2.6
|
199
|
+
|
200
|
+
If version is left out, Rumodule uses one of the version. The
|
201
|
+
selection is performed by first sorting the directory entries and
|
202
|
+
then selecting the last.
|
203
|
+
|
204
|
+
Usually the user should specify the actual version requested when
|
205
|
+
adding the module and when removing the directory is enough.
|
206
|
+
|
207
|
+
Rumodule files can be hidden from the system by using the "." prefix
|
208
|
+
to filename (as for "ls" shell utility").
|
209
|
+
|
210
|
+
|
211
|
+
= Summary
|
212
|
+
|
213
|
+
These steps are required to take Rumodule into use:
|
214
|
+
|
215
|
+
* Create Rumodule Files to dir.
|
216
|
+
* Set RUMODULE env var to dir.
|
217
|
+
* Setup rumo Shell Function.
|
218
|
+
|