launchy 2.4.3 → 2.5.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 +5 -5
- data/CONTRIBUTING.md +4 -3
- data/HISTORY.md +8 -0
- data/LICENSE +1 -1
- data/README.md +39 -8
- data/Rakefile +12 -10
- data/lib/launchy.rb +12 -1
- data/lib/launchy/application.rb +1 -1
- data/lib/launchy/detect/nix_desktop_environment.rb +4 -3
- data/lib/launchy/detect/runner.rb +2 -2
- data/lib/launchy/version.rb +1 -1
- data/spec/application_spec.rb +7 -7
- data/spec/applications/browser_spec.rb +29 -19
- data/spec/cli_spec.rb +10 -10
- data/spec/detect/host_os_family_spec.rb +6 -4
- data/spec/detect/host_os_spec.rb +3 -3
- data/spec/detect/nix_desktop_environment_spec.rb +4 -13
- data/spec/detect/ruby_engine_spec.rb +4 -4
- data/spec/detect/runner_spec.rb +12 -12
- data/spec/launchy_spec.rb +26 -17
- data/spec/version_spec.rb +3 -3
- data/tasks/default.rake +23 -53
- data/tasks/this.rb +19 -20
- metadata +32 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 45f9c18d9b5afe8a29abfbdfb770545f3616ee1ec2547d60762e14604fd5c2e6
|
4
|
+
data.tar.gz: e84671dd85e089af53899b7ee595450536522bf5f00bf88d61a775a70dfc0647
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ffb4ab18f93e33bbedfe05f3506574dc7163974bcaca7057d46eae15c1a3a7369d6031cf4779769e873c33bcfb16808e0e2dddfa4477fc72c469549b68ec5685
|
7
|
+
data.tar.gz: f43067afd034ea8b145a3b183ccd5ed3c4cfff4c2524233310112fdbb39e69fb7d1493f4b0816a58e7297dde8ef4efd783dec699ff262317dfe27b959b9d3943
|
data/CONTRIBUTING.md
CHANGED
@@ -27,9 +27,9 @@ easiest way to contribute.
|
|
27
27
|
* Fork the [repo][].
|
28
28
|
* Create a new branch for your issue: `git checkout -b issue/my-issue`
|
29
29
|
* Lovingly craft your contribution:
|
30
|
-
* `rake develop` to get started
|
31
|
-
* `rake test` to run tests
|
32
|
-
* Make sure that `rake test` passes. It's important, I said it twice.
|
30
|
+
* `rake develop` to get started
|
31
|
+
* `bundle exec rake test` to run tests
|
32
|
+
* Make sure that `bundle exec rake test` passes. It's important, I said it twice.
|
33
33
|
* Add yourself to the contributors section below.
|
34
34
|
* Submit your [pull request][].
|
35
35
|
|
@@ -50,6 +50,7 @@ easiest way to contribute.
|
|
50
50
|
* [Cédric Félizard](https://github.com/infertux)
|
51
51
|
* [Daniel Farina](https://github.com/fdr)
|
52
52
|
* [Jack Turnbull](https://github.com/jackturnbull)
|
53
|
+
* [Jeremy Moritz](https://github.com/jeremymoritz)
|
53
54
|
|
54
55
|
[GitHub Account]: https://github.com/signup/free "GitHub Signup"
|
55
56
|
[GitHub Issues]: https://github.com/copiousfreetime/launchy/issues "Launchy Issues"
|
data/HISTORY.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# Launchy Changelog
|
2
2
|
|
3
|
+
## Version 2.5.0 - 2020-02-27
|
4
|
+
* Update depedencies
|
5
|
+
* Update minimum ruby level
|
6
|
+
* Move to `kde-open` on KDE - <https://github.com/copiousfreetime/launchy/pull/105> - wstephenson
|
7
|
+
* Applied some grammer / spelling fixes - <https://github.com/copiousfreetime/launchy/pull/130> - jeremymoritz
|
8
|
+
* `Pathname` instances do not raise exceptions when opening local files - <https://github.com/copiousfreetime/launchy/issues/101> - dmke
|
9
|
+
* Add a fallback console browsers - <https://github.com/copiousfreetime/launchy/issues/93> - trejkaz
|
10
|
+
|
3
11
|
## Version 2.4.3 - 2014-11-03
|
4
12
|
* Update documentation - <https://github.com/copiousfreetime/launchy/pull/81> - supremebeing7
|
5
13
|
* Fix launching of `exo-open` for XFCE - <https://github.com/copiousfreetime/launchy/issues/82> - dsandstrom
|
data/LICENSE
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
ISC LICENSE - http://opensource.org/licenses/isc-license.txt
|
2
2
|
|
3
|
-
Copyright (c) 2007-
|
3
|
+
Copyright (c) 2007-2020 Jeremy Hinegardner
|
4
4
|
|
5
5
|
Permission to use, copy, modify, and/or distribute this software for any
|
6
6
|
purpose with or without fee is hereby granted, provided that the above
|
data/README.md
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
# launchy
|
2
2
|
|
3
|
+
[](https://travis-ci.org/copiousfreetime/launchy)
|
4
|
+
|
5
|
+
|
3
6
|
* [Homepage](https://github.com/copiousfreetime/launchy)
|
4
7
|
* [Github Project](https://github.com/copiousfreetime/launchy)
|
5
|
-
* email jeremy at hinegardner dot org
|
6
8
|
|
7
9
|
## DESCRIPTION
|
8
10
|
|
@@ -11,7 +13,7 @@ forget manner.
|
|
11
13
|
|
12
14
|
There are application concepts (browser, email client, etc) that are common
|
13
15
|
across all platforms, and they may be launched differently on each platform.
|
14
|
-
Launchy is here to make a common approach to launching external
|
16
|
+
Launchy is here to make a common approach to launching external applications from
|
15
17
|
within ruby programs.
|
16
18
|
|
17
19
|
## FEATURES
|
@@ -20,26 +22,55 @@ Currently only launching a browser is supported.
|
|
20
22
|
|
21
23
|
## SYNOPSIS
|
22
24
|
|
23
|
-
You can use launchy on the commandline, within the Capybara and Rspec-rails
|
25
|
+
You can use launchy on the commandline, within the Capybara and Rspec-rails
|
26
|
+
testing environment, or via its API.
|
24
27
|
|
25
28
|
### Commandline
|
26
29
|
|
27
30
|
% launchy http://www.ruby-lang.org/
|
28
31
|
|
29
|
-
There are additional
|
32
|
+
There are additional command line options, use `launchy --help` to see them.
|
33
|
+
|
34
|
+
### Using the `BROWSER` environment variable
|
35
|
+
|
36
|
+
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 fallbabck you can make
|
38
|
+
use of the somewhat standard `BROWSER` environment variable.
|
39
|
+
|
40
|
+
`BROWSER` works in a similar same way to `PATH`. It is a colon (`:`) separated
|
41
|
+
list of commands to try. You can also put in a `%s` in the command and the URL
|
42
|
+
you are attempting to open will be substituted there.
|
43
|
+
|
44
|
+
As an example if you set `BROWSER=/usr/local/bin/firefox-bin -new-tab
|
45
|
+
'%s':/usr/local/bin/google-chrome-stable` and you call
|
46
|
+
`Launchy.open("http://www.ruby-lang.org/")` then Launchy will try, in order:
|
47
|
+
|
48
|
+
* `/usr/local/bin/firefox-bin -new-tab 'http://www.ruby-lang.org'`
|
49
|
+
* `/usr/local/bin/google-chrome-stable http://www.ruby-lang.org`
|
50
|
+
|
51
|
+
Additional links on the use of `BROWSER` as an environment variable.
|
52
|
+
|
53
|
+
* http://www.catb.org/esr/BROWSER/index.html
|
54
|
+
* https://help.ubuntu.com/community/EnvironmentVariables
|
55
|
+
* https://wiki.archlinux.org/index.php/environment_variables
|
30
56
|
|
31
57
|
### Capybara Testing
|
32
58
|
|
33
|
-
First, install [Capybara](https://github.com/jnicklas/capybara) and [Rspec for
|
59
|
+
First, install [Capybara](https://github.com/jnicklas/capybara) and [Rspec for
|
60
|
+
Rails](https://github.com/rspec/rspec-rails). Capybara provides the following
|
61
|
+
method:
|
34
62
|
|
35
63
|
save_and_open_page
|
36
64
|
|
37
|
-
When inserted into your code at the place where you would like to open your
|
65
|
+
When inserted into your code at the place where you would like to open your
|
66
|
+
program, and when rspec is run, Capybara displays this message:
|
38
67
|
|
39
68
|
Page saved to /home/code/my_app_name/tmp/capybara/capybara-current-date-and-time.html with save_and_open_page.
|
40
69
|
Please install the launchy gem to open page automatically.
|
41
70
|
|
42
|
-
With Launchy installed, when rspec is run again, it will launch an unstyled
|
71
|
+
With Launchy installed, when rspec is run again, it will launch an unstyled
|
72
|
+
instance of the specific page. It can be especially useful when debugging errors
|
73
|
+
in integration tests. For example:
|
43
74
|
|
44
75
|
context "signin" do
|
45
76
|
it "lets a user sign in" do
|
@@ -119,7 +150,7 @@ API will be the documented one.
|
|
119
150
|
|
120
151
|
http://opensource.org/licenses/isc-license.txt
|
121
152
|
|
122
|
-
Copyright (c) 2007-
|
153
|
+
Copyright (c) 2007-2020 Jeremy Hinegardner
|
123
154
|
|
124
155
|
Permission to use, copy, modify, and/or distribute this software for any
|
125
156
|
purpose with or without fee is hereby granted, provided that the above
|
data/Rakefile
CHANGED
@@ -7,19 +7,21 @@ This.email = "jeremy@copiousfreetime.org"
|
|
7
7
|
This.homepage = "http://github.com/copiousfreetime/#{ This.name }"
|
8
8
|
|
9
9
|
This.ruby_gemspec do |spec|
|
10
|
-
spec.add_dependency( 'addressable', '~> 2.
|
10
|
+
spec.add_dependency( 'addressable', '~> 2.7')
|
11
11
|
|
12
|
-
spec.add_development_dependency( 'rake' , '~>
|
13
|
-
spec.add_development_dependency( 'minitest' , '~> 5.
|
14
|
-
spec.add_development_dependency( 'rdoc' , '~>
|
15
|
-
|
16
|
-
spec.licenses = ['ISC']
|
17
|
-
end
|
18
|
-
|
19
|
-
This.java_gemspec( This.ruby_gemspec ) do |spec|
|
20
|
-
spec.add_dependency( 'spoon', '~> 0.0.1' )
|
12
|
+
spec.add_development_dependency( 'rake' , '~> 13.0')
|
13
|
+
spec.add_development_dependency( 'minitest' , '~> 5.14' )
|
14
|
+
spec.add_development_dependency( 'rdoc' , '~> 6.2' )
|
15
|
+
spec.add_development_dependency( 'simplecov', '~> 0.18' )
|
21
16
|
|
22
17
|
spec.licenses = ['ISC']
|
18
|
+
|
19
|
+
spec.metadata = {
|
20
|
+
"bug_tracker_uri" => "https://github.com/copiousfreetime/launchy/issues",
|
21
|
+
"changelog_uri" => "https://github.com/copiousfreetime/launchy/blob/master/README.md",
|
22
|
+
"homepage_uri" => "https://github.com/copiousfreetime/launchy",
|
23
|
+
"source_code_uri" => "https://github.com/copiousfreetime/launchy",
|
24
|
+
}
|
23
25
|
end
|
24
26
|
|
25
27
|
load 'tasks/default.rake'
|
data/lib/launchy.rb
CHANGED
@@ -8,7 +8,8 @@ require 'addressable/uri'
|
|
8
8
|
# The currently defined global options are:
|
9
9
|
#
|
10
10
|
# :debug Turn on debugging output
|
11
|
-
# :application Explicitly state what application class is going to be used
|
11
|
+
# :application Explicitly state what application class is going to be used.
|
12
|
+
# This must be a child class of Launchy::Application
|
12
13
|
# :host_os Explicitly state what host operating system to pretend to be
|
13
14
|
# :ruby_engine Explicitly state what ruby engine to pretend to be under
|
14
15
|
# :dry_run Do nothing and print the command that would be executed on $stdout
|
@@ -48,6 +49,7 @@ module Launchy
|
|
48
49
|
end
|
49
50
|
|
50
51
|
def string_to_uri( s )
|
52
|
+
s = s.to_s
|
51
53
|
uri = Addressable::URI.parse( s )
|
52
54
|
Launchy.log "URI parsing pass 1 : #{s} -> #{uri.to_hash}"
|
53
55
|
if not uri.scheme then
|
@@ -64,6 +66,7 @@ module Launchy
|
|
64
66
|
Launchy.host_os = nil
|
65
67
|
Launchy.ruby_engine = nil
|
66
68
|
Launchy.dry_run = false
|
69
|
+
Launchy.path = ENV['PATH']
|
67
70
|
end
|
68
71
|
|
69
72
|
def extract_global_options( options )
|
@@ -125,6 +128,14 @@ module Launchy
|
|
125
128
|
$stderr.puts "LAUNCHY_DEBUG: #{msg}" if Launchy.debug?
|
126
129
|
end
|
127
130
|
|
131
|
+
def path
|
132
|
+
@path
|
133
|
+
end
|
134
|
+
|
135
|
+
def path=(path)
|
136
|
+
@path = path
|
137
|
+
end
|
138
|
+
|
128
139
|
private
|
129
140
|
def to_bool( arg )
|
130
141
|
if arg.is_a? String
|
data/lib/launchy/application.rb
CHANGED
@@ -27,7 +27,7 @@ module Launchy
|
|
27
27
|
#
|
28
28
|
# Find the given executable in the available paths
|
29
29
|
def find_executable( bin, *paths )
|
30
|
-
paths =
|
30
|
+
paths = Launchy.path.split( File::PATH_SEPARATOR ) if paths.empty?
|
31
31
|
paths.each do |path|
|
32
32
|
file = File.join( path, bin )
|
33
33
|
if File.executable?( file ) then
|
@@ -19,7 +19,7 @@ module Launchy::Detect
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def self.fallback_browsers
|
22
|
-
%w[ firefox iceweasel seamonkey opera mozilla netscape galeon ].map { |x| ::Launchy::Argv.new( x ) }
|
22
|
+
%w[ firefox iceweasel seamonkey opera mozilla netscape galeon links lynx ].map { |x| ::Launchy::Argv.new( x ) }
|
23
23
|
end
|
24
24
|
|
25
25
|
def self.browsers
|
@@ -32,11 +32,12 @@ module Launchy::Detect
|
|
32
32
|
|
33
33
|
class Kde < NixDesktopEnvironment
|
34
34
|
def self.is_current_desktop_environment?
|
35
|
-
ENV['KDE_FULL_SESSION']
|
35
|
+
ENV['KDE_FULL_SESSION'] &&
|
36
|
+
Launchy::Application.find_executable( 'kde-open' )
|
36
37
|
end
|
37
38
|
|
38
39
|
def self.browser
|
39
|
-
::Launchy::Argv.new(
|
40
|
+
::Launchy::Argv.new( 'kde-open' )
|
40
41
|
end
|
41
42
|
end
|
42
43
|
|
@@ -108,8 +108,8 @@ module Launchy::Detect
|
|
108
108
|
|
109
109
|
class Jruby < Runner
|
110
110
|
def wet_run( cmd, *args )
|
111
|
-
|
112
|
-
|
111
|
+
child_pid = spawn( *shell_commands( cmd, *args ) )
|
112
|
+
Process.detach( child_pid )
|
113
113
|
end
|
114
114
|
end
|
115
115
|
|
data/lib/launchy/version.rb
CHANGED
data/spec/application_spec.rb
CHANGED
@@ -14,30 +14,30 @@ describe Launchy::Application do
|
|
14
14
|
uri.scheme == "junk2"
|
15
15
|
end
|
16
16
|
end
|
17
|
-
Launchy::Application.children.must_include( Junk2App )
|
17
|
+
_(Launchy::Application.children).must_include( Junk2App )
|
18
18
|
Launchy::Application.children.delete( Junk2App )
|
19
19
|
end
|
20
20
|
|
21
21
|
it "can find an app" do
|
22
|
-
Launchy::Application.children.must_include( JunkApp )
|
23
|
-
Launchy::Application.children.size.must_equal 3
|
22
|
+
_(Launchy::Application.children).must_include( JunkApp )
|
23
|
+
_(Launchy::Application.children.size).must_equal 3
|
24
24
|
uri = Addressable::URI.parse( "junk:///foo" )
|
25
|
-
Launchy::Application.handling( uri ).must_equal( JunkApp )
|
25
|
+
_(Launchy::Application.handling( uri )).must_equal( JunkApp )
|
26
26
|
end
|
27
27
|
|
28
28
|
it "raises an error if an application cannot be found for the given scheme" do
|
29
29
|
uri = Addressable::URI.parse( "foo:///bar" )
|
30
|
-
lambda { Launchy::Application.handling( uri ) }.must_raise( Launchy::ApplicationNotFoundError )
|
30
|
+
_(lambda { Launchy::Application.handling( uri ) }).must_raise( Launchy::ApplicationNotFoundError )
|
31
31
|
end
|
32
32
|
|
33
33
|
it "can find open or curl or xdg-open" do
|
34
34
|
found = %w[ open curl xdg-open ].any? do |app|
|
35
35
|
Launchy::Application.find_executable( app )
|
36
36
|
end
|
37
|
-
found.must_equal true
|
37
|
+
_(found).must_equal true
|
38
38
|
end
|
39
39
|
|
40
40
|
it "does not find xyzzy" do
|
41
|
-
Launchy::Application.find_executable( "xyzzy" ).
|
41
|
+
_(Launchy::Application.find_executable( "xyzzy" )).must_be_nil
|
42
42
|
end
|
43
43
|
end
|
@@ -14,15 +14,22 @@ describe Launchy::Application::Browser do
|
|
14
14
|
end
|
15
15
|
|
16
16
|
{ 'windows' => 'start "launchy" /b' ,
|
17
|
-
'darwin' => '/usr/bin/open',
|
17
|
+
'darwin' => [ '/usr/bin/open', '/bin/open' ], # because running tests on linux
|
18
18
|
'cygwin' => 'cmd /C start "launchy" /b',
|
19
|
-
|
20
|
-
|
21
|
-
'linux' => nil }.each do |host_os, cmdline|
|
19
|
+
'linux' => [nil, "xdg-open"], # because running tests on linux
|
20
|
+
}.each do |host_os, expected|
|
22
21
|
it "when host_os is '#{host_os}' the appropriate 'app_list' method is called" do
|
23
22
|
Launchy.host_os = host_os
|
24
23
|
browser = Launchy::Application::Browser.new
|
25
|
-
|
24
|
+
|
25
|
+
item = browser.app_list.first
|
26
|
+
item = item.to_s if item.kind_of?(::Launchy::Argv)
|
27
|
+
case expected
|
28
|
+
when Array
|
29
|
+
_(expected).must_include item
|
30
|
+
when String
|
31
|
+
_(item).must_equal expected
|
32
|
+
end
|
26
33
|
end
|
27
34
|
end
|
28
35
|
|
@@ -32,14 +39,14 @@ describe Launchy::Application::Browser do
|
|
32
39
|
Launchy.host_os = host_os
|
33
40
|
browser = Launchy::Application::Browser.new
|
34
41
|
cmd, args = browser.cmd_and_args( @test_url )
|
35
|
-
cmd.must_equal "my_special_browser --new-tab 'http://example.com/'"
|
36
|
-
args.must_equal []
|
42
|
+
_(cmd).must_equal "my_special_browser --new-tab 'http://example.com/'"
|
43
|
+
_(args).must_equal []
|
37
44
|
end
|
38
45
|
end
|
39
46
|
|
40
47
|
it "handles a file on the file system when there is no file:// scheme" do
|
41
48
|
uri = Addressable::URI.parse( __FILE__ )
|
42
|
-
Launchy::Application::Browser.handles?( uri ).must_equal true
|
49
|
+
_(Launchy::Application::Browser.handles?( uri )).must_equal true
|
43
50
|
end
|
44
51
|
|
45
52
|
it "handles the case where $BROWSER is set and no *nix desktop environment is found" do
|
@@ -48,21 +55,24 @@ describe Launchy::Application::Browser do
|
|
48
55
|
ENV['BROWSER'] = "do-this-instead"
|
49
56
|
Launchy.host_os = 'linux'
|
50
57
|
browser = Launchy::Application::Browser.new
|
51
|
-
browser.browser_cmdline.must_equal "do-this-instead"
|
58
|
+
_(browser.browser_cmdline).must_equal "do-this-instead"
|
52
59
|
end
|
53
60
|
|
54
61
|
# NOTE: Unable to figure out how capture the stderr from the child which has
|
55
62
|
# moved it at least once. This test just serves the purpose of noting why
|
56
|
-
# something happens, and the
|
57
|
-
it "When BROWSER is set to something that is not executable, error still appears on stderr" do
|
58
|
-
|
59
|
-
|
63
|
+
# something happens, and the problem we are attempting to fix.
|
64
|
+
#it "When BROWSER is set to something that is not executable, error still appears on stderr" do
|
65
|
+
# ENV['BROWSER'] = "not-an-app"
|
66
|
+
# url = "http://example.com/"
|
60
67
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
end
|
68
|
+
# _, err = capture_subprocess_io do
|
69
|
+
# begin
|
70
|
+
# Launchy.open( url )
|
71
|
+
# rescue => nil
|
72
|
+
# end
|
73
|
+
# end
|
74
|
+
# #_(err).must_match( /wibble/m )
|
75
|
+
# err # something
|
76
|
+
#end
|
67
77
|
end
|
68
78
|
|
data/spec/cli_spec.rb
CHANGED
@@ -21,9 +21,9 @@ describe Launchy::Cli do
|
|
21
21
|
begin
|
22
22
|
Launchy::Cli.new.run( argv, env )
|
23
23
|
rescue SystemExit => se
|
24
|
-
se.status.must_equal exit_val
|
25
|
-
$stderr.string.must_match stderr_regex if stderr_regex
|
26
|
-
$stdout.string.must_match stdout_regex if stdout_regex
|
24
|
+
_(se.status).must_equal exit_val
|
25
|
+
_($stderr.string).must_match stderr_regex if stderr_regex
|
26
|
+
_($stdout.string).must_match stdout_regex if stdout_regex
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
@@ -47,14 +47,14 @@ describe Launchy::Cli do
|
|
47
47
|
l = Launchy::Cli.new
|
48
48
|
argv = %w[ --debug --dry-run http://github.com/copiousfreetime/launchy ]
|
49
49
|
l.parse( argv , {} )
|
50
|
-
argv.size.must_equal 1
|
51
|
-
argv[0].must_equal "http://github.com/copiousfreetime/launchy"
|
50
|
+
_(argv.size).must_equal 1
|
51
|
+
_(argv[0]).must_equal "http://github.com/copiousfreetime/launchy"
|
52
52
|
end
|
53
53
|
|
54
54
|
it "prints the command on stdout when using --dry-run" do
|
55
55
|
argv = %w[ --debug --dry-run http://github.com/copiousfreetime/launchy ]
|
56
56
|
Launchy::Cli.new.good_run( argv, {} )
|
57
|
-
$stdout.string.must_match %r[github.com]
|
57
|
+
_($stdout.string).must_match %r[github.com]
|
58
58
|
end
|
59
59
|
|
60
60
|
{
|
@@ -65,10 +65,10 @@ describe Launchy::Cli do
|
|
65
65
|
argv = [ opt, val[1], "http://github.com/copiousfreetime/launchy" ]
|
66
66
|
l = Launchy::Cli.new
|
67
67
|
rc = l.parse( argv, {} )
|
68
|
-
rc.must_equal true
|
69
|
-
argv.size.must_equal 1
|
70
|
-
argv[0].must_equal "http://github.com/copiousfreetime/launchy"
|
71
|
-
l.options[val[0]].must_equal val[1]
|
68
|
+
_(rc).must_equal true
|
69
|
+
_(argv.size).must_equal 1
|
70
|
+
_(argv[0]).must_equal "http://github.com/copiousfreetime/launchy"
|
71
|
+
_(l.options[val[0]]).must_equal val[1]
|
72
72
|
end
|
73
73
|
end
|
74
74
|
end
|
@@ -13,7 +13,8 @@ describe Launchy::Detect::HostOsFamily do
|
|
13
13
|
|
14
14
|
YAML::load( IO.read( File.expand_path( "../../tattle-host-os.yaml", __FILE__ ) ) )['host_os'].keys.sort.each do |os|
|
15
15
|
it "OS family of #{os} is detected" do
|
16
|
-
Launchy::Detect::HostOsFamily.detect( os )
|
16
|
+
os_family = Launchy::Detect::HostOsFamily.detect( os )
|
17
|
+
_(os_family).must_be_kind_of Launchy::Detect::HostOsFamily
|
17
18
|
end
|
18
19
|
end
|
19
20
|
|
@@ -22,19 +23,20 @@ describe Launchy::Detect::HostOsFamily do
|
|
22
23
|
'linux' => :nix?,
|
23
24
|
'cygwin' => :cygwin? }.each_pair do |os, method|
|
24
25
|
it "#{method} returns true for #{os} " do
|
25
|
-
Launchy::Detect::HostOsFamily.detect( os ).send( method )
|
26
|
+
r = Launchy::Detect::HostOsFamily.detect( os ).send( method )
|
27
|
+
_(r).must_equal true
|
26
28
|
end
|
27
29
|
end
|
28
30
|
|
29
31
|
it "uses the global host_os overrides" do
|
30
32
|
ENV['LAUNCHY_HOST_OS'] = "fake-os-2"
|
31
|
-
lambda { Launchy::Detect::HostOsFamily.detect }.must_raise Launchy::Detect::HostOsFamily::NotFoundError
|
33
|
+
_(lambda { Launchy::Detect::HostOsFamily.detect }).must_raise Launchy::Detect::HostOsFamily::NotFoundError
|
32
34
|
ENV.delete('LAUNCHY_HOST_OS')
|
33
35
|
end
|
34
36
|
|
35
37
|
|
36
38
|
it "does not find an os of 'dos'" do
|
37
|
-
lambda { Launchy::Detect::HostOsFamily.detect( 'dos' ) }.must_raise Launchy::Detect::HostOsFamily::NotFoundError
|
39
|
+
_(lambda { Launchy::Detect::HostOsFamily.detect( 'dos' ) }).must_raise Launchy::Detect::HostOsFamily::NotFoundError
|
38
40
|
end
|
39
41
|
|
40
42
|
end
|
data/spec/detect/host_os_spec.rb
CHANGED
@@ -3,16 +3,16 @@ require 'spec_helper'
|
|
3
3
|
describe Launchy::Detect::HostOs do
|
4
4
|
|
5
5
|
it "uses the defult host os from ruby's config" do
|
6
|
-
Launchy::Detect::HostOs.new.host_os.must_equal RbConfig::CONFIG['host_os']
|
6
|
+
_(Launchy::Detect::HostOs.new.host_os).must_equal RbConfig::CONFIG['host_os']
|
7
7
|
end
|
8
8
|
|
9
9
|
it "uses the passed in value as the host os" do
|
10
|
-
Launchy::Detect::HostOs.new( "fake-os-1").host_os.must_equal "fake-os-1"
|
10
|
+
_(Launchy::Detect::HostOs.new( "fake-os-1").host_os).must_equal "fake-os-1"
|
11
11
|
end
|
12
12
|
|
13
13
|
it "uses the environment variable LAUNCHY_HOST_OS to override ruby's config" do
|
14
14
|
ENV['LAUNCHY_HOST_OS'] = "fake-os-2"
|
15
|
-
Launchy::Detect::HostOs.new.host_os.must_equal "fake-os-2"
|
15
|
+
_(Launchy::Detect::HostOs.new.host_os).must_equal "fake-os-2"
|
16
16
|
ENV.delete('LAUNCHY_HOST_OS')
|
17
17
|
end
|
18
18
|
|
@@ -10,27 +10,18 @@ describe Launchy::Detect::NixDesktopEnvironment do
|
|
10
10
|
Launchy.reset_global_options
|
11
11
|
end
|
12
12
|
|
13
|
-
it "can detect the desktop environment of a KDE machine using ENV['KDE_FULL_SESSION']" do
|
14
|
-
ENV.delete( "KDE_FULL_SESSION" )
|
15
|
-
ENV["KDE_FULL_SESSION"] = "launchy-test"
|
16
|
-
kde = Launchy::Detect::NixDesktopEnvironment::Kde
|
17
|
-
nix_env = Launchy::Detect::NixDesktopEnvironment.detect
|
18
|
-
nix_env.must_equal( kde )
|
19
|
-
nix_env.browser.must_equal( kde.browser )
|
20
|
-
ENV.delete( 'KDE_FULL_SESSION' )
|
21
|
-
end
|
22
|
-
|
23
13
|
it "returns false for XFCE if xprop is not found" do
|
24
14
|
Launchy.host_os = "linux"
|
25
|
-
Launchy::Detect::NixDesktopEnvironment::Xfce.is_current_desktop_environment
|
15
|
+
_(Launchy::Detect::NixDesktopEnvironment::Xfce.is_current_desktop_environment?).must_equal( false )
|
26
16
|
end
|
27
17
|
|
28
18
|
it "returns NotFound if it cannot determine the *nix desktop environment" do
|
29
19
|
Launchy.host_os = "linux"
|
30
20
|
ENV.delete( "KDE_FULL_SESSION" )
|
31
21
|
ENV.delete( "GNOME_DESKTOP_SESSION_ID" )
|
22
|
+
Launchy.path = %w[ / /tmp ].join(File::PATH_SEPARATOR)
|
32
23
|
not_found = Launchy::Detect::NixDesktopEnvironment.detect
|
33
|
-
not_found.must_equal( Launchy::Detect::NixDesktopEnvironment::NotFound )
|
34
|
-
not_found.browser.must_equal( Launchy::Argv.new )
|
24
|
+
_(not_found).must_equal( Launchy::Detect::NixDesktopEnvironment::NotFound )
|
25
|
+
_(not_found.browser).must_equal( Launchy::Argv.new )
|
35
26
|
end
|
36
27
|
end
|
@@ -12,18 +12,18 @@ describe Launchy::Detect::RubyEngine do
|
|
12
12
|
|
13
13
|
%w[ ruby jruby rbx macruby ].each do |ruby|
|
14
14
|
it "detects the #{ruby} RUBY_ENGINE" do
|
15
|
-
Launchy::Detect::RubyEngine.detect( ruby ).ancestors.must_include Launchy::Detect::RubyEngine
|
15
|
+
_(Launchy::Detect::RubyEngine.detect( ruby ).ancestors).must_include Launchy::Detect::RubyEngine
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
19
|
it "uses the global ruby_engine overrides" do
|
20
20
|
ENV['LAUNCHY_RUBY_ENGINE'] = "rbx"
|
21
|
-
Launchy::Detect::RubyEngine.detect.must_equal Launchy::Detect::RubyEngine::Rbx
|
21
|
+
_(Launchy::Detect::RubyEngine.detect).must_equal Launchy::Detect::RubyEngine::Rbx
|
22
22
|
ENV.delete('LAUNCHY_RUBY_ENGINE')
|
23
23
|
end
|
24
24
|
|
25
25
|
it "does not find a ruby engine of 'foo'" do
|
26
|
-
lambda { Launchy::Detect::RubyEngine.detect( 'foo' ) }.must_raise Launchy::Detect::RubyEngine::NotFoundError
|
26
|
+
_(lambda { Launchy::Detect::RubyEngine.detect( 'foo' ) }).must_raise Launchy::Detect::RubyEngine::NotFoundError
|
27
27
|
end
|
28
28
|
|
29
29
|
{ 'rbx' => :rbx?,
|
@@ -31,7 +31,7 @@ describe Launchy::Detect::RubyEngine do
|
|
31
31
|
'macruby' => :macruby?,
|
32
32
|
'jruby' => :jruby? }.each_pair do |engine, method|
|
33
33
|
it "#{method} returns true for #{engine} " do
|
34
|
-
Launchy::Detect::RubyEngine.detect( engine ).send( method ).must_equal true
|
34
|
+
_(Launchy::Detect::RubyEngine.detect( engine ).send( method )).must_equal true
|
35
35
|
end
|
36
36
|
end
|
37
37
|
end
|
data/spec/detect/runner_spec.rb
CHANGED
@@ -13,17 +13,17 @@ describe Launchy::Detect::Runner do
|
|
13
13
|
|
14
14
|
it "raises an error when there is an unknown host os" do
|
15
15
|
Launchy.host_os = "foo"
|
16
|
-
lambda{ Launchy::Detect::Runner.detect }.must_raise Launchy::Detect::HostOsFamily::NotFoundError
|
16
|
+
_(lambda{ Launchy::Detect::Runner.detect }).must_raise Launchy::Detect::HostOsFamily::NotFoundError
|
17
17
|
end
|
18
18
|
|
19
19
|
it "raises an error when there is an unknown ruby engine" do
|
20
20
|
Launchy.ruby_engine = "wibble"
|
21
|
-
lambda{ Launchy::Detect::Runner.detect }.must_raise Launchy::Detect::RubyEngine::NotFoundError
|
21
|
+
_(lambda{ Launchy::Detect::Runner.detect }).must_raise Launchy::Detect::RubyEngine::NotFoundError
|
22
22
|
end
|
23
23
|
|
24
24
|
it "raises and error when there is no command found" do
|
25
25
|
runner = Launchy::Detect::Runner.detect
|
26
|
-
lambda{ runner.run( nil, *%w[ arg1 arg2 arg 3] ) }.must_raise Launchy::CommandNotFoundError
|
26
|
+
_(lambda{ runner.run( nil, *%w[ arg1 arg2 arg 3] ) }).must_raise Launchy::CommandNotFoundError
|
27
27
|
end
|
28
28
|
|
29
29
|
# On anything that has fork, use Forkable
|
@@ -33,7 +33,7 @@ describe Launchy::Detect::Runner do
|
|
33
33
|
Launchy.host_os = host_os
|
34
34
|
Launchy.ruby_engine = engine_name
|
35
35
|
engine = Launchy::Detect::Runner.detect
|
36
|
-
engine.must_be_instance_of Launchy::Detect::Runner::Forkable
|
36
|
+
_(engine).must_be_instance_of Launchy::Detect::Runner::Forkable
|
37
37
|
end
|
38
38
|
end
|
39
39
|
end
|
@@ -48,7 +48,7 @@ describe Launchy::Detect::Runner do
|
|
48
48
|
Launchy.host_os = host_os
|
49
49
|
Launchy.ruby_engine = 'jruby'
|
50
50
|
engine = Launchy::Detect::Runner.detect
|
51
|
-
engine.must_be_instance_of runner
|
51
|
+
_(engine).must_be_instance_of runner
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
@@ -58,14 +58,14 @@ describe Launchy::Detect::Runner do
|
|
58
58
|
Launchy.host_os = "mingw"
|
59
59
|
Launchy.ruby_engine = engine_name
|
60
60
|
e = Launchy::Detect::Runner.detect
|
61
|
-
e.must_be_instance_of Launchy::Detect::Runner::Windows
|
61
|
+
_(e).must_be_instance_of Launchy::Detect::Runner::Windows
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
65
65
|
it "Windows launches use the 'cmd' command" do
|
66
66
|
win = Launchy::Detect::Runner::Windows.new
|
67
67
|
cmd = win.dry_run( "not-really", [ "http://example.com" ] )
|
68
|
-
cmd.must_equal 'cmd /c not-really http://example.com'
|
68
|
+
_(cmd).must_equal 'cmd /c not-really http://example.com'
|
69
69
|
end
|
70
70
|
|
71
71
|
%w[ & | ( ) < > ^ ].each do |reserved_char|
|
@@ -75,29 +75,29 @@ describe Launchy::Detect::Runner do
|
|
75
75
|
url = parts.join( reserved_char )
|
76
76
|
output_url = parts.join( "^#{reserved_char}" )
|
77
77
|
|
78
|
-
win.all_args( "not-really", [ url ] ).must_equal [ 'cmd', '/c', 'not-really', output_url ]
|
78
|
+
_(win.all_args( "not-really", [ url ] )).must_equal [ 'cmd', '/c', 'not-really', output_url ]
|
79
79
|
|
80
80
|
cmd = win.dry_run( "not-really", [ url ] )
|
81
|
-
cmd.must_equal "cmd /c not-really #{output_url}"
|
81
|
+
_(cmd).must_equal "cmd /c not-really #{output_url}"
|
82
82
|
end
|
83
83
|
end
|
84
84
|
|
85
85
|
it "Jruby doesnot escapes '&' in urls" do
|
86
86
|
jruby = Launchy::Detect::Runner::Jruby.new
|
87
87
|
cmd = jruby.dry_run( "not-really", [ @test_url ])
|
88
|
-
cmd.must_equal 'not-really http://example.com/?foo=bar&baz=wibble'
|
88
|
+
_(cmd).must_equal 'not-really http://example.com/?foo=bar&baz=wibble'
|
89
89
|
end
|
90
90
|
|
91
91
|
it "does not escape %38 items in urls" do
|
92
92
|
l = Launchy::Detect::Runner::Forkable.new
|
93
93
|
cmd = l.dry_run( "not-really", [ "http://ja.wikipedia.org/wiki/%E3%81%82" ] )
|
94
|
-
cmd.must_equal( 'not-really http://ja.wikipedia.org/wiki/%E3%81%82' )
|
94
|
+
_(cmd).must_equal( 'not-really http://ja.wikipedia.org/wiki/%E3%81%82' )
|
95
95
|
end
|
96
96
|
|
97
97
|
it "can launch a utf8 url" do
|
98
98
|
url = "http://ja.wikipedia.org/wiki/あ"
|
99
99
|
l = Launchy::Detect::Runner::Forkable.new
|
100
100
|
cmd = l.dry_run( "not-really", [ url ] )
|
101
|
-
cmd.must_equal( "not-really #{url}" )
|
101
|
+
_(cmd).must_equal( "not-really #{url}" )
|
102
102
|
end
|
103
103
|
end
|
data/spec/launchy_spec.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
+
require 'pathname'
|
2
3
|
|
3
4
|
describe Launchy do
|
4
5
|
|
@@ -22,7 +23,7 @@ describe Launchy do
|
|
22
23
|
old_stderr = $stderr
|
23
24
|
$stderr = StringIO.new
|
24
25
|
Launchy.log "This is a test log message"
|
25
|
-
$stderr.string.strip.must_equal "LAUNCHY_DEBUG: This is a test log message"
|
26
|
+
_($stderr.string.strip).must_equal "LAUNCHY_DEBUG: This is a test log message"
|
26
27
|
$stderr = old_stderr
|
27
28
|
ENV["LAUNCHY_DEBUG"] = nil
|
28
29
|
end
|
@@ -30,81 +31,89 @@ describe Launchy do
|
|
30
31
|
it "sets the global option :dry_run to true if LAUNCHY_DRY_RUN environment variable is 'true'" do
|
31
32
|
ENV['LAUNCHY_DRY_RUN'] = 'true'
|
32
33
|
Launchy.extract_global_options({})
|
33
|
-
Launchy.dry_run
|
34
|
+
_(Launchy.dry_run?).must_equal true
|
34
35
|
ENV['LAUNCHY_DRY_RUN'] = nil
|
35
36
|
end
|
36
37
|
|
37
38
|
it "sets the global option :debug to true if LAUNCHY_DEBUG environment variable is 'true'" do
|
38
39
|
ENV['LAUNCHY_DEBUG'] = 'true'
|
39
40
|
Launchy.extract_global_options({})
|
40
|
-
Launchy.debug
|
41
|
+
_(Launchy.debug?).must_equal true
|
41
42
|
ENV['LAUNCHY_DEBUG'] = nil
|
42
43
|
end
|
43
44
|
|
44
45
|
it "has the global option :debug" do
|
45
46
|
Launchy.extract_global_options( { :debug => 'true' } )
|
46
|
-
Launchy.debug
|
47
|
+
_(Launchy.debug?).must_equal true
|
47
48
|
Launchy.extract_global_options( { :debug => true } )
|
48
|
-
Launchy.debug
|
49
|
+
_(Launchy.debug?).must_equal true
|
49
50
|
end
|
50
51
|
|
51
52
|
it "has the global option :dry_run" do
|
52
53
|
Launchy.extract_global_options( { :dry_run => 'true' } )
|
53
|
-
Launchy.dry_run
|
54
|
+
_(Launchy.dry_run?).must_equal true
|
54
55
|
Launchy.extract_global_options( { :dry_run => true } )
|
55
|
-
Launchy.dry_run
|
56
|
+
_(Launchy.dry_run?).must_equal true
|
56
57
|
end
|
57
58
|
|
58
59
|
it "has the global option :application" do
|
59
60
|
Launchy.extract_global_options( { :application => "wibble" } )
|
60
|
-
Launchy.application.must_equal 'wibble'
|
61
|
+
_(Launchy.application).must_equal 'wibble'
|
61
62
|
end
|
62
63
|
|
63
64
|
it "has the global option :host_os" do
|
64
65
|
Launchy.extract_global_options( { :host_os => "my-special-os-v2" } )
|
65
|
-
Launchy.host_os.must_equal 'my-special-os-v2'
|
66
|
+
_(Launchy.host_os).must_equal 'my-special-os-v2'
|
66
67
|
end
|
67
68
|
|
68
69
|
it "has the global option :ruby_engine" do
|
69
70
|
Launchy.extract_global_options( { :ruby_engine => "myruby" } )
|
70
|
-
Launchy.ruby_engine.must_equal 'myruby'
|
71
|
+
_(Launchy.ruby_engine).must_equal 'myruby'
|
71
72
|
end
|
72
73
|
|
73
74
|
it "raises an exception if no scheme is found for the given uri" do
|
74
|
-
lambda { Launchy.open( @invalid_url ) }.must_raise Launchy::ApplicationNotFoundError
|
75
|
+
_(lambda { Launchy.open( @invalid_url ) }).must_raise Launchy::ApplicationNotFoundError
|
75
76
|
end
|
76
77
|
|
77
78
|
it "asssumes we open a local file if we have an exception if we have an invalid scheme and a valid path" do
|
78
79
|
uri = "blah://example.com/#{__FILE__}"
|
79
80
|
Launchy.open( uri , :dry_run => true )
|
80
|
-
$stdout.string.strip.
|
81
|
+
parts = $stdout.string.strip.split
|
82
|
+
_(parts.size).must_be :>, 1
|
83
|
+
_(parts.last).must_equal uri
|
81
84
|
end
|
82
85
|
|
83
86
|
it "opens a local file if we have a drive letter and a valid path on windows" do
|
84
87
|
uri = "C:#{__FILE__}"
|
85
88
|
Launchy.open( uri, :dry_run => true, :host_os => 'windows' )
|
86
|
-
$stdout.string.strip.must_equal 'cmd /c start "launchy" /b ' + uri
|
89
|
+
_($stdout.string.strip).must_equal 'cmd /c start "launchy" /b ' + uri
|
87
90
|
end
|
88
91
|
|
89
92
|
it "calls the block if instead of raising an exception if there is an error" do
|
90
93
|
Launchy.open( @invalid_url ) { $stderr.puts "oops had an error opening #{@invalid_url}" }
|
91
|
-
$stderr.string.strip.must_equal "oops had an error opening #{@invalid_url}"
|
94
|
+
_($stderr.string.strip).must_equal "oops had an error opening #{@invalid_url}"
|
92
95
|
end
|
93
96
|
|
94
97
|
it "calls the block with the values passed to launchy and the error" do
|
95
98
|
options = { :dry_run => true }
|
96
99
|
Launchy.open( @invalid_url, :dry_run => true ) { |e| $stderr.puts "had an error opening #{@invalid_url} with options #{options}: #{e}" }
|
97
|
-
$stderr.string.strip.must_equal "had an error opening #{@invalid_url} with options #{options}: No application found to handle '#{@invalid_url}'"
|
100
|
+
_($stderr.string.strip).must_equal "had an error opening #{@invalid_url} with options #{options}: No application found to handle '#{@invalid_url}'"
|
98
101
|
end
|
99
102
|
|
100
103
|
it "raises the error in the called block" do
|
101
|
-
lambda { Launchy.open( @invalid_url ) { raise StandardError, "KABOOM!" } }.must_raise StandardError
|
104
|
+
_(lambda { Launchy.open( @invalid_url ) { raise StandardError, "KABOOM!" } }).must_raise StandardError
|
102
105
|
end
|
103
106
|
|
104
107
|
[ 'www.example.com', 'www.example.com/foo/bar', "C:#{__FILE__}" ].each do |x|
|
105
108
|
it "picks a Browser for #{x}" do
|
106
109
|
app = Launchy.app_for_uri_string( x )
|
107
|
-
app.must_equal( Launchy::Application::Browser )
|
110
|
+
_(app).must_equal( Launchy::Application::Browser )
|
108
111
|
end
|
109
112
|
end
|
113
|
+
|
114
|
+
it "can use a Pathname as the URI" do
|
115
|
+
path = Pathname.new( Dir.pwd )
|
116
|
+
app = Launchy.app_for_uri_string( path )
|
117
|
+
_(app).must_equal( Launchy::Application::Browser )
|
118
|
+
end
|
110
119
|
end
|
data/spec/version_spec.rb
CHANGED
@@ -2,10 +2,10 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe 'Launchy::VERSION' do
|
4
4
|
it "should have a #.#.# format" do
|
5
|
-
Launchy::VERSION.must_match( /\d+\.\d+\.\d+/ )
|
6
|
-
Launchy::Version.to_s.must_match( /\d+\.\d+\.\d+/ )
|
5
|
+
_(Launchy::VERSION).must_match( /\d+\.\d+\.\d+/ )
|
6
|
+
_(Launchy::Version.to_s).must_match( /\d+\.\d+\.\d+/ )
|
7
7
|
Launchy::Version.to_a.each do |n|
|
8
|
-
n.to_i.must_be :>=, 0
|
8
|
+
_(n.to_i).must_be :>=, 0
|
9
9
|
end
|
10
10
|
end
|
11
11
|
end
|
data/tasks/default.rake
CHANGED
@@ -10,41 +10,26 @@ namespace :develop do
|
|
10
10
|
|
11
11
|
# Install all the development and runtime dependencies of this gem using the
|
12
12
|
# gemspec.
|
13
|
-
task :default do
|
13
|
+
task :default => 'Gemfile' do
|
14
14
|
require 'rubygems/dependency_installer'
|
15
15
|
installer = ::Gem::DependencyInstaller.new
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
puts "Installing gem depedencies needed for development"
|
20
|
-
This.platform_gemspec.dependencies.each do |dep|
|
21
|
-
if dep.matching_specs.empty? then
|
22
|
-
puts "Installing : #{dep}"
|
23
|
-
installer.install dep
|
24
|
-
else
|
25
|
-
puts "Skipping : #{dep} -> already installed #{dep.matching_specs.first.full_name}"
|
26
|
-
end
|
27
|
-
end
|
16
|
+
puts "Installing bundler..."
|
17
|
+
installer.install 'bundler'
|
18
|
+
sh 'bundle install'
|
28
19
|
puts "\n\nNow run 'rake test'"
|
29
20
|
end
|
30
21
|
|
31
22
|
# Create a Gemfile that just references the gemspec
|
32
23
|
file 'Gemfile' => :gemspec do
|
33
24
|
File.open( "Gemfile", "w+" ) do |f|
|
34
|
-
f.puts
|
25
|
+
f.puts "# DO NOT EDIT - This file is automatically generated"
|
26
|
+
f.puts "# Make changes to Manifest.txt and/or Rakefile and regenerate"
|
27
|
+
f.puts 'source "https://rubygems.org"'
|
35
28
|
f.puts 'gemspec'
|
36
29
|
end
|
37
30
|
end
|
38
|
-
|
39
|
-
desc "Create a bundler Gemfile"
|
40
|
-
task :using_bundler => 'Gemfile' do
|
41
|
-
puts "Now you can 'bundle'"
|
42
|
-
end
|
43
|
-
|
44
|
-
# Gemfiles are build artifacts
|
45
|
-
CLOBBER << FileList['Gemfile*']
|
46
31
|
end
|
47
|
-
desc "
|
32
|
+
desc "Bootstrap development"
|
48
33
|
task :develop => "develop:default"
|
49
34
|
|
50
35
|
#------------------------------------------------------------------------------
|
@@ -53,7 +38,7 @@ task :develop => "develop:default"
|
|
53
38
|
begin
|
54
39
|
require 'rake/testtask'
|
55
40
|
Rake::TestTask.new( :test ) do |t|
|
56
|
-
t.ruby_opts = %w[ -w
|
41
|
+
t.ruby_opts = %w[ -w ]
|
57
42
|
t.libs = %w[ lib spec test ]
|
58
43
|
t.pattern = "{test,spec}/**/{test_*,*_spec}.rb"
|
59
44
|
end
|
@@ -88,31 +73,16 @@ end
|
|
88
73
|
# Coverage - optional code coverage, rcov for 1.8 and simplecov for 1.9, so
|
89
74
|
# for the moment only rcov is listed.
|
90
75
|
#------------------------------------------------------------------------------
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
t.verbose = true
|
98
|
-
t.rcov_opts << "-x ^/" # remove all the global files
|
99
|
-
t.rcov_opts << "--sort coverage" # so we see the worst files at the top
|
100
|
-
end
|
101
|
-
rescue LoadError
|
102
|
-
This.task_warning( 'rcov' )
|
103
|
-
end
|
104
|
-
else
|
105
|
-
begin
|
106
|
-
require 'simplecov'
|
107
|
-
desc 'Run tests with code coverage'
|
108
|
-
task :coverage do
|
109
|
-
ENV['COVERAGE'] = 'true'
|
110
|
-
Rake::Task[:test].execute
|
111
|
-
end
|
112
|
-
CLOBBER << FileList["coverage"]
|
113
|
-
rescue LoadError
|
114
|
-
This.task_warning( 'simplecov' )
|
76
|
+
begin
|
77
|
+
require 'simplecov'
|
78
|
+
desc 'Run tests with code coverage'
|
79
|
+
task :coverage do
|
80
|
+
ENV['COVERAGE'] = 'true'
|
81
|
+
Rake::Task[:test].execute
|
115
82
|
end
|
83
|
+
CLOBBER << 'coverage' if File.directory?( 'coverage' )
|
84
|
+
rescue LoadError
|
85
|
+
This.task_warning( 'simplecov' )
|
116
86
|
end
|
117
87
|
|
118
88
|
#------------------------------------------------------------------------------
|
@@ -177,9 +147,10 @@ namespace :fixme do
|
|
177
147
|
end
|
178
148
|
|
179
149
|
def outdated_fixme_files
|
180
|
-
local_fixme_files.
|
150
|
+
local_fixme_files.select do |local|
|
181
151
|
upstream = fixme_project_path( local )
|
182
|
-
|
152
|
+
upstream.exist? &&
|
153
|
+
( Digest::SHA256.file( local ) != Digest::SHA256.file( upstream ) )
|
183
154
|
end
|
184
155
|
end
|
185
156
|
|
@@ -223,13 +194,12 @@ task :fixme => "fixme:default"
|
|
223
194
|
desc "Build the #{This.name}.gemspec file"
|
224
195
|
task :gemspec do
|
225
196
|
File.open( This.gemspec_file, "wb+" ) do |f|
|
197
|
+
f.puts "# DO NOT EDIT - This file is automatically generated"
|
198
|
+
f.puts "# Make changes to Manifest.txt and/or Rakefile and regenerate"
|
226
199
|
f.write This.platform_gemspec.to_ruby
|
227
200
|
end
|
228
201
|
end
|
229
202
|
|
230
|
-
# the gemspec is also a dev artifact and should not be kept around.
|
231
|
-
CLOBBER << This.gemspec_file.to_s
|
232
|
-
|
233
203
|
# .rbc files from ruby 2.0
|
234
204
|
CLOBBER << FileList["**/*.rbc"]
|
235
205
|
|
data/tasks/this.rb
CHANGED
@@ -13,7 +13,7 @@ class ThisProject
|
|
13
13
|
attr_accessor :email
|
14
14
|
|
15
15
|
# The homepage of this project
|
16
|
-
attr_accessor :homepage
|
16
|
+
attr_accessor :homepage
|
17
17
|
|
18
18
|
# The regex of files to exclude from the manifest
|
19
19
|
attr_accessor :exclude_from_manifest
|
@@ -25,7 +25,11 @@ class ThisProject
|
|
25
25
|
#
|
26
26
|
# Yields self
|
27
27
|
def initialize(&block)
|
28
|
-
@exclude_from_manifest =
|
28
|
+
@exclude_from_manifest = Regexp.union(/\.(git|DS_Store)/,
|
29
|
+
/^(doc|coverage|pkg|tmp|Gemfile(\.lock)?)/,
|
30
|
+
/^[^\/]+\.gemspec/,
|
31
|
+
/\.(swp|jar|bundle|so|rvmrc|travis.yml|byebug_history)$/,
|
32
|
+
/~$/)
|
29
33
|
@gemspecs = Hash.new
|
30
34
|
yield self if block_given?
|
31
35
|
end
|
@@ -119,7 +123,7 @@ class ThisProject
|
|
119
123
|
|
120
124
|
# Internal: Returns the gemspace associated with the current ruby platform
|
121
125
|
def platform_gemspec
|
122
|
-
gemspecs
|
126
|
+
gemspecs.fetch(platform) { This.ruby_gemspec }
|
123
127
|
end
|
124
128
|
|
125
129
|
def core_gemspec
|
@@ -132,6 +136,7 @@ class ThisProject
|
|
132
136
|
|
133
137
|
spec.summary = summary
|
134
138
|
spec.description = description
|
139
|
+
spec.license = license
|
135
140
|
|
136
141
|
spec.files = manifest
|
137
142
|
spec.executables = spec.files.grep(/^bin/) { |f| File.basename(f) }
|
@@ -140,6 +145,8 @@ class ThisProject
|
|
140
145
|
spec.extra_rdoc_files += spec.files.grep(/(txt|rdoc|md)$/)
|
141
146
|
spec.rdoc_options = [ "--main" , 'README.md',
|
142
147
|
"--markup", "tomdoc" ]
|
148
|
+
|
149
|
+
spec.required_ruby_version = '>= 2.4.0'
|
143
150
|
end
|
144
151
|
end
|
145
152
|
|
@@ -166,20 +173,6 @@ class ThisProject
|
|
166
173
|
return spec
|
167
174
|
end
|
168
175
|
|
169
|
-
# Internal: Set the recovery gem development dependency
|
170
|
-
#
|
171
|
-
# These are dynamically set since they cannot be hard coded as there is
|
172
|
-
# no way to ship them correctly in the gemspec
|
173
|
-
#
|
174
|
-
# Returns nothing.
|
175
|
-
def set_coverage_gem
|
176
|
-
if RUBY_VERSION < "1.9.0"
|
177
|
-
platform_gemspec.add_development_dependency( 'rcov', '~> 1.0.0' )
|
178
|
-
else
|
179
|
-
platform_gemspec.add_development_dependency( 'simplecov', '~> 0.8' )
|
180
|
-
end
|
181
|
-
end
|
182
|
-
|
183
176
|
# Internal: Return the platform of ThisProject at the current moment in time.
|
184
177
|
def platform
|
185
178
|
(RUBY_PLATFORM == "java") ? 'java' : Gem::Platform::RUBY
|
@@ -189,17 +182,23 @@ class ThisProject
|
|
189
182
|
def description_section
|
190
183
|
section_of( 'README.md', 'DESCRIPTION')
|
191
184
|
end
|
192
|
-
|
193
|
-
|
185
|
+
|
186
|
+
# Internal: Return the summary text from the README
|
194
187
|
def summary
|
195
188
|
description_section.first
|
196
189
|
end
|
197
190
|
|
198
|
-
# Internal: Return the full description text from the
|
191
|
+
# Internal: Return the full description text from the README
|
199
192
|
def description
|
200
193
|
description_section.join(" ").tr("\n", ' ').gsub(/[{}]/,'').gsub(/\[[^\]]+\]/,'') # strip rdoc
|
201
194
|
end
|
202
195
|
|
196
|
+
def license
|
197
|
+
license_file = project_path("LICENSE")
|
198
|
+
line = license_file.readlines.first
|
199
|
+
line.split(/\s+/).first
|
200
|
+
end
|
201
|
+
|
203
202
|
# Internal: The path to the gemspec file
|
204
203
|
def gemspec_file
|
205
204
|
project_path( "#{ name }.gemspec" )
|
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.5.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:
|
11
|
+
date: 2020-02-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -16,61 +16,75 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '2.
|
19
|
+
version: '2.7'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '2.
|
26
|
+
version: '2.7'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '13.0'
|
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: '
|
40
|
+
version: '13.0'
|
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: '5.
|
47
|
+
version: '5.14'
|
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: '5.
|
54
|
+
version: '5.14'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rdoc
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '6.2'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '6.2'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: simplecov
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0.18'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0.18'
|
69
83
|
description: Launchy is helper class for launching cross-platform applications in
|
70
84
|
a fire and forget manner. There are application concepts (browser, email client,
|
71
85
|
etc) that are common across all platforms, and they may be launched differently
|
72
86
|
on each platform. Launchy is here to make a common approach to launching external
|
73
|
-
|
87
|
+
applications from within ruby programs.
|
74
88
|
email: jeremy@copiousfreetime.org
|
75
89
|
executables:
|
76
90
|
- launchy
|
@@ -122,7 +136,11 @@ files:
|
|
122
136
|
homepage: http://github.com/copiousfreetime/launchy
|
123
137
|
licenses:
|
124
138
|
- ISC
|
125
|
-
metadata:
|
139
|
+
metadata:
|
140
|
+
bug_tracker_uri: https://github.com/copiousfreetime/launchy/issues
|
141
|
+
changelog_uri: https://github.com/copiousfreetime/launchy/blob/master/README.md
|
142
|
+
homepage_uri: https://github.com/copiousfreetime/launchy
|
143
|
+
source_code_uri: https://github.com/copiousfreetime/launchy
|
126
144
|
post_install_message:
|
127
145
|
rdoc_options:
|
128
146
|
- "--main"
|
@@ -135,15 +153,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
135
153
|
requirements:
|
136
154
|
- - ">="
|
137
155
|
- !ruby/object:Gem::Version
|
138
|
-
version:
|
156
|
+
version: 2.4.0
|
139
157
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
140
158
|
requirements:
|
141
159
|
- - ">="
|
142
160
|
- !ruby/object:Gem::Version
|
143
161
|
version: '0'
|
144
162
|
requirements: []
|
145
|
-
|
146
|
-
rubygems_version: 2.2.2
|
163
|
+
rubygems_version: 3.0.3
|
147
164
|
signing_key:
|
148
165
|
specification_version: 4
|
149
166
|
summary: Launchy is helper class for launching cross-platform applications in a fire
|