summaryrefslogtreecommitdiff
path: root/lib/bundler/cli/platform.rb
diff options
context:
space:
mode:
authorSmit Shah <who828@gmail.com>2014-01-08 09:49:54 +0530
committerSmit Shah <who828@gmail.com>2014-01-08 11:00:32 +0530
commit47aac07bd17773c78ee8d0e17f9fdad35059287e (patch)
treeab8ef508a898b61530d4d0971b0f5449923fcef2 /lib/bundler/cli/platform.rb
parentb51005d343b50c1cc151601a033647ab722c7e17 (diff)
downloadbundler-47aac07bd17773c78ee8d0e17f9fdad35059287e.tar.gz
Refactored open, conolse, inject, platform and viz
Diffstat (limited to 'lib/bundler/cli/platform.rb')
-rw-r--r--lib/bundler/cli/platform.rb42
1 files changed, 42 insertions, 0 deletions
diff --git a/lib/bundler/cli/platform.rb b/lib/bundler/cli/platform.rb
new file mode 100644
index 0000000000..94352e33c9
--- /dev/null
+++ b/lib/bundler/cli/platform.rb
@@ -0,0 +1,42 @@
+module Bundler
+ class CLI::Platform
+ attr_reader :options
+ def initialize(options)
+ @options = options
+ end
+
+ def run
+ platforms, ruby_version = Bundler.ui.silence do
+ [ Bundler.definition.platforms.map {|p| "* #{p}" },
+ Bundler.definition.ruby_version ]
+ end
+ output = []
+
+ if options[:ruby]
+ if ruby_version
+ output << ruby_version
+ else
+ output << "No ruby version specified"
+ end
+ else
+ output << "Your platform is: #{RUBY_PLATFORM}"
+ output << "Your app has gems that work on these platforms:\n#{platforms.join("\n")}"
+
+ if ruby_version
+ output << "Your Gemfile specifies a Ruby version requirement:\n* #{ruby_version}"
+
+ begin
+ Bundler.definition.validate_ruby!
+ output << "Your current platform satisfies the Ruby version requirement."
+ rescue RubyVersionMismatch => e
+ output << e.message
+ end
+ else
+ output << "Your Gemfile does not specify a Ruby version requirement."
+ end
+ end
+
+ Bundler.ui.info output.join("\n\n")
+ end
+ end
+end