launchy 2.4.0 → 2.4.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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NWUzNmEyNDA5NGVkMjUyYjU2MDVmMzQxY2FkMDJhZjQxNzMwYmE4OA==
4
+ ZTBlZTMzMGZlMDNmM2Y5MDk3MzVmZWMzNjIwMGI5MjdiYWE1NmVlNA==
5
5
  data.tar.gz: !binary |-
6
- MmUxYmRlODUyNDhhZmRlY2U2MWY1NTc5ZThlMDdkYTkwYjYzYTE3MQ==
6
+ MWQ0Mjc2MzA2Mjg4MDNhNzY5YjQ1M2RjZTNhNTlhYTJkZDM3MzZhYQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- OTlkMzhjYThhMjYzMGNkZTVkMDNlZmU0MDU0N2RkNDc0NzlmNzMwNDEwMzY4
10
- NTg3MDc0ZDEyMDRlMTZjYzcxZjkyNTY4N2MwZmNkZDhiZWVkNjA0Zjk1YzUw
11
- MjNmZGM1ZjAxM2Y5ODg2NGE0NTUwMDk3ODg2ZjAzODBkOWJjN2M=
9
+ NzBmYTIwODEzYzMyNGZhMjY3Y2E1YzU4NWE1MTkxMTA4Nzg0ZWE1MzhlZTRh
10
+ NDhhYjdhNzQ5NDY0YzgzMjIwZGZiMWEyZTRjNGE0NjkyM2FmMGUyMmUyN2Jh
11
+ NDQ0NDVmNmE1N2U1ZTQ3MmY3YmEyYjM4OWYxMjYxNDQyMzU5OTk=
12
12
  data.tar.gz: !binary |-
13
- NDQ5YWMzNTRhYmJjZTNmNTU2OGNjN2UyMzBjMTcxMTllNmUwMGY0ZDRjZTA3
14
- NTEzM2NiZjJmMGZlZTYwMjZlYmIzNjRiMDRiMmI5MTMzZmI0MDZiYjIxNTQ1
15
- OTMwMmRlMTA1MDRiZjczOGQyMTMzNjIxYjNiYjQ4NzZlMzNlMzc=
13
+ OTA3NTI4MTE1NGVjZmFlMDJjOWJjOWYzYjgxYWUxNzA2M2NiNDU1YzI3NWM1
14
+ N2MzYzFkNjdhMmVlZjE4ZjA0YTg0MDAxODQ4NjQwODZhODliODAwM2I3Mjhl
15
+ MDg5NWI5MzBhNGNhNGQ2NTRkZGY2ZDlhOGFlZWI1MzFiYWVkNDY=
data/HISTORY.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Launchy Changelog
2
2
 
3
+ ## Version 2.4.1 - 2013-11-26
4
+ * Abstract out the argv of the commandline - <https://github.com/copiousfreetime/launchy/issues/71>
5
+
3
6
  ## Version 2.4.0 - 2013-11-12
4
7
  * Support `Launchy.open( url, :debug => true )` - <http://github.com/copiousfreetime/launchy/issues/63> - schmich
5
8
  * Fix inconsistencies in `debug?` and `dry_run?` methods - <http://github.com/copiousfreetime/launchy/issues/63> - schmich
data/Manifest.txt CHANGED
@@ -8,6 +8,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
data/lib/launchy.rb CHANGED
@@ -143,6 +143,7 @@ module Launchy
143
143
  end
144
144
 
145
145
  require 'launchy/version'
146
+ require 'launchy/argv'
146
147
  require 'launchy/cli'
147
148
  require 'launchy/descendant_tracker'
148
149
  require 'launchy/error'
@@ -28,9 +28,7 @@ class Launchy::Application
28
28
  def nix_app_list
29
29
  nix_de = Launchy::Detect::NixDesktopEnvironment.detect
30
30
  list = nix_de.browsers
31
-
32
- list.delete_if { |b| b.nil? || (b.strip.size == 0) }
33
- list.collect { |bin| find_executable( bin ) }.find_all { |x| not x.nil? }
31
+ list.find_all { |argv| argv.valid? }
34
32
  end
35
33
 
36
34
  # use a call back mechanism to get the right app_list that is decided by the
