launchy 2.5.0 → 3.1.1
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 +4 -4
- data/CONTRIBUTING.md +1 -0
- data/HISTORY.md +46 -20
- data/{LICENSE → LICENSE.txt} +1 -1
- data/Manifest.txt +4 -21
- data/README.md +10 -47
- data/exe/launchy +5 -0
- data/launchy.gemspec +33 -0
- data/lib/launchy/application.rb +38 -20
- data/lib/launchy/applications/browser.rb +70 -63
- data/lib/launchy/argv.rb +11 -6
- data/lib/launchy/cli.rb +29 -34
- 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 -5
- data/lib/launchy/error.rb +2 -0
- data/lib/launchy/os_family.rb +2 -0
- data/lib/launchy/runner.rb +55 -0
- data/lib/launchy/version.rb +7 -5
- data/lib/launchy.rb +76 -68
- metadata +23 -83
- data/Rakefile +0 -27
- data/bin/launchy +0 -4
- data/lib/launchy/deprecated.rb +0 -52
- data/lib/launchy/detect/ruby_engine.rb +0 -78
- data/lib/launchy/detect/runner.rb +0 -152
- data/spec/application_spec.rb +0 -43
- data/spec/applications/browser_spec.rb +0 -78
- data/spec/cli_spec.rb +0 -75
- 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/detect/ruby_engine_spec.rb +0 -37
- data/spec/detect/runner_spec.rb +0 -103
- data/spec/launchy_spec.rb +0 -119
- data/spec/mock_application.rb +0 -9
- data/spec/spec_helper.rb +0 -11
- data/spec/tattle-host-os.yaml +0 -427
- data/spec/version_spec.rb +0 -11
- data/tasks/default.rake +0 -242
- data/tasks/this.rb +0 -208
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 147fa0dafa116ae097364aab290ffdb2f508ff44b87019dc266aeaccf1963ab7
|
|
4
|
+
data.tar.gz: aad595ea32b9a1b1027c0650fd23b1a19865dda3f60c76890e6b0bb1be9e6c0d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b8193061c42405778b539067521999e9ff2776c0317ba8fae47ce300d901e55473abccad60486b93952e101a32c15a8d462205880c1ceaf7a1a6fe04833b6404
|
|
7
|
+
data.tar.gz: 57b74c3a254e4437b04b4baa367abb384e733bef508f8f746a22c13997ce13b063208fe6c5c9b16bb8e6963aad2d59367d1aea1188e3326c7aaac69f1e53cae9
|
data/CONTRIBUTING.md
CHANGED
|
@@ -51,6 +51,7 @@ easiest way to contribute.
|
|
|
51
51
|
* [Daniel Farina](https://github.com/fdr)
|
|
52
52
|
* [Jack Turnbull](https://github.com/jackturnbull)
|
|
53
53
|
* [Jeremy Moritz](https://github.com/jeremymoritz)
|
|
54
|
+
* [Jamie Donnelly](https://github.com/JamieKDonnelly)
|
|
54
55
|
|
|
55
56
|
[GitHub Account]: https://github.com/signup/free "GitHub Signup"
|
|
56
57
|
[GitHub Issues]: https://github.com/copiousfreetime/launchy/issues "Launchy Issues"
|
data/HISTORY.md
CHANGED
|
@@ -1,4 +1,30 @@
|
|
|
1
1
|
# Launchy Changelog
|
|
2
|
+
## Version 3.1.1 - 2025-02-21
|
|
3
|
+
* Fix the quoted parameter for windows launching - <https://github.com/copiousfreetime/launchy/issues/164>
|
|
4
|
+
|
|
5
|
+
## Version 3.1.0 - 2025-01-23
|
|
6
|
+
* Fix the argv array when passing to ChildProcess on windows - <https://github.com/copiousfreetime/launchy/issues/159>
|
|
7
|
+
* Update the ruby test matrix for 3.4
|
|
8
|
+
* Update the ruby test matrix to drop 3.0
|
|
9
|
+
|
|
10
|
+
## Version 3.0.1 - 2024-05-03
|
|
11
|
+
* Added rubocop and fix all the warnings
|
|
12
|
+
* Fix rubygem changelog_uri - Spone
|
|
13
|
+
* Update the semaphore flow
|
|
14
|
+
* Update the ruby test matrix
|
|
15
|
+
* Change to Gemfile for development
|
|
16
|
+
|
|
17
|
+
## Version 3.0.0 - 2024-03-03
|
|
18
|
+
* Remove unused `deprecated.rb` file - <https://github.com/copiousfreetime/launchy/issues/148>
|
|
19
|
+
* Update supported ruby version to be 3.x
|
|
20
|
+
* use the `:application` parameter - <https://github.com/copiousfreetime/launchy/issues/121>
|
|
21
|
+
* adjust the semaphore configuration to allow better caching
|
|
22
|
+
* replace the homegrown process runner with [`childprocess`](https://rubygems.org/gems/childprocess)
|
|
23
|
+
|
|
24
|
+
## Version 2.5.2 - 2022-12-27
|
|
25
|
+
* Update Addressable - <https://github.com/copiousfreetime/launchy/pull/145> - JamieKDonnelly
|
|
26
|
+
* Fix deprecated usage of `Object#=~` - <https://github.com/copiousfreetime/launchy/pull/138> - marcrohloff
|
|
27
|
+
* Move to sempahore for matrix builds and macos tests
|
|
2
28
|
|
|
3
29
|
## Version 2.5.0 - 2020-02-27
|
|
4
30
|
* Update depedencies
|
|
@@ -21,12 +47,12 @@
|
|
|
21
47
|
* Abstract out the argv of the commandline - <https://github.com/copiousfreetime/launchy/issues/71>
|
|
22
48
|
|
|
23
49
|
## Version 2.4.0 - 2013-11-12
|
|
24
|
-
* Support `Launchy.open( url, :debug => true )` - <
|
|
25
|
-
* Fix inconsistencies in `debug?` and `dry_run?` methods - <
|
|
26
|
-
* Fix detection of missing *nix desktops - <
|
|
27
|
-
* Fix running tests in bare Linux environment - <
|
|
28
|
-
* Fix mistaking windows drive as uri schema - <
|
|
29
|
-
* Attempt fixing windows `start` command oddities, again - <
|
|
50
|
+
* Support `Launchy.open( url, :debug => true )` - <https://github.com/copiousfreetime/launchy/issues/63> - schmich
|
|
51
|
+
* Fix inconsistencies in `debug?` and `dry_run?` methods - <https://github.com/copiousfreetime/launchy/issues/63> - schmich
|
|
52
|
+
* Fix detection of missing *nix desktops - <https://github.com/copiousfreetime/launchy/issues/70>
|
|
53
|
+
* Fix running tests in bare Linux environment - <https://github.com/copiousfreetime/launchy/issues/67> - gioele
|
|
54
|
+
* Fix mistaking windows drive as uri schema - <https://github.com/copiousfreetime/launchy/issues/65>
|
|
55
|
+
* Attempt fixing windows `start` command oddities, again - <https://github.com/copiousfreetime/launchy/issues/62>
|
|
30
56
|
|
|
31
57
|
## Version 2.3.0 - 2013-04-11
|
|
32
58
|
|
|
@@ -34,39 +60,39 @@
|
|
|
34
60
|
|
|
35
61
|
## Version 2.2.0 - 2013-02-06
|
|
36
62
|
|
|
37
|
-
* Change XFCE detection to not depend on grep <
|
|
38
|
-
* Suppress forked process output <
|
|
39
|
-
* Display help/usage if no url is given <
|
|
40
|
-
* Detect the fluxbox environment <
|
|
41
|
-
* Automatically detect `http` url's if they are missing the `http://` <
|
|
63
|
+
* Change XFCE detection to not depend on grep <https://github.com/copiousfreetime/launchy/issues/52> - bogdan
|
|
64
|
+
* Suppress forked process output <https://github.com/copiousfreetime/launchy/issues/51>
|
|
65
|
+
* Display help/usage if no url is given <https://github.com/copiousfreetime/launchy/issues/54>
|
|
66
|
+
* Detect the fluxbox environment <https://github.com/copiousfreetime/launchy/issues/53>
|
|
67
|
+
* Automatically detect `http` url's if they are missing the `http://` <https://github.com/copiousfreetime/launchy/issues/55>
|
|
42
68
|
* Update to latest project management rake tasks
|
|
43
69
|
|
|
44
70
|
## Version 2.1.2 - 2012-08-06
|
|
45
71
|
|
|
46
|
-
* Fix where HostOS would fail to convert to string on JRuby in 1.9 mode <
|
|
72
|
+
* Fix where HostOS would fail to convert to string on JRuby in 1.9 mode <https://github.com/copiousfreetime/launchy/issues/45>
|
|
47
73
|
|
|
48
74
|
## Version 2.1.1 - 2012-07-28
|
|
49
75
|
|
|
50
|
-
* Update addressable runtime dependency <
|
|
76
|
+
* Update addressable runtime dependency <https://github.com/copiousfreetime/launchy/issues/47>
|
|
51
77
|
* Bring minitest and ffi development dependencies up to date
|
|
52
78
|
|
|
53
79
|
## Version 2.1.0 - 2012-03-18
|
|
54
80
|
|
|
55
|
-
* Fix raising exception when no browser program found <
|
|
81
|
+
* Fix raising exception when no browser program found <https://github.com/copiousfreetime/launchy/issues/42>
|
|
56
82
|
* Add `LAUNCHY_DRY_RUN` environment variable (Mariusz Pietrzyk / wijet)
|
|
57
83
|
* Update dependencies
|
|
58
84
|
|
|
59
85
|
## Version 2.0.5 - 2011-07-24
|
|
60
86
|
|
|
61
|
-
* Fix the case where `$BROWSER` is set and no *nix desktop was found <
|
|
87
|
+
* Fix the case where `$BROWSER` is set and no *nix desktop was found <https://github.com/copiousfreetime/launchy/issues/33>
|
|
62
88
|
|
|
63
89
|
## Version 2.0.4 - 2011-07-23
|
|
64
90
|
|
|
65
|
-
* Fix windows `start` commandline <
|
|
66
|
-
* Add capability to open local files with no file: scheme present <
|
|
67
|
-
* Added `rake how_to_contribute` task <
|
|
68
|
-
* Make better decisions on when to do shell escaping <
|
|
69
|
-
* Switch to Addressable::URI so UTF-8 urls may be parsed. <
|
|
91
|
+
* Fix windows `start` commandline <https://github.com/copiousfreetime/launchy/issues/5>
|
|
92
|
+
* Add capability to open local files with no file: scheme present <https://github.com/copiousfreetime/launchy/issues/29>
|
|
93
|
+
* Added `rake how_to_contribute` task <https://github.com/copiousfreetime/launchy/issues/30>
|
|
94
|
+
* Make better decisions on when to do shell escaping <https://github.com/copiousfreetime/launchy/issues/31>
|
|
95
|
+
* Switch to Addressable::URI so UTF-8 urls may be parsed. <https://github.com/copiousfreetime/launchy/issues/32>
|
|
70
96
|
|
|
71
97
|
## Version 2.0.3 - 2011-07-17
|
|
72
98
|
|
data/{LICENSE → LICENSE.txt}
RENAMED
data/Manifest.txt
CHANGED
|
@@ -1,38 +1,21 @@
|
|
|
1
1
|
CONTRIBUTING.md
|
|
2
2
|
HISTORY.md
|
|
3
|
-
LICENSE
|
|
3
|
+
LICENSE.txt
|
|
4
4
|
Manifest.txt
|
|
5
5
|
README.md
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
exe/launchy
|
|
7
|
+
launchy.gemspec
|
|
8
8
|
lib/launchy.rb
|
|
9
9
|
lib/launchy/application.rb
|
|
10
10
|
lib/launchy/applications/browser.rb
|
|
11
11
|
lib/launchy/argv.rb
|
|
12
12
|
lib/launchy/cli.rb
|
|
13
|
-
lib/launchy/deprecated.rb
|
|
14
13
|
lib/launchy/descendant_tracker.rb
|
|
15
14
|
lib/launchy/detect.rb
|
|
16
15
|
lib/launchy/detect/host_os.rb
|
|
17
16
|
lib/launchy/detect/host_os_family.rb
|
|
18
17
|
lib/launchy/detect/nix_desktop_environment.rb
|
|
19
|
-
lib/launchy/detect/ruby_engine.rb
|
|
20
|
-
lib/launchy/detect/runner.rb
|
|
21
18
|
lib/launchy/error.rb
|
|
22
19
|
lib/launchy/os_family.rb
|
|
20
|
+
lib/launchy/runner.rb
|
|
23
21
|
lib/launchy/version.rb
|
|
24
|
-
spec/application_spec.rb
|
|
25
|
-
spec/applications/browser_spec.rb
|
|
26
|
-
spec/cli_spec.rb
|
|
27
|
-
spec/detect/host_os_family_spec.rb
|
|
28
|
-
spec/detect/host_os_spec.rb
|
|
29
|
-
spec/detect/nix_desktop_environment_spec.rb
|
|
30
|
-
spec/detect/ruby_engine_spec.rb
|
|
31
|
-
spec/detect/runner_spec.rb
|
|
32
|
-
spec/launchy_spec.rb
|
|
33
|
-
spec/mock_application.rb
|
|
34
|
-
spec/spec_helper.rb
|
|
35
|
-
spec/tattle-host-os.yaml
|
|
36
|
-
spec/version_spec.rb
|
|
37
|
-
tasks/default.rake
|
|
38
|
-
tasks/this.rb
|
data/README.md
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# launchy
|
|
2
2
|
|
|
3
|
-
[](https://copiousfreetime.semaphoreci.com/projects/launchy)
|
|
5
4
|
|
|
6
5
|
* [Homepage](https://github.com/copiousfreetime/launchy)
|
|
7
6
|
* [Github Project](https://github.com/copiousfreetime/launchy)
|
|
@@ -27,14 +26,14 @@ testing environment, or via its API.
|
|
|
27
26
|
|
|
28
27
|
### Commandline
|
|
29
28
|
|
|
30
|
-
% launchy
|
|
29
|
+
% launchy https://www.ruby-lang.org/
|
|
31
30
|
|
|
32
31
|
There are additional command line options, use `launchy --help` to see them.
|
|
33
32
|
|
|
34
33
|
### Using the `BROWSER` environment variable
|
|
35
34
|
|
|
36
35
|
Launchy has a predefined set of common browsers on each platform that it
|
|
37
|
-
attempts to use, and of course it is not exhaustive. As a
|
|
36
|
+
attempts to use, and of course it is not exhaustive. As a fallback you can make
|
|
38
37
|
use of the somewhat standard `BROWSER` environment variable.
|
|
39
38
|
|
|
40
39
|
`BROWSER` works in a similar same way to `PATH`. It is a colon (`:`) separated
|
|
@@ -43,10 +42,10 @@ you are attempting to open will be substituted there.
|
|
|
43
42
|
|
|
44
43
|
As an example if you set `BROWSER=/usr/local/bin/firefox-bin -new-tab
|
|
45
44
|
'%s':/usr/local/bin/google-chrome-stable` and you call
|
|
46
|
-
`Launchy.open("
|
|
45
|
+
`Launchy.open("https://www.ruby-lang.org/")` then Launchy will try, in order:
|
|
47
46
|
|
|
48
|
-
* `/usr/local/bin/firefox-bin -new-tab '
|
|
49
|
-
* `/usr/local/bin/google-chrome-stable
|
|
47
|
+
* `/usr/local/bin/firefox-bin -new-tab 'https://www.ruby-lang.org'`
|
|
48
|
+
* `/usr/local/bin/google-chrome-stable https://www.ruby-lang.org`
|
|
50
49
|
|
|
51
50
|
Additional links on the use of `BROWSER` as an environment variable.
|
|
52
51
|
|
|
@@ -83,7 +82,7 @@ in integration tests. For example:
|
|
|
83
82
|
|
|
84
83
|
### Public API
|
|
85
84
|
|
|
86
|
-
In the vein of [Semantic Versioning](
|
|
85
|
+
In the vein of [Semantic Versioning](https://semver.org), this is the sole
|
|
87
86
|
supported public API.
|
|
88
87
|
|
|
89
88
|
Launchy.open( uri, options = {} ) { |exception| }
|
|
@@ -93,7 +92,6 @@ At the moment, the only available options are:
|
|
|
93
92
|
:debug Turn on debugging output
|
|
94
93
|
:application Explicitly state what application class is going to be used
|
|
95
94
|
:host_os Explicitly state what host operating system to pretend to be
|
|
96
|
-
:ruby_engine Explicitly state what ruby engine to pretend to be under
|
|
97
95
|
:dry_run Do nothing and print the command that would be executed on $stdout
|
|
98
96
|
|
|
99
97
|
If `Launchy.open` is invoked with a block, then no exception will be thrown, and
|
|
@@ -102,53 +100,18 @@ exception that was raised.
|
|
|
102
100
|
|
|
103
101
|
### An example of using the public API:
|
|
104
102
|
|
|
105
|
-
Launchy.open( "
|
|
103
|
+
Launchy.open( "https://www.ruby-lang.org" )
|
|
106
104
|
|
|
107
105
|
### An example of using the public API and using the error block:
|
|
108
106
|
|
|
109
|
-
uri = "
|
|
107
|
+
uri = "https://www.ruby-lang.org"
|
|
110
108
|
Launchy.open( uri ) do |exception|
|
|
111
109
|
puts "Attempted to open #{uri} and failed because #{exception}"
|
|
112
110
|
end
|
|
113
111
|
|
|
114
|
-
## UPGRADING from versions before 2.0.0
|
|
115
|
-
|
|
116
|
-
The previously published version of Launchy before the 2.0.0 series was 0.4.0.
|
|
117
|
-
There have been so many changes, and a mistaken tag at 1.0.0, that I have
|
|
118
|
-
decided to bump all the way to 2.x.y.
|
|
119
|
-
|
|
120
|
-
I have attempted to keep backward compatibility with the previous examples. The
|
|
121
|
-
previous API examples of:
|
|
122
|
-
|
|
123
|
-
Launchy::Browser.run("http://www.ruby-lang.org/")
|
|
124
|
-
|
|
125
|
-
and
|
|
126
|
-
|
|
127
|
-
Launchy::Browser.new.visit("http://www.ruby-lang.org/")
|
|
128
|
-
|
|
129
|
-
will still work, and you will get a deprecation notice, along with the line
|
|
130
|
-
of code you should probably update. For example, this is what would print out
|
|
131
|
-
in the github gem if it was updated to use 2.0.x but not use the supported API.
|
|
132
|
-
|
|
133
|
-
% gh home
|
|
134
|
-
WARNING: You made a call to a deprecated Launchy API. This call should be changed to 'Launchy.open( uri )'
|
|
135
|
-
WARNING: I think I was able to find the location that needs to be fixed. Please go look at:
|
|
136
|
-
WARNING:
|
|
137
|
-
WARNING: /Users/jeremy/.rvm/gems/ruby-1.8.7-p334/gems/github-0.6.2/lib/commands/helpers.rb:275:in `open'
|
|
138
|
-
WARNING: helper :open do |url|
|
|
139
|
-
WARNING: has_launchy? proc {
|
|
140
|
-
WARNING: Launchy::Browser.new.visit url
|
|
141
|
-
WARNING: }
|
|
142
|
-
WARNING: end
|
|
143
|
-
WARNING:
|
|
144
|
-
WARNING: If this is not the case, please file a bug. Please file a bug at https://github.com/copiousfreetime/launchy/issues/new
|
|
145
|
-
|
|
146
|
-
These deprecation notices will go away with version 3.0 and the only available
|
|
147
|
-
API will be the documented one.
|
|
148
|
-
|
|
149
112
|
## ISC LICENSE
|
|
150
113
|
|
|
151
|
-
|
|
114
|
+
https://opensource.org/licenses/isc-license.txt
|
|
152
115
|
|
|
153
116
|
Copyright (c) 2007-2020 Jeremy Hinegardner
|
|
154
117
|
|
data/exe/launchy
ADDED
data/launchy.gemspec
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# DO NOT EDIT - This file is automatically generated
|
|
2
|
+
# Make changes to Manifest.txt and/or Rakefile and regenerate
|
|
3
|
+
# -*- encoding: utf-8 -*-
|
|
4
|
+
# stub: launchy 3.1.1 ruby lib
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |s|
|
|
7
|
+
s.name = "launchy".freeze
|
|
8
|
+
s.version = "3.1.1".freeze
|
|
9
|
+
|
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
|
11
|
+
s.metadata = { "bug_tracker_uri" => "https://github.com/copiousfreetime/launchy/issues", "changelog_uri" => "https://github.com/copiousfreetime/launchy/blob/master/HISTORY.md", "homepage_uri" => "https://github.com/copiousfreetime/launchy", "source_code_uri" => "https://github.com/copiousfreetime/launchy" } if s.respond_to? :metadata=
|
|
12
|
+
s.require_paths = ["lib".freeze]
|
|
13
|
+
s.authors = ["Jeremy Hinegardner".freeze]
|
|
14
|
+
s.bindir = "exe".freeze
|
|
15
|
+
s.date = "2025-02-21"
|
|
16
|
+
s.description = "Launchy is helper class for launching cross-platform applications in a fire and forget manner. There are application concepts (browser, email client, etc) that are common across all platforms, and they may be launched differently on each platform. Launchy is here to make a common approach to launching external applications from within ruby programs.".freeze
|
|
17
|
+
s.email = "jeremy@copiousfreetime.org".freeze
|
|
18
|
+
s.executables = ["launchy".freeze]
|
|
19
|
+
s.extra_rdoc_files = ["CONTRIBUTING.md".freeze, "HISTORY.md".freeze, "LICENSE.txt".freeze, "Manifest.txt".freeze, "README.md".freeze]
|
|
20
|
+
s.files = ["CONTRIBUTING.md".freeze, "HISTORY.md".freeze, "LICENSE.txt".freeze, "Manifest.txt".freeze, "README.md".freeze, "exe/launchy".freeze, "launchy.gemspec".freeze, "lib/launchy.rb".freeze, "lib/launchy/application.rb".freeze, "lib/launchy/applications/browser.rb".freeze, "lib/launchy/argv.rb".freeze, "lib/launchy/cli.rb".freeze, "lib/launchy/descendant_tracker.rb".freeze, "lib/launchy/detect.rb".freeze, "lib/launchy/detect/host_os.rb".freeze, "lib/launchy/detect/host_os_family.rb".freeze, "lib/launchy/detect/nix_desktop_environment.rb".freeze, "lib/launchy/error.rb".freeze, "lib/launchy/os_family.rb".freeze, "lib/launchy/runner.rb".freeze, "lib/launchy/version.rb".freeze]
|
|
21
|
+
s.homepage = "https://github.com/copiousfreetime/launchy".freeze
|
|
22
|
+
s.licenses = ["ISC".freeze]
|
|
23
|
+
s.rdoc_options = ["--main".freeze, "README.md".freeze, "--markup".freeze, "tomdoc".freeze]
|
|
24
|
+
s.required_ruby_version = Gem::Requirement.new(">= 2.3.0".freeze)
|
|
25
|
+
s.rubygems_version = "3.6.3".freeze
|
|
26
|
+
s.summary = "Launchy is helper class for launching cross-platform applications in a fire and forget manner.".freeze
|
|
27
|
+
|
|
28
|
+
s.specification_version = 4
|
|
29
|
+
|
|
30
|
+
s.add_runtime_dependency(%q<addressable>.freeze, ["~> 2.8".freeze])
|
|
31
|
+
s.add_runtime_dependency(%q<childprocess>.freeze, ["~> 5.0".freeze])
|
|
32
|
+
s.add_runtime_dependency(%q<logger>.freeze, ["~> 1.6".freeze])
|
|
33
|
+
end
|
data/lib/launchy/application.rb
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "set"
|
|
2
4
|
module Launchy
|
|
3
5
|
#
|
|
4
6
|
# Application is the base class of all the application types that launchy may
|
|
@@ -18,45 +20,61 @@ module Launchy
|
|
|
18
20
|
# Find the application that handles the given uri.
|
|
19
21
|
#
|
|
20
22
|
# returns the Class that can handle the uri
|
|
21
|
-
def handling(
|
|
22
|
-
klass = find_child(
|
|
23
|
+
def handling(uri)
|
|
24
|
+
klass = find_child(:handles?, uri)
|
|
23
25
|
return klass if klass
|
|
26
|
+
|
|
24
27
|
raise ApplicationNotFoundError, "No application found to handle '#{uri}'"
|
|
25
28
|
end
|
|
26
29
|
|
|
30
|
+
# Find the application with the given name
|
|
27
31
|
#
|
|
32
|
+
# returns the Class that has the given name
|
|
33
|
+
def for_name(name)
|
|
34
|
+
klass = find_child(:has_name?, name)
|
|
35
|
+
return klass if klass
|
|
36
|
+
|
|
37
|
+
raise ApplicationNotFoundError, "No application found named '#{name}'"
|
|
38
|
+
end
|
|
39
|
+
|
|
28
40
|
# Find the given executable in the available paths
|
|
29
|
-
|
|
30
|
-
|
|
41
|
+
#
|
|
42
|
+
# returns the path to the executable or nil if not found
|
|
43
|
+
def find_executable(bin, *paths)
|
|
44
|
+
paths = Launchy.path.split(File::PATH_SEPARATOR) if paths.empty?
|
|
31
45
|
paths.each do |path|
|
|
32
|
-
file = File.join(
|
|
33
|
-
if File.executable?(
|
|
34
|
-
Launchy.log "#{
|
|
46
|
+
file = File.join(path, bin)
|
|
47
|
+
if File.executable?(file)
|
|
48
|
+
Launchy.log "#{name} : found executable #{file}"
|
|
35
49
|
return file
|
|
36
50
|
end
|
|
37
51
|
end
|
|
38
|
-
Launchy.log "#{
|
|
39
|
-
|
|
52
|
+
Launchy.log "#{name} : Unable to find `#{bin}' in #{paths.join(', ')}"
|
|
53
|
+
nil
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Does this class have the given name-like string?
|
|
57
|
+
#
|
|
58
|
+
# returns true if the class has the given name
|
|
59
|
+
def has_name?(qname)
|
|
60
|
+
qname.to_s.downcase == name.split("::").last.downcase
|
|
40
61
|
end
|
|
41
62
|
end
|
|
42
63
|
|
|
43
|
-
attr_reader :host_os_family
|
|
44
|
-
attr_reader :ruby_engine
|
|
45
|
-
attr_reader :runner
|
|
64
|
+
attr_reader :host_os_family, :runner
|
|
46
65
|
|
|
47
66
|
def initialize
|
|
48
67
|
@host_os_family = Launchy::Detect::HostOsFamily.detect
|
|
49
|
-
@
|
|
50
|
-
@runner = Launchy::Detect::Runner.detect
|
|
68
|
+
@runner = Launchy::Runner.new
|
|
51
69
|
end
|
|
52
70
|
|
|
53
|
-
def find_executable(
|
|
54
|
-
Application.find_executable(
|
|
71
|
+
def find_executable(bin, *paths)
|
|
72
|
+
Application.find_executable(bin, *paths)
|
|
55
73
|
end
|
|
56
74
|
|
|
57
|
-
def run(
|
|
58
|
-
runner.run(
|
|
75
|
+
def run(cmd, *args)
|
|
76
|
+
runner.run(cmd, *args)
|
|
59
77
|
end
|
|
60
78
|
end
|
|
61
79
|
end
|
|
62
|
-
require
|
|
80
|
+
require "launchy/applications/browser"
|
|
@@ -1,82 +1,89 @@
|
|
|
1
|
-
|
|
2
|
-
#
|
|
3
|
-
# The class handling the browser application and all of its schemes
|
|
4
|
-
#
|
|
5
|
-
class Browser < Launchy::Application
|
|
6
|
-
def self.schemes
|
|
7
|
-
%w[ http https ftp file ]
|
|
8
|
-
end
|
|
1
|
+
# frozen_string_literal: true
|
|
9
2
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
3
|
+
module Launchy
|
|
4
|
+
class Application
|
|
5
|
+
#
|
|
6
|
+
# The class handling the browser application and all of its schemes
|
|
7
|
+
#
|
|
8
|
+
class Browser < Launchy::Application
|
|
9
|
+
def self.schemes
|
|
10
|
+
%w[http https ftp file]
|
|
11
|
+
end
|
|
14
12
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
end
|
|
13
|
+
def self.handles?(uri)
|
|
14
|
+
return true if schemes.include?(uri.scheme)
|
|
18
15
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
end
|
|
16
|
+
true if File.exist?(uri.path)
|
|
17
|
+
end
|
|
22
18
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
19
|
+
# The escaped \\ is necessary so that when shellsplit is done later,
|
|
20
|
+
# the "launchy", with quotes, goes through to the commandline, since that
|
|
21
|
+
def windows_app_list
|
|
22
|
+
['start \\"launchy\\" /b']
|
|
23
|
+
end
|
|
27
24
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
list.find_all { |argv| argv.valid? }
|
|
32
|
-
end
|
|
25
|
+
def cygwin_app_list
|
|
26
|
+
['cmd /C start \\"launchy\\" /b']
|
|
27
|
+
end
|
|
33
28
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
end
|
|
29
|
+
# hardcode this to open?
|
|
30
|
+
def darwin_app_list
|
|
31
|
+
[find_executable("open")]
|
|
32
|
+
end
|
|
39
33
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
return browser_env
|
|
46
|
-
end
|
|
34
|
+
def nix_app_list
|
|
35
|
+
nix_de = Launchy::Detect::NixDesktopEnvironment.detect
|
|
36
|
+
list = nix_de.browsers
|
|
37
|
+
list.find_all(&:valid?)
|
|
38
|
+
end
|
|
47
39
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
40
|
+
# use a call back mechanism to get the right app_list that is decided by the
|
|
41
|
+
# host_os_family class.
|
|
42
|
+
def app_list
|
|
43
|
+
host_os_family.app_list(self)
|
|
52
44
|
end
|
|
53
|
-
|
|
54
|
-
|
|
45
|
+
|
|
46
|
+
def browser_env
|
|
47
|
+
return [] unless ENV["BROWSER"]
|
|
48
|
+
|
|
49
|
+
browser_env = ENV["BROWSER"].split(File::PATH_SEPARATOR)
|
|
50
|
+
browser_env.flatten!
|
|
51
|
+
browser_env.delete_if { |b| b.nil? || b.strip.empty? }
|
|
52
|
+
browser_env
|
|
55
53
|
end
|
|
56
54
|
|
|
57
|
-
|
|
55
|
+
# Get the full commandline of what we are going to add the uri to
|
|
56
|
+
def browser_cmdline
|
|
57
|
+
browser_env.each do |p|
|
|
58
|
+
Launchy.log "#{self.class.name} : possibility from BROWSER environment variable : #{p}"
|
|
59
|
+
end
|
|
60
|
+
app_list.each do |p|
|
|
61
|
+
Launchy.log "#{self.class.name} : possibility from app_list : #{p}"
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
possibilities = (browser_env + app_list).flatten
|
|
58
65
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
66
|
+
if (browser = possibilities.shift)
|
|
67
|
+
Launchy.log "#{self.class.name} : Using browser value '#{browser}'"
|
|
68
|
+
return browser
|
|
69
|
+
end
|
|
70
|
+
raise Launchy::CommandNotFoundError,
|
|
71
|
+
"Unable to find a browser command. If this is unexpected, #{Launchy.bug_report_message}"
|
|
62
72
|
end
|
|
63
|
-
raise Launchy::CommandNotFoundError, "Unable to find a browser command. If this is unexpected, #{Launchy.bug_report_message}"
|
|
64
|
-
end
|
|
65
73
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
cmd
|
|
74
|
+
def cmd_and_args(uri, _options = {})
|
|
75
|
+
cmd = browser_cmdline.to_s
|
|
76
|
+
args = [uri.to_s]
|
|
77
|
+
cmd.gsub!("%s", args.shift) if cmd.include?("%s")
|
|
78
|
+
[cmd, args]
|
|
71
79
|
end
|
|
72
|
-
return [cmd, args]
|
|
73
|
-
end
|
|
74
80
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
81
|
+
# final assembly of the command and do %s substitution
|
|
82
|
+
# http://www.catb.org/~esr/BROWSER/index.html
|
|
83
|
+
def open(uri, options = {})
|
|
84
|
+
cmd, args = cmd_and_args(uri, options)
|
|
85
|
+
run(cmd, args)
|
|
86
|
+
end
|
|
80
87
|
end
|
|
81
88
|
end
|
|
82
89
|
end
|
data/lib/launchy/argv.rb
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module Launchy
|
|
4
|
+
# Internal: Ecapsulate the commandline argumens passed to Launchy
|
|
5
|
+
#
|
|
2
6
|
class Argv
|
|
3
7
|
attr_reader :argv
|
|
4
|
-
|
|
8
|
+
|
|
9
|
+
def initialize(*args)
|
|
5
10
|
@argv = args.flatten
|
|
6
11
|
end
|
|
7
12
|
|
|
8
13
|
def to_s
|
|
9
|
-
@argv.join(
|
|
14
|
+
@argv.join(" ")
|
|
10
15
|
end
|
|
11
16
|
|
|
12
17
|
def to_str
|
|
@@ -18,18 +23,18 @@ module Launchy
|
|
|
18
23
|
end
|
|
19
24
|
|
|
20
25
|
def valid?
|
|
21
|
-
|
|
26
|
+
!blank? && executable?
|
|
22
27
|
end
|
|
23
28
|
|
|
24
29
|
def blank?
|
|
25
|
-
@argv.empty? ||
|
|
30
|
+
@argv.empty? || @argv.first.strip.empty?
|
|
26
31
|
end
|
|
27
32
|
|
|
28
33
|
def executable?
|
|
29
|
-
::Launchy::Application.find_executable(
|
|
34
|
+
::Launchy::Application.find_executable(@argv.first)
|
|
30
35
|
end
|
|
31
36
|
|
|
32
|
-
def ==(
|
|
37
|
+
def ==(other)
|
|
33
38
|
@argv == other.argv
|
|
34
39
|
end
|
|
35
40
|
end
|