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
18
19
20
# File 'lib/git/background/runner.rb', line 11

def initialize notifier_name
  case notifier_name
  when String
    notifier = Notifier::supported_notifier_from_name notifier_name
    raise "#{notifier} is not supported" unless notifier
    Notifier::default_notifier = notifier
  when false
    @no_notifier = true
  end
end

Instance Method Details

#runObject



22
23
24
25
26
27
28
29
30
# File 'lib/git/background/runner.rb', line 22

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