ruby-version-1.0.1/ 0000755 0001750 0001750 00000000000 12665576077 011750 5 ustar ch ch ruby-version-1.0.1/ruby_version.gemspec 0000644 0001750 0001750 00000002053 12665576077 016043 0 ustar ch ch # -*- encoding: utf-8 -*-
require File.expand_path('../lib/ruby_version', __FILE__)
Gem::Specification.new do |gem|
gem.name = "ruby_version"
gem.version = RubyVersion::VERSION
gem.summary = 'Adds the RubyVersion pseudo-constant.'
gem.description = 'Provides a RubyVersion class to simplify checking for the right Ruby version in your programs.'
gem.license = "MIT"
gem.authors = ["Jan Lelis"]
gem.email = "mail@janlelis.de"
gem.homepage = "https://github.com/janlelis/ruby_version"
gem.files = Dir['{**/}{.*,*}'].select { |path| File.file?(path) }
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
gem.require_paths = ['lib']
gem.add_development_dependency 'bundler', '~> 1.0'
gem.add_development_dependency 'rake', '~> 10.1'
gem.add_development_dependency 'rdoc', '~> 3.0'
gem.add_development_dependency 'rspec', '~> 2.4'
gem.add_development_dependency 'rubygems-tasks', '~> 0.2'
end
ruby-version-1.0.1/metadata.yml 0000644 0001750 0001750 00000006044 12665576077 014257 0 ustar ch ch --- !ruby/object:Gem::Specification
name: ruby_version
version: !ruby/object:Gem::Version
version: 1.0.1
platform: ruby
authors:
- Jan Lelis
autorequire:
bindir: bin
cert_chain: []
date: 2014-01-17 00:00:00.000000000 Z
dependencies:
- !ruby/object:Gem::Dependency
name: bundler
requirement: !ruby/object:Gem::Requirement
requirements:
- - "~>"
- !ruby/object:Gem::Version
version: '1.0'
type: :development
prerelease: false
version_requirements: !ruby/object:Gem::Requirement
requirements:
- - "~>"
- !ruby/object:Gem::Version
version: '1.0'
- !ruby/object:Gem::Dependency
name: rake
requirement: !ruby/object:Gem::Requirement
requirements:
- - "~>"
- !ruby/object:Gem::Version
version: '10.1'
type: :development
prerelease: false
version_requirements: !ruby/object:Gem::Requirement
requirements:
- - "~>"
- !ruby/object:Gem::Version
version: '10.1'
- !ruby/object:Gem::Dependency
name: rdoc
requirement: !ruby/object:Gem::Requirement
requirements:
- - "~>"
- !ruby/object:Gem::Version
version: '3.0'
type: :development
prerelease: false
version_requirements: !ruby/object:Gem::Requirement
requirements:
- - "~>"
- !ruby/object:Gem::Version
version: '3.0'
- !ruby/object:Gem::Dependency
name: rspec
requirement: !ruby/object:Gem::Requirement
requirements:
- - "~>"
- !ruby/object:Gem::Version
version: '2.4'
type: :development
prerelease: false
version_requirements: !ruby/object:Gem::Requirement
requirements:
- - "~>"
- !ruby/object:Gem::Version
version: '2.4'
- !ruby/object:Gem::Dependency
name: rubygems-tasks
requirement: !ruby/object:Gem::Requirement
requirements:
- - "~>"
- !ruby/object:Gem::Version
version: '0.2'
type: :development
prerelease: false
version_requirements: !ruby/object:Gem::Requirement
requirements:
- - "~>"
- !ruby/object:Gem::Version
version: '0.2'
description: Provides a RubyVersion class to simplify checking for the right Ruby
version in your programs.
email: mail@janlelis.de
executables: []
extensions: []
extra_rdoc_files: []
files:
- ".gitignore"
- ".rspec"
- ".travis.yml"
- ChangeLog.rdoc
- Gemfile
- Gemfile.lock
- LICENSE.txt
- README.rdoc
- Rakefile
- lib/ruby_version.rb
- pkg/ruby_version-1.0.0.gem
- ruby_version.gemspec
- spec/ruby_version_spec.rb
- spec/spec_helper.rb
homepage: https://github.com/janlelis/ruby_version
licenses:
- MIT
metadata: {}
post_install_message:
rdoc_options: []
require_paths:
- lib
required_ruby_version: !ruby/object:Gem::Requirement
requirements:
- - ">="
- !ruby/object:Gem::Version
version: '0'
required_rubygems_version: !ruby/object:Gem::Requirement
requirements:
- - ">="
- !ruby/object:Gem::Version
version: '0'
requirements: []
rubyforge_project:
rubygems_version: 2.2.1
signing_key:
specification_version: 4
summary: Adds the RubyVersion pseudo-constant.
test_files:
- spec/ruby_version_spec.rb
- spec/spec_helper.rb
ruby-version-1.0.1/.gitignore 0000644 0001750 0001750 00000000021 12665576077 013731 0 ustar ch ch Gemfile.lock
pkg
ruby-version-1.0.1/.travis.yml 0000644 0001750 0001750 00000000213 12665576077 014055 0 ustar ch ch language: ruby
rvm:
#- ruby-head (travis error)
- 2.1.0
- 2.0.0
- 1.9.3
- 1.9.2
- 1.8.7
- ree
- jruby
- jruby-19mode
- jruby-18mode
- rbx
ruby-version-1.0.1/Gemfile.lock 0000644 0001750 0001750 00000001244 12665576077 014173 0 ustar ch ch PATH
remote: .
specs:
ruby_version (1.0.1)
GEM
remote: https://rubygems.org/
specs:
diff-lcs (1.2.5)
json (1.8.1)
rake (10.1.1)
rdoc (3.12.2)
json (~> 1.4)
rspec (2.14.1)
rspec-core (~> 2.14.0)
rspec-expectations (~> 2.14.0)
rspec-mocks (~> 2.14.0)
rspec-core (2.14.7)
rspec-expectations (2.14.4)
diff-lcs (>= 1.1.3, < 2.0)
rspec-mocks (2.14.4)
rubygems-tasks (0.2.4)
rubysl-date (2.0.6)
rubysl-singleton (2.0.0)
PLATFORMS
ruby
DEPENDENCIES
bundler (~> 1.0)
rake (~> 10.1)
rdoc (~> 3.0)
rspec (~> 2.4)
ruby_version!
rubygems-tasks (~> 0.2)
rubysl-date
rubysl-singleton
ruby-version-1.0.1/ChangeLog.rdoc 0000644 0001750 0001750 00000000227 12665576077 014451 0 ustar ch ch === 1.0.1 / 2014-01-15
* Fix VERSION constant
* Add RubyVersion.revision method
=== 1.0.0 / 2014-01-14
* Moved from zucker 13.1 gem into its own gem
ruby-version-1.0.1/LICENSE.txt 0000644 0001750 0001750 00000002035 12665576077 013573 0 ustar ch ch Copyright (c) 2014 Jan Lelis
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
ruby-version-1.0.1/.rspec 0000644 0001750 0001750 00000000040 12665576077 013057 0 ustar ch ch --colour --format documentation
ruby-version-1.0.1/README.rdoc 0000644 0001750 0001750 00000002354 12665576077 013562 0 ustar ch ch = RubyVersion {
}[https://travis-ci.org/janlelis/ruby_version]
Provides a +RubyVersion+ to simplify checking for the right Ruby version in your programs.
== Setup
On your command-line:
$ gem install ruby_version
In Ruby:
require 'ruby_version'
== Usage
# Output RUBY_VERSION
RubyVersion.to_s
# Check for the main version with a Float
RubyVersion.is? 2.1
# Use strings for exacter checking
RubyVersion.is.above '1.9.2'
RubyVersion.is.at_least '2.0.0' # or exactly, below, at_most
# You can use the common comparison operators
RubyVersion >= '1.8.7'
RubyVersion.between? '1.8.7', '1.9.2'
# Relase date checks
RubyVersion.is.older_than Date.today
RubyVersion.is.newer_than '2009-08-19'
# Misc Accessors
RubyVersion.major # => 1
RubyVersion.minor # => 8
RubyVersion.tiny # => 7
RubyVersion.patchlevel # => 249
RubyVersion.description # => "ruby 1.8.7 (2010-01-10 patchlevel 249) [i486-linux]"
== Also See
https://github.com/janlelis/ruby_engine |
https://github.com/janlelis/ruby_info |
https://github.com/rdp/os
== J-_-L
Copyright (c) 2010-2014 Jan Lelis. MIT License. Originated from the zucker gem.
ruby-version-1.0.1/lib/ 0000755 0001750 0001750 00000000000 12665576077 012516 5 ustar ch ch ruby-version-1.0.1/lib/ruby_version.rb 0000644 0001750 0001750 00000004203 12665576077 015570 0 ustar ch ch require 'date'
require 'time'
module RubyVersion
VERSION = '1.0.1'
class << self
def to_s
RUBY_VERSION
end
alias inspect to_s
# comparable
def <=>(other)
value = case other
when Integer
RUBY_VERSION.to_i
when Float
RUBY_VERSION.to_f
when String
RUBY_VERSION
when Date, Time
other.class.parse(RUBY_RELEASE_DATE)
else
other = other.to_s
RUBY_VERSION
end
value <=> other
end
include Comparable
# chaining for dsl-like language
def is?(other = nil)
if other
RubyVersion == other
else
RubyVersion
end
end
alias is is?
# aliases
alias below <
alias below? <
alias at_most <=
alias at_most? <=
alias above >
alias above? >
alias at_least >=
alias at_least? >=
alias exactly ==
alias exactly? ==
def not(other)
self != other
end
alias not? not
alias between between?
# compare dates
def newer_than(other)
if other.is_a? Date or other.is_a? Time
RubyVersion > other
else
RUBY_RELEASE_DATE > other.to_s
end
end
alias newer_than? newer_than
def older_than(other)
if other.is_a? Date or other.is_a? Time
RubyVersion < other
else
RUBY_RELEASE_DATE < other.to_s
end
end
alias older_than? older_than
def released_today
RubyVersion.date == Date.today
end
alias released_today? released_today
# accessors
def major
RUBY_VERSION.to_i
end
alias main major
def minor
RUBY_VERSION.split('.')[1].to_i
end
alias mini minor
def tiny
RUBY_VERSION.split('.')[2].to_i
end
alias teeny tiny
def patchlevel
RUBY_PATCHLEVEL
end
def platform
RUBY_PLATFORM
end
def release_date
Date.parse RUBY_RELEASE_DATE
end
alias date release_date
def description
RUBY_DESCRIPTION
end
def revision
defined?(RUBY_REVISION) && RUBY_REVISION
end
end
end
# J-_-L
ruby-version-1.0.1/Gemfile 0000644 0001750 0001750 00000000153 12665576077 013242 0 ustar ch ch source 'https://rubygems.org'
gemspec
platform :rbx do
gem 'rubysl-date'
gem 'rubysl-singleton'
end
ruby-version-1.0.1/pkg/ 0000755 0001750 0001750 00000000000 12665576077 012531 5 ustar ch ch ruby-version-1.0.1/pkg/ruby_version-1.0.0.gem 0000644 0001750 0001750 00000020000 12665576077 016373 0 ustar ch ch metadata.gz 0000444 0000000 0000000 00000001330 12265336757 013453 0 ustar 00wheel wheel 0000000 0000000 RՖ_o )O&N'KVԩvæb` Gοڧ(Ndqw?$olWǦx d}B.^M4o A)_uA45wRrt2KI24⟥~%%KBBiW5/tb[nq I<6C_klF(CJX20Ukph B̖/،ӓriđ)"0v<2)K!NK