launchy 2.1.2 → 2.2.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.
- data/CONTRIBUTING.md +52 -0
- data/HISTORY.rdoc +9 -1
- data/LICENSE +1 -1
- data/Manifest.txt +3 -1
- data/README.rdoc +1 -1
- data/Rakefile +8 -285
- data/lib/launchy.rb +26 -15
- data/lib/launchy/cli.rb +16 -8
- data/lib/launchy/detect/nix_desktop_environment.rb +12 -2
- data/lib/launchy/detect/runner.rb +11 -1
- data/lib/launchy/error.rb +1 -0
- data/lib/launchy/version.rb +1 -1
- data/spec/detect/nix_desktop_environment_spec.rb +8 -0
- data/spec/launchy_spec.rb +8 -3
- data/spec/spec_helper.rb +6 -0
- data/tasks/default.rake +213 -0
- data/tasks/this.rb +202 -0
- metadata +11 -39
- data/NOTES +0 -1
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
# Hi there!
|
2
|
+
|
3
|
+
I see you are interested in contributing. That is wonderful. I love
|
4
|
+
contributions.
|
5
|
+
|
6
|
+
I guarantee that there are bugs in this software. And I guarantee that there is
|
7
|
+
a feature you want that is not in here yet. As such, any and all bugs reports
|
8
|
+
are gratefully accepted, bugfixes even more so. Helping out with bugs is the
|
9
|
+
easiest way to contribute.
|
10
|
+
|
11
|
+
|
12
|
+
## The Quick Version
|
13
|
+
|
14
|
+
* Have a [GitHub Account][].
|
15
|
+
* Search the [GitHub Issues][] and see if your issue already present. If so
|
16
|
+
add your comments, :thumbsup:, etc.
|
17
|
+
* Issue not there? Not a problem, open up a [new issue][].
|
18
|
+
* **Bug reports** please be as detailed as possible. Include:
|
19
|
+
* full ruby engine and version: `ruby -e 'puts RUBY_DESCRIPTION'`
|
20
|
+
* operating system and version
|
21
|
+
* version of launchy `ruby -rubygems -Ilib -e "require 'launchy'; puts Launchy::VERSION"`
|
22
|
+
* as much detail about the bug as possible so I can replicate it. Feel free
|
23
|
+
to link in a [gist][]
|
24
|
+
* **New Feature**
|
25
|
+
* What the new feature should do.
|
26
|
+
* What benefit the new feature brings to the project.
|
27
|
+
* Fork the [repo][].
|
28
|
+
* Create a new branch for your issue: `git checkout -b issue/my-issue`
|
29
|
+
* Lovingly craft your contribution:
|
30
|
+
* `rake develop` to get started, or if you prefer bundler `rake develop:using_bundler && bundle`.
|
31
|
+
* `rake test` to run tests
|
32
|
+
* Make sure that `rake test` passes. It's important, I said it twice.
|
33
|
+
* Add yourself to the contributors section below.
|
34
|
+
* Submit your [pull request][].
|
35
|
+
|
36
|
+
# Contributors
|
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
|
46
|
+
|
47
|
+
[GitHub Account]: https://github.com/signup/free "GitHub Signup"
|
48
|
+
[GitHub Issues]: https://github.com/copiousfreetime/launchy/issues "Launchy Issues"
|
49
|
+
[new issue]: https://github.com/copiousfreetime/launchy/issues/new "New Launchy Issue"
|
50
|
+
[gist]: https://gist.github.com/ "New Gist"
|
51
|
+
[repo]: https://github.com/copiousfreetime/launchy "Launchy Repo"
|
52
|
+
[pull request]: https://help.github.com/articles/using-pull-requests "Using Pull Requests"
|
data/HISTORY.rdoc
CHANGED
@@ -1,4 +1,13 @@
|
|
1
1
|
= Launchy Changlog
|
2
|
+
== Version 2.2.0 - 2013-02-06
|
3
|
+
|
4
|
+
* Change XFCE detection to not depend on grep (copiousfreetime/launchy#52 - thanks bogdan)
|
5
|
+
* Suppress forked process output (copiousfreetime/launchy#51)
|
6
|
+
* Display help/usage if no url is given (copiousfreetime/launchy#54)
|
7
|
+
* Detect the fluxbox environment (copiousfreetime/launchy#53)
|
8
|
+
* Automatically detect 'http' url's if they are missing the 'http://' (copiousfreetime/launchy#55)
|
9
|
+
* Update to latest project management rake tasks
|
10
|
+
|
2
11
|
== Version 2.1.2 - 2012-08-06
|
3
12
|
|
4
13
|
* Fix where HostOS would fail to convert to string on JRuby in 1.9 mode (copiousfreetime/launchy#45)
|
@@ -14,7 +23,6 @@
|
|
14
23
|
* Add LAUNCHY_DRY_RUN environment variable (thanks Mariusz Pietrzyk / wijet)
|
15
24
|
* Update dependencies
|
16
25
|
|
17
|
-
|
18
26
|
== Version 2.0.5 - 2011-07-24
|
19
27
|
|
20
28
|
* Fix the case where $BROWSER is set and no *nix desktop was found (copiousfreetime/launchy#33)
|
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-2013 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/Manifest.txt
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
+
CONTRIBUTING.md
|
1
2
|
HISTORY.rdoc
|
2
3
|
LICENSE
|
3
4
|
Manifest.txt
|
4
|
-
NOTES
|
5
5
|
README.rdoc
|
6
6
|
Rakefile
|
7
7
|
bin/launchy
|
@@ -33,3 +33,5 @@ spec/mock_application.rb
|
|
33
33
|
spec/spec_helper.rb
|
34
34
|
spec/tattle-host-os.yaml
|
35
35
|
spec/version_spec.rb
|
36
|
+
tasks/default.rake
|
37
|
+
tasks/this.rb
|
data/README.rdoc
CHANGED
@@ -83,7 +83,7 @@ in the github gem if it was updated to use 2.0.x but not use the supported API.
|
|
83
83
|
|
84
84
|
http://opensource.org/licenses/isc-license.txt
|
85
85
|
|
86
|
-
Copyright (c) 2007-
|
86
|
+
Copyright (c) 2007-2013 Jeremy Hinegardner
|
87
87
|
|
88
88
|
Permission to use, copy, modify, and/or distribute this software for any
|
89
89
|
purpose with or without fee is hereby granted, provided that the above
|
data/Rakefile
CHANGED
@@ -1,298 +1,21 @@
|
|
1
1
|
# vim: syntax=ruby
|
2
|
+
load 'tasks/this.rb'
|
2
3
|
|
3
4
|
This.name = "launchy"
|
4
5
|
This.author = "Jeremy Hinegardner"
|
5
6
|
This.email = "jeremy@copiousfreetime.org"
|
6
7
|
This.homepage = "http://github.com/copiousfreetime/#{ This.name }"
|
7
|
-
This.version = Util.version
|
8
8
|
|
9
|
-
|
10
|
-
|
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
|
9
|
+
This.ruby_gemspec do |spec|
|
10
|
+
spec.add_dependency( 'addressable', '~> 2.3')
|
15
11
|
|
16
|
-
|
17
|
-
|
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
|
-
#------------------------------------------------------------------------------
|
90
|
-
begin
|
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
|
99
|
-
rescue LoadError
|
100
|
-
$stderr.puts "rcov task is not defined, please 'gem install rcov'"
|
101
|
-
end
|
102
|
-
|
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"
|
124
|
-
end
|
125
|
-
|
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
|
135
|
-
|
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
|
146
|
-
|
147
|
-
spec.summary = This.summary
|
148
|
-
spec.description = This.description
|
149
|
-
|
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.3' )
|
159
|
-
|
160
|
-
# The Development Dependencies
|
161
|
-
spec.add_development_dependency( 'rake' , '~> 0.9.2.2')
|
162
|
-
spec.add_development_dependency( 'minitest' , '~> 3.3.0' )
|
12
|
+
spec.add_development_dependency( 'rake' , '~> 10.0.3')
|
13
|
+
spec.add_development_dependency( 'minitest' , '~> 4.5.0' )
|
163
14
|
spec.add_development_dependency( 'rdoc' , '~> 3.12' )
|
164
|
-
spec.add_development_dependency( 'spoon' , '~> 0.0.1' )
|
165
|
-
spec.add_development_dependency( 'ffi' , '~> 1.1.1' )
|
166
|
-
|
167
15
|
end
|
168
16
|
|
169
|
-
|
170
|
-
|
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.1.1' )
|
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
|
17
|
+
This.java_gemspec( This.ruby_gemspec ) do |spec|
|
18
|
+
spec.add_dependency( 'spoon', '~> 0.0.1' )
|
197
19
|
end
|
198
20
|
|
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
|
-
}
|
21
|
+
load 'tasks/default.rake'
|
data/lib/launchy.rb
CHANGED
@@ -20,22 +20,33 @@ module Launchy
|
|
20
20
|
|
21
21
|
class << self
|
22
22
|
#
|
23
|
-
#
|
23
|
+
# Launch an application for the given uri string
|
24
24
|
#
|
25
|
-
def open(
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
25
|
+
def open(uri_s, options = {} )
|
26
|
+
extract_global_options( options )
|
27
|
+
uri = string_to_uri( uri_s )
|
28
|
+
app = app_for_uri( uri )
|
29
|
+
app.new.open( uri, options )
|
30
|
+
rescue Launchy::Error => le
|
31
|
+
raise le
|
32
|
+
rescue Exception => e
|
33
|
+
msg = "Failure in opening uri #{uri_s.inspect} with options #{options.inspect}: #{e}"
|
34
|
+
raise Launchy::Error, msg
|
35
|
+
end
|
36
|
+
|
37
|
+
def app_for_uri( uri )
|
38
|
+
Launchy::Application.handling( uri )
|
39
|
+
end
|
40
|
+
|
41
|
+
def app_for_uri_string( s )
|
42
|
+
app_for_uri( string_to_uri( s ) )
|
43
|
+
end
|
44
|
+
|
45
|
+
def string_to_uri( s )
|
46
|
+
uri = Addressable::URI.parse( s )
|
47
|
+
uri = Addressable::URI.heuristic_parse( s ) unless uri.scheme
|
48
|
+
raise Launchy::ArgumentError, "Invalid URI given: #{s.inspect}" unless uri
|
49
|
+
return uri
|
39
50
|
end
|
40
51
|
|
41
52
|
def reset_global_options
|
data/lib/launchy/cli.rb
CHANGED
@@ -57,14 +57,10 @@ module Launchy
|
|
57
57
|
end
|
58
58
|
|
59
59
|
def parse( argv, env )
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
$stderr.puts "#{parser.program_name}: #{pe}"
|
65
|
-
$stderr.puts "Try `#{parser.program_name} --help for more information."
|
66
|
-
return false
|
67
|
-
end
|
60
|
+
parser.parse!( argv )
|
61
|
+
return true
|
62
|
+
rescue ::OptionParser::ParseError => pe
|
63
|
+
error_output( pe )
|
68
64
|
end
|
69
65
|
|
70
66
|
def good_run( argv, env )
|
@@ -74,6 +70,18 @@ module Launchy
|
|
74
70
|
else
|
75
71
|
return false
|
76
72
|
end
|
73
|
+
rescue StandardError => e
|
74
|
+
error_output( e )
|
75
|
+
end
|
76
|
+
|
77
|
+
def error_output( error )
|
78
|
+
$stderr.puts "ERROR: #{error}"
|
79
|
+
Launchy.log "ERROR: #{error}"
|
80
|
+
error.backtrace.each do |bt|
|
81
|
+
Launchy.log bt
|
82
|
+
end
|
83
|
+
$stderr.puts "Try `#{parser.program_name} --help' for more information."
|
84
|
+
return false
|
77
85
|
end
|
78
86
|
|
79
87
|
def run( argv = ARGV, env = ENV )
|
@@ -2,7 +2,7 @@ module Launchy::Detect
|
|
2
2
|
#
|
3
3
|
# Detect the current desktop environment for *nix machines
|
4
4
|
# Currently this is Linux centric. The detection is based upon the detection
|
5
|
-
# used by xdg-open from http://portland.freedesktop.org/
|
5
|
+
# used by xdg-open from http://portland.freedesktop.org/
|
6
6
|
class NixDesktopEnvironment
|
7
7
|
class NotFoundError < Launchy::Error; end
|
8
8
|
|
@@ -49,7 +49,7 @@ module Launchy::Detect
|
|
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
|
52
|
+
%x[ xprop -root _DT_SAVE_MODE].include?("xfce")
|
53
53
|
else
|
54
54
|
false
|
55
55
|
end
|
@@ -59,6 +59,16 @@ module Launchy::Detect
|
|
59
59
|
'exo-open'
|
60
60
|
end
|
61
61
|
end
|
62
|
+
|
63
|
+
class Fluxbox < NixDesktopEnvironment
|
64
|
+
def self.is_current_desktop_environment?
|
65
|
+
ENV['DESKTOP_SESSION'] == 'fluxbox'
|
66
|
+
end
|
67
|
+
|
68
|
+
def self.browser
|
69
|
+
'xdg-open'
|
70
|
+
end
|
71
|
+
end
|
62
72
|
end
|
63
73
|
end
|
64
74
|
|
@@ -25,7 +25,6 @@ module Launchy::Detect
|
|
25
25
|
|
26
26
|
return Windows.new if host_os_family.windows?
|
27
27
|
if ruby_engine.jruby? then
|
28
|
-
require 'spoon'
|
29
28
|
return Jruby.new
|
30
29
|
end
|
31
30
|
return Forkable.new
|
@@ -95,6 +94,7 @@ module Launchy::Detect
|
|
95
94
|
|
96
95
|
class Jruby < Runner
|
97
96
|
def wet_run( cmd, *args )
|
97
|
+
require 'spoon'
|
98
98
|
Spoon.spawnp( *shell_commands( cmd, *args ) )
|
99
99
|
end
|
100
100
|
end
|
@@ -102,11 +102,21 @@ module Launchy::Detect
|
|
102
102
|
class Forkable < Runner
|
103
103
|
def wet_run( cmd, *args )
|
104
104
|
child_pid = fork do
|
105
|
+
close_file_descriptors unless Launchy.debug?
|
106
|
+
Launchy.log("wet_run: before exec in child process")
|
105
107
|
exec( *shell_commands( cmd, *args ))
|
106
108
|
exit!
|
107
109
|
end
|
108
110
|
Process.detach( child_pid )
|
109
111
|
end
|
112
|
+
|
113
|
+
def close_file_descriptors
|
114
|
+
[$stdin, $stdout, $stderr].each do |io|
|
115
|
+
io.reopen( "/dev/null", "r+" )
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
private :close_file_descriptors
|
110
120
|
end
|
111
121
|
end
|
112
122
|
end
|
data/lib/launchy/error.rb
CHANGED
data/lib/launchy/version.rb
CHANGED
@@ -22,6 +22,14 @@ describe Launchy::Detect::NixDesktopEnvironment do
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
+
it "detects the fluxbox desktop environment" do
|
26
|
+
ENV['DESKTOP_SESSION'] = 'fluxbox'
|
27
|
+
fluxbox_env = Launchy::Detect::NixDesktopEnvironment.detect
|
28
|
+
fluxbox_env.must_equal( Launchy::Detect::NixDesktopEnvironment::Fluxbox )
|
29
|
+
fluxbox_env.browser.must_equal( Launchy::Detect::NixDesktopEnvironment::Fluxbox.browser )
|
30
|
+
ENV.delete( 'DESKTOP_SESSION' )
|
31
|
+
end
|
32
|
+
|
25
33
|
it "returns false for XFCE if xprop is not found" do
|
26
34
|
Launchy.host_os = "linux"
|
27
35
|
Launchy::Detect::NixDesktopEnvironment::Xfce.is_current_desktop_environment?.must_equal( false )
|
data/spec/launchy_spec.rb
CHANGED
@@ -50,9 +50,14 @@ describe Launchy do
|
|
50
50
|
Launchy.ruby_engine.must_equal 'myruby'
|
51
51
|
end
|
52
52
|
|
53
|
-
it "
|
54
|
-
Launchy.open( "blah://something/invalid" )
|
55
|
-
$stderr.string.must_match( /Failure in opening/ )
|
53
|
+
it "raises an exception if no scheme is found for the given uri" do
|
54
|
+
lambda { Launchy.open( "blah://something/invalid" ) }.must_raise Launchy::ApplicationNotFoundError
|
56
55
|
end
|
57
56
|
|
57
|
+
[ 'www.example.com', 'www.example.com/foo/bar' ].each do |x|
|
58
|
+
it "picks a Browser for #{x}" do
|
59
|
+
app = Launchy.app_for_uri_string( x )
|
60
|
+
app.must_equal( Launchy::Application::Browser )
|
61
|
+
end
|
62
|
+
end
|
58
63
|
end
|
data/spec/spec_helper.rb
CHANGED
data/tasks/default.rake
ADDED
@@ -0,0 +1,213 @@
|
|
1
|
+
# vim: syntax=ruby
|
2
|
+
require 'rake/clean'
|
3
|
+
#------------------------------------------------------------------------------
|
4
|
+
# If you want to Develop on this project just run 'rake develop' and you'll
|
5
|
+
# have all you need to get going. If you want to use bundler for development,
|
6
|
+
# then run 'rake develop:using_bundler'
|
7
|
+
#------------------------------------------------------------------------------
|
8
|
+
namespace :develop do
|
9
|
+
|
10
|
+
# Install all the development and runtime dependencies of this gem using the
|
11
|
+
# gemspec.
|
12
|
+
task :default do
|
13
|
+
require 'rubygems/dependency_installer'
|
14
|
+
installer = Gem::DependencyInstaller.new
|
15
|
+
|
16
|
+
This.set_coverage_gem
|
17
|
+
|
18
|
+
puts "Installing gem depedencies needed for development"
|
19
|
+
This.platform_gemspec.dependencies.each do |dep|
|
20
|
+
if dep.matching_specs.empty? then
|
21
|
+
puts "Installing : #{dep}"
|
22
|
+
installer.install dep
|
23
|
+
else
|
24
|
+
puts "Skipping : #{dep} -> already installed #{dep.matching_specs.first.full_name}"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
puts "\n\nNow run 'rake test'"
|
28
|
+
end
|
29
|
+
|
30
|
+
# Create a Gemfile that just references the gemspec
|
31
|
+
file 'Gemfile' => :gemspec do
|
32
|
+
File.open( "Gemfile", "w+" ) do |f|
|
33
|
+
f.puts 'source :rubygems'
|
34
|
+
f.puts 'gemspec'
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
desc "Create a bundler Gemfile"
|
39
|
+
task :using_bundler => 'Gemfile' do
|
40
|
+
puts "Now you can 'bundle'"
|
41
|
+
end
|
42
|
+
|
43
|
+
# Gemfiles are build artifacts
|
44
|
+
CLOBBER << FileList['Gemfile*']
|
45
|
+
end
|
46
|
+
desc "Boostrap development"
|
47
|
+
task :develop => "develop:default"
|
48
|
+
|
49
|
+
#------------------------------------------------------------------------------
|
50
|
+
# Minitest - standard TestTask
|
51
|
+
#------------------------------------------------------------------------------
|
52
|
+
begin
|
53
|
+
require 'rake/testtask'
|
54
|
+
Rake::TestTask.new( :test ) do |t|
|
55
|
+
t.ruby_opts = %w[ -w -rubygems ]
|
56
|
+
t.libs = %w[ lib spec ]
|
57
|
+
t.pattern = "spec/**/*_spec.rb"
|
58
|
+
end
|
59
|
+
task :default => :test
|
60
|
+
rescue LoadError
|
61
|
+
This.task_warning( 'test' )
|
62
|
+
end
|
63
|
+
|
64
|
+
#------------------------------------------------------------------------------
|
65
|
+
# RDoc - standard rdoc rake task, although we must make sure to use a more
|
66
|
+
# recent version of rdoc since it is the one that has 'tomdoc' markup
|
67
|
+
#------------------------------------------------------------------------------
|
68
|
+
begin
|
69
|
+
gem 'rdoc' # otherwise we get the wrong task from stdlib
|
70
|
+
require 'rdoc/task'
|
71
|
+
RDoc::Task.new do |t|
|
72
|
+
t.markup = 'tomdoc'
|
73
|
+
t.rdoc_dir = 'doc'
|
74
|
+
t.main = 'README.rdoc'
|
75
|
+
t.title = "#{This.name} #{This.version}"
|
76
|
+
t.rdoc_files.include( '*.rdoc', 'lib/**/*.rb' )
|
77
|
+
end
|
78
|
+
rescue LoadError => le
|
79
|
+
This.task_warning( 'rdoc' )
|
80
|
+
end
|
81
|
+
|
82
|
+
#------------------------------------------------------------------------------
|
83
|
+
# Coverage - optional code coverage, rcov for 1.8 and simplecov for 1.9, so
|
84
|
+
# for the moment only rcov is listed.
|
85
|
+
#------------------------------------------------------------------------------
|
86
|
+
if RUBY_VERSION < "1.9.0"
|
87
|
+
begin
|
88
|
+
require 'rcov/rcovtask'
|
89
|
+
Rcov::RcovTask.new( 'coverage' ) do |t|
|
90
|
+
t.libs << 'spec'
|
91
|
+
t.pattern = 'spec/**/*_spec.rb'
|
92
|
+
t.verbose = true
|
93
|
+
t.rcov_opts << "-x ^/" # remove all the global files
|
94
|
+
t.rcov_opts << "--sort coverage" # so we see the worst files at the top
|
95
|
+
end
|
96
|
+
rescue LoadError
|
97
|
+
This.task_warning( 'rcov' )
|
98
|
+
end
|
99
|
+
else
|
100
|
+
begin
|
101
|
+
require 'simplecov'
|
102
|
+
desc 'Run tests with code coverage'
|
103
|
+
task :coverage do
|
104
|
+
ENV['COVERAGE'] = 'true'
|
105
|
+
Rake::Task[:test].execute
|
106
|
+
end
|
107
|
+
CLOBBER << FileList["coverage"]
|
108
|
+
rescue LoadError
|
109
|
+
This.task_warning( 'simplecov' )
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
#------------------------------------------------------------------------------
|
114
|
+
# Manifest - We want an explicit list of thos files that are to be packaged in
|
115
|
+
# the gem. Most of this is from Hoe.
|
116
|
+
#------------------------------------------------------------------------------
|
117
|
+
namespace 'manifest' do
|
118
|
+
desc "Check the manifest"
|
119
|
+
task :check => :clean do
|
120
|
+
files = FileList["**/*", ".*"].exclude( This.exclude_from_manifest ).to_a.sort
|
121
|
+
files = files.select{ |f| File.file?( f ) }
|
122
|
+
|
123
|
+
tmp = "Manifest.tmp"
|
124
|
+
File.open( tmp, 'w' ) do |f|
|
125
|
+
f.puts files.join("\n")
|
126
|
+
end
|
127
|
+
|
128
|
+
begin
|
129
|
+
sh "diff -du Manifest.txt #{tmp}"
|
130
|
+
ensure
|
131
|
+
rm tmp
|
132
|
+
end
|
133
|
+
puts "Manifest looks good"
|
134
|
+
end
|
135
|
+
|
136
|
+
desc "Generate the manifest"
|
137
|
+
task :generate => :clean do
|
138
|
+
files = %x[ git ls-files ].split("\n").sort
|
139
|
+
files.reject! { |f| f =~ This.exclude_from_manifest }
|
140
|
+
File.open( "Manifest.txt", "w" ) do |f|
|
141
|
+
f.puts files.join("\n")
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
#------------------------------------------------------------------------------
|
147
|
+
# Fixme - look for fixmes and report them
|
148
|
+
#------------------------------------------------------------------------------
|
149
|
+
desc "Look for fixmes and report them"
|
150
|
+
task :fixme => 'manifest:check' do
|
151
|
+
This.manifest.each do |file|
|
152
|
+
next if file == File.basename( __FILE__ )
|
153
|
+
|
154
|
+
puts "FIXME: Rename #{file}" if file =~ /fixme/i
|
155
|
+
|
156
|
+
IO.readlines( file ).each_with_index do |line, idx|
|
157
|
+
prefix = "FIXME: #{file}:#{idx+1}".ljust(42)
|
158
|
+
puts "#{prefix} => #{line.strip}" if line =~ /fixme/i
|
159
|
+
end
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
#------------------------------------------------------------------------------
|
164
|
+
# Gem Specification
|
165
|
+
#------------------------------------------------------------------------------
|
166
|
+
# Really this is only here to support those who use bundler
|
167
|
+
desc "Build the #{This.name}.gemspec file"
|
168
|
+
task :gemspec do
|
169
|
+
File.open( This.gemspec_file, "wb+" ) do |f|
|
170
|
+
f.write This.platform_gemspec.to_ruby
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
# the gemspec is also a dev artifact and should not be kept around.
|
175
|
+
CLOBBER << This.gemspec_file
|
176
|
+
|
177
|
+
# The standard gem packaging task, everyone has it.
|
178
|
+
require 'rubygems/package_task'
|
179
|
+
Gem::PackageTask.new( This.platform_gemspec ) do
|
180
|
+
# nothing
|
181
|
+
end
|
182
|
+
|
183
|
+
#------------------------------------------------------------------------------
|
184
|
+
# Release - the steps we go through to do a final release, this is pulled from
|
185
|
+
# a compbination of mojombo's rakegem, hoe and hoe-git
|
186
|
+
#
|
187
|
+
# 1) make sure we are on the master branch
|
188
|
+
# 2) make sure there are no uncommitted items
|
189
|
+
# 3) check the manifest and make sure all looks good
|
190
|
+
# 4) build the gem
|
191
|
+
# 5) do an empty commit to have the commit message of the version
|
192
|
+
# 6) tag that commit as the version
|
193
|
+
# 7) push master
|
194
|
+
# 8) push the tag
|
195
|
+
# 7) pus the gem
|
196
|
+
#------------------------------------------------------------------------------
|
197
|
+
task :release_check do
|
198
|
+
unless `git branch` =~ /^\* master$/
|
199
|
+
abort "You must be on the master branch to release!"
|
200
|
+
end
|
201
|
+
unless `git status` =~ /^nothing to commit/m
|
202
|
+
abort "Nope, sorry, you have unfinished business"
|
203
|
+
end
|
204
|
+
end
|
205
|
+
|
206
|
+
desc "Create tag v#{This.version}, build and push #{This.platform_gemspec.full_name} to rubygems.org"
|
207
|
+
task :release => [ :release_check, 'manifest:check', :gem ] do
|
208
|
+
sh "git commit --allow-empty -a -m 'Release #{This.version}'"
|
209
|
+
sh "git tag -a -m 'v#{This.version}' v#{This.version}"
|
210
|
+
sh "git push origin master"
|
211
|
+
sh "git push origin v#{This.version}"
|
212
|
+
sh "gem push pkg/#{This.platform_gemspec.full_name}.gem"
|
213
|
+
end
|
data/tasks/this.rb
ADDED
@@ -0,0 +1,202 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
|
3
|
+
# Public: A Class containing all the metadata and utilities needed to manage a
|
4
|
+
# ruby project.
|
5
|
+
class ThisProject
|
6
|
+
# The name of this project
|
7
|
+
attr_accessor :name
|
8
|
+
|
9
|
+
# The author's name
|
10
|
+
attr_accessor :author
|
11
|
+
|
12
|
+
# The email address of the author(s)
|
13
|
+
attr_accessor :email
|
14
|
+
|
15
|
+
# The homepage of this project
|
16
|
+
attr_accessor :homepage
|
17
|
+
|
18
|
+
# The regex of files to exclude from the manifest
|
19
|
+
attr_accessor :exclude_from_manifest
|
20
|
+
|
21
|
+
# The hash of Gem::Specifications keyed' by platform
|
22
|
+
attr_accessor :gemspecs
|
23
|
+
|
24
|
+
# Public: Initialize ThisProject
|
25
|
+
#
|
26
|
+
# Yields self
|
27
|
+
def initialize(&block)
|
28
|
+
@exclude_from_manifest = %r/tmp$|\.(git|DS_Store)|^(doc|coverage|pkg)|Gemfile*|\.gemspec$|\.swp$|\.jar|\.rvmrc$|~$/
|
29
|
+
@gemspecs = Hash.new
|
30
|
+
yield self if block_given?
|
31
|
+
end
|
32
|
+
|
33
|
+
# Public: return the version of ThisProject
|
34
|
+
#
|
35
|
+
# Search the ruby files in the project looking for the one that has the
|
36
|
+
# version string in it. This does not eval any code in the project, it parses
|
37
|
+
# the source code looking for the string.
|
38
|
+
#
|
39
|
+
# Returns a String version
|
40
|
+
def version
|
41
|
+
[ "lib/#{ name }.rb", "lib/#{ name }/version.rb" ].each do |v|
|
42
|
+
path = project_path( v )
|
43
|
+
line = path.read[/^\s*VERSION\s*=\s*.*/]
|
44
|
+
if line then
|
45
|
+
return line.match(/.*VERSION\s*=\s*['"](.*)['"]/)[1]
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
# Internal: Return a section of an RDoc file with the given section name
|
51
|
+
#
|
52
|
+
# path - the relative path in the project of the file to parse
|
53
|
+
# section_name - the section out of the file from which to parse data
|
54
|
+
#
|
55
|
+
# Retuns the text of the section as an array of paragrphs.
|
56
|
+
def section_of( file, section_name )
|
57
|
+
re = /^=+ (.*)$/
|
58
|
+
sectional = project_path( file )
|
59
|
+
parts = sectional.read.split( re )[1..-1]
|
60
|
+
parts.map! { |p| p.strip }
|
61
|
+
|
62
|
+
sections = Hash.new
|
63
|
+
Hash[*parts].each do |k,v|
|
64
|
+
sections[k] = v.split("\n\n")
|
65
|
+
end
|
66
|
+
return sections[section_name]
|
67
|
+
end
|
68
|
+
|
69
|
+
# Internal: print out a warning about the give task
|
70
|
+
def task_warning( task )
|
71
|
+
warn "WARNING: '#{task}' tasks are not defined. Please run 'rake develop'"
|
72
|
+
end
|
73
|
+
|
74
|
+
# Internal: Return the full path to the file that is relative to the project
|
75
|
+
# root.
|
76
|
+
#
|
77
|
+
# path - the relative path of the file from the project root
|
78
|
+
#
|
79
|
+
# Returns the Pathname of the file
|
80
|
+
def project_path( relative_path )
|
81
|
+
project_root.join( relative_path )
|
82
|
+
end
|
83
|
+
|
84
|
+
# Internal: The absolute path of this file
|
85
|
+
#
|
86
|
+
# Returns the Pathname of this file.
|
87
|
+
def this_file_path
|
88
|
+
Pathname.new( __FILE__ ).expand_path
|
89
|
+
end
|
90
|
+
|
91
|
+
# Internal: The root directory of this project
|
92
|
+
#
|
93
|
+
# This is defined as being the directory that is in the path of this project
|
94
|
+
# that has the first Rakefile
|
95
|
+
#
|
96
|
+
# Returns the Pathname of the directory
|
97
|
+
def project_root
|
98
|
+
this_file_path.ascend do |p|
|
99
|
+
rakefile = p.join( 'Rakefile' )
|
100
|
+
return p if rakefile.exist?
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
# Internal: Returns the contents of the Manifest.txt file as an array
|
105
|
+
#
|
106
|
+
# Returns an Array of strings
|
107
|
+
def manifest
|
108
|
+
manifest_file = project_path( "Manifest.txt" )
|
109
|
+
abort "You need a Manifest.txt" unless manifest_file.readable?
|
110
|
+
manifest_file.readlines.map { |l| l.strip }
|
111
|
+
end
|
112
|
+
|
113
|
+
# Internal: Returns the gemspace associated with the current ruby platform
|
114
|
+
def platform_gemspec
|
115
|
+
gemspecs[platform]
|
116
|
+
end
|
117
|
+
|
118
|
+
def core_gemspec
|
119
|
+
Gem::Specification.new do |spec|
|
120
|
+
spec.name = name
|
121
|
+
spec.version = version
|
122
|
+
spec.author = author
|
123
|
+
spec.email = email
|
124
|
+
spec.homepage = homepage
|
125
|
+
|
126
|
+
spec.summary = summary
|
127
|
+
spec.description = description
|
128
|
+
|
129
|
+
spec.files = manifest
|
130
|
+
spec.executables = spec.files.grep(/^bin/) { |f| File.basename(f) }
|
131
|
+
spec.test_files = spec.files.grep(/^spec/)
|
132
|
+
|
133
|
+
spec.extra_rdoc_files += spec.files.grep(/(txt|rdoc)$/)
|
134
|
+
spec.rdoc_options = [ "--main" , 'README.rdoc',
|
135
|
+
"--markup", "tomdoc" ]
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
# Internal: Return the gemspec for the ruby platform
|
140
|
+
def ruby_gemspec( core = core_gemspec, &block )
|
141
|
+
yielding_gemspec( 'ruby', core, &block )
|
142
|
+
end
|
143
|
+
|
144
|
+
# Internal: Return the gemspec for the jruby platform
|
145
|
+
def java_gemspec( core = core_gemspec, &block )
|
146
|
+
yielding_gemspec( 'java', core, &block )
|
147
|
+
end
|
148
|
+
|
149
|
+
# Internal: give an initial spec and a key, create a new gemspec based off of
|
150
|
+
# it.
|
151
|
+
#
|
152
|
+
# This will force the new gemspecs 'platform' to be that of the key, since the
|
153
|
+
# only reason you would have multiple gemspecs at this point is to deal with
|
154
|
+
# different platforms.
|
155
|
+
def yielding_gemspec( key, core )
|
156
|
+
spec = gemspecs[key] ||= core.dup
|
157
|
+
spec.platform = key
|
158
|
+
yield spec if block_given?
|
159
|
+
return spec
|
160
|
+
end
|
161
|
+
|
162
|
+
# Internal: Set the recovery gem development dependency
|
163
|
+
#
|
164
|
+
# These are dynamically set since they cannot be hard coded as there is
|
165
|
+
# no way to ship them correctly in the gemspec
|
166
|
+
#
|
167
|
+
# Returns nothing.
|
168
|
+
def set_coverage_gem
|
169
|
+
if RUBY_VERSION < "1.9.0"
|
170
|
+
platform_gemspec.add_development_dependency( 'rcov', '~> 1.0.0' )
|
171
|
+
else
|
172
|
+
platform_gemspec.add_development_dependency( 'simplecov', '~> 0.7.1' )
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
# Internal: Return the platform of ThisProject at the current moment in time.
|
177
|
+
def platform
|
178
|
+
(RUBY_PLATFORM == "java") ? 'java' : Gem::Platform::RUBY
|
179
|
+
end
|
180
|
+
|
181
|
+
# Internal: Return the DESCRIPTION section of the README.rdoc file
|
182
|
+
def description_section
|
183
|
+
section_of( 'README.rdoc', 'DESCRIPTION')
|
184
|
+
end
|
185
|
+
|
186
|
+
# Internal: Return the summary text from the README
|
187
|
+
def summary
|
188
|
+
description_section.first
|
189
|
+
end
|
190
|
+
|
191
|
+
# Internal: Return the full description text from the READEM
|
192
|
+
def description
|
193
|
+
description_section.join(" ").tr("\n", ' ').gsub(/[{}]/,'').gsub(/\[[^\]]+\]/,'') # strip rdoc
|
194
|
+
end
|
195
|
+
|
196
|
+
# Internal: The path to the gemspec file
|
197
|
+
def gemspec_file
|
198
|
+
project_path( "#{ name }.gemspec" )
|
199
|
+
end
|
200
|
+
end
|
201
|
+
|
202
|
+
This = ThisProject.new
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: launchy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-02-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: addressable
|
@@ -34,7 +34,7 @@ dependencies:
|
|
34
34
|
requirements:
|
35
35
|
- - ~>
|
36
36
|
- !ruby/object:Gem::Version
|
37
|
-
version: 0.
|
37
|
+
version: 10.0.3
|
38
38
|
type: :development
|
39
39
|
prerelease: false
|
40
40
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -42,7 +42,7 @@ dependencies:
|
|
42
42
|
requirements:
|
43
43
|
- - ~>
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
version: 0.
|
45
|
+
version: 10.0.3
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
47
|
name: minitest
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
@@ -50,7 +50,7 @@ dependencies:
|
|
50
50
|
requirements:
|
51
51
|
- - ~>
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version:
|
53
|
+
version: 4.5.0
|
54
54
|
type: :development
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -58,7 +58,7 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - ~>
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 4.5.0
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
63
|
name: rdoc
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
@@ -75,38 +75,6 @@ dependencies:
|
|
75
75
|
- - ~>
|
76
76
|
- !ruby/object:Gem::Version
|
77
77
|
version: '3.12'
|
78
|
-
- !ruby/object:Gem::Dependency
|
79
|
-
name: spoon
|
80
|
-
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
|
-
requirements:
|
83
|
-
- - ~>
|
84
|
-
- !ruby/object:Gem::Version
|
85
|
-
version: 0.0.1
|
86
|
-
type: :development
|
87
|
-
prerelease: false
|
88
|
-
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
|
-
requirements:
|
91
|
-
- - ~>
|
92
|
-
- !ruby/object:Gem::Version
|
93
|
-
version: 0.0.1
|
94
|
-
- !ruby/object:Gem::Dependency
|
95
|
-
name: ffi
|
96
|
-
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
|
-
requirements:
|
99
|
-
- - ~>
|
100
|
-
- !ruby/object:Gem::Version
|
101
|
-
version: 1.1.1
|
102
|
-
type: :development
|
103
|
-
prerelease: false
|
104
|
-
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
|
-
requirements:
|
107
|
-
- - ~>
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
version: 1.1.1
|
110
78
|
description: Launchy is helper class for launching cross-platform applications in
|
111
79
|
a fire and forget manner. There are application concepts (browser, email client,
|
112
80
|
etc) that are common across all platforms, and they may be launched differently
|
@@ -121,10 +89,10 @@ extra_rdoc_files:
|
|
121
89
|
- Manifest.txt
|
122
90
|
- README.rdoc
|
123
91
|
files:
|
92
|
+
- CONTRIBUTING.md
|
124
93
|
- HISTORY.rdoc
|
125
94
|
- LICENSE
|
126
95
|
- Manifest.txt
|
127
|
-
- NOTES
|
128
96
|
- README.rdoc
|
129
97
|
- Rakefile
|
130
98
|
- bin/launchy
|
@@ -156,12 +124,16 @@ files:
|
|
156
124
|
- spec/spec_helper.rb
|
157
125
|
- spec/tattle-host-os.yaml
|
158
126
|
- spec/version_spec.rb
|
127
|
+
- tasks/default.rake
|
128
|
+
- tasks/this.rb
|
159
129
|
homepage: http://github.com/copiousfreetime/launchy
|
160
130
|
licenses: []
|
161
131
|
post_install_message:
|
162
132
|
rdoc_options:
|
163
133
|
- --main
|
164
134
|
- README.rdoc
|
135
|
+
- --markup
|
136
|
+
- tomdoc
|
165
137
|
require_paths:
|
166
138
|
- lib
|
167
139
|
required_ruby_version: !ruby/object:Gem::Requirement
|
data/NOTES
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
* Allow for new tab/ new window for opening a browser
|