diff options
author | Carl Lerche <carllerche@mac.com> | 2010-06-06 13:02:17 -0700 |
---|---|---|
committer | Carl Lerche <carllerche@mac.com> | 2010-06-06 13:02:17 -0700 |
commit | 30b63b090c9ab4f733f91b0141100865e8bc99ac (patch) | |
tree | af1e4562093753503b0874c5b7de55b8e7cb0a10 /lib | |
parent | 917cc4fd2ffeec796fd2fcb996d2154e15e279dd (diff) | |
download | bundler-30b63b090c9ab4f733f91b0141100865e8bc99ac.tar.gz |
Get the basic platform DSL working
Diffstat (limited to 'lib')
-rw-r--r-- | lib/bundler/definition.rb | 1 | ||||
-rw-r--r-- | lib/bundler/dependency.rb | 27 |
2 files changed, 28 insertions, 0 deletions
diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb index 5f07ebbc27..e22ab9c159 100644 --- a/lib/bundler/definition.rb +++ b/lib/bundler/definition.rb @@ -66,6 +66,7 @@ module Bundler def specs_for(groups) deps = dependencies.select { |d| (d.groups & groups).any? } + deps.delete_if { |d| !d.current_platform? } specs.for(expand_dependencies(deps)) end diff --git a/lib/bundler/dependency.rb b/lib/bundler/dependency.rb index 1d0a912d96..060ccce592 100644 --- a/lib/bundler/dependency.rb +++ b/lib/bundler/dependency.rb @@ -40,6 +40,11 @@ module Bundler platforms end + def current_platform? + return true if @platforms.empty? + @platforms.any? { |p| send("#{p}?") } + end + def to_lock out = " #{name}" @@ -51,5 +56,27 @@ module Bundler out << "\n" end + + private + + def ruby? + !mswin? && (!defined?(RUBY_ENGINE) || RUBY_ENGINE == "ruby" || RUBY_ENGINE == "rbx") + end + + def ruby_18? + ruby? && RUBY_VERSION < "1.9" + end + + def ruby_19? + ruby? && RUBY_VERSION >= "1.9" + end + + def jruby? + RUBY_ENGINE == "jruby" + end + + def mswin? + # w0t? + end end end |