Class: Git::Background::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/git/background/runner.rb

Instance Method Summary collapse

Constructor Details

#initialize(notifier_name) ⇒ Runner

Returns a new instance of Runner.



11
12
13
14
15
16
17
# File 'lib/git/background/runner.rb', line 11

def initialize notifier_name
  if notifier_name
    notifier = Notifier::supported_notifier_from_name notifier_name
    raise "#{notifier} is not supported" unless notifier
    Notifier::default_notifier = notifier
  end
end

Instance Method Details

#runObject



19
20
21
22
23
24
25
26
# File 'lib/git/background/runner.rb', line 19

def run
  Process::daemon true
  result = `git #{ARGV.join ' '}`
  Notifier::notify(
    title: "git-background: #{$?.success? ? 'success' : 'failed'}",
    message: result
  )
end