Sha256: 53ccc9d7c4afd6d3b1b139998cc8d0d7bbb987fc11917e22c5341b47592439e6
Contents?: true
Size: 961 Bytes
Versions: 2
Compression:
Stored size: 961 Bytes
Contents
require 'postit/parser' module PostIt class Environment def initialize(argv) @argv = argv end def env_var_version ENV['BUNDLER_VERSION'] end def cli_arg_version return unless str = @argv.first str = str.dup.force_encoding('BINARY') if str.respond_to?(:force_encoding) if Gem::Version.correct?(str) @argv.shift str end end def gemfile ENV['BUNDLE_GEMFILE'] || 'Gemfile' end def lockfile File.expand_path case File.basename(gemfile) when 'gems.rb' then gemfile.sub(/\.rb$/, gemfile) else "#{gemfile}.lock" end end def lockfile_version PostIt::Parser.new(lockfile).parse end def bundler_version @bundler_version ||= begin env_var_version || cli_arg_version || lockfile_version || "#{Gem::Requirement.default}.a" end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
postit-0.2.0 | lib/postit/environment.rb |
postit-0.1.2 | lib/postit/environment.rb |