launchy 2.0.5 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/{HISTORY → HISTORY.rdoc} +7 -0
- data/Manifest.txt +35 -0
- data/{README → README.rdoc} +0 -0
- data/Rakefile +286 -58
- data/lib/launchy.rb +2 -2
- data/lib/launchy/applications/browser.rb +5 -3
- data/lib/launchy/cli.rb +1 -1
- data/lib/launchy/detect/nix_desktop_environment.rb +6 -2
- data/lib/launchy/detect/runner.rb +2 -1
- data/lib/launchy/error.rb +1 -0
- data/lib/launchy/version.rb +1 -1
- data/spec/detect/nix_desktop_environment_spec.rb +4 -0
- data/spec/detect/runner_spec.rb +5 -0
- data/spec/launchy_spec.rb +7 -0
- data/spec/spec_helper.rb +2 -2
- metadata +32 -73
- data/tasks/bundler.rake +0 -13
- data/tasks/contribute.rake +0 -36
data/{HISTORY → HISTORY.rdoc}
RENAMED
@@ -1,4 +1,11 @@
|
|
1
1
|
= Launchy Changlog
|
2
|
+
== Version 2.1.0 - 2012-03-18
|
3
|
+
|
4
|
+
* Fix raising exception when no browser program found (copiousfreetime/launchy#42)
|
5
|
+
* Add LAUNCHY_DRY_RUN environment variable (thanks Mariusz Pietrzyk / wijet)
|
6
|
+
* Update dependencies
|
7
|
+
|
8
|
+
|
2
9
|
== Version 2.0.5 - 2011-07-24
|
3
10
|
|
4
11
|
* Fix the case where $BROWSER is set and no *nix desktop was found (copiousfreetime/launchy#33)
|
data/Manifest.txt
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
HISTORY.rdoc
|
2
|
+
LICENSE
|
3
|
+
Manifest.txt
|
4
|
+
NOTES
|
5
|
+
README.rdoc
|
6
|
+
Rakefile
|
7
|
+
bin/launchy
|
8
|
+
lib/launchy.rb
|
9
|
+
lib/launchy/application.rb
|
10
|
+
lib/launchy/applications/browser.rb
|
11
|
+
lib/launchy/cli.rb
|
12
|
+
lib/launchy/deprecated.rb
|
13
|
+
lib/launchy/descendant_tracker.rb
|
14
|
+
lib/launchy/detect.rb
|
15
|
+
lib/launchy/detect/host_os.rb
|
16
|
+
lib/launchy/detect/host_os_family.rb
|
17
|
+
lib/launchy/detect/nix_desktop_environment.rb
|
18
|
+
lib/launchy/detect/ruby_engine.rb
|
19
|
+
lib/launchy/detect/runner.rb
|
20
|
+
lib/launchy/error.rb
|
21
|
+
lib/launchy/os_family.rb
|
22
|
+
lib/launchy/version.rb
|
23
|
+
spec/application_spec.rb
|
24
|
+
spec/applications/browser_spec.rb
|
25
|
+
spec/cli_spec.rb
|
26
|
+
spec/detect/host_os_family_spec.rb
|
27
|
+
spec/detect/host_os_spec.rb
|
28
|
+
spec/detect/nix_desktop_environment_spec.rb
|
29
|
+
spec/detect/ruby_engine_spec.rb
|
30
|
+
spec/detect/runner_spec.rb
|
31
|
+
spec/launchy_spec.rb
|
32
|
+
spec/mock_application.rb
|
33
|
+
spec/spec_helper.rb
|
34
|
+
spec/tattle-host-os.yaml
|
35
|
+
spec/version_spec.rb
|
data/{README → README.rdoc}
RENAMED
File without changes
|
data/Rakefile
CHANGED
@@ -1,70 +1,298 @@
|
|
1
|
-
|
2
|
-
# Copyright (c) 2007 Jeremy Hinegardner
|
3
|
-
# All rights reserved. See LICENSE and/or COPYING for details.
|
4
|
-
#++
|
1
|
+
# vim: syntax=ruby
|
5
2
|
|
3
|
+
This.name = "launchy"
|
4
|
+
This.author = "Jeremy Hinegardner"
|
5
|
+
This.email = "jeremy@copiousfreetime.org"
|
6
|
+
This.homepage = "http://github.com/copiousfreetime/#{ This.name }"
|
7
|
+
This.version = Util.version
|
8
|
+
|
9
|
+
#------------------------------------------------------------------------------
|
10
|
+
# If you want to Develop on this project just run 'rake develop' and you'll
|
11
|
+
# have all you need to get going. If you want to use bundler for development,
|
12
|
+
# then run 'rake develop:using_bundler'
|
13
|
+
#------------------------------------------------------------------------------
|
14
|
+
namespace :develop do
|
15
|
+
|
16
|
+
# Install all the development and runtime dependencies of this gem using the
|
17
|
+
# gemspec.
|
18
|
+
task :default do
|
19
|
+
require 'rubygems/dependency_installer'
|
20
|
+
installer = Gem::DependencyInstaller.new
|
21
|
+
|
22
|
+
puts "Installing gem depedencies needed for development"
|
23
|
+
Util.platform_gemspec.dependencies.each do |dep|
|
24
|
+
if dep.matching_specs.empty? then
|
25
|
+
puts "Installing : #{dep}"
|
26
|
+
installer.install dep
|
27
|
+
else
|
28
|
+
puts "Skipping : #{dep} -> already installed #{dep.matching_specs.first.full_name}"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
puts "\n\nNow run 'rake test'"
|
32
|
+
end
|
33
|
+
|
34
|
+
# Create a Gemfile that just references the gemspec
|
35
|
+
file 'Gemfile' => :gemspec do
|
36
|
+
File.open( "Gemfile", "w+" ) do |f|
|
37
|
+
f.puts 'source :rubygems'
|
38
|
+
f.puts 'gemspec'
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
desc "Create a bundler Gemfile"
|
43
|
+
task :using_bundler => 'Gemfile' do
|
44
|
+
puts "Now you can 'bundle'"
|
45
|
+
end
|
46
|
+
|
47
|
+
# Gemfiles are build artifacts
|
48
|
+
CLOBBER << FileList['Gemfile*']
|
49
|
+
end
|
50
|
+
desc "Boostrap development"
|
51
|
+
task :develop => "develop:default"
|
52
|
+
|
53
|
+
#------------------------------------------------------------------------------
|
54
|
+
# Minitest - standard TestTask
|
55
|
+
#------------------------------------------------------------------------------
|
56
|
+
begin
|
57
|
+
require 'rake/testtask'
|
58
|
+
Rake::TestTask.new( :test ) do |t|
|
59
|
+
t.ruby_opts = %w[ -w -rubygems ]
|
60
|
+
t.libs = %w[ lib spec ]
|
61
|
+
t.pattern = "spec/**/*_spec.rb"
|
62
|
+
end
|
63
|
+
task :default => :test
|
64
|
+
rescue LoadError
|
65
|
+
Util.task_warning( 'test' )
|
66
|
+
end
|
67
|
+
|
68
|
+
#------------------------------------------------------------------------------
|
69
|
+
# RDoc - standard rdoc rake task, although we must make sure to use a more
|
70
|
+
# recent version of rdoc since it is the one that has 'tomdoc' markup
|
71
|
+
#------------------------------------------------------------------------------
|
72
|
+
begin
|
73
|
+
gem 'rdoc' # otherwise we get the wrong task from stdlib
|
74
|
+
require 'rdoc/task'
|
75
|
+
RDoc::Task.new do |t|
|
76
|
+
t.markup = 'tomdoc'
|
77
|
+
t.rdoc_dir = 'doc'
|
78
|
+
t.main = 'README.rdoc'
|
79
|
+
t.title = "#{This.name} #{This.version}"
|
80
|
+
t.rdoc_files.include( '*.rdoc', 'lib/**/*.rb' )
|
81
|
+
end
|
82
|
+
rescue LoadError => le
|
83
|
+
Util.task_warning( 'rdoc' )
|
84
|
+
end
|
85
|
+
|
86
|
+
#------------------------------------------------------------------------------
|
87
|
+
# Coverage - optional code coverage, rcov for 1.8 and simplecov for 1.9, so
|
88
|
+
# for the moment only rcov is listed.
|
89
|
+
#------------------------------------------------------------------------------
|
6
90
|
begin
|
7
|
-
|
8
|
-
|
91
|
+
require 'rcov/rcovtask'
|
92
|
+
Rcov::RcovTask.new do |t|
|
93
|
+
t.libs << 'spec'
|
94
|
+
t.pattern = 'spec/**/*_spec.rb'
|
95
|
+
t.verbose = true
|
96
|
+
t.rcov_opts << "-x ^/" # remove all the global files
|
97
|
+
t.rcov_opts << "--sort coverage" # so we see the worst files at the top
|
98
|
+
end
|
9
99
|
rescue LoadError
|
10
|
-
|
11
|
-
Rake.application.invoke_task( :help )
|
100
|
+
$stderr.puts "rcov task is not defined, please 'gem install rcov'"
|
12
101
|
end
|
13
102
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
description <<_
|
36
|
-
Launchy is helper class for launching cross-platform applications in a
|
37
|
-
fire and forget manner.
|
38
|
-
|
39
|
-
There are application concepts (browser, email client, etc) that are
|
40
|
-
common across all platforms, and they may be launched differently on
|
41
|
-
each platform. Launchy is here to make a common approach to launching
|
42
|
-
external application from within ruby programs.
|
43
|
-
_
|
44
|
-
|
45
|
-
if RUBY_PLATFORM == "java" then
|
46
|
-
depend_on "spoon" , "~> 0.0.1"
|
47
|
-
depend_on 'ffi' , "~> 1.0.9"
|
48
|
-
gem.extras = { :platform => Gem::Platform.new( "java" ) }
|
103
|
+
#------------------------------------------------------------------------------
|
104
|
+
# Manifest - We want an explicit list of thos files that are to be packaged in
|
105
|
+
# the gem. Most of this is from Hoe.
|
106
|
+
#------------------------------------------------------------------------------
|
107
|
+
namespace 'manifest' do
|
108
|
+
desc "Check the manifest"
|
109
|
+
task :check => :clean do
|
110
|
+
files = FileList["**/*", ".*"].exclude( This.exclude_from_manifest ).to_a.sort
|
111
|
+
files = files.select{ |f| File.file?( f ) }
|
112
|
+
|
113
|
+
tmp = "Manifest.tmp"
|
114
|
+
File.open( tmp, 'w' ) do |f|
|
115
|
+
f.puts files.join("\n")
|
116
|
+
end
|
117
|
+
|
118
|
+
begin
|
119
|
+
sh "diff -du Manifest.txt #{tmp}"
|
120
|
+
ensure
|
121
|
+
rm tmp
|
122
|
+
end
|
123
|
+
puts "Manifest looks good"
|
49
124
|
end
|
50
125
|
|
51
|
-
|
126
|
+
desc "Generate the manifest"
|
127
|
+
task :generate => :clean do
|
128
|
+
files = %x[ git ls-files ].split("\n").sort
|
129
|
+
files.reject! { |f| f =~ This.exclude_from_manifest }
|
130
|
+
File.open( "Manifest.txt", "w" ) do |f|
|
131
|
+
f.puts files.join("\n")
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
52
135
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
136
|
+
#------------------------------------------------------------------------------
|
137
|
+
# Gem Specification
|
138
|
+
#------------------------------------------------------------------------------
|
139
|
+
This.gemspec = Hash.new
|
140
|
+
This.gemspec['ruby'] = Gem::Specification.new do |spec|
|
141
|
+
spec.name = This.name
|
142
|
+
spec.version = This.version
|
143
|
+
spec.author = This.author
|
144
|
+
spec.email = This.email
|
145
|
+
spec.homepage = This.homepage
|
60
146
|
|
61
|
-
|
62
|
-
|
147
|
+
spec.summary = This.summary
|
148
|
+
spec.description = This.description
|
63
149
|
|
64
|
-
|
65
|
-
}
|
150
|
+
spec.files = This.manifest
|
151
|
+
spec.executables = spec.files.grep(/^bin/) { |f| File.basename(f) }
|
152
|
+
spec.test_files = spec.files.grep(/^spec/)
|
153
|
+
|
154
|
+
spec.extra_rdoc_files += spec.files.grep(/(txt|rdoc)$/)
|
155
|
+
spec.rdoc_options = [ "--main" , 'README.rdoc', ]
|
156
|
+
|
157
|
+
# The Runtime Dependencies
|
158
|
+
spec.add_runtime_dependency( 'addressable', '~> 2.2.6' )
|
159
|
+
|
160
|
+
# The Development Dependencies
|
161
|
+
spec.add_development_dependency( 'rake' , '~> 0.9.2.2')
|
162
|
+
spec.add_development_dependency( 'minitest' , '~> 2.11.3' )
|
163
|
+
spec.add_development_dependency( 'rdoc' , '~> 3.12' )
|
164
|
+
spec.add_development_dependency( 'spoon' , '~> 0.0.1' )
|
165
|
+
spec.add_development_dependency( 'ffi' , '~> 1.0.9' )
|
66
166
|
|
67
|
-
# Sorry Tim, I need to manage my own bones version
|
68
|
-
::Bones.config.gem._spec.dependencies.delete_if do |d|
|
69
|
-
d.name == 'bones' and d.requirement.to_s =~ /^>=/
|
70
167
|
end
|
168
|
+
|
169
|
+
#----------------------------------------------
|
170
|
+
# JRuby spec has a few more runtime dependencies
|
171
|
+
#----------------------------------------------
|
172
|
+
jruby_gemspec = This.gemspec['ruby'].dup
|
173
|
+
jruby_gemspec.add_runtime_dependency( 'spoon', '~> 0.0.1' )
|
174
|
+
jruby_gemspec.add_runtime_dependency( 'ffi' , '~> 1.0.9' )
|
175
|
+
jruby_gemspec.platform = 'java'
|
176
|
+
This.gemspec['java'] = jruby_gemspec
|
177
|
+
|
178
|
+
|
179
|
+
# The name of the gemspec file on disk
|
180
|
+
This.gemspec_file = "#{This.name}.gemspec"
|
181
|
+
|
182
|
+
# Really this is only here to support those who use bundler
|
183
|
+
desc "Build the #{This.name}.gemspec file"
|
184
|
+
task :gemspec do
|
185
|
+
File.open( This.gemspec_file, "wb+" ) do |f|
|
186
|
+
f.write Util.platform_gemspec.to_ruby
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
190
|
+
# the gemspec is also a dev artifact and should not be kept around.
|
191
|
+
CLOBBER << This.gemspec_file
|
192
|
+
|
193
|
+
# The standard gem packaging task, everyone has it.
|
194
|
+
require 'rubygems/package_task'
|
195
|
+
Gem::PackageTask.new( Util.platform_gemspec ) do
|
196
|
+
# nothing
|
197
|
+
end
|
198
|
+
|
199
|
+
#------------------------------------------------------------------------------
|
200
|
+
# Release - the steps we go through to do a final release, this is pulled from
|
201
|
+
# a compbination of mojombo's rakegem, hoe and hoe-git
|
202
|
+
#
|
203
|
+
# 1) make sure we are on the master branch
|
204
|
+
# 2) make sure there are no uncommitted items
|
205
|
+
# 3) check the manifest and make sure all looks good
|
206
|
+
# 4) build the gem
|
207
|
+
# 5) do an empty commit to have the commit message of the version
|
208
|
+
# 6) tag that commit as the version
|
209
|
+
# 7) push master
|
210
|
+
# 8) push the tag
|
211
|
+
# 7) pus the gem
|
212
|
+
#------------------------------------------------------------------------------
|
213
|
+
task :release_check do
|
214
|
+
unless `git branch` =~ /^\* master$/
|
215
|
+
abort "You must be on the master branch to release!"
|
216
|
+
end
|
217
|
+
unless `git status` =~ /^nothing to commit/m
|
218
|
+
abort "Nope, sorry, you have unfinished business"
|
219
|
+
end
|
220
|
+
end
|
221
|
+
|
222
|
+
desc "Create tag v#{This.version}, build and push #{Util.platform_gemspec.full_name} to rubygems.org"
|
223
|
+
task :release => [ :release_check, 'manifest:check', :gem ] do
|
224
|
+
sh "git commit --allow-empty -a -m 'Release #{This.version}'"
|
225
|
+
sh "git tag -a -m 'v#{This.version}' v#{This.version}"
|
226
|
+
sh "git push origin master"
|
227
|
+
sh "git push origin v#{This.version}"
|
228
|
+
sh "gem push pkg/#{Util.platform_gemspec.full_name}.gem"
|
229
|
+
end
|
230
|
+
|
231
|
+
#------------------------------------------------------------------------------
|
232
|
+
# Rakefile Support - This is all the guts and utility methods that are
|
233
|
+
# necessary to support the above tasks.
|
234
|
+
#
|
235
|
+
# Lots of Credit for this Rakefile goes to:
|
236
|
+
#
|
237
|
+
# Ara T. Howard - see the Rakefile in all of his projects -
|
238
|
+
# https://github.com/ahoward/
|
239
|
+
# Tom Preston Werner - his Rakegem project https://github.com/mojombo/rakegem
|
240
|
+
# Seattle.rb - Hoe - cuz it has relly good stuff in there
|
241
|
+
#------------------------------------------------------------------------------
|
242
|
+
BEGIN {
|
243
|
+
|
244
|
+
require 'ostruct'
|
245
|
+
require 'rake/clean'
|
246
|
+
require 'rubygems' unless defined? Gem
|
247
|
+
|
248
|
+
module Util
|
249
|
+
def self.version
|
250
|
+
[ "lib/#{ This.name }.rb", "lib/#{ This.name }/version.rb" ].each do |v|
|
251
|
+
line = File.read( v )[/^\s*VERSION\s*=\s*.*/]
|
252
|
+
if line then
|
253
|
+
return line.match(/.*VERSION\s*=\s*['"](.*)['"]/)[1]
|
254
|
+
end
|
255
|
+
end
|
256
|
+
end
|
257
|
+
|
258
|
+
# Partition an rdoc file into sections and return the text of the section
|
259
|
+
# as an array of paragraphs
|
260
|
+
def self.section_of( file, section_name )
|
261
|
+
re = /^=+ (.*)$/
|
262
|
+
parts = File.read( file ).split( re )[1..-1]
|
263
|
+
parts.map! { |p| p.strip }
|
264
|
+
|
265
|
+
sections = Hash.new
|
266
|
+
Hash[*parts].each do |k,v|
|
267
|
+
sections[k] = v.split("\n\n")
|
268
|
+
end
|
269
|
+
return sections[section_name]
|
270
|
+
end
|
271
|
+
|
272
|
+
def self.task_warning( task )
|
273
|
+
warn "WARNING: '#{task}' tasks are not defined. Please run 'rake develop'"
|
274
|
+
end
|
275
|
+
|
276
|
+
def self.read_manifest
|
277
|
+
abort "You need a Manifest.txt" unless File.readable?( "Manifest.txt" )
|
278
|
+
File.readlines( "Manifest.txt" ).map { |l| l.strip }
|
279
|
+
end
|
280
|
+
|
281
|
+
def self.platform_gemspec
|
282
|
+
This.gemspec[This.platform]
|
283
|
+
end
|
284
|
+
end
|
285
|
+
|
286
|
+
# Hold all the metadata about this project
|
287
|
+
This = OpenStruct.new
|
288
|
+
This.platform = (RUBY_PLATFORM == "java") ? 'java' : Gem::Platform::RUBY
|
289
|
+
|
290
|
+
desc = Util.section_of( 'README.rdoc', 'DESCRIPTION')
|
291
|
+
This.summary = desc.first
|
292
|
+
This.description = desc.join(" ").tr("\n", ' ').gsub(/[{}]/,'').gsub(/\[[^\]]+\]/,'') # strip rdoc
|
293
|
+
|
294
|
+
|
295
|
+
This.exclude_from_manifest = %r/tmp$|\.(git|DS_Store)|^(doc|coverage|pkg)|\.gemspec$|\.swp$|\.jar|\.rvmrc$|~$/
|
296
|
+
This.manifest = Util.read_manifest
|
297
|
+
|
298
|
+
}
|
data/lib/launchy.rb
CHANGED
@@ -51,7 +51,7 @@ module Launchy
|
|
51
51
|
Launchy.application = options.delete( :application ) || ENV['LAUNCHY_APPLICATION']
|
52
52
|
Launchy.host_os = options.delete( :host_os ) || ENV['LAUNCHY_HOST_OS']
|
53
53
|
Launchy.ruby_engine = options.delete( :ruby_engine ) || ENV['LAUNCHY_RUBY_ENGINE']
|
54
|
-
Launchy.dry_run = options.delete( :dry_run )
|
54
|
+
Launchy.dry_run = options.delete( :dry_run ) || ENV['LAUNCHY_DRY_RUN']
|
55
55
|
end
|
56
56
|
|
57
57
|
def debug=( d )
|
@@ -97,7 +97,7 @@ module Launchy
|
|
97
97
|
end
|
98
98
|
|
99
99
|
def bug_report_message
|
100
|
-
"Please file a bug at https://github.com/copiousfreetime/launchy/issues/new"
|
100
|
+
"Please rerun with environment variable LAUNCHY_DEBUG=true or the '-d' commandline option and file a bug at https://github.com/copiousfreetime/launchy/issues/new"
|
101
101
|
end
|
102
102
|
|
103
103
|
def log(msg)
|
@@ -55,9 +55,11 @@ class Launchy::Application
|
|
55
55
|
possibilities.each do |p|
|
56
56
|
Launchy.log "#{self.class.name} : possibility : #{p}"
|
57
57
|
end
|
58
|
-
browser = possibilities.shift
|
59
|
-
|
60
|
-
|
58
|
+
if browser = possibilities.shift then
|
59
|
+
Launchy.log "#{self.class.name} : Using browser value '#{browser}'"
|
60
|
+
return browser
|
61
|
+
end
|
62
|
+
raise Launchy::CommandNotFoundError, "Unable to find a browser command. If this is unexpected, #{Launchy.bug_report_message}"
|
61
63
|
end
|
62
64
|
|
63
65
|
def cmd_and_args( uri, options = {} )
|
data/lib/launchy/cli.rb
CHANGED
@@ -14,7 +14,7 @@ module Launchy::Detect
|
|
14
14
|
# NixDekstopEnvironment::Unknown
|
15
15
|
def self.detect
|
16
16
|
found = find_child( :is_current_desktop_environment? )
|
17
|
-
Launchy.log("Current Desktop environment not
|
17
|
+
Launchy.log("Current Desktop environment not found. #{Launchy.bug_report_message}") unless found
|
18
18
|
return found
|
19
19
|
end
|
20
20
|
|
@@ -48,7 +48,11 @@ module Launchy::Detect
|
|
48
48
|
|
49
49
|
class Xfce < NixDesktopEnvironment
|
50
50
|
def self.is_current_desktop_environment?
|
51
|
-
|
51
|
+
if Launchy::Application.find_executable( 'xprop' ) then
|
52
|
+
%x[ xprop -root _DT_SAVE_MODE | grep ' = \"xfce\"$' ].strip.size > 0
|
53
|
+
else
|
54
|
+
false
|
55
|
+
end
|
52
56
|
end
|
53
57
|
|
54
58
|
def self.browser
|
@@ -28,7 +28,7 @@ module Launchy::Detect
|
|
28
28
|
require 'spoon'
|
29
29
|
return Jruby.new
|
30
30
|
end
|
31
|
-
return Forkable.new
|
31
|
+
return Forkable.new
|
32
32
|
end
|
33
33
|
|
34
34
|
#
|
@@ -55,6 +55,7 @@ module Launchy::Detect
|
|
55
55
|
end
|
56
56
|
|
57
57
|
def run( cmd, *args )
|
58
|
+
raise Launchy::CommandNotFoundError, "No command found to run with args '#{args.join(' ')}'. If this is unexpected, #{Launchy.bug_report_message}" unless cmd
|
58
59
|
if Launchy.dry_run? then
|
59
60
|
$stdout.puts dry_run( cmd, *args )
|
60
61
|
else
|
data/lib/launchy/error.rb
CHANGED
data/lib/launchy/version.rb
CHANGED
@@ -22,6 +22,10 @@ describe Launchy::Detect::NixDesktopEnvironment do
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
+
it "returns false for XFCE if xprop is not found" do
|
26
|
+
Launchy.host_os = "linux"
|
27
|
+
Launchy::Detect::NixDesktopEnvironment::Xfce.is_current_desktop_environment?.must_equal( false )
|
28
|
+
end
|
25
29
|
|
26
30
|
it "returns nil if it cannot determine the *nix desktop environment" do
|
27
31
|
Launchy.host_os = "linux"
|
data/spec/detect/runner_spec.rb
CHANGED
@@ -20,6 +20,11 @@ describe Launchy::Detect::Runner do
|
|
20
20
|
lambda{ Launchy::Detect::Runner.detect }.must_raise Launchy::Detect::RubyEngine::NotFoundError
|
21
21
|
end
|
22
22
|
|
23
|
+
it "raises and error when there is no command found" do
|
24
|
+
runner = Launchy::Detect::Runner.detect
|
25
|
+
lambda{ runner.run( nil, *%w[ arg1 arg2 arg 3] ) }.must_raise Launchy::CommandNotFoundError
|
26
|
+
end
|
27
|
+
|
23
28
|
# On anything that has fork, use Forkable
|
24
29
|
%w[ linux darwin cygwin ].each do |host_os|
|
25
30
|
%w[ ruby rbx macruby ].each do |engine_name|
|
data/spec/launchy_spec.rb
CHANGED
@@ -23,6 +23,13 @@ describe Launchy do
|
|
23
23
|
ENV["LAUNCHY_DEBUG"] = nil
|
24
24
|
end
|
25
25
|
|
26
|
+
it "sets the global option :dry_run to value of LAUNCHY_DRY_RUN environment variable" do
|
27
|
+
ENV['LAUNCHY_DRY_RUN'] = 'true'
|
28
|
+
Launchy.extract_global_options({})
|
29
|
+
Launchy.dry_run?.must_equal 'true'
|
30
|
+
ENV['LAUNCHY_DRY_RUN'] = nil
|
31
|
+
end
|
32
|
+
|
26
33
|
it "has the global option :debug" do
|
27
34
|
Launchy.extract_global_options( { :debug => 'true' } )
|
28
35
|
Launchy.debug?.must_equal true
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: launchy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 11
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 2
|
8
|
+
- 1
|
8
9
|
- 0
|
9
|
-
|
10
|
-
version: 2.0.5
|
10
|
+
version: 2.1.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jeremy Hinegardner
|
@@ -15,8 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
19
|
-
default_executable:
|
18
|
+
date: 2012-03-18 00:00:00 Z
|
20
19
|
dependencies:
|
21
20
|
- !ruby/object:Gem::Dependency
|
22
21
|
name: addressable
|
@@ -42,12 +41,13 @@ dependencies:
|
|
42
41
|
requirements:
|
43
42
|
- - ~>
|
44
43
|
- !ruby/object:Gem::Version
|
45
|
-
hash:
|
44
|
+
hash: 11
|
46
45
|
segments:
|
47
46
|
- 0
|
48
47
|
- 9
|
49
48
|
- 2
|
50
|
-
|
49
|
+
- 2
|
50
|
+
version: 0.9.2.2
|
51
51
|
type: :development
|
52
52
|
version_requirements: *id002
|
53
53
|
- !ruby/object:Gem::Dependency
|
@@ -58,66 +58,33 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - ~>
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
hash:
|
61
|
+
hash: 37
|
62
62
|
segments:
|
63
63
|
- 2
|
64
|
+
- 11
|
64
65
|
- 3
|
65
|
-
|
66
|
-
version: 2.3.1
|
66
|
+
version: 2.11.3
|
67
67
|
type: :development
|
68
68
|
version_requirements: *id003
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: rdoc
|
71
71
|
prerelease: false
|
72
72
|
requirement: &id004 !ruby/object:Gem::Requirement
|
73
73
|
none: false
|
74
74
|
requirements:
|
75
75
|
- - ~>
|
76
76
|
- !ruby/object:Gem::Version
|
77
|
-
hash:
|
77
|
+
hash: 31
|
78
78
|
segments:
|
79
79
|
- 3
|
80
|
-
-
|
81
|
-
|
82
|
-
version: 3.7.0
|
80
|
+
- 12
|
81
|
+
version: "3.12"
|
83
82
|
type: :development
|
84
83
|
version_requirements: *id004
|
85
|
-
- !ruby/object:Gem::Dependency
|
86
|
-
name: bones-rcov
|
87
|
-
prerelease: false
|
88
|
-
requirement: &id005 !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
|
-
requirements:
|
91
|
-
- - ~>
|
92
|
-
- !ruby/object:Gem::Version
|
93
|
-
hash: 21
|
94
|
-
segments:
|
95
|
-
- 1
|
96
|
-
- 0
|
97
|
-
- 1
|
98
|
-
version: 1.0.1
|
99
|
-
type: :development
|
100
|
-
version_requirements: *id005
|
101
|
-
- !ruby/object:Gem::Dependency
|
102
|
-
name: rcov
|
103
|
-
prerelease: false
|
104
|
-
requirement: &id006 !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
|
-
requirements:
|
107
|
-
- - ~>
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
hash: 41
|
110
|
-
segments:
|
111
|
-
- 0
|
112
|
-
- 9
|
113
|
-
- 9
|
114
|
-
version: 0.9.9
|
115
|
-
type: :development
|
116
|
-
version_requirements: *id006
|
117
84
|
- !ruby/object:Gem::Dependency
|
118
85
|
name: spoon
|
119
86
|
prerelease: false
|
120
|
-
requirement: &
|
87
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
121
88
|
none: false
|
122
89
|
requirements:
|
123
90
|
- - ~>
|
@@ -129,11 +96,11 @@ dependencies:
|
|
129
96
|
- 1
|
130
97
|
version: 0.0.1
|
131
98
|
type: :development
|
132
|
-
version_requirements: *
|
99
|
+
version_requirements: *id005
|
133
100
|
- !ruby/object:Gem::Dependency
|
134
101
|
name: ffi
|
135
102
|
prerelease: false
|
136
|
-
requirement: &
|
103
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
137
104
|
none: false
|
138
105
|
requirements:
|
139
106
|
- - ~>
|
@@ -145,31 +112,23 @@ dependencies:
|
|
145
112
|
- 9
|
146
113
|
version: 1.0.9
|
147
114
|
type: :development
|
148
|
-
version_requirements: *
|
149
|
-
description:
|
150
|
-
Launchy is helper class for launching cross-platform applications in a
|
151
|
-
fire and forget manner.
|
152
|
-
|
153
|
-
There are application concepts (browser, email client, etc) that are
|
154
|
-
common across all platforms, and they may be launched differently on
|
155
|
-
each platform. Launchy is here to make a common approach to launching
|
156
|
-
external application from within ruby programs.
|
157
|
-
|
115
|
+
version_requirements: *id006
|
116
|
+
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 application from within ruby programs.
|
158
117
|
email: jeremy@copiousfreetime.org
|
159
118
|
executables:
|
160
119
|
- launchy
|
161
120
|
extensions: []
|
162
121
|
|
163
122
|
extra_rdoc_files:
|
164
|
-
- HISTORY
|
165
|
-
-
|
166
|
-
- README
|
167
|
-
- bin/launchy
|
123
|
+
- HISTORY.rdoc
|
124
|
+
- Manifest.txt
|
125
|
+
- README.rdoc
|
168
126
|
files:
|
169
|
-
- HISTORY
|
127
|
+
- HISTORY.rdoc
|
170
128
|
- LICENSE
|
129
|
+
- Manifest.txt
|
171
130
|
- NOTES
|
172
|
-
- README
|
131
|
+
- README.rdoc
|
173
132
|
- Rakefile
|
174
133
|
- bin/launchy
|
175
134
|
- lib/launchy.rb
|
@@ -200,16 +159,13 @@ files:
|
|
200
159
|
- spec/spec_helper.rb
|
201
160
|
- spec/tattle-host-os.yaml
|
202
161
|
- spec/version_spec.rb
|
203
|
-
|
204
|
-
- tasks/contribute.rake
|
205
|
-
has_rdoc: true
|
206
|
-
homepage: http://www.copiousfreetime.org/projects/launchy
|
162
|
+
homepage: http://github.com/copiousfreetime/launchy
|
207
163
|
licenses: []
|
208
164
|
|
209
165
|
post_install_message:
|
210
166
|
rdoc_options:
|
211
167
|
- --main
|
212
|
-
- README
|
168
|
+
- README.rdoc
|
213
169
|
require_paths:
|
214
170
|
- lib
|
215
171
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -232,8 +188,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
232
188
|
version: "0"
|
233
189
|
requirements: []
|
234
190
|
|
235
|
-
rubyforge_project:
|
236
|
-
rubygems_version: 1.
|
191
|
+
rubyforge_project:
|
192
|
+
rubygems_version: 1.8.16
|
237
193
|
signing_key:
|
238
194
|
specification_version: 3
|
239
195
|
summary: Launchy is helper class for launching cross-platform applications in a fire and forget manner.
|
@@ -247,4 +203,7 @@ test_files:
|
|
247
203
|
- spec/detect/ruby_engine_spec.rb
|
248
204
|
- spec/detect/runner_spec.rb
|
249
205
|
- spec/launchy_spec.rb
|
206
|
+
- spec/mock_application.rb
|
207
|
+
- spec/spec_helper.rb
|
208
|
+
- spec/tattle-host-os.yaml
|
250
209
|
- spec/version_spec.rb
|
data/tasks/bundler.rake
DELETED
data/tasks/contribute.rake
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
desc "Instructions on how to contribute to launchy"
|
2
|
-
task :help do
|
3
|
-
abort <<-_banner
|
4
|
-
-----------------------------------------------------------------------
|
5
|
-
I see you are wanting to do some development on launchy. You will
|
6
|
-
need to install the 'bones' gem first.
|
7
|
-
|
8
|
-
% gem install bones -v #{USING_BONES_VERSION}
|
9
|
-
|
10
|
-
The easiest way to start after that is with the
|
11
|
-
'install:dependencies' task:
|
12
|
-
|
13
|
-
% rake gem:install_dependencies
|
14
|
-
|
15
|
-
If you use bundler, then you will need to first create the Gemfile
|
16
|
-
and then run 'bundle install':
|
17
|
-
|
18
|
-
% rake bundle:gemfile
|
19
|
-
% bundle install
|
20
|
-
|
21
|
-
Now you are ready to work on launchy. Please submit bugs and pull
|
22
|
-
requests to:
|
23
|
-
|
24
|
-
https://github.com/copiousfreetime/launchy
|
25
|
-
|
26
|
-
Thanks!
|
27
|
-
|
28
|
-
-jeremy
|
29
|
-
-----------------------------------------------------------------------
|
30
|
-
_banner
|
31
|
-
end
|
32
|
-
|
33
|
-
desc "(Alias for 'help') Instructions on how to contribute to launchy"
|
34
|
-
task 'how_to_contribute' => :help
|
35
|
-
desc "(Alias for 'help') Instructions on how to contribute to launchy"
|
36
|
-
task '==> I WANT TO CONTRIBUTE <==' => :help
|