onde 0.0.1 → 0.0.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.
- checksums.yaml +4 -4
- data/lib/onde/version.rb +1 -1
- data/lib/onde.rb +15 -8
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4603e2a0c10686da022fe2fc1156b3d23784f1dc
|
|
4
|
+
data.tar.gz: 64e03b8c2844be20ca470aa886c03c0d636278e8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 90e825dcd537a129b755d73bdfd3f9607855655687f5799cb7f1dfaab9484ae1ac0af415531ebc3dda0292a96c40f2cb38394a45c2712a89a1e9006a5f11f24e
|
|
7
|
+
data.tar.gz: a324afce19aedde254b5a5835cf58c6448632b404230b9b52591a7997671a22ed97e386374d9361a98312277bedfb5ba946b7997dc20a816e76d69a8a6ac3356
|
data/lib/onde/version.rb
CHANGED
data/lib/onde.rb
CHANGED
|
@@ -20,23 +20,30 @@ class Onde
|
|
|
20
20
|
@@onde_file_path ||= '.onde.yml'
|
|
21
21
|
end
|
|
22
22
|
|
|
23
|
-
def path(path_alias,
|
|
23
|
+
def path(path_alias, variables={}, options={})
|
|
24
24
|
_path = paths[path_alias.to_sym]
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
if kwargs
|
|
30
|
-
kwargs.each do |variable, value|
|
|
26
|
+
if variables
|
|
27
|
+
variables.each do |variable, value|
|
|
31
28
|
_path = _path.gsub(/<#{variable}>/, value)
|
|
32
29
|
end
|
|
33
30
|
end
|
|
34
31
|
|
|
35
32
|
if !!(_path =~ /<.*?>/)
|
|
36
|
-
raise Onde::ArgumentsError
|
|
33
|
+
raise Onde::ArgumentsError.new("No value supplied for the variable #{ _path.scan(/<.*?>/)[0] }")
|
|
37
34
|
end
|
|
38
35
|
|
|
39
|
-
|
|
36
|
+
escape_spaces = options[:escape_spaces]
|
|
37
|
+
escape_spaces = true if escape_spaces.nil?
|
|
38
|
+
_path = _path.gsub(/ /, '\ ') if escape_spaces
|
|
39
|
+
|
|
40
|
+
terminal_slash = options[:terminal_slash]
|
|
41
|
+
terminal_slash = false if terminal_slash.nil?
|
|
42
|
+
_path = _path + '/' if terminal_slash and !(_path =~ /\/\z/)
|
|
43
|
+
|
|
44
|
+
expand_home = options[:expand_home_dir]
|
|
45
|
+
expand_home = true if expand_home.nil?
|
|
46
|
+
_path = _path.sub(/\A~/, Dir.home) if expand_home
|
|
40
47
|
|
|
41
48
|
_path
|
|
42
49
|
end
|