Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

gathering info about ruby

  • Loading branch information...
commit 0469db7903bc8bc7e3dc57b79e54c54d268abae5 1 parent d425cc2
@tenderlove authored
View
4 lib/busted.rb
@@ -1 +1,5 @@
require 'busted/gem'
+
+module Busted
+ BASEDIR = File.expand_path(File.join(File.dirname(__FILE__), '..'))
+end
View
11 lib/busted/gem.rb
@@ -1,4 +1,5 @@
require 'tempfile'
+require 'erb'
module Busted
class Gem
@@ -33,6 +34,16 @@ def archive_file
end
end
+ def ruby_info_file
+ template_file = File.join(BASEDIR, 'templates', 'ruby_info.erb')
+ template = ERB.new(File.read(template_file))
+ target = File.join(Dir::tmpdir, 'ruby_info.txt')
+ File.open(target, 'wb') { |f|
+ f.write template.result(binding)
+ }
+ target
+ end
+
private
def copy_gem
dirname = File.join(Dir::tmpdir, File.basename(@gemspec.full_gem_path))
View
3  templates/ruby_info.erb
@@ -0,0 +1,3 @@
+# Ruby Information
+<% Config::CONFIG.sort_by { |x,y| x }.each do |k,v| %><%= k %>: <%= v %>
+<% end %>
View
8 test/busted/test_gem.rb
@@ -23,5 +23,13 @@ def test_archive_file
assert_match Dir::tmpdir, filename
assert File.exists?(filename)
end
+
+ def test_ruby_info
+ broken = Busted::Gem.new(@spec)
+ filename = broken.ruby_info_file
+ assert_match Dir::tmpdir, filename
+ assert File.exists?(filename)
+ assert_match /txt$/, filename
+ end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.