# File lib/bundler/vendor/postit/lib/postit/environment.rb, line 5 def initialize(argv) @argv = argv end
# File lib/bundler/vendor/postit/lib/postit/environment.rb, line 37 def bundler_version @bundler_version ||= begin env_var_version || cli_arg_version || lockfile_version || "#{Gem::Requirement.default}.a" end end
# File lib/bundler/vendor/postit/lib/postit/environment.rb, line 13 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
# File lib/bundler/vendor/postit/lib/postit/environment.rb, line 9 def env_var_version ENV['BUNDLER_VERSION'] end
# File lib/bundler/vendor/postit/lib/postit/environment.rb, line 22 def gemfile ENV['BUNDLE_GEMFILE'] || 'Gemfile' end
# File lib/bundler/vendor/postit/lib/postit/environment.rb, line 26 def lockfile File.expand_path case File.basename(gemfile) when 'gems.rb' then gemfile.sub(/\.rb$/, gemfile) else "#{gemfile}.lock" end end
# File lib/bundler/vendor/postit/lib/postit/environment.rb, line 33 def lockfile_version BundlerVendoredPostIt::PostIt::Parser.new(lockfile).parse end