This repository has been archived by the owner on Apr 14, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Carl Lerche
committed
Aug 28, 2009
1 parent
7622e35
commit 75608df
Showing
7 changed files
with
120 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,7 +62,7 @@ def cleanup(bundle) | |
repo.cleanup(bundle) | ||
end | ||
end | ||
|
||
def each_repo | ||
@repos.each do |k, repo| | ||
yield repo | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
class Pathname | ||
def mkdir_p | ||
FileUtils.mkdir_p(self) | ||
end | ||
|
||
def touch_p | ||
dirname.mkdir_p | ||
touch | ||
end | ||
|
||
def touch | ||
FileUtils.touch(self) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
module Spec | ||
module Helpers | ||
def run_in_context(*args) | ||
cmd = args.pop.gsub(/(?=")/, "\\") | ||
env = args.pop || tmp_file("vendor", "gems", "environment") | ||
lib = File.join(File.dirname(__FILE__), '..', '..', 'lib') | ||
%x{#{Gem.ruby} -I#{lib} -r #{env} -e "#{cmd}"}.strip | ||
end | ||
|
||
def gem_command(command, args = "") | ||
if command == :exec | ||
args = args.gsub(/(?=")/, "\\") | ||
args = %["#{args}"] | ||
end | ||
lib = File.join(File.dirname(__FILE__), '..', '..', 'lib') | ||
%x{#{Gem.ruby} -I#{lib} -rubygems -S gem #{command} #{args}}.strip | ||
end | ||
|
||
def build_manifest_file(*args) | ||
path = tmp_file("Gemfile") | ||
path = args.shift if args.first.is_a?(Pathname) | ||
str = args.shift || "" | ||
FileUtils.mkdir_p(path.dirname) | ||
File.open(path, 'w') do |f| | ||
f.puts str | ||
end | ||
end | ||
|
||
def build_manifest(*args) | ||
path = tmp_file("Gemfile") | ||
path = args.shift if args.first.is_a?(Pathname) | ||
str = args.shift || "" | ||
FileUtils.mkdir_p(path.dirname) | ||
Dir.chdir(path.dirname) do | ||
build_manifest_file(path, str) | ||
Bundler::Environment.load(path) | ||
end | ||
end | ||
|
||
def install_manifest(*args) | ||
m = build_manifest(*args) | ||
m.install | ||
m | ||
end | ||
|
||
def reset! | ||
tmp_dir.rmtree if tmp_dir.exist? | ||
tmp_dir.mkdir | ||
end | ||
end | ||
end |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
module Spec | ||
module PathUtils | ||
def this_file | ||
Pathname.new(__FILE__).dirname.join('..').expand_path | ||
end | ||
|
||
def tmp_dir | ||
this_file.join("..", "tmp") | ||
end | ||
|
||
def tmp_gem_path(*path) | ||
tmp_file("vendor", "gems").join(*path) | ||
end | ||
|
||
def tmp_bindir(*path) | ||
tmp_file("bin").join(*path) | ||
end | ||
|
||
def tmp_file(*path) | ||
tmp_dir.join(*path) | ||
end | ||
|
||
def cached(gem_name) | ||
File.join(tmp_dir, 'cache', "#{gem_name}.gem") | ||
end | ||
|
||
def fixture_dir | ||
this_file.join("fixtures") | ||
end | ||
|
||
def gem_repo1 | ||
fixture_dir.join("repository1").expand_path | ||
end | ||
|
||
def gem_repo2 | ||
fixture_dir.join("repository2").expand_path | ||
end | ||
|
||
def gem_repo3 | ||
fixture_dir.join("repository3").expand_path | ||
end | ||
|
||
def fixture(gem_name) | ||
fixture_dir.join("repository1", "gems", "#{gem_name}.gem") | ||
end | ||
|
||
def copy(gem_name) | ||
FileUtils.cp(fixture(gem_name), File.join(tmp_dir, 'cache')) | ||
end | ||
end | ||
end |