gs 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README.md +11 -7
  2. data/bin/gs +16 -10
  3. metadata +2 -2
data/README.md CHANGED
@@ -22,13 +22,6 @@ tracker.
22
22
  This library provides a command line application called `gs`. These
23
23
  are the available options:
24
24
 
25
- ### gs
26
-
27
- When called with no arguments, it starts a shell session and
28
- configures the variables GEM_HOME, GEM_PATH and PATH to point
29
- to the $PWD/.gs directory. In addition, it sets the GS_NAME
30
- variable with the name of the current gemset (useful for PS1).
31
-
32
25
  ### gs init
33
26
 
34
27
  Creates the $PWD/.gs directory.
@@ -37,6 +30,17 @@ Creates the $PWD/.gs directory.
37
30
 
38
31
  Displays the documentation.
39
32
 
33
+ ### gs [command]
34
+
35
+ When called with no arguments, it starts a shell session and
36
+ configures the variables GEM_HOME, GEM_PATH and PATH to point to the
37
+ $PWD/.gs directory. In addition, it sets the GS_NAME variable with the
38
+ name of the current gemset (useful for PS1).
39
+
40
+ When called with arguments other than init or help, it will execute
41
+ command in a gs shell session and return to the parent session once
42
+ finished.
43
+
40
44
  ## Getting started
41
45
 
42
46
  First, grab the gem:
data/bin/gs CHANGED
@@ -7,9 +7,9 @@ NAME
7
7
  gs -- Gemset management
8
8
 
9
9
  SYNOPSIS
10
- gs
11
10
  gs init
12
11
  gs help
12
+ gs [command]
13
13
 
14
14
  DESCRIPTION
15
15
  When called with no arguments, it starts a shell session and
@@ -22,22 +22,28 @@ DESCRIPTION
22
22
 
23
23
  help
24
24
  Displays this message.
25
- EOS
26
25
 
27
- subshell = [
28
- "env",
29
- %Q{GEM_HOME="$PWD/.gs"},
30
- %Q{GEM_PATH="$PWD/.gs:`gem env path`"},
31
- %Q{GS_NAME="`basename $PWD`"},
32
- %Q{PATH="$PWD/.gs/bin:$PATH"},
33
- %Q{$SHELL} ].join(" ")
26
+ [command]
27
+ An optional command that will be executed under gs shell
28
+ session and return to the caller session once finished.
29
+ EOS
34
30
 
35
31
  case ARGV[0]
36
32
  when "init" then Dir.mkdir(".gs")
37
33
  when "help" then puts help
38
34
  else
39
35
  if File.directory?(".gs")
40
- exec subshell
36
+ env = ENV.to_hash
37
+ env["GS_NAME"] = `basename $PWD`.strip
38
+ env["GEM_HOME"] = "#{ENV['PWD']}/.gs"
39
+ env["GEM_PATH"] = "#{ENV['PWD']}/.gs:`gem env path`"
40
+ env["PATH"] = "#{ENV['PWD']}/.gs/bin:#{ENV['PATH']}"
41
+
42
+ if ARGV.length > 0
43
+ exec env, *ARGV
44
+ else
45
+ exec env, ENV["SHELL"]
46
+ end
41
47
  else
42
48
  puts "Directory .gs not found. Try `gs help`."
43
49
  exit 1
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-11 00:00:00.000000000 Z
12
+ date: 2012-05-15 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Gemset management
15
15
  email: