launchy 3.0.0 → 3.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/HISTORY.md +8 -1
- data/Manifest.txt +3 -16
- data/exe/launchy +5 -0
- data/launchy.gemspec +32 -0
- data/lib/launchy/application.rb +24 -21
- data/lib/launchy/applications/browser.rb +68 -63
- data/lib/launchy/argv.rb +11 -6
- data/lib/launchy/cli.rb +29 -29
- data/lib/launchy/descendant_tracker.rb +14 -12
- data/lib/launchy/detect/host_os.rb +21 -18
- data/lib/launchy/detect/host_os_family.rb +94 -53
- data/lib/launchy/detect/nix_desktop_environment.rb +74 -69
- data/lib/launchy/detect.rb +7 -3
- data/lib/launchy/error.rb +2 -0
- data/lib/launchy/os_family.rb +2 -0
- data/lib/launchy/runner.rb +25 -17
- data/lib/launchy/version.rb +7 -5
- data/lib/launchy.rb +69 -65
- metadata +10 -103
- data/Rakefile +0 -29
- data/bin/launchy +0 -4
- data/spec/application_spec.rb +0 -43
- data/spec/applications/browser_spec.rb +0 -73
- data/spec/cli_spec.rb +0 -74
- data/spec/detect/host_os_family_spec.rb +0 -42
- data/spec/detect/host_os_spec.rb +0 -19
- data/spec/detect/nix_desktop_environment_spec.rb +0 -27
- data/spec/launchy_spec.rb +0 -142
- data/spec/mock_application.rb +0 -13
- data/spec/spec_helper.rb +0 -8
- data/spec/tattle-host-os.yaml +0 -427
- data/spec/version_spec.rb +0 -11
- data/tasks/default.rake +0 -250
- data/tasks/this.rb +0 -208
- /data/{LICENSE → LICENSE.txt} +0 -0
@@ -1,71 +1,112 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Launchy
|
4
|
+
module Detect
|
5
|
+
# Detect the current host os family
|
6
|
+
#
|
7
|
+
# If the current host familiy cannot be detected then return
|
8
|
+
# HostOsFamily::Unknown
|
9
|
+
class HostOsFamily
|
10
|
+
class NotFoundError < Launchy::Error; end
|
11
|
+
extend ::Launchy::DescendantTracker
|
12
|
+
|
13
|
+
class << self
|
14
|
+
def detect(host_os = HostOs.new)
|
15
|
+
found = find_child(:matches?, host_os)
|
16
|
+
return found.new(host_os) if found
|
17
|
+
|
18
|
+
raise NotFoundError, "Unknown OS family for host os '#{host_os}'. #{Launchy.bug_report_message}"
|
19
|
+
end
|
20
|
+
|
21
|
+
def matches?(host_os)
|
22
|
+
matching_regex.match(host_os.to_s)
|
23
|
+
end
|
24
|
+
|
25
|
+
def windows?
|
26
|
+
self == Windows
|
27
|
+
end
|
28
|
+
|
29
|
+
def darwin?
|
30
|
+
self == Darwin
|
31
|
+
end
|
32
|
+
|
33
|
+
def nix?
|
34
|
+
self == Nix
|
35
|
+
end
|
36
|
+
|
37
|
+
def cygwin?
|
38
|
+
self == Cygwin
|
39
|
+
end
|
16
40
|
end
|
17
41
|
|
18
|
-
|
19
|
-
|
42
|
+
attr_reader :host_os
|
43
|
+
|
44
|
+
def initialize(host_os = HostOs.new)
|
45
|
+
@host_os = host_os
|
20
46
|
end
|
21
47
|
|
22
|
-
def windows?
|
23
|
-
|
24
|
-
|
25
|
-
def cygwin?() self == Cygwin; end
|
26
|
-
end
|
48
|
+
def windows?
|
49
|
+
self.class.windows?
|
50
|
+
end
|
27
51
|
|
52
|
+
def darwin?
|
53
|
+
self.class.darwin?
|
54
|
+
end
|
28
55
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
end
|
56
|
+
def nix?
|
57
|
+
self.class.nix?
|
58
|
+
end
|
33
59
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
def cygwin?() self.class.cygwin?; end
|
60
|
+
def cygwin?
|
61
|
+
self.class.cygwin?
|
62
|
+
end
|
38
63
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
64
|
+
#---------------------------
|
65
|
+
# All known host os families
|
66
|
+
#---------------------------
|
67
|
+
#
|
68
|
+
class Windows < HostOsFamily
|
69
|
+
def self.matching_regex
|
70
|
+
/(mingw|mswin|msys|windows)/i
|
71
|
+
end
|
72
|
+
|
73
|
+
def app_list(app)
|
74
|
+
app.windows_app_list
|
75
|
+
end
|
46
76
|
end
|
47
|
-
def app_list( app ) app.windows_app_list; end
|
48
|
-
end
|
49
77
|
|
50
|
-
|
51
|
-
|
52
|
-
|
78
|
+
# Mac OS X family
|
79
|
+
class Darwin < HostOsFamily
|
80
|
+
def self.matching_regex
|
81
|
+
/(darwin|mac os)/i
|
82
|
+
end
|
83
|
+
|
84
|
+
def app_list(app)
|
85
|
+
app.darwin_app_list
|
86
|
+
end
|
53
87
|
end
|
54
|
-
def app_list( app ) app.darwin_app_list; end
|
55
|
-
end
|
56
88
|
|
57
|
-
|
58
|
-
|
59
|
-
|
89
|
+
# All the *nix family of operating systems, and BSDs
|
90
|
+
class Nix < HostOsFamily
|
91
|
+
def self.matching_regex
|
92
|
+
/(linux|bsd|aix|solaris|sunos|dragonfly)/i
|
93
|
+
end
|
94
|
+
|
95
|
+
def app_list(app)
|
96
|
+
app.nix_app_list
|
97
|
+
end
|
60
98
|
end
|
61
|
-
def app_list( app ) app.nix_app_list; end
|
62
|
-
end
|
63
99
|
|
64
|
-
|
65
|
-
|
66
|
-
|
100
|
+
# Cygwin - if anyone is still using that
|
101
|
+
class Cygwin < HostOsFamily
|
102
|
+
def self.matching_regex
|
103
|
+
/cygwin/i
|
104
|
+
end
|
105
|
+
|
106
|
+
def app_list(app)
|
107
|
+
app.cygwin_app_list
|
108
|
+
end
|
67
109
|
end
|
68
|
-
def app_list( app ) app.cygwin_app_list; end
|
69
110
|
end
|
70
111
|
end
|
71
112
|
end
|
@@ -1,93 +1,98 @@
|
|
1
|
-
|
2
|
-
#
|
3
|
-
# Detect the current desktop environment for *nix machines
|
4
|
-
# Currently this is Linux centric. The detection is based upon the detection
|
5
|
-
# used by xdg-open from http://portland.freedesktop.org/
|
6
|
-
class NixDesktopEnvironment
|
7
|
-
class NotFoundError < Launchy::Error; end
|
1
|
+
# frozen_string_literal: true
|
8
2
|
|
9
|
-
|
10
|
-
|
11
|
-
# Detect the current *nix desktop environment
|
3
|
+
module Launchy
|
4
|
+
module Detect
|
12
5
|
#
|
13
|
-
#
|
14
|
-
#
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
6
|
+
# Detect the current desktop environment for *nix machines
|
7
|
+
# Currently this is Linux centric. The detection is based upon the detection
|
8
|
+
# used by xdg-open from http://portland.freedesktop.org/
|
9
|
+
class NixDesktopEnvironment
|
10
|
+
class NotFoundError < Launchy::Error; end
|
11
|
+
|
12
|
+
extend ::Launchy::DescendantTracker
|
13
|
+
|
14
|
+
# Detect the current *nix desktop environment
|
15
|
+
#
|
16
|
+
# If the current dekstop environment be detected, the return
|
17
|
+
# NixDekstopEnvironment::Unknown
|
18
|
+
def self.detect
|
19
|
+
found = find_child(:is_current_desktop_environment?)
|
20
|
+
Launchy.log("Current Desktop environment not found. #{Launchy.bug_report_message}") unless found
|
21
|
+
found
|
22
|
+
end
|
20
23
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
+
def self.fallback_browsers
|
25
|
+
%w[firefox iceweasel seamonkey opera mozilla netscape galeon links lynx].map { |x| ::Launchy::Argv.new(x) }
|
26
|
+
end
|
24
27
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
+
def self.browsers
|
29
|
+
[browser, fallback_browsers].flatten
|
30
|
+
end
|
28
31
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
+
#---------------------------------------
|
33
|
+
# The list of known desktop environments
|
34
|
+
#---------------------------------------
|
32
35
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
36
|
+
# KDE desktop environment
|
37
|
+
class Kde < NixDesktopEnvironment
|
38
|
+
def self.is_current_desktop_environment?
|
39
|
+
ENV.fetch("KDE_FULL_SESSION", nil) &&
|
40
|
+
Launchy::Application.find_executable("kde-open")
|
41
|
+
end
|
38
42
|
|
39
|
-
|
40
|
-
|
43
|
+
def self.browser
|
44
|
+
::Launchy::Argv.new("kde-open")
|
45
|
+
end
|
41
46
|
end
|
42
|
-
end
|
43
47
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
48
|
+
# Gnome desktop environment
|
49
|
+
class Gnome < NixDesktopEnvironment
|
50
|
+
def self.is_current_desktop_environment?
|
51
|
+
ENV.fetch("GNOME_DESKTOP_SESSION_ID", nil) &&
|
52
|
+
Launchy::Application.find_executable("gnome-open")
|
53
|
+
end
|
49
54
|
|
50
|
-
|
51
|
-
|
55
|
+
def self.browser
|
56
|
+
::Launchy::Argv.new("gnome-open")
|
57
|
+
end
|
52
58
|
end
|
53
|
-
end
|
54
59
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
60
|
+
# Xfce desktop environment
|
61
|
+
class Xfce < NixDesktopEnvironment
|
62
|
+
def self.is_current_desktop_environment?
|
63
|
+
if Launchy::Application.find_executable("xprop")
|
64
|
+
`xprop -root _DT_SAVE_MODE`.include?("xfce")
|
65
|
+
else
|
66
|
+
false
|
67
|
+
end
|
61
68
|
end
|
62
|
-
end
|
63
69
|
|
64
|
-
|
65
|
-
|
70
|
+
def self.browser
|
71
|
+
::Launchy::Argv.new(%w[exo-open --launch WebBrowser])
|
72
|
+
end
|
66
73
|
end
|
67
|
-
end
|
68
74
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
75
|
+
# Fall back environment as the last case
|
76
|
+
class Xdg < NixDesktopEnvironment
|
77
|
+
def self.is_current_desktop_environment?
|
78
|
+
Launchy::Application.find_executable(browser)
|
79
|
+
end
|
74
80
|
|
75
|
-
|
76
|
-
|
81
|
+
def self.browser
|
82
|
+
::Launchy::Argv.new("xdg-open")
|
83
|
+
end
|
77
84
|
end
|
78
|
-
end
|
79
85
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
86
|
+
# The one that is found when all else fails. And this must be declared last
|
87
|
+
class NotFound < NixDesktopEnvironment
|
88
|
+
def self.is_current_desktop_environment?
|
89
|
+
true
|
90
|
+
end
|
85
91
|
|
86
|
-
|
87
|
-
|
92
|
+
def self.browser
|
93
|
+
::Launchy::Argv.new
|
94
|
+
end
|
88
95
|
end
|
89
96
|
end
|
90
|
-
|
91
97
|
end
|
92
98
|
end
|
93
|
-
|
data/lib/launchy/detect.rb
CHANGED
@@ -1,8 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Launchy
|
4
|
+
# Internal: Namespace for detecting the environment that Launchy is running in
|
5
|
+
#
|
2
6
|
module Detect
|
3
7
|
end
|
4
8
|
end
|
5
9
|
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
10
|
+
require "launchy/detect/host_os"
|
11
|
+
require "launchy/detect/host_os_family"
|
12
|
+
require "launchy/detect/nix_desktop_environment"
|
data/lib/launchy/error.rb
CHANGED
data/lib/launchy/os_family.rb
CHANGED
data/lib/launchy/runner.rb
CHANGED
@@ -1,19 +1,27 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "childprocess"
|
2
4
|
module Launchy
|
5
|
+
# Internal: Run a command in a child process
|
6
|
+
#
|
3
7
|
class Runner
|
4
|
-
def run(
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
+
def run(cmd, *args)
|
9
|
+
unless cmd
|
10
|
+
raise Launchy::CommandNotFoundError,
|
11
|
+
"No command found to run with args '#{args.join(' ')}'. If this is unexpected, #{Launchy.bug_report_message}"
|
12
|
+
end
|
13
|
+
|
14
|
+
if Launchy.dry_run?
|
15
|
+
$stdout.puts dry_run(cmd, *args)
|
8
16
|
else
|
9
|
-
wet_run(
|
17
|
+
wet_run(cmd, *args)
|
10
18
|
end
|
11
19
|
end
|
12
20
|
|
13
|
-
def wet_run(
|
14
|
-
argv = [
|
21
|
+
def wet_run(cmd, *args)
|
22
|
+
argv = [cmd, *args].flatten
|
15
23
|
Launchy.log "ChildProcess: argv => #{argv.inspect}"
|
16
|
-
process = ChildProcess.build(
|
24
|
+
process = ChildProcess.build(*argv)
|
17
25
|
|
18
26
|
process.io.inherit!
|
19
27
|
process.leader = true
|
@@ -21,7 +29,7 @@ module Launchy
|
|
21
29
|
process.start
|
22
30
|
end
|
23
31
|
|
24
|
-
def dry_run(
|
32
|
+
def dry_run(cmd, *args)
|
25
33
|
shell_commands(cmd, args).join(" ")
|
26
34
|
end
|
27
35
|
|
@@ -30,17 +38,17 @@ module Launchy
|
|
30
38
|
# args are not escaped because the whole set is passed to system as *args
|
31
39
|
# and in that case system shell escaping rules are not done.
|
32
40
|
#
|
33
|
-
def shell_commands(
|
34
|
-
cmdline = [
|
35
|
-
cmdline << args.flatten.collect
|
36
|
-
|
41
|
+
def shell_commands(cmd, args)
|
42
|
+
cmdline = [cmd.to_s.shellsplit]
|
43
|
+
cmdline << args.flatten.collect(&:to_s)
|
44
|
+
commandline_normalize(cmdline)
|
37
45
|
end
|
38
46
|
|
39
|
-
def commandline_normalize(
|
47
|
+
def commandline_normalize(cmdline)
|
40
48
|
c = cmdline.flatten!
|
41
|
-
c = c.find_all { |a|
|
49
|
+
c = c.find_all { |a| !a.nil? and a.size.positive? }
|
42
50
|
Launchy.log "commandline_normalized => #{c.join(' ')}"
|
43
|
-
|
51
|
+
c
|
44
52
|
end
|
45
53
|
end
|
46
54
|
end
|
data/lib/launchy/version.rb
CHANGED
@@ -1,11 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Launchy
|
2
|
-
VERSION = "3.0.
|
4
|
+
VERSION = "3.0.1"
|
3
5
|
|
6
|
+
# Internal: Version number of Launchy
|
4
7
|
module Version
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
PATCH = Integer(VERSION.split('.')[2])
|
8
|
+
MAJOR = Integer(VERSION.split(".")[0])
|
9
|
+
MINOR = Integer(VERSION.split(".")[1])
|
10
|
+
PATCH = Integer(VERSION.split(".")[2])
|
9
11
|
|
10
12
|
def self.to_a
|
11
13
|
[MAJOR, MINOR, PATCH]
|
data/lib/launchy.rb
CHANGED
@@ -1,6 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "English"
|
4
|
+
require "addressable/uri"
|
5
|
+
require "shellwords"
|
6
|
+
require "stringio"
|
4
7
|
|
5
8
|
#
|
6
9
|
# The entry point into Launchy. This is the sole supported public API.
|
@@ -19,59 +22,62 @@ require 'stringio'
|
|
19
22
|
# application class
|
20
23
|
#
|
21
24
|
module Launchy
|
22
|
-
|
23
25
|
class << self
|
24
26
|
#
|
25
27
|
# Launch an application for the given uri string
|
26
28
|
#
|
27
|
-
def open(uri_s, options = {}
|
28
|
-
leftover = extract_global_options(
|
29
|
-
uri = string_to_uri(
|
30
|
-
if name = options[:application]
|
31
|
-
app = app_for_name(
|
29
|
+
def open(uri_s, options = {})
|
30
|
+
leftover = extract_global_options(options)
|
31
|
+
uri = string_to_uri(uri_s)
|
32
|
+
if (name = options[:application])
|
33
|
+
app = app_for_name(name)
|
32
34
|
end
|
33
35
|
|
34
|
-
if app.nil?
|
35
|
-
app = app_for_uri( uri )
|
36
|
-
end
|
36
|
+
app = app_for_uri(uri) if app.nil?
|
37
37
|
|
38
|
-
app.new.open(
|
39
|
-
rescue Launchy::Error =>
|
40
|
-
raise
|
41
|
-
rescue
|
38
|
+
app.new.open(uri, leftover)
|
39
|
+
rescue Launchy::Error => e
|
40
|
+
raise e
|
41
|
+
rescue StandardError => e
|
42
42
|
msg = "Failure in opening uri #{uri_s.inspect} with options #{options.inspect}: #{e}"
|
43
43
|
raise Launchy::Error, msg
|
44
44
|
ensure
|
45
|
-
if
|
46
|
-
yield
|
47
|
-
|
45
|
+
if $ERROR_INFO && block_given?
|
46
|
+
yield $ERROR_INFO
|
47
|
+
|
48
|
+
# explicitly return here to swallow the errors if there was an error
|
49
|
+
# and we yielded to the block
|
50
|
+
# rubocop:disable Lint/EnsureReturn
|
51
|
+
return
|
52
|
+
# rubocop:enable Lint/EnsureReturn
|
48
53
|
end
|
49
54
|
end
|
50
55
|
|
51
|
-
def app_for_uri(
|
52
|
-
Launchy::Application.handling(
|
56
|
+
def app_for_uri(uri)
|
57
|
+
Launchy::Application.handling(uri)
|
53
58
|
end
|
54
59
|
|
55
|
-
def app_for_name(
|
56
|
-
Launchy::Application.for_name(
|
60
|
+
def app_for_name(name)
|
61
|
+
Launchy::Application.for_name(name)
|
57
62
|
rescue Launchy::ApplicationNotFoundError
|
58
63
|
nil
|
59
64
|
end
|
60
65
|
|
61
|
-
def app_for_uri_string(
|
62
|
-
app_for_uri(
|
66
|
+
def app_for_uri_string(str)
|
67
|
+
app_for_uri(string_to_uri(str))
|
63
68
|
end
|
64
69
|
|
65
|
-
def string_to_uri(
|
66
|
-
|
67
|
-
uri = Addressable::URI.parse(
|
68
|
-
Launchy.log "URI parsing pass 1 : #{
|
69
|
-
|
70
|
-
uri = Addressable::URI.heuristic_parse(
|
71
|
-
Launchy.log "URI parsing pass 2 : #{
|
70
|
+
def string_to_uri(str)
|
71
|
+
str = str.to_s
|
72
|
+
uri = Addressable::URI.parse(str)
|
73
|
+
Launchy.log "URI parsing pass 1 : #{str} -> #{uri.to_hash}"
|
74
|
+
unless uri.scheme
|
75
|
+
uri = Addressable::URI.heuristic_parse(str)
|
76
|
+
Launchy.log "URI parsing pass 2 : #{str} -> #{uri.to_hash}"
|
72
77
|
end
|
73
|
-
raise Launchy::ArgumentError, "Invalid URI given: #{
|
74
|
-
|
78
|
+
raise Launchy::ArgumentError, "Invalid URI given: #{str.inspect}" unless uri
|
79
|
+
|
80
|
+
uri
|
75
81
|
end
|
76
82
|
|
77
83
|
def reset_global_options
|
@@ -79,49 +85,49 @@ module Launchy
|
|
79
85
|
Launchy.application = nil
|
80
86
|
Launchy.host_os = nil
|
81
87
|
Launchy.dry_run = false
|
82
|
-
Launchy.path = ENV
|
88
|
+
Launchy.path = ENV.fetch("PATH", nil)
|
83
89
|
end
|
84
90
|
|
85
|
-
def extract_global_options(
|
91
|
+
def extract_global_options(options)
|
86
92
|
leftover = options.dup
|
87
|
-
Launchy.debug = leftover.delete(
|
88
|
-
Launchy.application = leftover.delete(
|
89
|
-
Launchy.host_os = leftover.delete(
|
90
|
-
Launchy.dry_run = leftover.delete(
|
93
|
+
Launchy.debug = leftover.delete(:debug) || ENV.fetch("LAUNCHY_DEBUG", nil)
|
94
|
+
Launchy.application = leftover.delete(:application) || ENV.fetch("LAUNCHY_APPLICATION", nil)
|
95
|
+
Launchy.host_os = leftover.delete(:host_os) || ENV.fetch("LAUNCHY_HOST_OS", nil)
|
96
|
+
Launchy.dry_run = leftover.delete(:dry_run) || ENV.fetch("LAUNCHY_DRY_RUN", nil)
|
91
97
|
end
|
92
98
|
|
93
|
-
def debug=(
|
94
|
-
@debug = to_bool(
|
99
|
+
def debug=(enabled)
|
100
|
+
@debug = to_bool(enabled)
|
95
101
|
end
|
96
102
|
|
97
103
|
# we may do logging before a call to 'open', hence the need to check
|
98
104
|
# LAUNCHY_DEBUG here
|
99
105
|
def debug?
|
100
|
-
@debug || to_bool(
|
106
|
+
@debug || to_bool(ENV.fetch("LAUNCHY_DEBUG", nil))
|
101
107
|
end
|
102
108
|
|
103
|
-
def application=(
|
109
|
+
def application=(app)
|
104
110
|
@application = app
|
105
111
|
end
|
106
112
|
|
107
113
|
def application
|
108
|
-
@application || ENV
|
114
|
+
@application || ENV.fetch("LAUNCHY_APPLICATION", nil)
|
109
115
|
end
|
110
116
|
|
111
|
-
def host_os=(
|
117
|
+
def host_os=(host_os)
|
112
118
|
@host_os = host_os
|
113
119
|
end
|
114
120
|
|
115
121
|
def host_os
|
116
|
-
@host_os || ENV
|
122
|
+
@host_os || ENV.fetch("LAUNCHY_HOST_OS", nil)
|
117
123
|
end
|
118
124
|
|
119
|
-
def dry_run=(
|
120
|
-
@dry_run = to_bool(
|
125
|
+
def dry_run=(dry_run)
|
126
|
+
@dry_run = to_bool(dry_run)
|
121
127
|
end
|
122
128
|
|
123
129
|
def dry_run?
|
124
|
-
@dry_run || to_bool(
|
130
|
+
@dry_run || to_bool(ENV.fetch("LAUNCHY_DRY_RUN", nil))
|
125
131
|
end
|
126
132
|
|
127
133
|
def bug_report_message
|
@@ -140,15 +146,13 @@ module Launchy
|
|
140
146
|
@path = path
|
141
147
|
end
|
142
148
|
|
143
|
-
|
144
|
-
|
149
|
+
private
|
150
|
+
|
151
|
+
def to_bool(arg)
|
145
152
|
if arg.is_a? String
|
146
|
-
arg ==
|
147
|
-
elsif arg.is_a? TrueClass
|
148
|
-
true
|
153
|
+
arg == "true"
|
149
154
|
else
|
150
|
-
|
151
|
-
false
|
155
|
+
arg.is_a? TrueClass
|
152
156
|
end
|
153
157
|
end
|
154
158
|
end
|
@@ -157,11 +161,11 @@ module Launchy
|
|
157
161
|
Launchy.reset_global_options
|
158
162
|
end
|
159
163
|
|
160
|
-
require
|
161
|
-
require
|
162
|
-
require
|
163
|
-
require
|
164
|
-
require
|
165
|
-
require
|
166
|
-
require
|
167
|
-
require
|
164
|
+
require "launchy/version"
|
165
|
+
require "launchy/argv"
|
166
|
+
require "launchy/cli"
|
167
|
+
require "launchy/descendant_tracker"
|
168
|
+
require "launchy/error"
|
169
|
+
require "launchy/application"
|
170
|
+
require "launchy/detect"
|
171
|
+
require "launchy/runner"
|