class GitWaybackMachine::Engine
Public Class Methods
new()
click to toggle source
# File lib/git_wayback_machine/engine.rb, line 4 def initialize @history = GitWaybackMachine::History.new @navigator = GitWaybackMachine::Navigator.new(@history) end
Public Instance Methods
move_to(entry)
click to toggle source
# File lib/git_wayback_machine/engine.rb, line 22 def move_to(entry) `git reset --hard #{entry.sha}` end
rollback!()
click to toggle source
# File lib/git_wayback_machine/engine.rb, line 30 def rollback! puts "\rJumping back to the reality!" move_to @history[0] `git stash pop` unless @stash.include?("No local changes to save") end
start!()
click to toggle source
# File lib/git_wayback_machine/engine.rb, line 9 def start! stash! @navigator.on_change do |commit| move_to commit end rescue Interrupt => e nil # that's cool ensure rollback! end
stash!()
click to toggle source
# File lib/git_wayback_machine/engine.rb, line 26 def stash! @stash = `git stash -u` end