ruby-version-1.0.1/0000755000175000017500000000000012665576077011750 5ustar chchruby-version-1.0.1/ruby_version.gemspec0000644000175000017500000000205312665576077016043 0ustar chch# -*- 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.yml0000644000175000017500000000604412665576077014257 0ustar chch--- !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/.gitignore0000644000175000017500000000002112665576077013731 0ustar chchGemfile.lock pkg ruby-version-1.0.1/.travis.yml0000644000175000017500000000021312665576077014055 0ustar chchlanguage: 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.lock0000644000175000017500000000124412665576077014173 0ustar chchPATH 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.rdoc0000644000175000017500000000022712665576077014451 0ustar chch=== 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.txt0000644000175000017500000000203512665576077013573 0ustar chchCopyright (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/.rspec0000644000175000017500000000004012665576077013057 0ustar chch--colour --format documentation ruby-version-1.0.1/README.rdoc0000644000175000017500000000235412665576077013562 0ustar chch= 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/0000755000175000017500000000000012665576077012516 5ustar chchruby-version-1.0.1/lib/ruby_version.rb0000644000175000017500000000420312665576077015570 0ustar chchrequire '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/Gemfile0000644000175000017500000000015312665576077013242 0ustar chchsource 'https://rubygems.org' gemspec platform :rbx do gem 'rubysl-date' gem 'rubysl-singleton' end ruby-version-1.0.1/pkg/0000755000175000017500000000000012665576077012531 5ustar chchruby-version-1.0.1/pkg/ruby_version-1.0.0.gem0000644000175000017500000002000012665576077016373 0ustar chchmetadata.gz0000444000000000000000000000133012265336757013453 0ustar00wheelwheel00000000000000RՖ_o )O&N'KVԩvæb`Gοڧ(Ndqw?$olWǦxd} B.^M4o A)_uA45wRrt2KI24⟥~%%KBBiW5/tb[nq I<6C_klF(CJX20Ukph B̖/،ӓriđ)"0v<2)K!NKbM+iZZ}mWʥGrvXԞ>J="ڣ-(dF\(uo|ovea<ڵSSpN/ƽ_Ֆ\vV,G)'~Xc}owgqe|5/Z1idLiVQ+MqF jIK3"~Dp.=GQ\Zܖeo`|4__*՝o5 \lr@ʰET,U1iZ郔AP<&$]@R%2.=ĿC}UtXYkNBMJr3a2m4(x a@`!FP‡N2-7u(B=k$/N.3ۀ> @k y'+K\NsdXdRtQ}>q>UKqG`|kU.)ɃkQVqO2kIp%0E(Zv8nrA.VGeܟEǫ VPZmݓȳp}O5tT}Nqe*qҽ3_u'zw}-Uiɛ<$PAQCh@ǷdV@J?!@ 3[2 BĄUMOص,bo V6L+%fT{|d\lG RD2BavmN笇4 @\4R<f e#qĠ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T 1oZIh`VWhaDvmvlW`Zchecksums.yaml.gz0000444000000000000000000000041512265336757014624 0ustar00wheelwheel00000000000000Re1R@E"@:;{ObebJmvy{z<O:b"uݝD3g\\ .!urFs(P\TݰEfpq I-<•ۂ4 ʲTpv! oZ '1.8.7').should == false (RubyVersion <= '1.8.7').should == true (RubyVersion.is.between? '1.8.6', '1.8.7').should == true end it 'should create some handy compare aliases' do RubyVersion.is.above( '1.8.7' ).should == false RubyVersion.is.at_least( '1.8.7' ).should == true RubyVersion.is.exactly( '1.8.7' ).should == true end it 'also allows to check for the release dates' do RubyVersion.is.older_than( Date.today ).should == true RubyVersion.is.newer_than( '2000-01-01' ).should == true end end it 'should define some accessors' do RubyVersion.major.should == 1 RubyVersion.minor.should == 8 RubyVersion.tiny.should == 7 RubyVersion.patchlevel.should == RUBY_PATCHLEVEL RubyVersion.description.should == RUBY_DESCRIPTION end after :all do capture_stderr{ RUBY_VERSION = @remember_version } end end ruby-version-1.0.1/Rakefile0000644000175000017500000000113212665576077013412 0ustar chch# encoding: utf-8 require 'rubygems' begin require 'bundler' rescue LoadError => e warn e.message warn "Run `gem install bundler` to install Bundler." exit -1 end begin Bundler.setup(:development) rescue Bundler::BundlerError => e warn e.message warn "Run `bundle install` to install missing gems." exit e.status_code end require 'rake' require 'rubygems/tasks' Gem::Tasks.new require 'rdoc/task' RDoc::Task.new do |rdoc| rdoc.title = "ruby_version" end task :doc => :rdoc require 'rspec/core/rake_task' RSpec::Core::RakeTask.new task :test => :spec task :default => :spec