mirror of
https://github.com/samsonjs/samhuri.net.git
synced 2026-03-25 09:05:47 +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('"', '\\"')
|
||||
end
|
||||
|
||||
def run(cmd)
|
||||
if @dry_run
|
||||
def run(cmd, safety = :destructive)
|
||||
if safety == :destructive && @dry_run
|
||||
puts ">>> cd '#{@path}' && #{cmd}"
|
||||
else
|
||||
`cd '#{@path}' && #{cmd} 2>&1`
|
||||
|
|
@ -361,11 +361,7 @@ class HarpBlog
|
|||
end
|
||||
|
||||
def git_sha
|
||||
if output = run('git log -n1 | head -n1 | cut -d" " -f2')
|
||||
output.strip
|
||||
else
|
||||
'fake-sha'
|
||||
end
|
||||
run('git log -n1 | head -n1 | cut -d" " -f2', :nondestructive).strip
|
||||
end
|
||||
|
||||
def git_commit(action, title, *files)
|
||||
|
|
|
|||
Loading…
Reference in a new issue