auto-gemsets 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/HELP +33 -9
- data/VERSION +1 -1
- data/auto-gemsets.gemspec +1 -1
- data/auto_gemsets.sh +18 -4
- data/lib/auto-gemsets/application.rb +12 -10
- data/spec/application_spec.rb +2 -2
- metadata +2 -2
data/HELP
CHANGED
@@ -1,17 +1,41 @@
|
|
1
|
-
|
2
|
-
The gemset command also has various sub-commands that help you manage your gemset library
|
1
|
+
gemset [command]
|
3
2
|
|
4
|
-
|
3
|
+
When the gemset command is called with no arguments,
|
4
|
+
it simply displays the current gemset in use.
|
5
|
+
Note that the GEM environment includes both
|
6
|
+
the current and default gemset's gems.
|
5
7
|
|
6
|
-
|
8
|
+
Commands
|
9
|
+
========
|
7
10
|
|
8
|
-
|
11
|
+
ls, list
|
12
|
+
List all gemsets in your GEMSET_ROOT.
|
13
|
+
The gemset with the -> at the begining is the current gemset.
|
14
|
+
The gemset with the * at the end is the default gemset.
|
15
|
+
Note that the GEM environment includes both the current and default gemset's gems.
|
9
16
|
|
10
|
-
|
17
|
+
rm, remove
|
18
|
+
gemset rm (gemset)
|
19
|
+
gemset remove (gemset)
|
11
20
|
|
12
|
-
|
21
|
+
Removes the given gemset from the GEMSET_ROOT.
|
22
|
+
To prevent unwanted deletions, a confirmation dialog will ask if you wish to continue.
|
13
23
|
|
14
|
-
|
24
|
+
touch, create
|
25
|
+
gemset touch (gemset)
|
26
|
+
gemset create (gemset)
|
15
27
|
|
16
|
-
|
28
|
+
Create a new gemset in the GESET_ROOT with the given name
|
17
29
|
|
30
|
+
mv, rename
|
31
|
+
gemset mv (gemset) (name)
|
32
|
+
gemset rename (gemset) (name)
|
33
|
+
|
34
|
+
Renames the given gemset with the given name within the GESET_ROOT.
|
35
|
+
If the new gemset name conflicts with an existing gemset,
|
36
|
+
a confirmation dialog will ask if you wish to continue
|
37
|
+
|
38
|
+
edit
|
39
|
+
gemset edit (gemset)
|
40
|
+
|
41
|
+
Opens the gemset's Gemfile in your default EDITOR or TERM_EDITOR
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.4
|
data/auto-gemsets.gemspec
CHANGED
data/auto_gemsets.sh
CHANGED
@@ -20,7 +20,7 @@ function auto_gemsets() {
|
|
20
20
|
export GEM_PATH="${GEM_HOME}:${DEFAULT_GEMSET}"
|
21
21
|
export GEMSET="${gemset}"
|
22
22
|
export GEMFILE="${gemfile}"
|
23
|
-
create_gemset_if_missing &&
|
23
|
+
create_gemset_if_missing && list_gemset
|
24
24
|
break
|
25
25
|
elif [[ ! -f "$gemfile" ]]; then
|
26
26
|
set_default_gemset
|
@@ -36,11 +36,19 @@ function set_default_gemset() {
|
|
36
36
|
export GEM_HOME="${DEFAULT_GEMSET}"
|
37
37
|
export GEM_ROOT="${DEFAULT_GEMSET}"
|
38
38
|
export GEM_PATH="${DEFAULT_GEMSET}"
|
39
|
-
|
39
|
+
export GEMSET="daytonn*"
|
40
|
+
export GEMFILE="*default"
|
41
|
+
if [ -z "$GEMSET_PRELOAD" ]; then
|
42
|
+
list_gemset
|
43
|
+
fi
|
40
44
|
fi
|
41
45
|
fi
|
42
46
|
}
|
43
47
|
|
48
|
+
function list_gemset() {
|
49
|
+
echo "Now using ${GEMSET} gemset via ${GEMFILE}"
|
50
|
+
}
|
51
|
+
|
44
52
|
if [ ! -n "$GEMSET_ROOT" ]; then
|
45
53
|
export GEMSET_ROOT="${HOME}/.gemsets"
|
46
54
|
fi
|
@@ -57,5 +65,11 @@ else
|
|
57
65
|
fi
|
58
66
|
fi
|
59
67
|
|
60
|
-
|
61
|
-
|
68
|
+
function init() {
|
69
|
+
# Set default on load
|
70
|
+
GEMSET_PRELOAD="true"
|
71
|
+
set_default_gemset
|
72
|
+
unset GEMSET_PRELOAD
|
73
|
+
}
|
74
|
+
|
75
|
+
init
|
@@ -21,20 +21,20 @@ module AutoGemsets
|
|
21
21
|
@output = output
|
22
22
|
@input = input
|
23
23
|
@args = args
|
24
|
-
@command = @args.empty?
|
24
|
+
@command = @args.shift.to_sym unless @args.empty? || @args.first =~ /^-/
|
25
25
|
|
26
26
|
parse_options
|
27
27
|
end
|
28
28
|
|
29
29
|
def current
|
30
|
-
@output.puts ENV['GEMSET']
|
30
|
+
@output.puts "-> #{ENV['GEMSET']}"
|
31
31
|
end
|
32
32
|
|
33
33
|
def run
|
34
34
|
if @command
|
35
|
-
self.send @command, *@args
|
35
|
+
self.send @command, *@args
|
36
36
|
else
|
37
|
-
help
|
37
|
+
options[:help] ? help : self.send(:current)
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
@@ -42,9 +42,10 @@ module AutoGemsets
|
|
42
42
|
gemsets = Dir.glob(File.join(ENV['HOME'], '.gemsets', '*')).map do |d|
|
43
43
|
gemset = File.basename(d)
|
44
44
|
default_gemset = File.basename(ENV['DEFAULT_GEMSET'])
|
45
|
-
|
45
|
+
case gemset
|
46
|
+
when default_gemset
|
46
47
|
gemset = " #{gemset}*"
|
47
|
-
|
48
|
+
when ENV['GEMSET']
|
48
49
|
gemset = "-> #{gemset}"
|
49
50
|
else
|
50
51
|
gemset = " #{gemset}"
|
@@ -128,7 +129,7 @@ module AutoGemsets
|
|
128
129
|
|
129
130
|
def edit
|
130
131
|
raise "You must set $EDITOR or $TERM_EDITOR to edit Gemfiles" unless ENV['EDITOR'] || ENV['TERM_EDITOR']
|
131
|
-
%x{#{ENV['EDITOR'] || ENV['TERM_EDITOR']} #{ENV['GEMFILE']}}
|
132
|
+
%x{#{ENV['EDITOR'] || ENV['TERM_EDITOR']} #{ENV['GEMFILE']}} if File.exists ENV['GEMFILE']
|
132
133
|
end
|
133
134
|
|
134
135
|
private
|
@@ -142,20 +143,21 @@ module AutoGemsets
|
|
142
143
|
|
143
144
|
opts.on('-h', '--help', 'Display help') do
|
144
145
|
@options[:help] = true
|
145
|
-
help
|
146
146
|
end
|
147
147
|
end.parse!
|
148
|
+
|
149
|
+
@args.reject! { |a| a =~ /^-/ }
|
148
150
|
end
|
149
151
|
|
150
152
|
def help
|
151
|
-
puts AutoGemsets::HELP
|
153
|
+
@output.puts AutoGemsets::HELP
|
152
154
|
end
|
153
155
|
|
154
156
|
def version
|
155
157
|
version = File.read("#{AutoGemsets::base_directory}/VERSION")
|
156
158
|
message = "auto-gemsets #{version}\n"
|
157
159
|
message << "Copyright (c) #{Time.now.year} Dayton Nolan\n"
|
158
|
-
puts message
|
160
|
+
@output.puts message
|
159
161
|
end
|
160
162
|
|
161
163
|
def gemset_path(gemset)
|
data/spec/application_spec.rb
CHANGED
@@ -27,12 +27,12 @@ describe AutoGemsets::Application do
|
|
27
27
|
end
|
28
28
|
|
29
29
|
it "shows the current gemset" do
|
30
|
-
@output.should_receive(:puts).with(@gemset)
|
30
|
+
@output.should_receive(:puts).with("-> #{@gemset}")
|
31
31
|
@app.current
|
32
32
|
end
|
33
33
|
|
34
34
|
it "shows the current gemset when called with no arguments" do
|
35
|
-
@output.should_receive(:puts).with(@gemset)
|
35
|
+
@output.should_receive(:puts).with("-> #{@gemset}")
|
36
36
|
app = AutoGemsets::Application.new(@output, @input, [])
|
37
37
|
app.run
|
38
38
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: auto-gemsets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -148,7 +148,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
148
148
|
version: '0'
|
149
149
|
segments:
|
150
150
|
- 0
|
151
|
-
hash:
|
151
|
+
hash: 4117892607969008592
|
152
152
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
153
153
|
none: false
|
154
154
|
requirements:
|