summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTerence Lee <hone02@gmail.com>2012-12-26 18:13:11 -0500
committerTerence Lee <hone02@gmail.com>2012-12-26 18:13:11 -0500
commit9db6c216b2ad0a11e53734a12972c7f6c389bd42 (patch)
treeb35feae90df67559072f49c5ab543a00c800eaa3 /lib
parent69c5d8bbe88ff50ba116240fffdaa6d2f7161f83 (diff)
downloadbundler-9db6c216b2ad0a11e53734a12972c7f6c389bd42.tar.gz
extract ruby method in Dsl into its own module
Diffstat (limited to 'lib')
-rw-r--r--lib/bundler.rb1
-rw-r--r--lib/bundler/dsl.rb10
-rw-r--r--lib/bundler/ruby_dsl.rb11
3 files changed, 14 insertions, 8 deletions
diff --git a/lib/bundler.rb b/lib/bundler.rb
index 614b56da9f..ade64c2f81 100644
--- a/lib/bundler.rb
+++ b/lib/bundler.rb
@@ -31,6 +31,7 @@ module Bundler
autoload :RemoteSpecification, 'bundler/remote_specification'
autoload :Resolver, 'bundler/resolver'
autoload :RubyVersion, 'bundler/ruby_version'
+ autoload :RubyDsl, 'bundler/ruby_dsl'
autoload :Runtime, 'bundler/runtime'
autoload :Settings, 'bundler/settings'
autoload :SharedHelpers, 'bundler/shared_helpers'
diff --git a/lib/bundler/dsl.rb b/lib/bundler/dsl.rb
index cc35cf4d5e..84346a8249 100644
--- a/lib/bundler/dsl.rb
+++ b/lib/bundler/dsl.rb
@@ -2,6 +2,8 @@ require 'bundler/dependency'
module Bundler
class Dsl
+ include RubyDsl
+
def self.evaluate(gemfile, lockfile, unlock)
builder = new
builder.eval_gemfile(gemfile)
@@ -171,14 +173,6 @@ module Bundler
@env = old
end
- def ruby(ruby_version, options = {})
- raise GemfileError, "Please define :engine_version" if options[:engine] && options[:engine_version].nil?
- raise GemfileError, "Please define :engine" if options[:engine_version] && options[:engine].nil?
-
- raise GemfileError, "ruby_version must match the :engine_version for MRI" if options[:engine] == "ruby" && options[:engine_version] && ruby_version != options[:engine_version]
- @ruby_version = RubyVersion.new(ruby_version, options[:engine], options[:engine_version])
- end
-
def method_missing(name, *args)
location = caller[0].split(':')[0..1].join(':')
raise GemfileError, "Undefined local variable or method `#{name}' for Gemfile\n" \
diff --git a/lib/bundler/ruby_dsl.rb b/lib/bundler/ruby_dsl.rb
new file mode 100644
index 0000000000..87bb801dc7
--- /dev/null
+++ b/lib/bundler/ruby_dsl.rb
@@ -0,0 +1,11 @@
+module Bundler
+ module RubyDsl
+ def ruby(ruby_version, options = {})
+ raise GemfileError, "Please define :engine_version" if options[:engine] && options[:engine_version].nil?
+ raise GemfileError, "Please define :engine" if options[:engine_version] && options[:engine].nil?
+
+ raise GemfileError, "ruby_version must match the :engine_version for MRI" if options[:engine] == "ruby" && options[:engine_version] && ruby_version != options[:engine_version]
+ @ruby_version = RubyVersion.new(ruby_version, options[:engine], options[:engine_version])
+ end
+ end
+end