buff-ruby_engine 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
@@ -0,0 +1 @@
1
+ 1.9.3-p429
@@ -0,0 +1,7 @@
1
+ script: "bundle exec thor spec"
2
+ language: ruby
3
+ rvm:
4
+ - 1.9.2
5
+ - 1.9.3
6
+ - 2.0.0
7
+ - jruby-19mode
@@ -0,0 +1,24 @@
1
+ # Contributing
2
+
3
+ ## Running tests
4
+
5
+ ### Install prerequisites
6
+
7
+ Install the latest version of [Bundler](http://gembundler.com)
8
+
9
+ $ gem install bundler
10
+
11
+ Clone the project
12
+
13
+ $ git clone git://github.com/RiotGames/buff-ruby_engine.git
14
+
15
+ and run:
16
+
17
+ $ cd buff-ruby_engine
18
+ $ bundle install
19
+
20
+ Bundler will install all gems and their dependencies required for testing and developing.
21
+
22
+ ### Running unit (RSpec) tests
23
+
24
+ $ bundle exec guard start
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
@@ -0,0 +1,15 @@
1
+ notification :off
2
+
3
+ guard "spork" do
4
+ watch('Gemfile')
5
+ watch('spec/spec_helper.rb') { :rspec }
6
+ watch(%r{^spec/support/.+\.rb$}) { :rspec }
7
+ end
8
+
9
+ guard "rspec", cli: "--color --drb --format Fuubar", all_on_start: false, all_after_pass: false do
10
+ watch(%r{^spec/.+_spec\.rb$})
11
+
12
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
13
+ watch('spec/spec_helper.rb') { "spec" }
14
+ watch(%r{^spec/support/.+\.rb$}) { "spec" }
15
+ end
data/LICENSE ADDED
@@ -0,0 +1,15 @@
1
+ Copyright 2012-2013 Riot Games
2
+
3
+ Jamie Winsor (<reset@riotgames.com>)
4
+
5
+ Licensed under the Apache License, Version 2.0 (the "License");
6
+ you may not use this file except in compliance with the License.
7
+ You may obtain a copy of the License at
8
+
9
+ http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ Unless required by applicable law or agreed to in writing, software
12
+ distributed under the License is distributed on an "AS IS" BASIS,
13
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ See the License for the specific language governing permissions and
15
+ limitations under the License.
@@ -0,0 +1,48 @@
1
+ # Buff::RubyEngine
2
+ [![Gem Version](https://badge.fury.io/rb/buff-ruby_engine.png)](http://badge.fury.io/rb/buff-ruby_engine)
3
+ [![Build Status](https://travis-ci.org/RiotGames/buff-ruby_engine.png?branch=master)](https://travis-ci.org/RiotGames/buff-ruby_engine)
4
+
5
+ A mixin for querying the platform running Ruby
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ gem 'buff-ruby_engine'
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install buff-ruby_engine
20
+
21
+ ## Usage
22
+
23
+ Using it as a mixin
24
+
25
+ require 'buff/ruby_engine'
26
+
27
+ class PowerUp
28
+ include Buff::RubyEngine
29
+ end
30
+
31
+ power_up = PowerUp.new
32
+ power_up.mri? #=> true
33
+ power_up.jruby? #=> false
34
+ power_up.rubinius? #=> false
35
+
36
+ Using it as a module
37
+
38
+ require 'buff/ruby_engine'
39
+
40
+ Buff::RubyEngine.mri? #=> true
41
+ Buff::RubyEngine.jruby? #=> false
42
+ Buff::RubyEngine.rubinius? #=> false
43
+
44
+ # Authors and Contributors
45
+
46
+ * Jamie Winsor (<reset@riotgames.com>)
47
+
48
+ Thank you to all of our [Contributors](https://github.com/RiotGames/buff-ruby_engine/graphs/contributors), testers, and users.
@@ -0,0 +1,42 @@
1
+ # encoding: utf-8
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+
4
+ require 'bundler'
5
+ require 'bundler/setup'
6
+ require 'buff/ruby_engine'
7
+
8
+ class Default < Thor
9
+ extend Buff::RubyEngine
10
+
11
+ unless jruby?
12
+ require 'thor/rake_compat'
13
+
14
+ include Thor::RakeCompat
15
+ Bundler::GemHelper.install_tasks
16
+
17
+ desc "build", "Build buff-ruby_engine-#{Buff::RubyEngine::VERSION}.gem into the pkg directory"
18
+ def build
19
+ Rake::Task["build"].execute
20
+ end
21
+
22
+ desc "install", "Build and install buff-ruby_engine-#{Buff::RubyEngine::VERSION}.gem into system gems"
23
+ def install
24
+ Rake::Task["install"].execute
25
+ end
26
+
27
+ desc "release", "Create tag v#{Buff::RubyEngine::VERSION} and build and push buff-ruby_engine-#{Buff::RubyEngine::VERSION}.gem to Rubygems"
28
+ def release
29
+ Rake::Task["release"].execute
30
+ end
31
+ end
32
+
33
+ class Spec < Thor
34
+ namespace :spec
35
+ default_task :unit
36
+
37
+ desc "unit", "run the project's unit tests"
38
+ def unit
39
+ exec "rspec --color --format=documentation spec"
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,31 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'buff/ruby_engine/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "buff-ruby_engine"
8
+ spec.version = Buff::RubyEngine::VERSION
9
+ spec.authors = ["Jamie Winsor"]
10
+ spec.email = ["reset@riotgames.com"]
11
+ spec.description = %q{A mixin for querying the platform running Ruby}
12
+ spec.summary = %q{Buff up your code with a mixin for querying the platform running Ruby}
13
+ spec.homepage = "https://github.com/RiotGames/buff-ruby_engine"
14
+ spec.license = "Apache 2.0"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^spec/})
19
+ spec.require_paths = ["lib"]
20
+ spec.required_ruby_version = ">= 1.9.2"
21
+
22
+ spec.add_development_dependency "thor", "~> 0.18.0"
23
+ spec.add_development_dependency "bundler", "~> 1.3"
24
+ spec.add_development_dependency "rake"
25
+ spec.add_development_dependency "rspec"
26
+ spec.add_development_dependency "fuubar"
27
+ spec.add_development_dependency "guard"
28
+ spec.add_development_dependency "guard-rspec"
29
+ spec.add_development_dependency "guard-spork"
30
+ spec.add_development_dependency "spork"
31
+ end
@@ -0,0 +1 @@
1
+ require_relative 'buff/ruby_engine'
@@ -0,0 +1,23 @@
1
+ module Buff
2
+ module RubyEngine
3
+ require_relative 'ruby_engine/version'
4
+
5
+ extend self
6
+
7
+ # @return [Boolean]
8
+ def jruby?
9
+ RUBY_ENGINE == 'jruby'
10
+ end
11
+
12
+ # @return [Boolean]
13
+ def mri?
14
+ RUBY_ENGINE == 'ruby'
15
+ end
16
+
17
+ # @return [Boolean]
18
+ def rubinius?
19
+ RUBY_ENGINE == 'rbx'
20
+ end
21
+ alias_method :rbx?, :rubinius?
22
+ end
23
+ end
@@ -0,0 +1,10 @@
1
+ require 'buff/ruby_engine'
2
+
3
+ module Kernel
4
+ include Buff::RubyEngine
5
+ end
6
+
7
+ class Object
8
+ # Re-include since the Kernel module was altered
9
+ include Kernel
10
+ end
@@ -0,0 +1,5 @@
1
+ module Buff
2
+ module RubyEngine
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,51 @@
1
+ require 'spec_helper'
2
+
3
+ describe Buff::RubyEngine do
4
+ describe "#jruby?" do
5
+ subject { described_class.jruby? }
6
+
7
+ context "when the ruby engine is jruby" do
8
+ before { stub_const("RUBY_ENGINE", "jruby") }
9
+
10
+ it { expect(subject).to be_true }
11
+ end
12
+
13
+ context "when the ruby engine is not jruby" do
14
+ before { stub_const("RUBY_ENGINE", "ruby") }
15
+
16
+ it { expect(subject).to be_false }
17
+ end
18
+ end
19
+
20
+ describe "#mri?" do
21
+ subject { described_class.mri? }
22
+
23
+ context "when the ruby engine is mri" do
24
+ before { stub_const("RUBY_ENGINE", "ruby") }
25
+
26
+ it { expect(subject).to be_true }
27
+ end
28
+
29
+ context "when the ruby engine is not mri" do
30
+ before { stub_const("RUBY_ENGINE", "jruby") }
31
+
32
+ it { expect(subject).to be_false }
33
+ end
34
+ end
35
+
36
+ describe "#rubinius?" do
37
+ subject { described_class.rubinius? }
38
+
39
+ context "when the ruby engine is rubinius" do
40
+ before { stub_const("RUBY_ENGINE", "rbx") }
41
+
42
+ it { expect(subject).to be_true }
43
+ end
44
+
45
+ context "when the ruby engine is not rubinius" do
46
+ before { stub_const("RUBY_ENGINE", "mri") }
47
+
48
+ it { expect(subject).to be_false }
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,27 @@
1
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
+
3
+ require 'rspec'
4
+ require 'buff/ruby_engine'
5
+
6
+ def setup_rspec
7
+ RSpec.configure do |config|
8
+ config.expect_with :rspec do |c|
9
+ c.syntax = :expect
10
+ end
11
+
12
+ config.mock_with :rspec
13
+ config.treat_symbols_as_metadata_keys_with_true_values = true
14
+ config.filter_run focus: true
15
+ config.run_all_when_everything_filtered = true
16
+ end
17
+ end
18
+
19
+ if Buff::RubyEngine.jruby?
20
+ require 'buff/ruby_engine'
21
+ setup_rspec
22
+ else
23
+ require 'spork'
24
+
25
+ Spork.prefork { setup_rspec }
26
+ Spork.each_run { require 'buff/ruby_engine' }
27
+ end
metadata ADDED
@@ -0,0 +1,211 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: buff-ruby_engine
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Jamie Winsor
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-06-11 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: thor
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 0.18.0
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 0.18.0
30
+ - !ruby/object:Gem::Dependency
31
+ name: bundler
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: '1.3'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: '1.3'
46
+ - !ruby/object:Gem::Dependency
47
+ name: rake
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: rspec
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: fuubar
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ - !ruby/object:Gem::Dependency
95
+ name: guard
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ - !ruby/object:Gem::Dependency
111
+ name: guard-rspec
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ - !ruby/object:Gem::Dependency
127
+ name: guard-spork
128
+ requirement: !ruby/object:Gem::Requirement
129
+ none: false
130
+ requirements:
131
+ - - ! '>='
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ type: :development
135
+ prerelease: false
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ! '>='
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ - !ruby/object:Gem::Dependency
143
+ name: spork
144
+ requirement: !ruby/object:Gem::Requirement
145
+ none: false
146
+ requirements:
147
+ - - ! '>='
148
+ - !ruby/object:Gem::Version
149
+ version: '0'
150
+ type: :development
151
+ prerelease: false
152
+ version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
154
+ requirements:
155
+ - - ! '>='
156
+ - !ruby/object:Gem::Version
157
+ version: '0'
158
+ description: A mixin for querying the platform running Ruby
159
+ email:
160
+ - reset@riotgames.com
161
+ executables: []
162
+ extensions: []
163
+ extra_rdoc_files: []
164
+ files:
165
+ - .gitignore
166
+ - .ruby-version
167
+ - .travis.yml
168
+ - CONTRIBUTING.md
169
+ - Gemfile
170
+ - Guardfile
171
+ - LICENSE
172
+ - README.md
173
+ - Thorfile
174
+ - buff-ruby_engine.gemspec
175
+ - lib/buff-ruby_engine.rb
176
+ - lib/buff/ruby_engine.rb
177
+ - lib/buff/ruby_engine/kernel_ext.rb
178
+ - lib/buff/ruby_engine/version.rb
179
+ - spec/buff/ruby_engine_spec.rb
180
+ - spec/spec_helper.rb
181
+ homepage: https://github.com/RiotGames/buff-ruby_engine
182
+ licenses:
183
+ - Apache 2.0
184
+ post_install_message:
185
+ rdoc_options: []
186
+ require_paths:
187
+ - lib
188
+ required_ruby_version: !ruby/object:Gem::Requirement
189
+ none: false
190
+ requirements:
191
+ - - ! '>='
192
+ - !ruby/object:Gem::Version
193
+ version: 1.9.2
194
+ required_rubygems_version: !ruby/object:Gem::Requirement
195
+ none: false
196
+ requirements:
197
+ - - ! '>='
198
+ - !ruby/object:Gem::Version
199
+ version: '0'
200
+ segments:
201
+ - 0
202
+ hash: -352670113274747996
203
+ requirements: []
204
+ rubyforge_project:
205
+ rubygems_version: 1.8.23
206
+ signing_key:
207
+ specification_version: 3
208
+ summary: Buff up your code with a mixin for querying the platform running Ruby
209
+ test_files:
210
+ - spec/buff/ruby_engine_spec.rb
211
+ - spec/spec_helper.rb