mixin-platform 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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,8 @@
1
+ script: "bundle exec thor spec"
2
+ language: ruby
3
+ rvm:
4
+ - 1.9.1
5
+ - 1.9.2
6
+ - 1.9.3
7
+ - 2.0.0
8
+ - 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/mixin-platform.git
14
+
15
+ and run:
16
+
17
+ $ cd mixin-platform
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,46 @@
1
+ # Mixin::Platform
2
+
3
+ A mixin for querying the platform running Ruby
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'mixin-platform'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install mixin-platform
18
+
19
+ ## Usage
20
+
21
+ Using it as a Mixin
22
+
23
+ require 'mixin/platform'
24
+
25
+ class PowerUp
26
+ include Mixin::Platform
27
+ end
28
+
29
+ power_up = PowerUp.new
30
+ power_up.osx? #=> true
31
+ power_up.windows? #-> false
32
+ power_up.linux? #=> false
33
+
34
+ Using it as a module
35
+
36
+ require 'mixin/platform'
37
+
38
+ Mixin::Platform.osx? #=> true
39
+ Mixin::Platform.windows? #=> false
40
+ Mixin::Platform.linux? #=> false
41
+
42
+ # Authors and Contributors
43
+
44
+ * Jamie Winsor (<reset@riotgames.com>)
45
+
46
+ Thank you to all of our [Contributors](https://github.com/RiotGames/mixin-platform/graphs/contributors), testers, and users.
@@ -0,0 +1,43 @@
1
+ # encoding: utf-8
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+
4
+ require 'bundler'
5
+ require 'bundler/setup'
6
+ require 'mixin/platform/version'
7
+ require 'mixin/ruby_engine'
8
+
9
+ class Default < Thor
10
+ extend Mixin::RubyEngine
11
+
12
+ unless jruby?
13
+ require 'thor/rake_compat'
14
+
15
+ include Thor::RakeCompat
16
+ Bundler::GemHelper.install_tasks
17
+
18
+ desc "build", "Build mixin-platform-#{Mixin::Platform::VERSION}.gem into the pkg directory"
19
+ def build
20
+ Rake::Task["build"].execute
21
+ end
22
+
23
+ desc "install", "Build and install mixin-platform-#{Mixin::Platform::VERSION}.gem into system gems"
24
+ def install
25
+ Rake::Task["install"].execute
26
+ end
27
+
28
+ desc "release", "Create tag v#{Mixin::Platform::VERSION} and build and push mixin-platform-#{Mixin::Platform::VERSION}.gem to Rubygems"
29
+ def release
30
+ Rake::Task["release"].execute
31
+ end
32
+ end
33
+
34
+ class Spec < Thor
35
+ namespace :spec
36
+ default_task :unit
37
+
38
+ desc "unit", "run the project's unit tests"
39
+ def unit
40
+ exec "rspec --color --format=documentation spec"
41
+ end
42
+ end
43
+ end
@@ -0,0 +1 @@
1
+ require_relative 'mixin/platform'
@@ -0,0 +1,24 @@
1
+ require 'rbconfig'
2
+
3
+ module Mixin
4
+ module Platform
5
+ require_relative 'platform/version'
6
+
7
+ extend self
8
+
9
+ # @return [Boolean]
10
+ def windows?
11
+ (RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/) ? true : false
12
+ end
13
+
14
+ # @return [Boolean]
15
+ def osx?
16
+ (RbConfig::CONFIG['host_os'] =~ /darwin/) ? true : false
17
+ end
18
+
19
+ # @return [Boolean]
20
+ def linux?
21
+ (RbConfig::CONFIG['host_os'] =~ /linux/) ? true : false
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,5 @@
1
+ module Mixin
2
+ module Platform
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,32 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'mixin/platform/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "mixin-platform"
8
+ spec.version = Mixin::Platform::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{A mixin for querying the platform running Ruby}
13
+ spec.homepage = "https://github.com/RiotGames/mixin-platform"
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.1"
21
+
22
+ spec.add_development_dependency "mixin-ruby_engine"
23
+ spec.add_development_dependency "thor", "~> 0.18.0"
24
+ spec.add_development_dependency "bundler", "~> 1.3"
25
+ spec.add_development_dependency "rake"
26
+ spec.add_development_dependency "rspec"
27
+ spec.add_development_dependency "fuubar"
28
+ spec.add_development_dependency "guard"
29
+ spec.add_development_dependency "guard-rspec"
30
+ spec.add_development_dependency "guard-spork"
31
+ spec.add_development_dependency "spork"
32
+ end
@@ -0,0 +1,79 @@
1
+ require 'spec_helper'
2
+
3
+ describe Mixin::Platform do
4
+ describe "::windows?" do
5
+ subject { described_class.windows? }
6
+
7
+ context "when rb config host_os matches mswin" do
8
+ before { RbConfig::CONFIG.stub(:[]).with('host_os').and_return('mswin') }
9
+
10
+ it "should be true" do
11
+ expect(subject).to be_true
12
+ end
13
+ end
14
+
15
+ context "when rb config host_os matches mingw" do
16
+ before { RbConfig::CONFIG.stub(:[]).with('host_os').and_return('mingw') }
17
+
18
+ it "should be true" do
19
+ expect(subject).to be_true
20
+ end
21
+ end
22
+
23
+ context "when rb config host_os matches cygwin" do
24
+ before { RbConfig::CONFIG.stub(:[]).with('host_os').and_return('cygwin') }
25
+
26
+ it "should be true" do
27
+ expect(subject).to be_true
28
+ end
29
+ end
30
+
31
+ context "when rb config host_os does not match a windows flavor" do
32
+ before { RbConfig::CONFIG.stub(:[]).with('host_os').and_return('darwin11.3.0') }
33
+
34
+ it "should be true" do
35
+ expect(subject).to be_false
36
+ end
37
+ end
38
+ end
39
+
40
+ describe "::osx?" do
41
+ subject { described_class.osx? }
42
+
43
+ context "when rb config host_os matches darwin" do
44
+ before { RbConfig::CONFIG.stub(:[]).with('host_os').and_return('darwin') }
45
+
46
+ it "should be true" do
47
+ expect(subject).to be_true
48
+ end
49
+ end
50
+
51
+ context "when rb config host_os does not match darwin" do
52
+ before { RbConfig::CONFIG.stub(:[]).with('host_os').and_return('mingw') }
53
+
54
+ it "should be true" do
55
+ expect(subject).to be_false
56
+ end
57
+ end
58
+ end
59
+
60
+ describe "::linux?" do
61
+ subject { described_class.linux? }
62
+
63
+ context "when rb config host_os matches linux" do
64
+ before { RbConfig::CONFIG.stub(:[]).with('host_os').and_return('linux') }
65
+
66
+ it "should be true" do
67
+ expect(subject).to be_true
68
+ end
69
+ end
70
+
71
+ context "when rb config host_os does not match linux" do
72
+ before { RbConfig::CONFIG.stub(:[]).with('host_os').and_return('mingw') }
73
+
74
+ it "should be true" do
75
+ expect(subject).to be_false
76
+ end
77
+ end
78
+ end
79
+ end
@@ -0,0 +1,27 @@
1
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
+
3
+ require 'rspec'
4
+ require 'mixin/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 Mixin::RubyEngine.jruby?
20
+ require 'mixin/platform'
21
+ setup_rspec
22
+ else
23
+ require 'spork'
24
+
25
+ Spork.prefork { setup_rspec }
26
+ Spork.each_run { require 'mixin/platform' }
27
+ end
metadata ADDED
@@ -0,0 +1,226 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mixin-platform
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: mixin-ruby_engine
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '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'
30
+ - !ruby/object:Gem::Dependency
31
+ name: thor
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: 0.18.0
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: 0.18.0
46
+ - !ruby/object:Gem::Dependency
47
+ name: bundler
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: '1.3'
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: '1.3'
62
+ - !ruby/object:Gem::Dependency
63
+ name: rake
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: rspec
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: fuubar
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
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-rspec
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: guard-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
+ - !ruby/object:Gem::Dependency
159
+ name: spork
160
+ requirement: !ruby/object:Gem::Requirement
161
+ none: false
162
+ requirements:
163
+ - - ! '>='
164
+ - !ruby/object:Gem::Version
165
+ version: '0'
166
+ type: :development
167
+ prerelease: false
168
+ version_requirements: !ruby/object:Gem::Requirement
169
+ none: false
170
+ requirements:
171
+ - - ! '>='
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ description: A mixin for querying the platform running Ruby
175
+ email:
176
+ - reset@riotgames.com
177
+ executables: []
178
+ extensions: []
179
+ extra_rdoc_files: []
180
+ files:
181
+ - .gitignore
182
+ - .ruby-version
183
+ - .travis.yml
184
+ - CONTRIBUTING.md
185
+ - Gemfile
186
+ - Guardfile
187
+ - LICENSE
188
+ - README.md
189
+ - Thorfile
190
+ - lib/mixin-platform.rb
191
+ - lib/mixin/platform.rb
192
+ - lib/mixin/platform/version.rb
193
+ - mixin-platform.gemspec
194
+ - spec/mixin/platform_spec.rb
195
+ - spec/spec_helper.rb
196
+ homepage: https://github.com/RiotGames/mixin-platform
197
+ licenses:
198
+ - Apache 2.0
199
+ post_install_message:
200
+ rdoc_options: []
201
+ require_paths:
202
+ - lib
203
+ required_ruby_version: !ruby/object:Gem::Requirement
204
+ none: false
205
+ requirements:
206
+ - - ! '>='
207
+ - !ruby/object:Gem::Version
208
+ version: 1.9.1
209
+ required_rubygems_version: !ruby/object:Gem::Requirement
210
+ none: false
211
+ requirements:
212
+ - - ! '>='
213
+ - !ruby/object:Gem::Version
214
+ version: '0'
215
+ segments:
216
+ - 0
217
+ hash: -532804316912547462
218
+ requirements: []
219
+ rubyforge_project:
220
+ rubygems_version: 1.8.23
221
+ signing_key:
222
+ specification_version: 3
223
+ summary: A mixin for querying the platform running Ruby
224
+ test_files:
225
+ - spec/mixin/platform_spec.rb
226
+ - spec/spec_helper.rb