buff-ruby_engine-1.0.0/0000755000004100000410000000000012753476423015003 5ustar www-datawww-databuff-ruby_engine-1.0.0/Thorfile0000644000004100000410000000200312753476423016475 0ustar www-datawww-data# encoding: utf-8 $:.push File.expand_path("../lib", __FILE__) require 'bundler' require 'bundler/setup' require 'buff/ruby_engine' class Default < Thor extend Buff::RubyEngine unless jruby? require 'thor/rake_compat' include Thor::RakeCompat Bundler::GemHelper.install_tasks desc "build", "Build buff-ruby_engine-#{Buff::RubyEngine::VERSION}.gem into the pkg directory" def build Rake::Task["build"].invoke end desc "install", "Build and install buff-ruby_engine-#{Buff::RubyEngine::VERSION}.gem into system gems" def install Rake::Task["install"].invoke end desc "release", "Create tag v#{Buff::RubyEngine::VERSION} and build and push buff-ruby_engine-#{Buff::RubyEngine::VERSION}.gem to Rubygems" def release Rake::Task["release"].invoke end end class Spec < Thor namespace :spec default_task :unit desc "unit", "run the project's unit tests" def unit exec "rspec --color --format=documentation spec" end end end buff-ruby_engine-1.0.0/Gemfile0000644000004100000410000000004712753476423016277 0ustar www-datawww-datasource 'https://rubygems.org' gemspec buff-ruby_engine-1.0.0/spec/0000755000004100000410000000000012753476423015735 5ustar www-datawww-databuff-ruby_engine-1.0.0/spec/buff/0000755000004100000410000000000012753476423016657 5ustar www-datawww-databuff-ruby_engine-1.0.0/spec/buff/ruby_engine_spec.rb0000644000004100000410000000222412753476423022524 0ustar www-datawww-datarequire 'spec_helper' describe Buff::RubyEngine do describe "#jruby?" do subject { described_class.jruby? } context "when the ruby engine is jruby" do before { stub_const("RUBY_ENGINE", "jruby") } it { expect(subject).to be true } end context "when the ruby engine is not jruby" do before { stub_const("RUBY_ENGINE", "ruby") } it { expect(subject).to be false } end end describe "#mri?" do subject { described_class.mri? } context "when the ruby engine is mri" do before { stub_const("RUBY_ENGINE", "ruby") } it { expect(subject).to be true } end context "when the ruby engine is not mri" do before { stub_const("RUBY_ENGINE", "jruby") } it { expect(subject).to be false } end end describe "#rubinius?" do subject { described_class.rubinius? } context "when the ruby engine is rubinius" do before { stub_const("RUBY_ENGINE", "rbx") } it { expect(subject).to be true } end context "when the ruby engine is not rubinius" do before { stub_const("RUBY_ENGINE", "mri") } it { expect(subject).to be false } end end end buff-ruby_engine-1.0.0/spec/spec_helper.rb0000644000004100000410000000101312753476423020546 0ustar www-datawww-data$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) require 'rspec' require 'buff/ruby_engine' def setup_rspec RSpec.configure do |config| config.expect_with :rspec do |c| c.syntax = :expect end config.mock_with :rspec config.filter_run focus: true config.run_all_when_everything_filtered = true end end if Buff::RubyEngine.jruby? require 'buff/ruby_engine' setup_rspec else require 'spork' Spork.prefork { setup_rspec } Spork.each_run { require 'buff/ruby_engine' } end buff-ruby_engine-1.0.0/.travis.yml0000644000004100000410000000027312753476423017116 0ustar www-datawww-datasudo: false language: ruby cache: bundler matrix: include: - rvm: 2.2.5 - rvm: 2.3.1 - rvm: ruby-head allow_failures: - rvm: ruby-head script: bundle exec thor spec buff-ruby_engine-1.0.0/lib/0000755000004100000410000000000012753476423015551 5ustar www-datawww-databuff-ruby_engine-1.0.0/lib/buff-ruby_engine.rb0000644000004100000410000000004412753476423021322 0ustar www-datawww-datarequire_relative 'buff/ruby_engine' buff-ruby_engine-1.0.0/lib/buff/0000755000004100000410000000000012753476423016473 5ustar www-datawww-databuff-ruby_engine-1.0.0/lib/buff/ruby_engine/0000755000004100000410000000000012753476423021001 5ustar www-datawww-databuff-ruby_engine-1.0.0/lib/buff/ruby_engine/kernel_ext.rb0000644000004100000410000000023712753476423023470 0ustar www-datawww-datarequire 'buff/ruby_engine' module Kernel include Buff::RubyEngine end class Object # Re-include since the Kernel module was altered include Kernel end buff-ruby_engine-1.0.0/lib/buff/ruby_engine/version.rb0000644000004100000410000000010012753476423023002 0ustar www-datawww-datamodule Buff module RubyEngine VERSION = "1.0.0" end end buff-ruby_engine-1.0.0/lib/buff/ruby_engine.rb0000644000004100000410000000055612753476423021334 0ustar www-datawww-datamodule Buff module RubyEngine require_relative 'ruby_engine/version' extend self # @return [Boolean] def jruby? RUBY_ENGINE == 'jruby' end # @return [Boolean] def mri? RUBY_ENGINE == 'ruby' end # @return [Boolean] def rubinius? RUBY_ENGINE == 'rbx' end alias_method :rbx?, :rubinius? end end buff-ruby_engine-1.0.0/.gitignore0000644000004100000410000000023212753476423016770 0ustar www-datawww-data*.gem *.rbc .bundle .config .yardoc Gemfile.lock InstalledFiles _yardoc coverage doc/ lib/bundler/man pkg rdoc spec/reports test/tmp test/version_tmp tmp buff-ruby_engine-1.0.0/buff-ruby_engine.gemspec0000644000004100000410000000244712753476423021605 0ustar www-datawww-data# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'buff/ruby_engine/version' Gem::Specification.new do |spec| spec.name = "buff-ruby_engine" spec.version = Buff::RubyEngine::VERSION spec.authors = ["Jamie Winsor"] spec.email = ["jamie@vialstudios.com"] spec.description = %q{A mixin for querying the platform running Ruby} spec.summary = %q{Buff up your code with a mixin for querying the platform running Ruby} spec.homepage = "https://github.com/RiotGames/buff-ruby_engine" spec.license = "Apache 2.0" spec.files = `git ls-files`.split($/) spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } spec.test_files = spec.files.grep(%r{^spec/}) spec.require_paths = ["lib"] spec.required_ruby_version = ">= 2.2.0" spec.add_development_dependency "thor", "~> 0.19.0" spec.add_development_dependency "bundler", "~> 1.3" spec.add_development_dependency "rake" spec.add_development_dependency "rspec", "~> 3.0" spec.add_development_dependency "fuubar" spec.add_development_dependency "guard" spec.add_development_dependency "guard-rspec" spec.add_development_dependency "guard-spork" spec.add_development_dependency "spork" end buff-ruby_engine-1.0.0/CONTRIBUTING.md0000644000004100000410000000071312753476423017235 0ustar www-datawww-data# Contributing ## Running tests ### Install prerequisites Install the latest version of [Bundler](http://gembundler.com) ``` $ gem install bundler ``` Clone the project ``` $ git clone git://github.com/berkshelf/buff-ruby_engine.git ``` and run: ``` $ cd buff-ruby_engine $ bundle install ``` Bundler will install all gems and their dependencies required for testing and developing. ### Running unit (RSpec) tests ``` $ bundle exec guard start ``` buff-ruby_engine-1.0.0/LICENSE0000644000004100000410000000113012753476423016003 0ustar www-datawww-dataCopyright 2012-2013 Riot Games Jamie Winsor () Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. buff-ruby_engine-1.0.0/README.md0000644000004100000410000000217412753476423016266 0ustar www-datawww-data# Buff::RubyEngine [![Gem Version](https://badge.fury.io/rb/buff-ruby_engine.svg)](http://badge.fury.io/rb/buff-ruby_engine) [![Build Status](https://travis-ci.org/berkshelf/buff-ruby_engine.svg?branch=master)](https://travis-ci.org/berkshelf/buff-ruby_engine) A mixin for querying the platform running Ruby ## Installation Add this line to your application's Gemfile: ```ruby gem 'buff-ruby_engine' ``` And then execute: ``` $ bundle ``` Or install it yourself as: ``` $ gem install buff-ruby_engine ``` ## Usage Using it as a mixin ```ruby require 'buff/ruby_engine' class PowerUp include Buff::RubyEngine end power_up = PowerUp.new power_up.mri? #=> true power_up.jruby? #=> false power_up.rubinius? #=> false ``` Using it as a module ```ruby require 'buff/ruby_engine' Buff::RubyEngine.mri? #=> true Buff::RubyEngine.jruby? #=> false Buff::RubyEngine.rubinius? #=> false ``` # Authors and Contributors - Jamie Winsor ([jamie@vialstudios.com](mailto:jamie@vialstudios.com)) Thank you to all of our [Contributors](https://github.com/berkshelf/buff-ruby_engine/graphs/contributors), testers, and users. buff-ruby_engine-1.0.0/Guardfile0000644000004100000410000000070412753476423016631 0ustar www-datawww-datanotification :off guard "spork" do watch('Gemfile') watch('spec/spec_helper.rb') { :rspec } watch(%r{^spec/support/.+\.rb$}) { :rspec } end guard "rspec", cli: "--color --drb --format Fuubar", all_on_start: false, all_after_pass: false do watch(%r{^spec/.+_spec\.rb$}) watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" } watch('spec/spec_helper.rb') { "spec" } watch(%r{^spec/support/.+\.rb$}) { "spec" } end