defaultopen 1.0.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.
- checksums.yaml +7 -0
- data/lib/defaultopen.rb +30 -0
- metadata +44 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 81d3574a80f10bb73582f859bcd86307ef8b4c92
|
4
|
+
data.tar.gz: 7a0104760586196afb702b40ad0b43fd654ca672
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 90e1ad11d568036f120839a184e534c0fd74b4cb5e90a528752c49754dc6c2046e6adb3508bc0693648c228cea927e730ddfa7d3e2ece660019c1b0dff6d6432
|
7
|
+
data.tar.gz: 4821558105e5a3e63bf311b6bf7c7da9ea75913832a9a7199e18224b15ebd8c81fc797bd1cf4b24be0dc1350c5e6cbbf2df988dccb3c845105a1f8a5f389b7ab
|
data/lib/defaultopen.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
module DefaultOpen
|
2
|
+
|
3
|
+
def DefaultOpen.open(filename)
|
4
|
+
|
5
|
+
if (/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) != nil then
|
6
|
+
# windows
|
7
|
+
return system "start #{filename}"
|
8
|
+
elsif (/darwin/ =~ RUBY_PLATFORM) != nil
|
9
|
+
# OS X
|
10
|
+
return system "open #{filename}"
|
11
|
+
else
|
12
|
+
# else, we assume Linux/Unix.
|
13
|
+
|
14
|
+
if system("xdg-open #{filename}") != nil then
|
15
|
+
return true
|
16
|
+
end
|
17
|
+
|
18
|
+
if system("gnome-open #{filename}") != nil then
|
19
|
+
return true
|
20
|
+
end
|
21
|
+
|
22
|
+
if system("kfmclient exec #{filename}") != nil then
|
23
|
+
return true
|
24
|
+
end
|
25
|
+
|
26
|
+
return false
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
metadata
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: defaultopen
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Eric Arnebäck
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-05-24 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Provides a cross-platform way of opening a file in its default application
|
14
|
+
email: arnebackeric@gmail.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/defaultopen.rb
|
20
|
+
homepage: http://rubygems.org/gems/defaultopen
|
21
|
+
licenses:
|
22
|
+
- MIT
|
23
|
+
metadata: {}
|
24
|
+
post_install_message:
|
25
|
+
rdoc_options: []
|
26
|
+
require_paths:
|
27
|
+
- lib
|
28
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
34
|
+
requirements:
|
35
|
+
- - ">="
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
requirements: []
|
39
|
+
rubyforge_project:
|
40
|
+
rubygems_version: 2.4.5
|
41
|
+
signing_key:
|
42
|
+
specification_version: 4
|
43
|
+
summary: Cross-platform file opener
|
44
|
+
test_files: []
|