nkryptic-sandbox 0.2.1 → 0.2.2

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/TODO CHANGED
@@ -1,4 +1,7 @@
1
-
1
+ TODO: fix dependencies in rake files
2
+ TODO: add 'gem: --no-ri --no-rdoc' to .gemrc in new sandbox
3
+ TODO: do 'gem sources -a http://gems.github.com'
4
+ TODO: 0 gems initially to be installed
2
5
  TODO: put in timeout when installing gems
3
6
  TODO: check for network connection
4
7
  TODO: perhaps look in installed rubygems cache first
@@ -2,19 +2,8 @@
2
2
  # This file must be used with "source bin/activate" *from bash*
3
3
  # you cannot run it directly
4
4
 
5
- deactivate_sandbox () {
6
- if [ -n "$_OLD_SANDBOX_PATH" ] ; then
7
- PATH="$_OLD_SANDBOX_PATH"
8
- export PATH
9
- unset _OLD_SANDBOX_PATH
10
- fi
5
+ forget_cached_commands () {
11
6
 
12
- if [ -n "$_OLD_SANDBOX_HOME" ] ; then
13
- HOME="$_OLD_SANDBOX_HOME"
14
- export HOME
15
- unset _OLD_SANDBOX_HOME
16
- fi
17
-
18
7
  # This should detect bash and zsh, which have a hash command that must
19
8
  # be called to get it to forget past commands. Without forgetting
20
9
  # past commands the $PATH changes we made may not be respected
@@ -22,76 +11,94 @@ deactivate_sandbox () {
22
11
  hash -r
23
12
  fi
24
13
 
14
+ }
15
+
16
+ deactivate_sandbox () {
17
+
25
18
  if [ -n "$_OLD_SANDBOX_GEM_HOME" ] ; then
26
19
  GEM_HOME="$_OLD_SANDBOX_GEM_HOME"
27
20
  export GEM_HOME
28
- unset _OLD_SANDBOX_GEM_HOME
21
+ else
22
+ unset GEM_HOME
29
23
  fi
30
24
 
31
25
  if [ -n "$_OLD_SANDBOX_GEM_PATH" ] ; then
32
26
  GEM_PATH="$_OLD_SANDBOX_GEM_PATH"
33
27
  export GEM_PATH
34
- unset _OLD_SANDBOX_GEM_PATH
28
+ else
29
+ unset GEM_PATH
30
+ fi
31
+
32
+ if [ -n "$_OLD_SANDBOX_PATH" ] ; then
33
+ PATH="$_OLD_SANDBOX_PATH"
34
+ export PATH
35
+ fi
36
+
37
+ if [ -n "$_OLD_SANDBOX_HOME" ] ; then
38
+ HOME="$_OLD_SANDBOX_HOME"
39
+ export HOME
35
40
  fi
36
41
 
37
42
  if [ -n "$_OLD_SANDBOX_PS1" ] ; then
38
43
  PS1="$_OLD_SANDBOX_PS1"
39
44
  export PS1
40
- unset _OLD_SANDBOX_PS1
41
45
  fi
42
46
 
43
- # unset again, in case they were missed because they were blank
47
+ unset _OLD_SANDBOX_PATH
48
+ unset _OLD_SANDBOX_HOME
44
49
  unset _OLD_SANDBOX_GEM_HOME
45
50
  unset _OLD_SANDBOX_GEM_PATH
46
-
51
+ unset _OLD_SANDBOX_PS1
47
52
  unset SANDBOX_ENV
53
+
54
+ forget_cached_commands
55
+
48
56
  if [ ! "$1" = "nondestructive" ] ; then
49
57
  # Self destruct!
50
58
  unset deactivate_sandbox
59
+ unset forget_cached_commands
51
60
  fi
52
61
  }
53
62
 
54
- # unset irrelavent variables
55
- deactivate_sandbox nondestructive
56
-
57
- SANDBOX_ENV="<%= target %>"
58
- export SANDBOX_ENV
59
-
60
- _OLD_SANDBOX_PATH="$PATH"
61
- PATH="$SANDBOX_ENV/bin:$PATH"
62
- export PATH
63
-
64
- _OLD_SANDBOX_HOME="$HOME"
65
- HOME="$SANDBOX_ENV"
66
- export HOME
67
63
 
68
- _OLD_SANDBOX_GEM_HOME="$GEM_HOME"
69
- GEM_HOME="$SANDBOX_ENV/rubygems"
70
- export GEM_HOME
64
+ activate_sandbox () {
65
+
66
+ # unset irrelavent variables
67
+ deactivate_sandbox nondestructive
71
68
 
72
- _OLD_SANDBOX_GEM_PATH="$GEM_PATH"
73
- GEM_PATH="$GEM_HOME"
74
- export GEM_PATH
69
+ # preserve current variables
70
+ _OLD_SANDBOX_GEM_HOME="$GEM_HOME"
71
+ _OLD_SANDBOX_GEM_PATH="$GEM_PATH"
72
+ _OLD_SANDBOX_PATH="$PATH"
73
+ _OLD_SANDBOX_HOME="$HOME"
74
+ _OLD_SANDBOX_PS1="$PS1"
75
+
76
+ # set the sandbox-aware states
77
+ SANDBOX_ENV="<%= target %>"
78
+ PATH="$SANDBOX_ENV/bin:$PATH"
79
+ HOME="$SANDBOX_ENV"
80
+ GEM_HOME="$SANDBOX_ENV/rubygems"
81
+ GEM_PATH="$GEM_HOME"
82
+ if [ "`basename \"$SANDBOX_ENV\"`" = "__" ] ; then
83
+ # special case for Aspen magic directories
84
+ # see http://www.zetadev.com/software/aspen/
85
+ PS1="[sandbox:`basename \`dirname \"$SANDBOX_ENV\"\``] $PS1"
86
+ else
87
+ PS1="(sandbox:`basename \"$SANDBOX_ENV\"`)$PS1"
88
+ fi
89
+
90
+ export SANDBOX_ENV PATH HOME GEM_HOME GEM_PATH PS1
91
+
92
+ forget_cached_commands
93
+
94
+ unset activate_sandbox
95
+
96
+ }
75
97
 
76
- _OLD_SANDBOX_PS1="$PS1"
77
- if [ "`basename \"$SANDBOX_ENV\"`" = "__" ] ; then
78
- # special case for Aspen magic directories
79
- # see http://www.zetadev.com/software/aspen/
80
- PS1="[sandbox:`basename \`dirname \"$SANDBOX_ENV\"\``] $PS1"
81
- else
82
- PS1="(sandbox:`basename \"$SANDBOX_ENV\"`)$PS1"
83
- fi
84
- export PS1
85
98
 
86
- # This should detect bash and zsh, which have a hash command that must
87
- # be called to get it to forget past commands. Without forgetting
88
- # past commands the $PATH changes we made may not be respected
89
- if [ -n "$BASH" -o -n "$ZSH_VERSION" ] ; then
90
- hash -r
91
- fi
99
+ activate_sandbox
92
100
 
93
101
 
94
- #
95
102
  #
96
103
  # Thanks to the virtualenv developers ( http://pypi.python.org/pypi/virtualenv )
97
104
  #
@@ -5,7 +5,7 @@ module Sandbox
5
5
 
6
6
  MAJOR = 0
7
7
  MINOR = 2
8
- TINY = 1
8
+ TINY = 2
9
9
 
10
10
  STRING = [ MAJOR, MINOR, TINY ].join( '.' )
11
11
 
data/sandbox.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{sandbox}
5
- s.version = "0.2.1"
5
+ s.version = "0.2.2"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Jacob Radford"]
9
- s.date = %q{2008-12-05}
9
+ s.date = %q{2008-12-06}
10
10
  s.default_executable = %q{sandbox}
11
11
  s.description = %q{Create virtual ruby/rubygems sandboxes.}
12
12
  s.email = %q{nkryptic@gmail.com}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nkryptic-sandbox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jacob Radford
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-12-05 00:00:00 -08:00
12
+ date: 2008-12-06 00:00:00 -08:00
13
13
  default_executable: sandbox
14
14
  dependencies: []
15
15