mirror of
https://github.com/samsonjs/samhuri.net.git
synced 2026-04-27 14:57:40 +00:00
run non-destructive shell commands during dry runs
This commit is contained in:
parent
09b1224646
commit
ff5f87ff80
1 changed files with 3 additions and 7 deletions
|
|
@ -352,8 +352,8 @@ class HarpBlog
|
||||||
s.gsub('"', '\\"')
|
s.gsub('"', '\\"')
|
||||||
end
|
end
|
||||||
|
|
||||||
def run(cmd)
|
def run(cmd, safety = :destructive)
|
||||||
if @dry_run
|
if safety == :destructive && @dry_run
|
||||||
puts ">>> cd '#{@path}' && #{cmd}"
|
puts ">>> cd '#{@path}' && #{cmd}"
|
||||||
else
|
else
|
||||||
`cd '#{@path}' && #{cmd} 2>&1`
|
`cd '#{@path}' && #{cmd} 2>&1`
|
||||||
|
|
@ -361,11 +361,7 @@ class HarpBlog
|
||||||
end
|
end
|
||||||
|
|
||||||
def git_sha
|
def git_sha
|
||||||
if output = run('git log -n1 | head -n1 | cut -d" " -f2')
|
run('git log -n1 | head -n1 | cut -d" " -f2', :nondestructive).strip
|
||||||
output.strip
|
|
||||||
else
|
|
||||||
'fake-sha'
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def git_commit(action, title, *files)
|
def git_commit(action, title, *files)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue