os 0.9.2 → 0.9.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (8) hide show
  1. data/Gemfile +1 -1
  2. data/README.rdoc +3 -0
  3. data/Rakefile +1 -1
  4. data/VERSION +1 -1
  5. data/lib/os.rb +12 -0
  6. data/os.gemspec +4 -16
  7. data/spec/os_spec.rb +10 -0
  8. metadata +12 -72
data/Gemfile CHANGED
@@ -1,3 +1,3 @@
1
1
  source "http://rubygems.org"
2
2
 
3
- gemspec
3
+ gem 'rspec', ">= 2"
@@ -43,6 +43,9 @@ The OS gem allows for some easy telling if you're on windows or not.
43
43
  >> OS.cpu_count
44
44
  => 2 # number of cores
45
45
 
46
+ >> OS.open_file_command
47
+ => "start" # or open on mac, or xdg-open on linux (all designed to open a file)
48
+
46
49
  If there are any other features you'd like, let me know, I'll do what I can to add them :)
47
50
 
48
51
  http://github.com/rdp/os for feedback et al
data/Rakefile CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'rubygems' if RUBY_VERSION < '1.9.0'
2
2
  require 'rake'
3
3
 
4
- # Don't forget to run rake gemspec with each release!
4
+ # Don't forget to run rake gemspec with each release! ... I think...
5
5
 
6
6
  begin
7
7
  require 'jeweler'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.9.2
1
+ 0.9.3
data/lib/os.rb CHANGED
@@ -237,6 +237,18 @@ class OS
237
237
  end
238
238
  end
239
239
  end
240
+
241
+ def self.open_file_command
242
+ if OS.doze? || OS.cygwin?
243
+ "start"
244
+ elsif OS.mac?
245
+ "open"
246
+ else
247
+ # linux...what about cygwin?
248
+ "xdg-open"
249
+ end
250
+
251
+ end
240
252
 
241
253
  class << self
242
254
  alias :doze? :windows? # a joke name but I use it and like it :P
