Class: Desert::VersionChecker

Inherits:
Object
  • Object
show all
Defined in:
lib/desert/version_checker.rb

Class Method Summary collapse

Class Method Details

.current_rails_version_matches?(version_requirement) ⇒ Boolean

Returns:

  • (Boolean)


4
5
6
# File 'lib/desert/version_checker.rb', line 4

def current_rails_version_matches?(version_requirement)
  version_matches?(::Rails::VERSION::STRING, version_requirement)
end

.rails_version_is_1991?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/desert/version_checker.rb', line 21

def rails_version_is_1991?
  current_rails_version_matches?('=1.99.1')
end

.rails_version_is_below_1990?Boolean

Returns:

  • (Boolean)


12
13
14
15
# File 'lib/desert/version_checker.rb', line 12

def rails_version_is_below_1990?
  result = current_rails_version_matches?('<1.99.0')
  result
end

.rails_version_is_below_220?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/desert/version_checker.rb', line 25

def rails_version_is_below_220?
  current_rails_version_matches?('<2.2.0')
end

.rails_version_is_below_230?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/desert/version_checker.rb', line 29

def rails_version_is_below_230?
  current_rails_version_matches?('<2.3.0')
end

.rails_version_is_below_rc2?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/desert/version_checker.rb', line 17

def rails_version_is_below_rc2?
  current_rails_version_matches?('<1.99.1')
end

.version_matches?(version, version_requirement) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/desert/version_checker.rb', line 8

def version_matches?(version, version_requirement)
  Gem::Version::Requirement.new([version_requirement]).satisfied_by?(Gem::Version.new(version))
end