launchy 2.2.0-java → 2.4.2-java

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 6ea0d47e7c69916125a0834056984408882f7916
4
+ data.tar.gz: 5af496662915600e3b23eb1b82dc82949c5d1662
5
+ SHA512:
6
+ metadata.gz: df3c8286b31f630b56bd45fddd3c03241e36d19cc6cbeb9b706fd22958685137e25ac786d227aeb5ac89b23dbb0a7e36f28beec4b6f0e4e7bfa3faee6254440e
7
+ data.tar.gz: 31aea215b5b5d5713efcc85db56f9aa24eee28e5523a02ac4388d09e503e4d621d63f925559d797a87a08059068ee52714f886e7eb1d90422e23a8b3620cbd74
@@ -35,14 +35,17 @@ easiest way to contribute.
35
35
 
36
36
  # Contributors
37
37
 
38
- * [Jeremy Hinegardner][https://github.com/copiousfreetime]
39
- * [Mike Farmer][https://github.com/mikefarmer]
40
- * [Suraj N. Kurapati][https://github.com/sunaku]
41
- * [Postmodern][https://github.com/postmodern]
42
- * [Stephen Judkins][https://github.com/stephenjudkins]
43
- * [Mariusz Pietrzyk][https://github.com/wijet]
44
- * [Bogdan Gusiev][https://github.com/bogdan]
45
- * [Miquel Rodríguez Telep][https://github.com/mrtorrent]j
38
+ * [Jeremy Hinegardner](https://github.com/copiousfreetime)
39
+ * [Mike Farmer](https://github.com/mikefarmer)
40
+ * [Suraj N. Kurapati](https://github.com/sunaku)
41
+ * [Postmodern](https://github.com/postmodern)
42
+ * [Stephen Judkins](https://github.com/stephenjudkins)
43
+ * [Mariusz Pietrzyk](https://github.com/wijet)
44
+ * [Bogdan Gusiev](https://github.com/bogdan)
45
+ * [Miquel Rodríguez Telep](https://github.com/mrtorrent)
46
+ * [Chris Schmich](https://github.com/schmich)
47
+ * [Gioele Barabucci](https://github.com/gioele)
48
+ * [Colin Noel Bell](https://github.com/colbell)
46
49
 
47
50
  [GitHub Account]: https://github.com/signup/free "GitHub Signup"
48
51
  [GitHub Issues]: https://github.com/copiousfreetime/launchy/issues "Launchy Issues"
@@ -0,0 +1,154 @@
1
+ # Launchy Changelog
2
+
3
+ ## Version 2.4.2 - 2013-11-28
4
+ * Fix kde issue - <https://github.com/copiousfreetime/launchy/issues/72> - colbell
5
+
6
+ ## Version 2.4.1 - 2013-11-26
7
+ * Abstract out the argv of the commandline - <https://github.com/copiousfreetime/launchy/issues/71>
8
+
9
+ ## Version 2.4.0 - 2013-11-12
10
+ * Support `Launchy.open( url, :debug => true )` - <http://github.com/copiousfreetime/launchy/issues/63> - schmich
11
+ * Fix inconsistencies in `debug?` and `dry_run?` methods - <http://github.com/copiousfreetime/launchy/issues/63> - schmich
12
+ * Fix detection of missing *nix desktops - <http://github.com/copiousfreetime/launchy/issues/70>
13
+ * Fix running tests in bare Linux environment - <http://github.com/copiousfreetime/launchy/issues/67> - gioele
14
+ * Fix mistaking windows drive as uri schema - <http://github.com/copiousfreetime/launchy/issues/65>
15
+ * Attempt fixing windows `start` command oddities, again - <http://github.com/copiousfreetime/launchy/issues/62>
16
+
17
+ ## Version 2.3.0 - 2013-04-11
18
+
19
+ * Add the option to call a block on error instead of raising an exception
20
+
21
+ ## Version 2.2.0 - 2013-02-06
22
+
23
+ * Change XFCE detection to not depend on grep <http://github.com/copiousfreetime/launchy/issues/52> - bogdan
24
+ * Suppress forked process output <http://github.com/copiousfreetime/launchy/issues/51>
25
+ * Display help/usage if no url is given <http://github.com/copiousfreetime/launchy/issues/54>
26
+ * Detect the fluxbox environment <http://github.com/copiousfreetime/launchy/issues/53>
27
+ * Automatically detect `http` url's if they are missing the `http://` <http://github.com/copiousfreetime/launchy/issues/55>
28
+ * Update to latest project management rake tasks
29
+
30
+ ## Version 2.1.2 - 2012-08-06
31
+
32
+ * Fix where HostOS would fail to convert to string on JRuby in 1.9 mode <http://github.com/copiousfreetime/launchy/issues/45>
33
+
34
+ ## Version 2.1.1 - 2012-07-28
35
+
36
+ * Update addressable runtime dependency <http://github.com/copiousfreetime/launchy/issues/47>
37
+ * Bring minitest and ffi development dependencies up to date
38
+
39
+ ## Version 2.1.0 - 2012-03-18
40
+
41
+ * Fix raising exception when no browser program found <http://github.com/copiousfreetime/launchy/issues/42>
42
+ * Add `LAUNCHY_DRY_RUN` environment variable (Mariusz Pietrzyk / wijet)
43
+ * Update dependencies
44
+
45
+ ## Version 2.0.5 - 2011-07-24
46
+
47
+ * Fix the case where `$BROWSER` is set and no *nix desktop was found <http://github.com/copiousfreetime/launchy/issues/33>
48
+
49
+ ## Version 2.0.4 - 2011-07-23
50
+
51
+ * Fix windows `start` commandline <http://github.com/copiousfreetime/launchy/issues/5>
52
+ * Add capability to open local files with no file: scheme present <http://github.com/copiousfreetime/launchy/issues/29>
53
+ * Added `rake how_to_contribute` task <http://github.com/copiousfreetime/launchy/issues/30>
54
+ * Make better decisions on when to do shell escaping <http://github.com/copiousfreetime/launchy/issues/31>
55
+ * Switch to Addressable::URI so UTF-8 urls may be parsed. <http://github.com/copiousfreetime/launchy/issues/32>
56
+
57
+ ## Version 2.0.3 - 2011-07-17
58
+
59
+ * Add in Deprecated API wrappers that warn the user
60
+
61
+ ## Version 2.0.2 - 2011-07-17
62
+
63
+ * Typo fixes from @mtorrent
64
+ * Documentation updates explicitly stating the Public API
65
+ * Increase test coverage
66
+
67
+ ## Version 2.0.1 - 2011-07-16
68
+
69
+ * Almost a complete rewrite
70
+ * JRuby Support
71
+ * Organization is such that it will be easier to add additional applications
72
+ * Windows behavior possibly fixed, again
73
+
74
+ ## Version 1.0.0 - 2011-03-17
75
+
76
+ * Add JRuby support (Stephen Judkins)
77
+ * Remove unused Paths module
78
+ * Switch to using bones
79
+ * Switch to use minitest
80
+ * NOTE, this version was never released.
81
+
82
+ ## Version 0.4.0 - 2011-01-27
83
+
84
+ * Add support for `file:///` schema (postmodern)
85
+
86
+ ## Version 0.3.7 - 2010-07-19
87
+
88
+ * Fix launchy on windows (mikefarmer)
89
+
90
+ ## Version 0.3.6 - 2010-02-22
91
+
92
+ * add a test:spec task to run tests without rcov support
93
+ * added `testing` os family for running tests
94
+
95
+ ## Version 0.3.5 - 2009-12-17
96
+
97
+ * clarify that launchy is under ISC license
98
+ * fix missing data file in released gem needed for running specs
99
+
100
+ ## Version 0.3.3 - 2009-02-19
101
+
102
+ * pass command line as discrete items to system() to avoid string
103
+ interpretation by the system shell. (Suraj N. Kurapati)
104
+ * rework project layout and tasks
105
+
106
+ ## Version 0.3.2 - 2008-05-21
107
+
108
+ * detect aix and mingw as known operating systems.
109
+
110
+ ## Version 0.3.1 - 2007-09-08
111
+
112
+ * finalize the command line wrapper around the launchy library.
113
+ * added more tests
114
+
115
+ ## Version 0.3.0 - 2007-08-30
116
+
117
+ * reorganize the code structure, removing Spawnable namespace
118
+ * removed `do_magic` method, changed it to `open`
119
+ * added override environment variable LAUNCHY_HOST_OS for testing
120
+ * fix broken cygwin support [Bug #13472]
121
+
122
+ ## Version 0.2.1 - 2007-08-18
123
+
124
+ * fix inability to find windows executables [Bug #13132]
125
+
126
+ ## Version 0.2.0 - 2007-08-11
127
+
128
+ * rework browser finding
129
+ * manual override with `LAUNCHY_BROWSER` environment variable
130
+ * on *nix use desktop application launcher with fallback to list of browsers
131
+ * On windows, switch to 'start' command and remove dependency on win32-process
132
+ * removed win32 gem
133
+ * Add debug output by setting `LAUNCHY_DEBUG` environment variable to `true`
134
+
135
+ ## Version 0.1.2 - 2007-08-11
136
+
137
+ * forked child exits without calling `at_exit` handlers
138
+
139
+ ## Version 0.1.1
140
+
141
+ * fixed rubyforge task to release mswin32 gem also
142
+
143
+ ## Version 0.1.0
144
+
145
+ * Initial public release
146
+ * switched to using fork to spawn process and `require 'win32/process'` if on windows
147
+
148
+ ## Version 0.0.2
149
+
150
+ * First attempt at using systemu to spawn processes
151
+
152
+ ## Version 0.0.1
153
+
154
+ * Initially working release
@@ -1,13 +1,14 @@
1
1
  CONTRIBUTING.md
2
- HISTORY.rdoc
2
+ HISTORY.md
3
3
  LICENSE
4
4
  Manifest.txt
5
- README.rdoc
5
+ README.md
6
6
  Rakefile
7
7
  bin/launchy
8
8
  lib/launchy.rb
9
9
  lib/launchy/application.rb
10
10
  lib/launchy/applications/browser.rb
11
+ lib/launchy/argv.rb
11
12
  lib/launchy/cli.rb
12
13
  lib/launchy/deprecated.rb
13
14
  lib/launchy/descendant_tracker.rb
@@ -1,39 +1,39 @@
1
- == launchy
1
+ # launchy
2
2
 
3
- * Homepage[http://www.copiousfreetime.org/projects/launchy/]
4
- * {Github Project}[http://github.com/copiousfreetime/launchy]
3
+ * [Homepage](https://github.com/copiousfreetime/launchy)
4
+ * [Github Project](https://github.com/copiousfreetime/launchy)
5
5
  * email jeremy at hinegardner dot org
6
6
 
7
- == DESCRIPTION
7
+ ## DESCRIPTION
8
8
 
9
- Launchy is helper class for launching cross-platform applications in a
10
- fire and forget manner.
9
+ Launchy is helper class for launching cross-platform applications in a fire and
10
+ forget manner.
11
11
 
12
- There are application concepts (browser, email client, etc) that are
13
- common across all platforms, and they may be launched differently on
14
- each platform. Launchy is here to make a common approach to launching
15
- external application from within ruby programs.
12
+ There are application concepts (browser, email client, etc) that are common
13
+ across all platforms, and they may be launched differently on each platform.
14
+ Launchy is here to make a common approach to launching external application from
15
+ within ruby programs.
16
16
 
17
- == FEATURES
17
+ ## FEATURES
18
18
 
19
19
  Currently only launching a browser is supported.
20
20
 
21
- == SYNOPSIS
21
+ ## SYNOPSIS
22
22
 
23
23
  You can use launchy on the commandline, or via its API.
24
24
 
25
- === Commandline
25
+ ### Commandline
26
26
 
27
27
  % launchy http://www.ruby-lang.org/
28
28
 
29
- There are additional commandline options, use 'launchy --help' to see them.
29
+ There are additional commandline options, use `launchy --help` to see them.
30
30
 
31
- === Public API
31
+ ### Public API
32
32
 
33
- In the vein of {Semantic Versioning}[http://semver.org], starting with version 2.0.0, this is the
34
- sole supported public API.
33
+ In the vein of [Semantic Versioning](http://semver.org), this is the sole
34
+ supported public API.
35
35
 
36
- Launchy.open( uri, options = {} )
36
+ Launchy.open( uri, options = {} ) { |exception| }
37
37
 
38
38
  At the moment, the only available options are:
39
39
 
@@ -43,15 +43,26 @@ At the moment, the only available options are:
43
43
  :ruby_engine Explicitly state what ruby engine to pretend to be under
44
44
  :dry_run Do nothing and print the command that would be executed on $stdout
45
45
 
46
- An example of using the public API:
46
+ If `Launchy.open` is invoked with a block, then no exception will be thrown, and
47
+ the block will be called with the parameters passed to `#open` along with the
48
+ exception that was raised.
49
+
50
+ ### An example of using the public API:
47
51
 
48
52
  Launchy.open( "http://www.ruby-lang.org" )
49
53
 
50
- == UPGRADING
54
+ ### An example of using the public API and using the error block:
55
+
56
+ uri = "http://www.ruby-lang.org"
57
+ Launchy.open( uri ) do |exception|
58
+ puts "Attempted to open #{uri} and failed because #{exception}"
59
+ end
51
60
 
52
- The previously published version of Launchy was 0.4.0. There have been so many
53
- changes, and a mistaken tag at 1.0.0, that I have decided to bump all the way
54
- to 2.0.x.
61
+ ## UPGRADING from versions before 2.0.0
62
+
63
+ The previously published version of Launchy before the 2.0.0 series was 0.4.0.
64
+ There have been so many changes, and a mistaken tag at 1.0.0, that I have
65
+ decided to bump all the way to 2.x.y.
55
66
 
56
67
  I have attempted to keep backward compatibility with the previous examples. The
57
68
  previous API examples of:
@@ -79,7 +90,10 @@ in the github gem if it was updated to use 2.0.x but not use the supported API.
79
90
  WARNING:
80
91
  WARNING: If this is not the case, please file a bug. Please file a bug at https://github.com/copiousfreetime/launchy/issues/new
81
92
 
82
- == ISC LICENSE
93
+ These deprecation notices will go away with version 3.0 and the only available
94
+ API will be the documented one.
95
+
96
+ ## ISC LICENSE
83
97
 
84
98
  http://opensource.org/licenses/isc-license.txt
85
99
 
data/Rakefile CHANGED
@@ -9,8 +9,8 @@ This.homepage = "http://github.com/copiousfreetime/#{ This.name }"
9
9
  This.ruby_gemspec do |spec|
10
10
  spec.add_dependency( 'addressable', '~> 2.3')
11
11
 
12
- spec.add_development_dependency( 'rake' , '~> 10.0.3')
13
- spec.add_development_dependency( 'minitest' , '~> 4.5.0' )
12
+ spec.add_development_dependency( 'rake' , '~> 10.1')
13
+ spec.add_development_dependency( 'minitest' , '~> 5.0' )
14
14
  spec.add_development_dependency( 'rdoc' , '~> 3.12' )
15
15
  end
16
16
 
@@ -22,16 +22,21 @@ module Launchy
22
22
  #
23
23
  # Launch an application for the given uri string
24
24
  #
25
- def open(uri_s, options = {} )
26
- extract_global_options( options )
25
+ def open(uri_s, options = {}, &error_block )
26
+ leftover = extract_global_options( options )
27
27
  uri = string_to_uri( uri_s )
28
28
  app = app_for_uri( uri )
29
- app.new.open( uri, options )
29
+ app.new.open( uri, leftover )
30
30
  rescue Launchy::Error => le
31
31
  raise le
32
32
  rescue Exception => e
33
33
  msg = "Failure in opening uri #{uri_s.inspect} with options #{options.inspect}: #{e}"
34
34
  raise Launchy::Error, msg
35
+ ensure
36
+ if $! and block_given? then
37
+ yield $!
38
+ return # explicitly swallow the errors
39
+ end
35
40
  end
36
41
 
37
42
  def app_for_uri( uri )
@@ -39,12 +44,16 @@ module Launchy
39
44
  end
40
45
 
41
46
  def app_for_uri_string( s )
42
- app_for_uri( string_to_uri( s ) )
47
+ app_for_uri( string_to_uri( s ) )
43
48
  end
44
49
 
45
50
  def string_to_uri( s )
46
51
  uri = Addressable::URI.parse( s )
47
- uri = Addressable::URI.heuristic_parse( s ) unless uri.scheme
52
+ Launchy.log "URI parsing pass 1 : #{s} -> #{uri.to_hash}"
53
+ if not uri.scheme then
54
+ uri = Addressable::URI.heuristic_parse( s )
55
+ Launchy.log "URI parsing pass 2 : #{s} -> #{uri.to_hash}"
56
+ end
48
57
  raise Launchy::ArgumentError, "Invalid URI given: #{s.inspect}" unless uri
49
58
  return uri
50
59
  end
@@ -58,21 +67,22 @@ module Launchy
58
67
  end
59
68
 
60
69
  def extract_global_options( options )
61
- Launchy.debug = options.delete( :debug ) || ENV['LAUNCHY_DEBUG']
62
- Launchy.application = options.delete( :application ) || ENV['LAUNCHY_APPLICATION']
63
- Launchy.host_os = options.delete( :host_os ) || ENV['LAUNCHY_HOST_OS']
64
- Launchy.ruby_engine = options.delete( :ruby_engine ) || ENV['LAUNCHY_RUBY_ENGINE']
65
- Launchy.dry_run = options.delete( :dry_run ) || ENV['LAUNCHY_DRY_RUN']
70
+ leftover = options.dup
71
+ Launchy.debug = leftover.delete( :debug ) || ENV['LAUNCHY_DEBUG']
72
+ Launchy.application = leftover.delete( :application ) || ENV['LAUNCHY_APPLICATION']
73
+ Launchy.host_os = leftover.delete( :host_os ) || ENV['LAUNCHY_HOST_OS']
74
+ Launchy.ruby_engine = leftover.delete( :ruby_engine ) || ENV['LAUNCHY_RUBY_ENGINE']
75
+ Launchy.dry_run = leftover.delete( :dry_run ) || ENV['LAUNCHY_DRY_RUN']
66
76
  end
67
77
 
68
78
  def debug=( d )
69
- @debug = (d == "true")
79
+ @debug = to_bool( d )
70
80
  end
71
81
 
72
82
  # we may do logging before a call to 'open', hence the need to check
73
83
  # LAUNCHY_DEBUG here
74
84
  def debug?
75
- @debug || (ENV['LAUNCHY_DEBUG'] == 'true')
85
+ @debug || to_bool( ENV['LAUNCHY_DEBUG'] )
76
86
  end
77
87
 
78
88
  def application=( app )
@@ -100,11 +110,11 @@ module Launchy
100
110
  end
101
111
 
102
112
  def dry_run=( dry_run )
103
- @dry_run = dry_run
113
+ @dry_run = to_bool( dry_run )
104
114
  end
105
115
 
106
116
  def dry_run?
107
- @dry_run
117
+ @dry_run || to_bool( ENV['LAUNCHY_DRY_RUN'] )
108
118
  end
109
119
 
110
120
  def bug_report_message
@@ -114,10 +124,26 @@ module Launchy
114
124
  def log(msg)
115
125
  $stderr.puts "LAUNCHY_DEBUG: #{msg}" if Launchy.debug?
116
126
  end
127
+
128
+ private
129
+ def to_bool( arg )
130
+ if arg.is_a? String
131
+ arg == 'true'
132
+ elsif arg.is_a? TrueClass
133
+ true
134
+ else
135
+ # All other values mapped to false.
136
+ false
137
+ end
138
+ end
117
139
  end
140
+
141
+ # Iniitialize the global options to sane defaults during parse time.
142
+ Launchy.reset_global_options
118
143
  end
119
144
 
120
145
  require 'launchy/version'
146
+ require 'launchy/argv'
121
147
  require 'launchy/cli'
122
148
  require 'launchy/descendant_tracker'
123
149
  require 'launchy/error'
@@ -13,26 +13,22 @@ class Launchy::Application
13
13
  end
14
14
 
15
15
  def windows_app_list
16
- [ 'start /b' ]
16
+ [ 'start "launchy" /b' ]
17
17
  end
18
18
 
19
19
  def cygwin_app_list
20
- [ 'cmd /C start /b' ]
20
+ [ 'cmd /C start "launchy" /b' ]
21
21
  end
22
22
 
23
+ # hardcode this to open?
23
24
  def darwin_app_list
24
25
  [ find_executable( "open" ) ]
25
26
  end
26
27
 
27
28
  def nix_app_list
28
- app_list = %w[ xdg-open ]
29
- if nix_de = Launchy::Detect::NixDesktopEnvironment.detect then
30
- app_list << nix_de.browser
31
- app_list << nix_de.fallback_browsers
32
- end
33
- app_list.flatten!
34
- app_list.delete_if { |b| b.nil? || (b.strip.size == 0) }
35
- app_list.collect { |bin| find_executable( bin ) }.find_all { |x| not x.nil? }
29
+ nix_de = Launchy::Detect::NixDesktopEnvironment.detect
30
+ list = nix_de.browsers
31
+ list.find_all { |argv| argv.valid? }
36
32
  end
37
33
 
38
34
  # use a call back mechanism to get the right app_list that is decided by the
@@ -51,10 +47,15 @@ class Launchy::Application
51
47
 
52
48
  # Get the full commandline of what we are going to add the uri to
53
49
  def browser_cmdline
54
- possibilities = (browser_env + app_list).flatten
55
- possibilities.each do |p|
56
- Launchy.log "#{self.class.name} : possibility : #{p}"
50
+ browser_env.each do |p|
51
+ Launchy.log "#{self.class.name} : possibility from BROWSER environment variable : #{p}"
52
+ end
53
+ app_list.each do |p|
54
+ Launchy.log "#{self.class.name} : possibility from app_list : #{p}"
57
55
  end
56
+
57
+ possibilities = (browser_env + app_list).flatten
58
+
58
59
  if browser = possibilities.shift then
59
60
  Launchy.log "#{self.class.name} : Using browser value '#{browser}'"
60
61
  return browser