Class: FakeGem
Constant Summary collapse
- DEFAULT_VERSION =
"99.0.0"
- SUMMARY =
"Make RubyGems think that a gem is already installed."
Instance Method Summary collapse
-
#initialize(name, options = {}) ⇒ FakeGem
constructor
A new instance of FakeGem.
- #install ⇒ Object
Constructor Details
#initialize(name, options = {}) ⇒ FakeGem
Returns a new instance of FakeGem.
11 12 13 14 15 |
# File 'lib/fake_gem.rb', line 11 def initialize(name, ={}) @name = name = {:install_dir => Gem.dir}.merge() @version = .delete(:version) || DEFAULT_VERSION end |
Instance Method Details
#install ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/fake_gem.rb', line 17 def install temp_path = File.join(Dir.tmpdir, "fakegem.#{Process.pid}") FileUtils.mkdir_p(temp_path) Dir.chdir(temp_path) do build_gem Gem::Installer.new(specification.file_name, ).install end say "Fake gem #@name #@version is now installed" end |