launchy 2.3.0 → 2.4.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 +9 -9
- data/CONTRIBUTING.md +2 -0
- data/HISTORY.md +28 -20
- data/README.md +2 -2
- data/Rakefile +2 -2
- data/lib/launchy.rb +19 -4
- data/lib/launchy/applications/browser.rb +17 -14
- data/lib/launchy/cli.rb +1 -1
- data/lib/launchy/descendant_tracker.rb +1 -1
- data/lib/launchy/detect/nix_desktop_environment.rb +19 -2
- data/lib/launchy/detect/runner.rb +14 -1
- data/lib/launchy/version.rb +1 -1
- data/spec/application_spec.rb +2 -2
- data/spec/applications/browser_spec.rb +3 -2
- data/spec/detect/nix_desktop_environment_spec.rb +4 -11
- data/spec/launchy_spec.rb +32 -5
- data/tasks/default.rake +7 -6
- data/tasks/this.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NWUzNmEyNDA5NGVkMjUyYjU2MDVmMzQxY2FkMDJhZjQxNzMwYmE4OA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
7
|
-
|
6
|
+
MmUxYmRlODUyNDhhZmRlY2U2MWY1NTc5ZThlMDdkYTkwYjYzYTE3MQ==
|
7
|
+
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
OTlkMzhjYThhMjYzMGNkZTVkMDNlZmU0MDU0N2RkNDc0NzlmNzMwNDEwMzY4
|
10
|
+
NTg3MDc0ZDEyMDRlMTZjYzcxZjkyNTY4N2MwZmNkZDhiZWVkNjA0Zjk1YzUw
|
11
|
+
MjNmZGM1ZjAxM2Y5ODg2NGE0NTUwMDk3ODg2ZjAzODBkOWJjN2M=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NDQ5YWMzNTRhYmJjZTNmNTU2OGNjN2UyMzBjMTcxMTllNmUwMGY0ZDRjZTA3
|
14
|
+
NTEzM2NiZjJmMGZlZTYwMjZlYmIzNjRiMDRiMmI5MTMzZmI0MDZiYjIxNTQ1
|
15
|
+
OTMwMmRlMTA1MDRiZjczOGQyMTMzNjIxYjNiYjQ4NzZlMzNlMzc=
|
data/CONTRIBUTING.md
CHANGED
@@ -43,6 +43,8 @@ easiest way to contribute.
|
|
43
43
|
* [Mariusz Pietrzyk](https://github.com/wijet)
|
44
44
|
* [Bogdan Gusiev](https://github.com/bogdan)
|
45
45
|
* [Miquel Rodríguez Telep](https://github.com/mrtorrent)
|
46
|
+
* [Chris Schmich](https://github.com/schmich)
|
47
|
+
* [Gioele Barabucci](https://github.com/gioele)
|
46
48
|
|
47
49
|
[GitHub Account]: https://github.com/signup/free "GitHub Signup"
|
48
50
|
[GitHub Issues]: https://github.com/copiousfreetime/launchy/issues "Launchy Issues"
|
data/HISTORY.md
CHANGED
@@ -1,44 +1,52 @@
|
|
1
1
|
# Launchy Changelog
|
2
2
|
|
3
|
+
## Version 2.4.0 - 2013-11-12
|
4
|
+
* Support `Launchy.open( url, :debug => true )` - <http://github.com/copiousfreetime/launchy/issues/63> - schmich
|
5
|
+
* Fix inconsistencies in `debug?` and `dry_run?` methods - <http://github.com/copiousfreetime/launchy/issues/63> - schmich
|
6
|
+
* Fix detection of missing *nix desktops - <http://github.com/copiousfreetime/launchy/issues/70>
|
7
|
+
* Fix running tests in bare Linux environment - <http://github.com/copiousfreetime/launchy/issues/67> - gioele
|
8
|
+
* Fix mistaking windows drive as uri schema - <http://github.com/copiousfreetime/launchy/issues/65>
|
9
|
+
* Attempt fixing windows `start` command oddities, again - <http://github.com/copiousfreetime/launchy/issues/62>
|
10
|
+
|
3
11
|
## Version 2.3.0 - 2013-04-11
|
4
12
|
|
5
13
|
* Add the option to call a block on error instead of raising an exception
|
6
14
|
|
7
15
|
## Version 2.2.0 - 2013-02-06
|
8
16
|
|
9
|
-
* Change XFCE detection to not depend on grep
|
10
|
-
* Suppress forked process output
|
11
|
-
* Display help/usage if no url is given
|
12
|
-
* Detect the fluxbox environment
|
13
|
-
* Automatically detect `http` url's if they are missing the `http://`
|
17
|
+
* Change XFCE detection to not depend on grep <http://github.com/copiousfreetime/launchy/issues/52> - bogdan
|
18
|
+
* Suppress forked process output <http://github.com/copiousfreetime/launchy/issues/51>
|
19
|
+
* Display help/usage if no url is given <http://github.com/copiousfreetime/launchy/issues/54>
|
20
|
+
* Detect the fluxbox environment <http://github.com/copiousfreetime/launchy/issues/53>
|
21
|
+
* Automatically detect `http` url's if they are missing the `http://` <http://github.com/copiousfreetime/launchy/issues/55>
|
14
22
|
* Update to latest project management rake tasks
|
15
23
|
|
16
24
|
## Version 2.1.2 - 2012-08-06
|
17
25
|
|
18
|
-
* Fix where HostOS would fail to convert to string on JRuby in 1.9 mode
|
26
|
+
* Fix where HostOS would fail to convert to string on JRuby in 1.9 mode <http://github.com/copiousfreetime/launchy/issues/45>
|
19
27
|
|
20
28
|
## Version 2.1.1 - 2012-07-28
|
21
29
|
|
22
|
-
* Update addressable runtime dependency
|
30
|
+
* Update addressable runtime dependency <http://github.com/copiousfreetime/launchy/issues/47>
|
23
31
|
* Bring minitest and ffi development dependencies up to date
|
24
32
|
|
25
33
|
## Version 2.1.0 - 2012-03-18
|
26
34
|
|
27
|
-
* Fix raising exception when no browser program found
|
28
|
-
* Add LAUNCHY_DRY_RUN environment variable (
|
35
|
+
* Fix raising exception when no browser program found <http://github.com/copiousfreetime/launchy/issues/42>
|
36
|
+
* Add `LAUNCHY_DRY_RUN` environment variable (Mariusz Pietrzyk / wijet)
|
29
37
|
* Update dependencies
|
30
38
|
|
31
39
|
## Version 2.0.5 - 2011-07-24
|
32
40
|
|
33
|
-
* Fix the case where
|
41
|
+
* Fix the case where `$BROWSER` is set and no *nix desktop was found <http://github.com/copiousfreetime/launchy/issues/33>
|
34
42
|
|
35
43
|
## Version 2.0.4 - 2011-07-23
|
36
44
|
|
37
|
-
* Fix windows
|
38
|
-
* Add capability to open local files with no file: scheme present
|
39
|
-
* Added
|
40
|
-
* Make better decisions on when to do shell escaping
|
41
|
-
* Switch to Addressable::URI so UTF-8 urls may be parsed.
|
45
|
+
* Fix windows `start` commandline <http://github.com/copiousfreetime/launchy/issues/5>
|
46
|
+
* Add capability to open local files with no file: scheme present <http://github.com/copiousfreetime/launchy/issues/29>
|
47
|
+
* Added `rake how_to_contribute` task <http://github.com/copiousfreetime/launchy/issues/30>
|
48
|
+
* Make better decisions on when to do shell escaping <http://github.com/copiousfreetime/launchy/issues/31>
|
49
|
+
* Switch to Addressable::URI so UTF-8 urls may be parsed. <http://github.com/copiousfreetime/launchy/issues/32>
|
42
50
|
|
43
51
|
## Version 2.0.3 - 2011-07-17
|
44
52
|
|
@@ -101,7 +109,7 @@
|
|
101
109
|
## Version 0.3.0 - 2007-08-30
|
102
110
|
|
103
111
|
* reorganize the code structure, removing Spawnable namespace
|
104
|
-
* removed
|
112
|
+
* removed `do_magic` method, changed it to `open`
|
105
113
|
* added override environment variable LAUNCHY_HOST_OS for testing
|
106
114
|
* fix broken cygwin support [Bug #13472]
|
107
115
|
|
@@ -112,15 +120,15 @@
|
|
112
120
|
## Version 0.2.0 - 2007-08-11
|
113
121
|
|
114
122
|
* rework browser finding
|
115
|
-
* manual override with LAUNCHY_BROWSER environment variable
|
123
|
+
* manual override with `LAUNCHY_BROWSER` environment variable
|
116
124
|
* on *nix use desktop application launcher with fallback to list of browsers
|
117
125
|
* On windows, switch to 'start' command and remove dependency on win32-process
|
118
126
|
* removed win32 gem
|
119
|
-
* Add debug output by setting LAUNCHY_DEBUG environment variable to
|
127
|
+
* Add debug output by setting `LAUNCHY_DEBUG` environment variable to `true`
|
120
128
|
|
121
129
|
## Version 0.1.2 - 2007-08-11
|
122
130
|
|
123
|
-
* forked child exits without calling at_exit handlers
|
131
|
+
* forked child exits without calling `at_exit` handlers
|
124
132
|
|
125
133
|
## Version 0.1.1
|
126
134
|
|
@@ -129,7 +137,7 @@
|
|
129
137
|
## Version 0.1.0
|
130
138
|
|
131
139
|
* Initial public release
|
132
|
-
* switched to using fork to spawn process and require 'win32/process' if on windows
|
140
|
+
* switched to using fork to spawn process and `require 'win32/process'` if on windows
|
133
141
|
|
134
142
|
## Version 0.0.2
|
135
143
|
|
data/README.md
CHANGED
@@ -60,7 +60,7 @@ exception that was raised.
|
|
60
60
|
|
61
61
|
## UPGRADING from versions before 2.0.0
|
62
62
|
|
63
|
-
The previously published
|
63
|
+
The previously published version of Launchy before the 2.0.0 series was 0.4.0.
|
64
64
|
There have been so many changes, and a mistaken tag at 1.0.0, that I have
|
65
65
|
decided to bump all the way to 2.x.y.
|
66
66
|
|
@@ -90,7 +90,7 @@ in the github gem if it was updated to use 2.0.x but not use the supported API.
|
|
90
90
|
WARNING:
|
91
91
|
WARNING: If this is not the case, please file a bug. Please file a bug at https://github.com/copiousfreetime/launchy/issues/new
|
92
92
|
|
93
|
-
These deprecation notices will go away with version 3.0 and the only
|
93
|
+
These deprecation notices will go away with version 3.0 and the only available
|
94
94
|
API will be the documented one.
|
95
95
|
|
96
96
|
## ISC LICENSE
|
data/Rakefile
CHANGED
@@ -9,8 +9,8 @@ This.homepage = "http://github.com/copiousfreetime/#{ This.name }"
|
|
9
9
|
This.ruby_gemspec do |spec|
|
10
10
|
spec.add_dependency( 'addressable', '~> 2.3')
|
11
11
|
|
12
|
-
spec.add_development_dependency( 'rake' , '~> 10.
|
13
|
-
spec.add_development_dependency( 'minitest' , '~>
|
12
|
+
spec.add_development_dependency( 'rake' , '~> 10.1')
|
13
|
+
spec.add_development_dependency( 'minitest' , '~> 5.0' )
|
14
14
|
spec.add_development_dependency( 'rdoc' , '~> 3.12' )
|
15
15
|
end
|
16
16
|
|
data/lib/launchy.rb
CHANGED
@@ -76,13 +76,13 @@ module Launchy
|
|
76
76
|
end
|
77
77
|
|
78
78
|
def debug=( d )
|
79
|
-
@debug = (d
|
79
|
+
@debug = to_bool( d )
|
80
80
|
end
|
81
81
|
|
82
82
|
# we may do logging before a call to 'open', hence the need to check
|
83
83
|
# LAUNCHY_DEBUG here
|
84
84
|
def debug?
|
85
|
-
@debug || (ENV['LAUNCHY_DEBUG']
|
85
|
+
@debug || to_bool( ENV['LAUNCHY_DEBUG'] )
|
86
86
|
end
|
87
87
|
|
88
88
|
def application=( app )
|
@@ -110,11 +110,11 @@ module Launchy
|
|
110
110
|
end
|
111
111
|
|
112
112
|
def dry_run=( dry_run )
|
113
|
-
@dry_run = dry_run
|
113
|
+
@dry_run = to_bool( dry_run )
|
114
114
|
end
|
115
115
|
|
116
116
|
def dry_run?
|
117
|
-
@dry_run
|
117
|
+
@dry_run || to_bool( ENV['LAUNCHY_DRY_RUN'] )
|
118
118
|
end
|
119
119
|
|
120
120
|
def bug_report_message
|
@@ -124,7 +124,22 @@ module Launchy
|
|
124
124
|
def log(msg)
|
125
125
|
$stderr.puts "LAUNCHY_DEBUG: #{msg}" if Launchy.debug?
|
126
126
|
end
|
127
|
+
|
128
|
+
private
|
129
|
+
def to_bool( arg )
|
130
|
+
if arg.is_a? String
|
131
|
+
arg == 'true'
|
132
|
+
elsif arg.is_a? TrueClass
|
133
|
+
true
|
134
|
+
else
|
135
|
+
# All other values mapped to false.
|
136
|
+
false
|
137
|
+
end
|
138
|
+
end
|
127
139
|
end
|
140
|
+
|
141
|
+
# Iniitialize the global options to sane defaults during parse time.
|
142
|
+
Launchy.reset_global_options
|
128
143
|
end
|
129
144
|
|
130
145
|
require 'launchy/version'
|
@@ -9,30 +9,28 @@ class Launchy::Application
|
|
9
9
|
|
10
10
|
def self.handles?( uri )
|
11
11
|
return true if schemes.include?( uri.scheme )
|
12
|
-
return true if File.exist?( uri.path )
|
12
|
+
return true if File.exist?( uri.path )
|
13
13
|
end
|
14
14
|
|
15
15
|
def windows_app_list
|
16
|
-
[ 'start /b' ]
|
16
|
+
[ 'start "launchy" /b' ]
|
17
17
|
end
|
18
18
|
|
19
19
|
def cygwin_app_list
|
20
|
-
[ 'cmd /C start /b' ]
|
20
|
+
[ 'cmd /C start "launchy" /b' ]
|
21
21
|
end
|
22
22
|
|
23
|
+
# hardcode this to open?
|
23
24
|
def darwin_app_list
|
24
25
|
[ find_executable( "open" ) ]
|
25
26
|
end
|
26
27
|
|
27
28
|
def nix_app_list
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
app_list.flatten!
|
34
|
-
app_list.delete_if { |b| b.nil? || (b.strip.size == 0) }
|
35
|
-
app_list.collect { |bin| find_executable( bin ) }.find_all { |x| not x.nil? }
|
29
|
+
nix_de = Launchy::Detect::NixDesktopEnvironment.detect
|
30
|
+
list = nix_de.browsers
|
31
|
+
|
32
|
+
list.delete_if { |b| b.nil? || (b.strip.size == 0) }
|
33
|
+
list.collect { |bin| find_executable( bin ) }.find_all { |x| not x.nil? }
|
36
34
|
end
|
37
35
|
|
38
36
|
# use a call back mechanism to get the right app_list that is decided by the
|
@@ -51,10 +49,15 @@ class Launchy::Application
|
|
51
49
|
|
52
50
|
# Get the full commandline of what we are going to add the uri to
|
53
51
|
def browser_cmdline
|
54
|
-
|
55
|
-
|
56
|
-
|
52
|
+
browser_env.each do |p|
|
53
|
+
Launchy.log "#{self.class.name} : possibility from BROWSER environment variable : #{p}"
|
54
|
+
end
|
55
|
+
app_list.each do |p|
|
56
|
+
Launchy.log "#{self.class.name} : possibility from app_list : #{p}"
|
57
57
|
end
|
58
|
+
|
59
|
+
possibilities = (browser_env + app_list).flatten
|
60
|
+
|
58
61
|
if browser = possibilities.shift then
|
59
62
|
Launchy.log "#{self.class.name} : Using browser value '#{browser}'"
|
60
63
|
return browser
|
data/lib/launchy/cli.rb
CHANGED
@@ -22,6 +22,10 @@ module Launchy::Detect
|
|
22
22
|
%w[ firefox seamonkey opera mozilla netscape galeon ]
|
23
23
|
end
|
24
24
|
|
25
|
+
def self.browsers
|
26
|
+
[ browser, fallback_browsers ].flatten
|
27
|
+
end
|
28
|
+
|
25
29
|
#---------------------------------------
|
26
30
|
# The list of known desktop environments
|
27
31
|
#---------------------------------------
|
@@ -60,15 +64,28 @@ module Launchy::Detect
|
|
60
64
|
end
|
61
65
|
end
|
62
66
|
|
63
|
-
|
67
|
+
# Fall back environment as the last case
|
68
|
+
class Xdg < NixDesktopEnvironment
|
64
69
|
def self.is_current_desktop_environment?
|
65
|
-
|
70
|
+
Launchy::Application.find_executable( browser )
|
66
71
|
end
|
67
72
|
|
68
73
|
def self.browser
|
69
74
|
'xdg-open'
|
70
75
|
end
|
71
76
|
end
|
77
|
+
|
78
|
+
# The one that is found when all else fails. And this must be declared last
|
79
|
+
class NotFound < NixDesktopEnvironment
|
80
|
+
def self.is_current_desktop_environment?
|
81
|
+
true
|
82
|
+
end
|
83
|
+
|
84
|
+
def self.browser
|
85
|
+
[]
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
72
89
|
end
|
73
90
|
end
|
74
91
|
|
@@ -81,8 +81,21 @@ module Launchy::Detect
|
|
81
81
|
|
82
82
|
# escape the reserved shell characters in windows command shell
|
83
83
|
# http://technet.microsoft.com/en-us/library/cc723564.aspx
|
84
|
+
#
|
85
|
+
# Also make sure that the item after 'start' is guaranteed to be quoted.
|
86
|
+
# https://github.com/copiousfreetime/launchy/issues/62
|
84
87
|
def shell_commands( cmd, *args )
|
85
|
-
|
88
|
+
parts = cmd.shellsplit
|
89
|
+
|
90
|
+
if start_idx = parts.index('start') then
|
91
|
+
title_idx = start_idx + 1
|
92
|
+
title = parts[title_idx]
|
93
|
+
title = title.sub(/^/,'"') unless title[0] == '"'
|
94
|
+
title = title.sub(/$/,'"') unless title[-1] == '"'
|
95
|
+
parts[title_idx] = title
|
96
|
+
end
|
97
|
+
|
98
|
+
cmdline = [ parts ]
|
86
99
|
cmdline << args.flatten.collect { |a| a.to_s.gsub(/([&|()<>^])/, "^\\1") }
|
87
100
|
return commandline_normalize( cmdline )
|
88
101
|
end
|
data/lib/launchy/version.rb
CHANGED
data/spec/application_spec.rb
CHANGED
@@ -30,8 +30,8 @@ describe Launchy::Application do
|
|
30
30
|
lambda { Launchy::Application.handling( uri ) }.must_raise( Launchy::ApplicationNotFoundError )
|
31
31
|
end
|
32
32
|
|
33
|
-
it "can find open or curl" do
|
34
|
-
found = %w[ open curl ].any? do |app|
|
33
|
+
it "can find open or curl or xdg-open" do
|
34
|
+
found = %w[ open curl xdg-open ].any? do |app|
|
35
35
|
Launchy::Application.find_executable( app )
|
36
36
|
end
|
37
37
|
found.must_equal true
|
@@ -10,11 +10,12 @@ describe Launchy::Application::Browser do
|
|
10
10
|
after do
|
11
11
|
Launchy.reset_global_options
|
12
12
|
ENV.delete( 'KDE_FULL_SESSION' )
|
13
|
+
ENV.delete( 'BROWSER' )
|
13
14
|
end
|
14
15
|
|
15
|
-
{ 'windows' => 'start /b' ,
|
16
|
+
{ 'windows' => 'start "launchy" /b' ,
|
16
17
|
'darwin' => '/usr/bin/open',
|
17
|
-
'cygwin' => 'cmd /C start /b',
|
18
|
+
'cygwin' => 'cmd /C start "launchy" /b',
|
18
19
|
|
19
20
|
# when running these tests on a linux box, this test will fail
|
20
21
|
'linux' => nil }.each do |host_os, cmdline|
|
@@ -22,24 +22,17 @@ describe Launchy::Detect::NixDesktopEnvironment do
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
it "detects the fluxbox desktop environment" do
|
26
|
-
ENV['DESKTOP_SESSION'] = 'fluxbox'
|
27
|
-
fluxbox_env = Launchy::Detect::NixDesktopEnvironment.detect
|
28
|
-
fluxbox_env.must_equal( Launchy::Detect::NixDesktopEnvironment::Fluxbox )
|
29
|
-
fluxbox_env.browser.must_equal( Launchy::Detect::NixDesktopEnvironment::Fluxbox.browser )
|
30
|
-
ENV.delete( 'DESKTOP_SESSION' )
|
31
|
-
end
|
32
|
-
|
33
25
|
it "returns false for XFCE if xprop is not found" do
|
34
26
|
Launchy.host_os = "linux"
|
35
27
|
Launchy::Detect::NixDesktopEnvironment::Xfce.is_current_desktop_environment?.must_equal( false )
|
36
28
|
end
|
37
29
|
|
38
|
-
it "returns
|
30
|
+
it "returns NotFound if it cannot determine the *nix desktop environment" do
|
39
31
|
Launchy.host_os = "linux"
|
40
32
|
ENV.delete( "KDE_FULL_SESSION" )
|
41
33
|
ENV.delete( "GNOME_DESKTOP_SESSION_ID" )
|
42
|
-
Launchy::Detect::NixDesktopEnvironment.detect
|
34
|
+
not_found = Launchy::Detect::NixDesktopEnvironment.detect
|
35
|
+
not_found.must_equal( Launchy::Detect::NixDesktopEnvironment::NotFound )
|
36
|
+
not_found.browser.must_equal( [] )
|
43
37
|
end
|
44
|
-
|
45
38
|
end
|
data/spec/launchy_spec.rb
CHANGED
@@ -6,12 +6,15 @@ describe Launchy do
|
|
6
6
|
Launchy.reset_global_options
|
7
7
|
@stderr = $stderr
|
8
8
|
$stderr = StringIO.new
|
9
|
+
@stdout = $stdout
|
10
|
+
$stdout = StringIO.new
|
9
11
|
@invalid_url = 'blah://example.com/invalid'
|
10
12
|
end
|
11
13
|
|
12
14
|
after do
|
13
15
|
Launchy.reset_global_options
|
14
16
|
$stderr = @stderr
|
17
|
+
$stdout = @stdout
|
15
18
|
end
|
16
19
|
|
17
20
|
it "logs to stderr when LAUNCHY_DEBUG environment variable is set" do
|
@@ -24,16 +27,32 @@ describe Launchy do
|
|
24
27
|
ENV["LAUNCHY_DEBUG"] = nil
|
25
28
|
end
|
26
29
|
|
27
|
-
it "sets the global option :dry_run to
|
30
|
+
it "sets the global option :dry_run to true if LAUNCHY_DRY_RUN environment variable is 'true'" do
|
28
31
|
ENV['LAUNCHY_DRY_RUN'] = 'true'
|
29
32
|
Launchy.extract_global_options({})
|
30
|
-
Launchy.dry_run?.must_equal
|
33
|
+
Launchy.dry_run?.must_equal true
|
31
34
|
ENV['LAUNCHY_DRY_RUN'] = nil
|
32
35
|
end
|
33
36
|
|
37
|
+
it "sets the global option :debug to true if LAUNCHY_DEBUG environment variable is 'true'" do
|
38
|
+
ENV['LAUNCHY_DEBUG'] = 'true'
|
39
|
+
Launchy.extract_global_options({})
|
40
|
+
Launchy.debug?.must_equal true
|
41
|
+
ENV['LAUNCHY_DEBUG'] = nil
|
42
|
+
end
|
43
|
+
|
34
44
|
it "has the global option :debug" do
|
35
45
|
Launchy.extract_global_options( { :debug => 'true' } )
|
36
46
|
Launchy.debug?.must_equal true
|
47
|
+
Launchy.extract_global_options( { :debug => true } )
|
48
|
+
Launchy.debug?.must_equal true
|
49
|
+
end
|
50
|
+
|
51
|
+
it "has the global option :dry_run" do
|
52
|
+
Launchy.extract_global_options( { :dry_run => 'true' } )
|
53
|
+
Launchy.dry_run?.must_equal true
|
54
|
+
Launchy.extract_global_options( { :dry_run => true } )
|
55
|
+
Launchy.dry_run?.must_equal true
|
37
56
|
end
|
38
57
|
|
39
58
|
it "has the global option :application" do
|
@@ -55,8 +74,16 @@ describe Launchy do
|
|
55
74
|
lambda { Launchy.open( @invalid_url ) }.must_raise Launchy::ApplicationNotFoundError
|
56
75
|
end
|
57
76
|
|
58
|
-
it "
|
59
|
-
|
77
|
+
it "asssumes we open a local file if we have an exception if we have an invalid scheme and a valid path" do
|
78
|
+
uri = "blah://example.com/#{__FILE__}"
|
79
|
+
Launchy.open( uri , :dry_run => true )
|
80
|
+
$stdout.string.strip.must_equal "/usr/bin/open #{uri}"
|
81
|
+
end
|
82
|
+
|
83
|
+
it "opens a local file if we have a drive letter and a valid path on windows" do
|
84
|
+
uri = "C:#{__FILE__}"
|
85
|
+
Launchy.open( uri, :dry_run => true, :host_os => 'windows' )
|
86
|
+
$stdout.string.strip.must_equal 'cmd /c start "launchy" /b ' + uri
|
60
87
|
end
|
61
88
|
|
62
89
|
it "calls the block if instead of raising an exception if there is an error" do
|
@@ -74,7 +101,7 @@ describe Launchy do
|
|
74
101
|
lambda { Launchy.open( @invalid_url ) { raise StandardError, "KABOOM!" } }.must_raise StandardError
|
75
102
|
end
|
76
103
|
|
77
|
-
[ 'www.example.com', 'www.example.com/foo/bar' ].each do |x|
|
104
|
+
[ 'www.example.com', 'www.example.com/foo/bar', "C:#{__FILE__}" ].each do |x|
|
78
105
|
it "picks a Browser for #{x}" do
|
79
106
|
app = Launchy.app_for_uri_string( x )
|
80
107
|
app.must_equal( Launchy::Application::Browser )
|
data/tasks/default.rake
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# vim: syntax=ruby
|
2
2
|
require 'rake/clean'
|
3
|
+
require 'digest'
|
3
4
|
#------------------------------------------------------------------------------
|
4
5
|
# If you want to Develop on this project just run 'rake develop' and you'll
|
5
6
|
# have all you need to get going. If you want to use bundler for development,
|
@@ -11,7 +12,7 @@ namespace :develop do
|
|
11
12
|
# gemspec.
|
12
13
|
task :default do
|
13
14
|
require 'rubygems/dependency_installer'
|
14
|
-
installer = Gem::DependencyInstaller.new
|
15
|
+
installer = ::Gem::DependencyInstaller.new
|
15
16
|
|
16
17
|
This.set_coverage_gem
|
17
18
|
|
@@ -30,7 +31,7 @@ namespace :develop do
|
|
30
31
|
# Create a Gemfile that just references the gemspec
|
31
32
|
file 'Gemfile' => :gemspec do
|
32
33
|
File.open( "Gemfile", "w+" ) do |f|
|
33
|
-
f.puts 'source
|
34
|
+
f.puts 'source "https://rubygems.org/"'
|
34
35
|
f.puts 'gemspec'
|
35
36
|
end
|
36
37
|
end
|
@@ -53,8 +54,8 @@ begin
|
|
53
54
|
require 'rake/testtask'
|
54
55
|
Rake::TestTask.new( :test ) do |t|
|
55
56
|
t.ruby_opts = %w[ -w -rubygems ]
|
56
|
-
t.libs = %w[ lib spec ]
|
57
|
-
t.pattern = "spec
|
57
|
+
t.libs = %w[ lib spec test ]
|
58
|
+
t.pattern = "{test,spec}/**/{test_*,*_spec}.rb"
|
58
59
|
end
|
59
60
|
|
60
61
|
task :test_requirements
|
@@ -79,7 +80,7 @@ begin
|
|
79
80
|
t.rdoc_files.include( FileList['*.{rdoc,md,txt}'], FileList['ext/**/*.c'],
|
80
81
|
FileList['lib/**/*.rb'] )
|
81
82
|
end
|
82
|
-
rescue LoadError
|
83
|
+
rescue StandardError, LoadError
|
83
84
|
This.task_warning( 'rdoc' )
|
84
85
|
end
|
85
86
|
|
@@ -234,7 +235,7 @@ CLOBBER << FileList["**/*.rbc"]
|
|
234
235
|
|
235
236
|
# The standard gem packaging task, everyone has it.
|
236
237
|
require 'rubygems/package_task'
|
237
|
-
Gem::PackageTask.new( This.platform_gemspec ) do
|
238
|
+
::Gem::PackageTask.new( This.platform_gemspec ) do
|
238
239
|
# nothing
|
239
240
|
end
|
240
241
|
|
data/tasks/this.rb
CHANGED
@@ -25,7 +25,7 @@ class ThisProject
|
|
25
25
|
#
|
26
26
|
# Yields self
|
27
27
|
def initialize(&block)
|
28
|
-
@exclude_from_manifest = %r/\.(git|DS_Store)|^(doc|coverage|pkg|tmp
|
28
|
+
@exclude_from_manifest = %r/\.(git|DS_Store)|^(doc|coverage|pkg|tmp|Gemfile(\.lock)?)|^[^\/]+\.gemspec|\.(swp|jar|bundle|so|rvmrc)$|~$/
|
29
29
|
@gemspecs = Hash.new
|
30
30
|
yield self if block_given?
|
31
31
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: launchy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Hinegardner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-11-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -30,28 +30,28 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 10.
|
33
|
+
version: '10.1'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 10.
|
40
|
+
version: '10.1'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: minitest
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ~>
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: '5.0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: '5.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rdoc
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -141,7 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
141
141
|
version: '0'
|
142
142
|
requirements: []
|
143
143
|
rubyforge_project:
|
144
|
-
rubygems_version: 2.
|
144
|
+
rubygems_version: 2.1.5
|
145
145
|
signing_key:
|
146
146
|
specification_version: 4
|
147
147
|
summary: Launchy is helper class for launching cross-platform applications in a fire
|