Permalink
Browse files

Restore previous path after in_path block

That way relative paths will be predictable, like in git:clone which
uses . as path.
  • Loading branch information...
1 parent 5f407b2 commit 8178b514d76764cd6b9296a88c0f7e61d4a81f80 @sobrinho sobrinho committed Nov 11, 2016
@@ -33,7 +33,7 @@ def delete(stage)
def process(path = nil)
if path
queue[stage].unshift(%{echo "$ cd #{path}"}) if fetch(:verbose)
- %{(cd #{path} && #{queue[stage].join(' && ')})}
+ %{(cd #{path} && #{queue[stage].join(' && ')} && cd -)}
else
queue[stage].join("\n")
end
@@ -68,15 +68,15 @@
end
it 'joins all the commands within a path' do
- expect(commands.process('some/path')).to eq('(cd some/path && ls -al && pwd)')
+ expect(commands.process('some/path')).to eq('(cd some/path && ls -al && pwd && cd -)')
end
context 'when verbose' do
before { Mina::Configuration.instance.set(:verbose, true) }
after { Mina::Configuration.instance.remove(:verbose) }
it 'joins all the commands within a path and echoes it' do
- expect(commands.process('some/path')).to eq("(cd some/path && echo \"$ cd some/path\" && ls -al && pwd)")
+ expect(commands.process('some/path')).to eq("(cd some/path && echo \"$ cd some/path\" && ls -al && pwd && cd -)")
end
end
end
@@ -1 +1 @@
-\(cd\ .*/deploy/current\ &&\ RAILS_ENV="production"\ bundle\ exec\ rails\ console\)
+\(cd\ .*/deploy/current\ &&\ RAILS_ENV="production"\ bundle\ exec\ rails\ console\ &&\ cd\ -\)
@@ -1,2 +1,2 @@
echo\ "\-\-\-\-\->\ Cleaning\ up\ old\ releases\ \(keeping\ 2\)"
-\(cd\ .*/deploy/releases\ &&\ count=\$\(ls\ \-A1\ \|\ sort\ \-rn\ \|\ wc\ \-l\)\ &&\ remove=\$\(\(count\ >\ 2\ \?\ count\ \-\ 2\ :\ 0\)\)\ &&\ ls\ \-A1\ \|\ sort\ \-rn\ \|\ tail\ \-n\ \$remove\ \|\ xargs\ rm\ \-rf\ \{\}\)
+\(cd\ .*/deploy/releases\ &&\ count=\$\(ls\ \-A1\ \|\ sort\ \-rn\ \|\ wc\ \-l\)\ &&\ remove=\$\(\(count\ >\ 2\ \?\ count\ \-\ 2\ :\ 0\)\)\ &&\ ls\ \-A1\ \|\ sort\ \-rn\ \|\ tail\ \-n\ \$remove\ \|\ xargs\ rm\ \-rf\ \{\} &&\ cd\ -\)
@@ -1 +1 @@
-\(cd\ .*deploy/shared/log\ &&\ tail\ \-f\ production\.log\)
+\(cd\ .*deploy/shared/log\ &&\ tail\ \-f\ production\.log\ &&\ cd\ -\)
@@ -1,2 +1,2 @@
echo\ "\-\-\-\-\->\ Rolling\ back\ to\ previous\ release"
-\(cd\ .*/deploy/releases\ &&\ rollback_release=\$\(ls\ \-1A\ \|\ sort\ \-n\ \|\ tail\ \-n\ 2\ \|\ head\ \-n\ 1\)\ &&\ echo\ "\-\-\-\-\->\ Rollbacking\ to\ release:\ \$rollback_release"\ &&\ ln\ \-nfs\ .*/deploy/releases/\$rollback_release\ .*/deploy/current\ &&\ current_release=\$\(ls\ \-1A\ \|\ sort\ \-n\ \|\ tail\ \-n\ 1\)\ &&\ echo\ "\-\-\-\-\->\ Deleting\ current\ release:\ \$current_release"\ &&\ rm\ \-rf\ .*/deploy/releases/\$current_release\)
+\(cd\ .*/deploy/releases\ &&\ rollback_release=\$\(ls\ \-1A\ \|\ sort\ \-n\ \|\ tail\ \-n\ 2\ \|\ head\ \-n\ 1\)\ &&\ echo\ "\-\-\-\-\->\ Rollbacking\ to\ release:\ \$rollback_release"\ &&\ ln\ \-nfs\ .*/deploy/releases/\$rollback_release\ .*/deploy/current\ &&\ current_release=\$\(ls\ \-1A\ \|\ sort\ \-n\ \|\ tail\ \-n\ 1\)\ &&\ echo\ "\-\-\-\-\->\ Deleting\ current\ release:\ \$current_release"\ &&\ rm\ \-rf\ .*/deploy/releases/\$current_release\ &&\ cd\ -\)
@@ -1 +1 @@
-\(cd .*deploy && ls -al\)
+\(cd .*deploy && ls -al\ &&\ cd\ -\)

0 comments on commit 8178b51

Please sign in to comment.