deplomat 0.2.18 → 0.2.19
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/Gemfile.lock +1 -1
- data/VERSION +1 -1
- data/lib/deplomat/local_node.rb +8 -0
- data/lib/deplomat/node.rb +11 -15
- data/lib/deplomat/remote_node.rb +9 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a5a59554a67370399c1549d1efaa1900ff11f5dfffff2da0279c8faf0df56ce5
|
4
|
+
data.tar.gz: 2a4194a7208c310ec6ec5c365ce27bf71d577bfca25934e97e6544e19db501d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6ebf8007e6bd9e4e22a969e91246d267b7e01df0d68899300b24654f257e0e3bad60c1af7515bcd2e76f656076b8f0da3171aa64156ae0b2ff3d935d0899ba5
|
7
|
+
data.tar.gz: ce1470376799e1572739dde2ea14df4d62a4374afac0a658c632d1e2f447e46bd7db61d6e3c6ac01b9eefb4d2eef16dda085ce52368dd0080c7812b5983b0eae
|
data/Gemfile.lock
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.19
|
data/lib/deplomat/local_node.rb
CHANGED
@@ -6,6 +6,14 @@ module Deplomat
|
|
6
6
|
super
|
7
7
|
end
|
8
8
|
|
9
|
+
def path_exist?(path)
|
10
|
+
exists = File.exist?(adjusted_path(path))
|
11
|
+
print_to_terminal((exists ? "EXISTS: #{path}" : "NOT FOUND: #{path}"))
|
12
|
+
exists
|
13
|
+
end
|
14
|
+
alias :path_exists? :path_exist?
|
15
|
+
alias :file_exists? :path_exist?
|
16
|
+
|
9
17
|
end
|
10
18
|
|
11
19
|
end
|
data/lib/deplomat/node.rb
CHANGED
@@ -105,29 +105,25 @@ module Deplomat
|
|
105
105
|
alias :mkdir :create_dir
|
106
106
|
|
107
107
|
def create_symlink(source, target)
|
108
|
-
execute("ln -
|
108
|
+
execute("ln -sf #{source} #{target}")
|
109
109
|
end
|
110
110
|
alias :ln :create_symlink
|
111
111
|
|
112
|
-
def
|
113
|
-
|
114
|
-
|
115
|
-
|
112
|
+
def adjusted_path(path)
|
113
|
+
if !path.match(/\A\/|~\//)
|
114
|
+
path = "#{@current_path}/#{path}".sub("//", "/")
|
115
|
+
end
|
116
|
+
File.absolute_path(path)
|
116
117
|
end
|
117
|
-
alias :path_exists? :path_exist?
|
118
|
-
alias :file_exists? :path_exist?
|
119
118
|
|
120
119
|
def cd(path)
|
121
|
-
|
122
|
-
|
123
|
-
@current_path = if path
|
120
|
+
path = adjusted_path(path)
|
121
|
+
raise Deplomat::NoSuchPathError, path unless path_exist?(path)
|
122
|
+
@current_path = if path.match(/\A\/|~\//)
|
124
123
|
path
|
125
124
|
else
|
126
|
-
|
127
|
-
end
|
128
|
-
|
129
|
-
# Remove / from the end of the current path
|
130
|
-
@current_path.sub!(/\/+\Z/, '')
|
125
|
+
"#{@current_path}/#{path}"
|
126
|
+
end.sub(/\/+\Z/, '')
|
131
127
|
end
|
132
128
|
|
133
129
|
def git_push(remote="origin", branch="master")
|
data/lib/deplomat/remote_node.rb
CHANGED
@@ -50,6 +50,15 @@ module Deplomat
|
|
50
50
|
super("#{@ssh_command} '#{command}'", nil, message: message, stdout_source: stdout_source, log_command: false, _raise_exceptions: _raise_exceptions)
|
51
51
|
end
|
52
52
|
|
53
|
+
def path_exist?(path)
|
54
|
+
path = adjusted_path(path)
|
55
|
+
status = execute("test -f #{path} || test -d #{path}", nil, log_command: true, _raise_exceptions: false)[:status]
|
56
|
+
log((status == 1 ? "NOT FOUND: #{path}" : "EXISTS: #{path}"))
|
57
|
+
status == 0
|
58
|
+
end
|
59
|
+
alias :path_exists? :path_exist?
|
60
|
+
alias :file_exists? :path_exist?
|
61
|
+
|
53
62
|
def upload(what, where, except: nil)
|
54
63
|
except = "--exclude '#{except}'" if except
|
55
64
|
local_execute "rsync -arzve 'ssh #{@port ? "-p #{@port.to_s} " : ""}' #{except} --delete #{what} #{@user}@#{@host}:#{where}", nil
|