diff options
author | Carl Lerche <carllerche@mac.com> | 2010-06-06 02:03:53 -0700 |
---|---|---|
committer | Carl Lerche <carllerche@mac.com> | 2010-06-06 02:08:38 -0700 |
commit | 5c8d9c82b287ef2f6d2fd36b45d6cd11cad12c88 (patch) | |
tree | f297e7ed6ab79f2b452a56645768494f1cfc9c60 /lib/bundler/dependency.rb | |
parent | bc84ffc545b6197fc50e1c0e8c7c5a576248ed0e (diff) | |
download | bundler-5c8d9c82b287ef2f6d2fd36b45d6cd11cad12c88.tar.gz |
Set things up to start working on the platform DSL
Diffstat (limited to 'lib/bundler/dependency.rb')
-rw-r--r-- | lib/bundler/dependency.rb | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/lib/bundler/dependency.rb b/lib/bundler/dependency.rb index dacf991e04..1d0a912d96 100644 --- a/lib/bundler/dependency.rb +++ b/lib/bundler/dependency.rb @@ -7,19 +7,39 @@ module Bundler attr_reader :groups attr_reader :platforms + PLATFORM_MAP = { + :ruby => Gem::Platform::RUBY, + :ruby_18 => Gem::Platform::RUBY, + :ruby_19 => Gem::Platform::RUBY, + :jruby => Gem::Platform::JAVA, + :mswin => Gem::Platform::MSWIN + } + def initialize(name, version, options = {}, &blk) super(name, version) @autorequire = nil @groups = Array(options["group"] || :default).map { |g| g.to_sym } @source = options["source"] - @platforms = [] + @platforms = Array(options["platforms"]) if options.key?('require') @autorequire = Array(options['require'] || []) end end + def gem_platforms(valid_platforms) + return valid_platforms if @platforms.empty? + + platforms = [] + @platforms.each do |p| + platform = PLATFORM_MAP[p] + next unless valid_platforms.include?(platform) + platforms |= [platform] + end + platforms + end + def to_lock out = " #{name}" |