@@ -0,0 +1,36 @@
1
+ module Launchy
2
+ class Argv
3
+ attr_reader :argv
4
+ def initialize( *args )
5
+ @argv = args.flatten
6
+ end
7
+
8
+ def to_s
9
+ @argv.join(' ')
10
+ end
11
+
12
+ def to_str
13
+ to_s
14
+ end
15
+
16
+ def [](idx)
17
+ @argv[idx]
18
+ end
19
+
20
+ def valid?
21
+ (not blank?) && executable?
22
+ end
23
+
24
+ def blank?
25
+ @argv.empty? || (@argv.first.strip.size == 0)
26
+ end
27
+
28
+ def executable?
29
+ ::Launchy::Application.find_executable( @argv.first )
30
+ end
31
+
32
+ def ==( other )
33
+ @argv == other.argv
34
+ end
35
+ end
36
+ end
@@ -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 ]
22
+ %w[ firefox seamonkey opera mozilla netscape galeon ].map { |x| ::Launchy::Argv.new( x ) }
23
23
  end
24
24
 
25
25
  def self.browsers
@@ -36,7 +36,7 @@ module Launchy::Detect
36
36
  end
37
37
 
38
38
  def self.browser
39
- 'kfmclient'
39
+ ::Launchy::Argv.new( %w[ kvmclient openURL ] )
40
40
  end
41
41
  end
42
42
 
@@ -46,7 +46,7 @@ module Launchy::Detect
46
46
  end
47
47
 
48
48
  def self.browser
49
- 'gnome-open'
49
+ ::Launchy::Argv.new( 'gnome-open' )
50
50
  end
51
51
  end
52
52
 
@@ -60,7 +60,7 @@ module Launchy::Detect
60
60
  end
61
61
 
62
62
  def self.browser
63
- 'exo-open'
63
+ ::Launchy::Argv.new( 'exo-open' )
64
64
  end
65
65
  end
66
66
 
@@ -71,7 +71,7 @@ module Launchy::Detect
71
71
  end
72
72
 
73
73
  def self.browser
74
- 'xdg-open'
74
+ ::Launchy::Argv.new( 'xdg-open' )
75
75
  end
76
76
  end
77
77
 
@@ -82,7 +82,7 @@ module Launchy::Detect
82
82
  end
83
83
 
84
84
  def self.browser
85
- []
85
+ ::Launchy::Argv.new
86
86
  end
87
87
  end
88
88
 
@@ -1,5 +1,5 @@
1
1
  module Launchy
2
- VERSION = "2.4.0"
2
+ VERSION = "2.4.1"
3
3
 
4
4
  module Version
5
5
 
@@ -14,6 +14,8 @@ describe Launchy::Detect::NixDesktopEnvironment do
14
14
  { "KDE_FULL_SESSION" => Launchy::Detect::NixDesktopEnvironment::Kde,
15
15
  "GNOME_DESKTOP_SESSION_ID" => Launchy::Detect::NixDesktopEnvironment::Gnome }.each_pair do |k,v|
16
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" )
17
19
  ENV[k] = "launchy-test"
18
20
  nix_env = Launchy::Detect::NixDesktopEnvironment.detect
19
21
  nix_env.must_equal( v )
@@ -33,6 +35,6 @@ describe Launchy::Detect::NixDesktopEnvironment do
33
35
  ENV.delete( "GNOME_DESKTOP_SESSION_ID" )
34
36
  not_found = Launchy::Detect::NixDesktopEnvironment.detect
35
37
  not_found.must_equal( Launchy::Detect::NixDesktopEnvironment::NotFound )
36
- not_found.browser.must_equal( [] )
38
+ not_found.browser.must_equal( Launchy::Argv.new )
37
39
  end
38
40
  end
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.0
4
+ version: 2.4.1
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-13 00:00:00.000000000 Z
11
+ date: 2013-11-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -91,6 +91,7 @@ files:
91
91
  - lib/launchy.rb
92
92
  - lib/launchy/application.rb
93
93
  - lib/launchy/applications/browser.rb
94
+ - lib/launchy/argv.rb
94
95
  - lib/launchy/cli.rb
95
96
  - lib/launchy/deprecated.rb
96
97
  - lib/launchy/descendant_tracker.rb
@@ -141,7 +142,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
141
142
  version: '0'
142
143
  requirements: []
143
144
  rubyforge_project:
144
- rubygems_version: 2.1.5
145
+ rubygems_version: 2.1.11
145
146
  signing_key:
146
147
  specification_version: 4
147
148
  summary: Launchy is helper class for launching cross-platform applications in a fire