summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com>2009-08-18 17:42:54 -0700
committerYehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com>2009-08-18 17:42:54 -0700
commitbf00e9c769e2f6f1482cb34d15d50a1c8c9f21eb (patch)
tree417c87ce230390c868d952be994eda05575a9071
parent72bda3957af458e66303723b7a5be6d438233977 (diff)
downloadbundler-bf00e9c769e2f6f1482cb34d15d50a1c8c9f21eb.tar.gz
Bundle the bundler runtime
-rw-r--r--lib/bundler.rb2
-rw-r--r--lib/bundler/manifest.rb13
-rw-r--r--lib/bundler/repository.rb2
-rw-r--r--lib/bundler/runtime.rb48
-rw-r--r--lib/bundler/runtime/dependency.rb (renamed from lib/bundler/dependency.rb)0
-rw-r--r--lib/bundler/runtime/dsl.rb44
-rw-r--r--lib/bundler/templates/environment.erb6
7 files changed, 64 insertions, 51 deletions
diff --git a/lib/bundler.rb b/lib/bundler.rb
index 8fdeb22696..f684cc914f 100644
--- a/lib/bundler.rb
+++ b/lib/bundler.rb
@@ -13,10 +13,10 @@ require "bundler/gem_ext"
require "bundler/resolver"
require "bundler/manifest_file"
require "bundler/manifest"
-require "bundler/dependency"
require "bundler/dsl"
require "bundler/cli"
require "bundler/repository"
+require "bundler/runtime/dependency"
module Bundler
VERSION = "0.5.0"
diff --git a/lib/bundler/manifest.rb b/lib/bundler/manifest.rb
index 22d3cacb4e..57dc90a95c 100644
--- a/lib/bundler/manifest.rb
+++ b/lib/bundler/manifest.rb
@@ -22,6 +22,7 @@ module Bundler
# Cleanup incase fetch was a no-op
repository.cleanup(gems)
create_environment_file(repository.path)
+ create_bundler_runtime
Bundler.logger.info "Done."
end
@@ -119,5 +120,17 @@ module Bundler
end
files
end
+
+ def create_bundler_runtime
+ here = Pathname.new(__FILE__).dirname
+ there = path.join("bundler")
+
+ Bundler.logger.info "Creating the bundler runtime"
+
+ FileUtils.rm_rf(there)
+ there.mkdir
+ FileUtils.cp(here.join("runtime.rb"), there)
+ FileUtils.cp_r(here.join("runtime"), there)
+ end
end
end
diff --git a/lib/bundler/repository.rb b/lib/bundler/repository.rb
index 8f4c562387..5882d09e13 100644
--- a/lib/bundler/repository.rb
+++ b/lib/bundler/repository.rb
@@ -20,7 +20,7 @@ module Bundler
end
def valid?
- (Dir[@path.join("*")] - Dir[@path.join("{cache,doc,gems,environment.rb,specifications}")]).empty?
+ (Dir[@path.join("*")] - Dir[@path.join("{cache,doc,gems,bundler,environment.rb,specifications}")]).empty?
end
def download(spec)
diff --git a/lib/bundler/runtime.rb b/lib/bundler/runtime.rb
index 3af2f5cdf8..27e0254966 100644
--- a/lib/bundler/runtime.rb
+++ b/lib/bundler/runtime.rb
@@ -1,46 +1,2 @@
-require "bundler/dependency"
-
-module Bundler
- class ManifestFileNotFound < StandardError; end
-
- def self.require(environment = nil)
- ManifestBuilder.run(@gemfile, environment || :default)
- end
-
- class ManifestBuilder
- def self.run(gemfile, environment)
- unless File.exist?(gemfile)
- raise ManifestFileNotFound, "#{gemfile.inspect} does not exist"
- end
-
- builder = new(environment)
- builder.instance_eval(File.read(gemfile))
- builder
- end
-
- def initialize(environment)
- @environment = environment
- end
-
- def bundle_path(*) ; end
-
- def bin_path(*) ; end
-
- def disable_rubygems(*) ; end
-
- def disable_system_gems(*) ; end
-
- def source(*) ; end
-
- def clear_sources(*) ; end
-
- def gem(name, *args, &blk)
- options = args.last.is_a?(Hash) ? args.pop : {}
- version = args.last
-
- dep = Dependency.new(name, options.merge(:version => version), &blk)
- dep.require(@environment)
- dep
- end
- end
-end \ No newline at end of file
+require File.join(File.dirname(__FILE__), "runtime", "dsl")
+require File.join(File.dirname(__FILE__), "runtime", "dependency") \ No newline at end of file
diff --git a/lib/bundler/dependency.rb b/lib/bundler/runtime/dependency.rb
index 75d15a27fa..75d15a27fa 100644
--- a/lib/bundler/dependency.rb
+++ b/lib/bundler/runtime/dependency.rb
diff --git a/lib/bundler/runtime/dsl.rb b/lib/bundler/runtime/dsl.rb
new file mode 100644
index 0000000000..436867b4db
--- /dev/null
+++ b/lib/bundler/runtime/dsl.rb
@@ -0,0 +1,44 @@
+module Bundler
+ class ManifestFileNotFound < StandardError; end
+
+ def self.require(environment = nil)
+ ManifestBuilder.run(@gemfile, environment || :default)
+ end
+
+ class ManifestBuilder
+ def self.run(gemfile, environment)
+ unless File.exist?(gemfile)
+ raise ManifestFileNotFound, "#{gemfile.inspect} does not exist"
+ end
+
+ builder = new(environment)
+ builder.instance_eval(File.read(gemfile))
+ builder
+ end
+
+ def initialize(environment)
+ @environment = environment
+ end
+
+ def bundle_path(*) ; end
+
+ def bin_path(*) ; end
+
+ def disable_rubygems(*) ; end
+
+ def disable_system_gems(*) ; end
+
+ def source(*) ; end
+
+ def clear_sources(*) ; end
+
+ def gem(name, *args, &blk)
+ options = args.last.is_a?(Hash) ? args.pop : {}
+ version = args.last
+
+ dep = Dependency.new(name, options.merge(:version => version), &blk)
+ dep.require(@environment)
+ dep
+ end
+ end
+end \ No newline at end of file
diff --git a/lib/bundler/templates/environment.erb b/lib/bundler/templates/environment.erb
index 2c538e9273..8d474157b8 100644
--- a/lib/bundler/templates/environment.erb
+++ b/lib/bundler/templates/environment.erb
@@ -36,6 +36,8 @@ module Bundler
add_specs_to_loaded_specs
add_specs_to_index
<% end -%>
+
+ require File.join(dir, "bundler", "runtime")
end
<% if @rubygems -%>
@@ -79,6 +81,4 @@ module Gem
class VerificationError < Exception; end
class SystemExitException < SystemExit; end
end
-<% end -%>
-
-require "bundler/runtime" \ No newline at end of file
+<% end -%> \ No newline at end of file