Class: RubyDep::Travis

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_dep/travis.rb,
lib/ruby_dep/travis/ruby_version.rb

Defined Under Namespace

Classes: RubyVersion

Instance Method Summary collapse

Instance Method Details

#version_constraint(filename = '.travis.yml') ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/ruby_dep/travis.rb', line 7

def version_constraint(filename = '.travis.yml')
  yaml = YAML.load(IO.read(filename))
  versions = supported_versions(yaml)

  selected = versions_for_latest_major(versions)
  lowest = lowest_supported(selected)

  ["~> #{lowest[0..1].join('.')}", ">= #{lowest.join('.')}"]
rescue RubyVersion::Error => ex
  abort("RubyDep Error: #{ex.message}")
end