Sha256: 44afb167f3b5fbb07d0069ca24e68b3965033ca1e50f50809f9242599569e856

Contents?: true

Size: 835 Bytes

Versions: 2

Compression:

Stored size: 835 Bytes

Contents

require 'chicanery/git'

include Chicanery::Git

git_repo 'chicanery', '.', branches: [:master]

def now
  Time.now.to_i
end

def say message
  `growlnotify -t "some new chicanery ..." --image ~/icons/chicanery.png -m \"#{message}\"`
end

start = now
maximum = ARGV.shift.to_i

say "Uncommitted changes will be automatically reverted after #{maximum} seconds"

when_run do |state|
  start = now if `git status`.chomp.split("\n").last == 'nothing to commit, working directory clean'
  elapsed = now - start
  if elapsed >= maximum
    say "no commits detected in #{elapsed} seconds - reverting all uncommitted changes"
    `afplay ~/build_sounds/ticktock.mp3`
    `git reset --hard`
    `git clean -d -x -f`
    start = now
  end
end

when_commit do |branch, commit, previous|
  say "commit detected - resetting timer"
  start = now
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
chicanery-0.0.7 examples/baby_steps.rb
chicanery-0.0.6 examples/baby_steps.rb