getversion 0.0.3 → 0.0.4
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/bin/getversion.rb +1 -1
- data/lib/getversion/detectors/google.rb +0 -2
- data/lib/getversion/path.rb +8 -5
- metadata +1 -1
data/bin/getversion.rb
CHANGED
data/lib/getversion/path.rb
CHANGED
@@ -1,11 +1,8 @@
|
|
1
1
|
class Path
|
2
2
|
|
3
|
-
attr_accessor :path, :is_windows
|
4
|
-
|
5
3
|
def initialize(*path)
|
6
|
-
path.select! { |p| p unless p
|
4
|
+
path.select! { |p| p unless p.empty? }
|
7
5
|
@path = File.join path
|
8
|
-
@is_windows = !ENV['WINDIR'].nil?
|
9
6
|
end
|
10
7
|
|
11
8
|
def evaluated_path
|
@@ -15,11 +12,17 @@ class Path
|
|
15
12
|
|
16
13
|
def normalised_path
|
17
14
|
return unless @path
|
18
|
-
|
15
|
+
is_windows ? @path.gsub('/', '\\') : @path.gsub('\\', '/')
|
19
16
|
end
|
20
17
|
|
21
18
|
def to_s
|
22
19
|
evaluated_path
|
23
20
|
end
|
24
21
|
|
22
|
+
private
|
23
|
+
|
24
|
+
def is_windows
|
25
|
+
!ENV['WINDIR'].nil?
|
26
|
+
end
|
27
|
+
|
25
28
|
end
|