patheditor 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/bin/path_editor +17 -9
- metadata +2 -2
data/Rakefile
CHANGED
@@ -5,7 +5,7 @@ require 'rake/gempackagetask'
|
|
5
5
|
spec = Gem::Specification.new do |s|
|
6
6
|
s.name = "patheditor"
|
7
7
|
s.summary = "A simple program to manage the Windows PATH environment variable."
|
8
|
-
s.version = "1.0.
|
8
|
+
s.version = "1.0.2"
|
9
9
|
s.author = "Justin Bailey"
|
10
10
|
s.email = "jgbailey@nospam@gmail.com"
|
11
11
|
|
data/bin/path_editor
CHANGED
@@ -83,8 +83,13 @@ Forces changes to occur with confirmation. True by default unless paths are bein
|
|
83
83
|
idx += 1
|
84
84
|
end
|
85
85
|
|
86
|
-
|
87
|
-
|
86
|
+
unless duplicates.empty?
|
87
|
+
remove_paths(duplicates) { |p| @hl.say "Removing #{p} (duplicate)" }
|
88
|
+
end
|
89
|
+
|
90
|
+
unless nonexistent.empty?
|
91
|
+
remove_paths(nonexistent){ |p| @hl.say "Removing #{p} (doesn't exist)" }
|
92
|
+
end
|
88
93
|
end
|
89
94
|
|
90
95
|
if @add
|
@@ -138,24 +143,27 @@ Forces changes to occur with confirmation. True by default unless paths are bein
|
|
138
143
|
(@automatic_confirm && ! @confirm_disabled) || false
|
139
144
|
end
|
140
145
|
|
141
|
-
# Takes an array of paths or indices and removes them from the current path
|
146
|
+
# Takes an array of paths or indices and removes them from the current path. Yields
|
147
|
+
# each path before deleting it, if a block was provided
|
142
148
|
def remove_paths(paths_to_remove)
|
143
|
-
|
149
|
+
@paths_removed ||= 0
|
150
|
+
adjust = 0
|
144
151
|
paths_to_remove.each do |p|
|
145
152
|
if p.is_a?(Fixnum)
|
146
|
-
idx = p -
|
147
|
-
|
153
|
+
idx = p - adjust # adjust index based on paths removed so far.
|
154
|
+
yield @currPath.paths[idx] if block_given?
|
148
155
|
@currPath.paths.delete_at(idx)
|
149
156
|
else
|
150
|
-
|
157
|
+
yield p if block_given?
|
151
158
|
@currPath.paths.delete p
|
152
159
|
end
|
153
160
|
|
154
161
|
# If more than one path matches and the user did not specify "--no-confirmation", make
|
155
162
|
# sure to enable it here.
|
156
163
|
@path_updated = true
|
157
|
-
@automatic_confirm = true if
|
158
|
-
|
164
|
+
@automatic_confirm = true if @paths_removed > 0
|
165
|
+
@paths_removed += 1
|
166
|
+
adjust += 1
|
159
167
|
end
|
160
168
|
end
|
161
169
|
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
|
|
3
3
|
specification_version: 1
|
4
4
|
name: patheditor
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 1.0.
|
7
|
-
date: 2007-02-
|
6
|
+
version: 1.0.2
|
7
|
+
date: 2007-02-07 00:00:00 -08:00
|
8
8
|
summary: A simple program to manage the Windows PATH environment variable.
|
9
9
|
require_paths:
|
10
10
|
- lib
|