Class: Bugsage::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/bugsage/cli.rb

Instance Method Summary collapse

Instance Method Details

#explainObject



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/bugsage/cli.rb', line 43

def explain
  fake_exception = begin
    nil.foo
  rescue NoMethodError => e
    e
  end

  suggestion = Rule.match(fake_exception)

  if suggestion
    Formatter.print(suggestion)
  else
    puts "No matching rule found."
  end
end

#helloObject



14
15
16
# File 'lib/bugsage/cli.rb', line 14

def hello
  puts "BugSage is alive."
end

#installObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/bugsage/cli.rb', line 22

def install
  if options[:guide_only]
    Installation.print_guide
    return
  end

  Installation.print_guide
  say ""

  result = Installer.run(destination: options[:destination] || Dir.pwd, force: options[:force])

  if result[:created_initializer]
    say "Created #{result[:initializer_path]}", :green
  else
    say "Skipped #{result[:initializer_path]} (already exists). Use --force to overwrite.", :yellow
  end

  say "\n#{result[:summary].join("\n")}\n"
end

#versionObject



9
10
11
# File 'lib/bugsage/cli.rb', line 9

def version
  puts "BugSage v#{Bugsage::VERSION}"
end