Class: BundlerIssueReport::Report

Inherits:
Object
  • Object
show all
Defined in:
lib/bundler_issue_report.rb

Instance Method Summary collapse

Instance Method Details

#command(cmd, args) ⇒ Object



52
53
54
55
56
# File 'lib/bundler_issue_report.rb', line 52

def command(cmd, args)
  `#{cmd} #{args}`.strip
rescue Errno::ENOENT
  "<No #{cmd} found>"
end

#gem_version(gem_name) ⇒ Object



58
59
60
61
# File 'lib/bundler_issue_report.rb', line 58

def gem_version(gem_name)
  output = `gem list #{gem_name}`.strip
  output.empty? ? "<#{gem_name} not found>" : output
end

#read_file(filename) ⇒ Object



46
47
48
49
50
# File 'lib/bundler_issue_report.rb', line 46

def read_file(filename)
  File.read(filename).strip
rescue Errno::ENOENT
  "<No #{filename} found>"
end

#write_on(output) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/bundler_issue_report.rb', line 9

def write_on(output)
  output.write <<EOF
The command you ran:
$ [fill in]

Exception backtrace(s), if any:
[fill in]

Your Gemfile:
#{read_file("Gemfile")}

Your Gemfile.lock:
#{read_file("Gemfile.lock")}

Your Bundler configuration settings:
#{command('bundle', 'config')}

What version of bundler you are using
#{command('bundle', '-v')}

What version of Ruby you are using
#{command('ruby', '-v')}

What version of Rubygems you are using
#{command('gem', '-v')}

Whether you are using RVM, and if so what version
#{command('rvm', '-v')}

Whether you have the rubygems-bundler gem, which can break gem executables
#{gem_version('rubygems-bundler')}

Whether you have the open_gem gem, which can cause rake activation conflicts
#{gem_version('open_gem')}
EOF
end