Sha256: 78595bbb76f648ba69f3175d14b1bdbe924113ac11e228923761964e63870a19

Contents?: true

Size: 846 Bytes

Versions: 12

Compression:

Stored size: 846 Bytes

Contents

require 'chicanery/git'

include Chicanery::Git

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

poll_period 10

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

12 entries across 12 versions & 1 rubygems

Version Path
chicanery-0.2.0 examples/baby_steps.rb
chicanery-0.1.9 examples/baby_steps.rb
chicanery-0.1.8 examples/baby_steps.rb
chicanery-0.1.7 examples/baby_steps.rb
chicanery-0.1.6 examples/baby_steps.rb
chicanery-0.1.5 examples/baby_steps.rb
chicanery-0.1.4 examples/baby_steps.rb
chicanery-0.1.3 examples/baby_steps.rb
chicanery-0.1.1 examples/baby_steps.rb
chicanery-0.1.0 examples/baby_steps.rb
chicanery-0.0.9 examples/baby_steps.rb
chicanery-0.0.8 examples/baby_steps.rb