launchy 2.1.2-java → 2.2.0-java

Sign up to get free protection for your applications and to get access to all the features.
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-2011 Jeremy Hinegardner
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-2011 Jeremy Hinegardner
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
- # 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
9
+ This.ruby_gemspec do |spec|
10
+ spec.add_dependency( 'addressable', '~> 2.3')
15
11
 
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
- #------------------------------------------------------------------------------
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
- # 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.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
- # Convenience method to launch an item
23
+ # Launch an application for the given uri string
24
24
  #
25
- def open(uri, options = {} )
26
- begin
27
- extract_global_options( options )
28
- uri = Addressable::URI.parse( uri )
29
- app = Launchy::Application.handling( uri )
30
- app.new.open( uri, options )
31
- rescue Exception => e
32
- msg = "Failure in opening #{uri} with options #{options.inspect}: #{e}"
33
- Launchy.log "#{self.name} : #{msg}"
34
- e.backtrace.each do |bt|
35
- Launchy.log bt
36
- end
37
- $stderr.puts msg
38
- end
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