data/os.gemspec CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = [%q{rdp}, %q{David McCullars}]
12
- s.date = %q{2011-06-08}
12
+ s.date = %q{2011-06-09}
13
13
  s.description = %q{The OS gem allows for some useful and easy functions, like OS.windows? (=> true or false) OS.bits ( => 32 or 64) etc"}
14
14
  s.email = %q{rogerpack2005@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -40,26 +40,14 @@ Gem::Specification.new do |s|
40
40
  s.specification_version = 3
41
41
 
42
42
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
43
- s.add_development_dependency(%q<jeweler>, [">= 0"])
44
- s.add_development_dependency(%q<rspec>, [">= 2.0"])
45
- s.add_development_dependency(%q<rspec>, [">= 2.0"])
46
- s.add_development_dependency(%q<rspec>, [">= 2.0"])
47
- s.add_development_dependency(%q<rspec>, [">= 2.0"])
43
+ s.add_runtime_dependency(%q<rspec>, [">= 2"])
48
44
  s.add_development_dependency(%q<rspec>, [">= 2.0"])
49
45
  else
50
- s.add_dependency(%q<jeweler>, [">= 0"])
51
- s.add_dependency(%q<rspec>, [">= 2.0"])
52
- s.add_dependency(%q<rspec>, [">= 2.0"])
53
- s.add_dependency(%q<rspec>, [">= 2.0"])
54
- s.add_dependency(%q<rspec>, [">= 2.0"])
46
+ s.add_dependency(%q<rspec>, [">= 2"])
55
47
  s.add_dependency(%q<rspec>, [">= 2.0"])
56
48
  end
57
49
  else
58
- s.add_dependency(%q<jeweler>, [">= 0"])
59
- s.add_dependency(%q<rspec>, [">= 2.0"])
60
- s.add_dependency(%q<rspec>, [">= 2.0"])
61
- s.add_dependency(%q<rspec>, [">= 2.0"])
62
- s.add_dependency(%q<rspec>, [">= 2.0"])
50
+ s.add_dependency(%q<rspec>, [">= 2"])
63
51
  s.add_dependency(%q<rspec>, [">= 2.0"])
64
52
  end
65
53
  end
@@ -132,6 +132,16 @@ describe "OS" do
132
132
  assert OS.cpu_count >= 1
133
133
  end
134
134
  end
135
+
136
+ it "should have a start/open command helper" do
137
+ if OS.doze?
138
+ assert OS.open_file_command == "start"
139
+ elsif OS.mac?
140
+ assert OS.open_file_command == "open"
141
+ else
142
+ assert OS.open_file_command == "xdg-open"
143
+ end
144
+ end
135
145
 
136
146
  end
137
147
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: os
3
3
  version: !ruby/object:Gem::Version
4
- hash: 63
4
+ hash: 61
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
- - 2
10
- version: 0.9.2
9
+ - 3
10
+ version: 0.9.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - rdp
@@ -16,86 +16,27 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-06-08 00:00:00 Z
19
+ date: 2011-06-27 00:00:00 Z
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
- name: jeweler
22
+ type: :runtime
23
23
  prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- hash: 3
30
- segments:
31
- - 0
32
- version: "0"
33
- type: :development
34
- version_requirements: *id001
35
- - !ruby/object:Gem::Dependency
36
24
  name: rspec
37
- prerelease: false
38
- requirement: &id002 !ruby/object:Gem::Requirement
25
+ version_requirements: &id001 !ruby/object:Gem::Requirement
39
26
  none: false
40
27
  requirements:
41
28
  - - ">="
42
29
  - !ruby/object:Gem::Version
43
- hash: 3
30
+ hash: 7
44
31
  segments:
45
32
  - 2
46
- - 0
47
- version: "2.0"
48
- type: :development
49
- version_requirements: *id002
33
+ version: "2"
34
+ requirement: *id001
50
35
  - !ruby/object:Gem::Dependency
51
- name: rspec
52
- prerelease: false
53
- requirement: &id003 !ruby/object:Gem::Requirement
54
- none: false
55
- requirements:
56
- - - ">="
57
- - !ruby/object:Gem::Version
58
- hash: 3
59
- segments:
60
- - 2
61
- - 0
62
- version: "2.0"
63
36
  type: :development
64
- version_requirements: *id003
65
- - !ruby/object:Gem::Dependency
66
- name: rspec
67
37
  prerelease: false
68
- requirement: &id004 !ruby/object:Gem::Requirement
69
- none: false
70
- requirements:
71
- - - ">="
72
- - !ruby/object:Gem::Version
73
- hash: 3
74
- segments:
75
- - 2
76
- - 0
77
- version: "2.0"
78
- type: :development
79
- version_requirements: *id004
80
- - !ruby/object:Gem::Dependency
81
- name: rspec
82
- prerelease: false
83
- requirement: &id005 !ruby/object:Gem::Requirement
84
- none: false
85
- requirements:
86
- - - ">="
87
- - !ruby/object:Gem::Version
88
- hash: 3
89
- segments:
90
- - 2
91
- - 0
92
- version: "2.0"
93
- type: :development
94
- version_requirements: *id005
95
- - !ruby/object:Gem::Dependency
96
38
  name: rspec
97
- prerelease: false
98
- requirement: &id006 !ruby/object:Gem::Requirement
39
+ version_requirements: &id002 !ruby/object:Gem::Requirement
99
40
  none: false
100
41
  requirements:
101
42
  - - ">="
@@ -105,8 +46,7 @@ dependencies:
105
46
  - 2
106
47
  - 0
107
48
  version: "2.0"
108
- type: :development
109
- version_requirements: *id006
49
+ requirement: *id002
110
50
  description: The OS gem allows for some useful and easy functions, like OS.windows? (=> true or false) OS.bits ( => 32 or 64) etc"
111
51
  email: rogerpack2005@gmail.com
112
52
  executables: []
@@ -159,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
159
99
  requirements: []
160
100
 
161
101
  rubyforge_project:
162
- rubygems_version: 1.8.2
102
+ rubygems_version: 1.8.5
163
103
  signing_key:
164
104
  specification_version: 3
165
105
  summary: Simple and easy way to know if you're on windows or not (reliably), as well as how many bits the OS is, etc.