launchy 2.4.2 → 2.4.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4530a3fed3180fecebf8e400b827aaba7d1c8883
4
- data.tar.gz: 30794e878be1936e25e6ed1a79fb6562e3c0ec27
3
+ metadata.gz: 020cdb8c9a8e1da529b3d15415fe5e276a4e765d
4
+ data.tar.gz: 3c0fb5fff34cc96ddcf02434e94771e7cb72f220
5
5
  SHA512:
6
- metadata.gz: c593fcebac3fb96b80d5583bf10d738fbf26c5a51ae573224da63e0a7e37b719b0e17947175a2a2b8e76cb82ddda4a588accbb4e3c7bed98f817df957138c79b
7
- data.tar.gz: 7f6df9bae967f77b7f4a8e0b645107e6ee22a667775c5a4b9dd20ca2788c6409fd7de7b5635dc77be3b0b2a07a592d74b55efc40288dea2b27531619bc701d07
6
+ metadata.gz: 65a8da912395f266b1a2779d1b6a9f2898271569af2ca9457a5eed6294db3ce06f6ea51ed5dd3a6d5b899d3713e4af6d801e0c7eaa9371b61627a70d34edfa15
7
+ data.tar.gz: 39b920651bf1a11f6c03a8a3028d2933f6b5009e58ce7038c011c650d2a9999a289d37b6a9eab6f6d9f05410eb15ab18beca00b98c642bc35cc28f7fb732602f
@@ -46,6 +46,10 @@ easiest way to contribute.
46
46
  * [Chris Schmich](https://github.com/schmich)
47
47
  * [Gioele Barabucci](https://github.com/gioele)
48
48
  * [Colin Noel Bell](https://github.com/colbell)
49
+ * [Mark J. Lehman](https://github.com/supremebeing7)
50
+ * [Cédric Félizard](https://github.com/infertux)
51
+ * [Daniel Farina](https://github.com/fdr)
52
+ * [Jack Turnbull](https://github.com/jackturnbull)
49
53
 
50
54
  [GitHub Account]: https://github.com/signup/free "GitHub Signup"
51
55
  [GitHub Issues]: https://github.com/copiousfreetime/launchy/issues "Launchy Issues"
data/HISTORY.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Launchy Changelog
2
2
 
3
+ ## Version 2.4.3 - 2014-11-03
4
+ * Update documentation - <https://github.com/copiousfreetime/launchy/pull/81> - supremebeing7
5
+ * Fix launching of `exo-open` for XFCE - <https://github.com/copiousfreetime/launchy/issues/82> - dsandstrom
6
+ * Add iceweasel as a fallback browser - <https://github.com/copiousfreetime/launchy/pull/92> - jackturnbull
7
+ * Reopen $stderr in really bad situation - <https://github.com/copiousfreetime/launchy/pull/77> - infertux
8
+
3
9
  ## Version 2.4.2 - 2013-11-28
4
10
  * Fix kde issue - <https://github.com/copiousfreetime/launchy/issues/72> - colbell
5
11
 
data/README.md CHANGED
@@ -20,7 +20,7 @@ Currently only launching a browser is supported.
20
20
 
21
21
  ## SYNOPSIS
22
22
 
23
- You can use launchy on the commandline, or via its API.
23
+ You can use launchy on the commandline, within the Capybara and Rspec-rails testing environment, or via its API.
24
24
 
25
25
  ### Commandline
26
26
 
@@ -28,6 +28,28 @@ You can use launchy on the commandline, or via its API.
28
28
 
29
29
  There are additional commandline options, use `launchy --help` to see them.
30
30
 
31
+ ### Capybara Testing
32
+
33
+ First, install [Capybara](https://github.com/jnicklas/capybara) and [Rspec for Rails](https://github.com/rspec/rspec-rails). Capybara provides the following method:
34
+
35
+ save_and_open_page
36
+
37
+ When inserted into your code at the place where you would like to open your program, and when rspec is run, Capybara displays this message:
38
+
39
+ Page saved to /home/code/my_app_name/tmp/capybara/capybara-current-date-and-time.html with save_and_open_page.
40
+ Please install the launchy gem to open page automatically.
41
+
42
+ With Launchy installed, when rspec is run again, it will launch an unstyled instance of the specific page. It can be especially useful when debugging errors in integration tests. For example:
43
+
44
+ context "signin" do
45
+ it "lets a user sign in" do
46
+ visit root_path
47
+ click_link signin_path
48
+ save_and_open_page
49
+ page.should have_content "Enter your login information"
50
+ end
51
+ end
52
+
31
53
  ### Public API
32
54
 
33
55
  In the vein of [Semantic Versioning](http://semver.org), this is the sole
data/Rakefile CHANGED
@@ -11,11 +11,15 @@ This.ruby_gemspec do |spec|
11
11
 
12
12
  spec.add_development_dependency( 'rake' , '~> 10.1')
13
13
  spec.add_development_dependency( 'minitest' , '~> 5.0' )
14
- spec.add_development_dependency( 'rdoc' , '~> 3.12' )
14
+ spec.add_development_dependency( 'rdoc' , '~> 4.1' )
15
+
16
+ spec.licenses = ['ISC']
15
17
  end
16
18
 
17
19
  This.java_gemspec( This.ruby_gemspec ) do |spec|
18
20
  spec.add_dependency( 'spoon', '~> 0.0.1' )
21
+
22
+ spec.licenses = ['ISC']
19
23
  end
20
24
 
21
25
  load 'tasks/default.rake'
@@ -19,7 +19,7 @@ module Launchy::Detect
19
19
  end
20
20
 
21
21
  def self.fallback_browsers
22
- %w[ firefox seamonkey opera mozilla netscape galeon ].map { |x| ::Launchy::Argv.new( x ) }
22
+ %w[ firefox iceweasel seamonkey opera mozilla netscape galeon ].map { |x| ::Launchy::Argv.new( x ) }
23
23
  end
24
24
 
25
25
  def self.browsers
@@ -42,7 +42,8 @@ module Launchy::Detect
42
42
 
43
43
  class Gnome < NixDesktopEnvironment
44
44
  def self.is_current_desktop_environment?
45
- ENV['GNOME_DESKTOP_SESSION_ID']
45
+ ENV['GNOME_DESKTOP_SESSION_ID'] &&
46
+ Launchy::Application.find_executable( 'gnome-open' )
46
47
  end
47
48
 
48
49
  def self.browser
@@ -60,7 +61,7 @@ module Launchy::Detect
60
61
  end
61
62
 
62
63
  def self.browser
63
- ::Launchy::Argv.new( 'exo-open' )
64
+ ::Launchy::Argv.new( %w[ exo-open --launch WebBrowser ] )
64
65
  end
65
66
  end
66
67
 
@@ -1,4 +1,5 @@
1
1
  require 'shellwords'
2
+ require 'stringio'
2
3
 
3
4
  module Launchy::Detect
4
5
  class Runner
@@ -113,23 +114,39 @@ module Launchy::Detect
113
114
  end
114
115
 
115
116
  class Forkable < Runner
117
+ attr_reader :child_pid
118
+
116
119
  def wet_run( cmd, *args )
117
- child_pid = fork do
120
+ @child_pid = fork do
118
121
  close_file_descriptors unless Launchy.debug?
119
122
  Launchy.log("wet_run: before exec in child process")
120
- exec( *shell_commands( cmd, *args ))
123
+ exec_or_raise( cmd, *args )
121
124
  exit!
122
125
  end
123
- Process.detach( child_pid )
126
+ Process.detach( @child_pid )
124
127
  end
125
128
 
129
+ private
130
+
131
+ # attaching to a StringIO instead of reopening so we don't loose the
132
+ # STDERR, needed for exec_or_raise.
126
133
  def close_file_descriptors
127
- [$stdin, $stdout, $stderr].each do |io|
128
- io.reopen( "/dev/null", "r+" )
129
- end
134
+ $stdin.reopen( "/dev/null")
135
+
136
+ @saved_stdout = $stdout
137
+ @saved_stderr = $stderr
138
+
139
+ $stdout = StringIO.new
140
+ $stderr = StringIO.new
130
141
  end
131
142
 
132
- private :close_file_descriptors
143
+ def exec_or_raise( cmd, *args )
144
+ exec( *shell_commands( cmd, *args ))
145
+ rescue Exception => e
146
+ $stderr = @saved_stderr
147
+ $stdout = @saved_stdout
148
+ raise e
149
+ end
133
150
  end
134
151
  end
135
152
  end
@@ -1,5 +1,5 @@
1
1
  module Launchy
2
- VERSION = "2.4.2"
2
+ VERSION = "2.4.3"
3
3
 
4
4
  module Version
5
5
 
@@ -51,5 +51,18 @@ describe Launchy::Application::Browser do
51
51
  browser.browser_cmdline.must_equal "do-this-instead"
52
52
  end
53
53
 
54
+ # NOTE: Unable to figure out how capture the stderr from the child which has
55
+ # moved it at least once. This test just serves the purpose of noting why
56
+ # something happens, and the proble we are attempting to fix.
57
+ it "When BROWSER is set to something that is not executable, error still appears on stderr" do
58
+ ENV['BROWSER'] = "not-an-app"
59
+ url = "http://example.com/"
60
+
61
+ _, err = capture_subprocess_io do
62
+ Launchy.open( url )
63
+ end
64
+ #err.must_match( /wibble/m )
65
+ err # something
66
+ end
54
67
  end
55
68
 
@@ -10,19 +10,15 @@ describe Launchy::Detect::NixDesktopEnvironment do
10
10
  Launchy.reset_global_options
11
11
  end
12
12
 
13
-
14
- { "KDE_FULL_SESSION" => Launchy::Detect::NixDesktopEnvironment::Kde,
15
- "GNOME_DESKTOP_SESSION_ID" => Launchy::Detect::NixDesktopEnvironment::Gnome }.each_pair do |k,v|
16
- it "can detect the desktop environment of a *nix machine using ENV[#{k}]" do
17
- ENV.delete( "KDE_FULL_SESSION" )
18
- ENV.delete( "GNOME_DESKTOP_SESSION_ID" )
19
- ENV[k] = "launchy-test"
20
- nix_env = Launchy::Detect::NixDesktopEnvironment.detect
21
- nix_env.must_equal( v )
22
- nix_env.browser.must_equal( v.browser )
23
- ENV.delete( k )
24
- end
25
- end
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
26
22
 
27
23
  it "returns false for XFCE if xprop is not found" do
28
24
  Launchy.host_os = "linux"
@@ -100,5 +100,4 @@ describe Launchy::Detect::Runner do
100
100
  cmd = l.dry_run( "not-really", [ url ] )
101
101
  cmd.must_equal( "not-really #{url}" )
102
102
  end
103
-
104
103
  end
@@ -176,7 +176,7 @@ class ThisProject
176
176
  if RUBY_VERSION < "1.9.0"
177
177
  platform_gemspec.add_development_dependency( 'rcov', '~> 1.0.0' )
178
178
  else
179
- platform_gemspec.add_development_dependency( 'simplecov', '~> 0.7.1' )
179
+ platform_gemspec.add_development_dependency( 'simplecov', '~> 0.8' )
180
180
  end
181
181
  end
182
182
 
metadata CHANGED
@@ -1,71 +1,71 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: launchy
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.2
4
+ version: 2.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Hinegardner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-28 00:00:00.000000000 Z
11
+ date: 2014-11-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '2.3'
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
26
  version: '2.3'
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
33
  version: '10.1'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10.1'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: minitest
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '5.0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '5.0'
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: '3.12'
61
+ version: '4.1'
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: '3.12'
68
+ version: '4.1'
69
69
  description: Launchy is helper class for launching cross-platform applications in
70
70
  a fire and forget manner. There are application concepts (browser, email client,
71
71
  etc) that are common across all platforms, and they may be launched differently
@@ -120,29 +120,30 @@ files:
120
120
  - tasks/default.rake
121
121
  - tasks/this.rb
122
122
  homepage: http://github.com/copiousfreetime/launchy
123
- licenses: []
123
+ licenses:
124
+ - ISC
124
125
  metadata: {}
125
126
  post_install_message:
126
127
  rdoc_options:
127
- - --main
128
+ - "--main"
128
129
  - README.md
129
- - --markup
130
+ - "--markup"
130
131
  - tomdoc
131
132
  require_paths:
132
133
  - lib
133
134
  required_ruby_version: !ruby/object:Gem::Requirement
134
135
  requirements:
135
- - - '>='
136
+ - - ">="
136
137
  - !ruby/object:Gem::Version
137
138
  version: '0'
138
139
  required_rubygems_version: !ruby/object:Gem::Requirement
139
140
  requirements:
140
- - - '>='
141
+ - - ">="
141
142
  - !ruby/object:Gem::Version
142
143
  version: '0'
143
144
  requirements: []
144
145
  rubyforge_project:
145
- rubygems_version: 2.1.11
146
+ rubygems_version: 2.2.2
146
147
  signing_key:
147
148
  specification_version: 4
148
149
  summary: Launchy is helper class for launching cross-platform applications in a fire