which_osx 1.0.5 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/version.rb +1 -1
- data/lib/which_osx.rb +8 -5
- data/spec/which_osx_spec.rb +9 -2
- metadata +3 -3
data/lib/version.rb
CHANGED
data/lib/which_osx.rb
CHANGED
@@ -1,10 +1,7 @@
|
|
1
1
|
# A simple tool to determine the current version of Mac OS X.
|
2
2
|
|
3
3
|
# Regex for "##.#.#"
|
4
|
-
output = `sw_vers`.scan(/\d\d\.\d\.\d/).
|
5
|
-
|
6
|
-
# Take out some weird bits
|
7
|
-
output.delete! "[]\""
|
4
|
+
output = `sw_vers`.scan(/\d\d\.\d\.\d/).first
|
8
5
|
VERSION = output
|
9
6
|
|
10
7
|
class WhichOSX
|
@@ -20,7 +17,6 @@ class WhichOSX
|
|
20
17
|
|
21
18
|
rescue Errno::ENOENT
|
22
19
|
puts "It looks like you aren't using Mac OS X. Sorry!"
|
23
|
-
|
24
20
|
end
|
25
21
|
|
26
22
|
# Get the full name including version.
|
@@ -49,6 +45,8 @@ class WhichOSX
|
|
49
45
|
short_name = "Lion"
|
50
46
|
when major_version == "10.8"
|
51
47
|
short_name = "Mountain Lion"
|
48
|
+
when major_version == "10.9"
|
49
|
+
short_name = "Mavericks"
|
52
50
|
end
|
53
51
|
|
54
52
|
return short_name
|
@@ -65,6 +63,11 @@ class WhichOSX
|
|
65
63
|
end
|
66
64
|
end
|
67
65
|
|
66
|
+
# Checks if the operating system is currently running Mavericks.
|
67
|
+
def self.is_mavericks
|
68
|
+
self.is("Mavericks")
|
69
|
+
end
|
70
|
+
|
68
71
|
# Checks if the operating system is currently running Mountain Lion.
|
69
72
|
|
70
73
|
def self.is_mountain_lion
|
data/spec/which_osx_spec.rb
CHANGED
@@ -3,6 +3,12 @@
|
|
3
3
|
|
4
4
|
require 'which_osx'
|
5
5
|
|
6
|
+
describe WhichOSX do
|
7
|
+
|
8
|
+
before do
|
9
|
+
stub_const("WhichOSX::VERSION", "10.7.2")
|
10
|
+
end
|
11
|
+
|
6
12
|
describe "version" do
|
7
13
|
it "should issue a command that returns a string" do
|
8
14
|
WhichOSX.version.class.should === "String"
|
@@ -30,8 +36,9 @@ require 'which_osx'
|
|
30
36
|
end
|
31
37
|
|
32
38
|
describe "is... checks" do
|
33
|
-
it "should return true if the OS is
|
34
|
-
WhichOSX.
|
39
|
+
it "should return true if the OS is Lion" do
|
40
|
+
WhichOSX.is_lion.should be_true
|
35
41
|
end
|
36
42
|
end
|
37
43
|
|
44
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: which_osx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-06-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -112,7 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
112
112
|
version: '0'
|
113
113
|
requirements: []
|
114
114
|
rubyforge_project:
|
115
|
-
rubygems_version: 1.8.
|
115
|
+
rubygems_version: 1.8.25
|
116
116
|
signing_key:
|
117
117
|
specification_version: 3
|
118
118
|
summary: A simple ruby program for returning the version number of the current Mac
|