gemrage 0.3.2 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (165) hide show
  1. data/Gemfile +1 -0
  2. data/Gemfile.lock +6 -0
  3. data/VERSION +1 -1
  4. data/gemrage.gemspec +160 -2
  5. data/lib/rubygems/commands/scan_command.rb +26 -7
  6. data/spec/spec_helper.rb +2 -1
  7. data/vendor/ruby/1.8/bin/launchy +19 -0
  8. data/vendor/ruby/1.8/bin/rake +19 -0
  9. data/vendor/ruby/1.8/cache/configuration-1.1.0.gem +0 -0
  10. data/vendor/ruby/1.8/cache/launchy-0.3.7.gem +0 -0
  11. data/vendor/ruby/1.8/cache/rake-0.8.7.gem +0 -0
  12. data/vendor/ruby/1.8/gems/configuration-1.1.0/README +197 -0
  13. data/vendor/ruby/1.8/gems/configuration-1.1.0/README.erb +69 -0
  14. data/vendor/ruby/1.8/gems/configuration-1.1.0/Rakefile +241 -0
  15. data/vendor/ruby/1.8/gems/configuration-1.1.0/config/a.rb +5 -0
  16. data/vendor/ruby/1.8/gems/configuration-1.1.0/config/b.rb +19 -0
  17. data/vendor/ruby/1.8/gems/configuration-1.1.0/config/c.rb +8 -0
  18. data/vendor/ruby/1.8/gems/configuration-1.1.0/config/d.rb +5 -0
  19. data/vendor/ruby/1.8/gems/configuration-1.1.0/config/e.rb +13 -0
  20. data/vendor/ruby/1.8/gems/configuration-1.1.0/configuration.gemspec +28 -0
  21. data/vendor/ruby/1.8/gems/configuration-1.1.0/lib/configuration.rb +199 -0
  22. data/vendor/ruby/1.8/gems/configuration-1.1.0/samples/a.rb +11 -0
  23. data/vendor/ruby/1.8/gems/configuration-1.1.0/samples/b.rb +11 -0
  24. data/vendor/ruby/1.8/gems/configuration-1.1.0/samples/c.rb +11 -0
  25. data/vendor/ruby/1.8/gems/configuration-1.1.0/samples/d.rb +14 -0
  26. data/vendor/ruby/1.8/gems/configuration-1.1.0/samples/e.rb +12 -0
  27. data/vendor/ruby/1.8/gems/launchy-0.3.7/HISTORY +71 -0
  28. data/vendor/ruby/1.8/gems/launchy-0.3.7/LICENSE +16 -0
  29. data/vendor/ruby/1.8/gems/launchy-0.3.7/README +53 -0
  30. data/vendor/ruby/1.8/gems/launchy-0.3.7/Rakefile +62 -0
  31. data/vendor/ruby/1.8/gems/launchy-0.3.7/bin/launchy +12 -0
  32. data/vendor/ruby/1.8/gems/launchy-0.3.7/gemspec.rb +41 -0
  33. data/vendor/ruby/1.8/gems/launchy-0.3.7/lib/launchy/application.rb +178 -0
  34. data/vendor/ruby/1.8/gems/launchy-0.3.7/lib/launchy/browser.rb +98 -0
  35. data/vendor/ruby/1.8/gems/launchy-0.3.7/lib/launchy/command_line.rb +48 -0
  36. data/vendor/ruby/1.8/gems/launchy-0.3.7/lib/launchy/paths.rb +53 -0
  37. data/vendor/ruby/1.8/gems/launchy-0.3.7/lib/launchy/version.rb +17 -0
  38. data/vendor/ruby/1.8/gems/launchy-0.3.7/lib/launchy.rb +53 -0
  39. data/vendor/ruby/1.8/gems/launchy-0.3.7/spec/application_spec.rb +62 -0
  40. data/vendor/ruby/1.8/gems/launchy-0.3.7/spec/browser_spec.rb +58 -0
  41. data/vendor/ruby/1.8/gems/launchy-0.3.7/spec/launchy_spec.rb +18 -0
  42. data/vendor/ruby/1.8/gems/launchy-0.3.7/spec/paths_spec.rb +15 -0
  43. data/vendor/ruby/1.8/gems/launchy-0.3.7/spec/spec_helper.rb +5 -0
  44. data/vendor/ruby/1.8/gems/launchy-0.3.7/spec/tattle-host-os.yml +427 -0
  45. data/vendor/ruby/1.8/gems/launchy-0.3.7/spec/version_spec.rb +11 -0
  46. data/vendor/ruby/1.8/gems/launchy-0.3.7/tasks/announce.rake +39 -0
  47. data/vendor/ruby/1.8/gems/launchy-0.3.7/tasks/config.rb +107 -0
  48. data/vendor/ruby/1.8/gems/launchy-0.3.7/tasks/distribution.rake +46 -0
  49. data/vendor/ruby/1.8/gems/launchy-0.3.7/tasks/documentation.rake +32 -0
  50. data/vendor/ruby/1.8/gems/launchy-0.3.7/tasks/rspec.rake +37 -0
  51. data/vendor/ruby/1.8/gems/launchy-0.3.7/tasks/rubyforge.rake +52 -0
  52. data/vendor/ruby/1.8/gems/launchy-0.3.7/tasks/utils.rb +80 -0
  53. data/vendor/ruby/1.8/gems/rake-0.8.7/CHANGES +440 -0
  54. data/vendor/ruby/1.8/gems/rake-0.8.7/MIT-LICENSE +21 -0
  55. data/vendor/ruby/1.8/gems/rake-0.8.7/README +196 -0
  56. data/vendor/ruby/1.8/gems/rake-0.8.7/Rakefile +430 -0
  57. data/vendor/ruby/1.8/gems/rake-0.8.7/TODO +20 -0
  58. data/vendor/ruby/1.8/gems/rake-0.8.7/bin/rake +31 -0
  59. data/vendor/ruby/1.8/gems/rake-0.8.7/doc/command_line_usage.rdoc +102 -0
  60. data/vendor/ruby/1.8/gems/rake-0.8.7/doc/example/Rakefile1 +38 -0
  61. data/vendor/ruby/1.8/gems/rake-0.8.7/doc/example/Rakefile2 +35 -0
  62. data/vendor/ruby/1.8/gems/rake-0.8.7/doc/example/a.c +6 -0
  63. data/vendor/ruby/1.8/gems/rake-0.8.7/doc/example/b.c +6 -0
  64. data/vendor/ruby/1.8/gems/rake-0.8.7/doc/example/main.c +11 -0
  65. data/vendor/ruby/1.8/gems/rake-0.8.7/doc/glossary.rdoc +51 -0
  66. data/vendor/ruby/1.8/gems/rake-0.8.7/doc/jamis.rb +591 -0
  67. data/vendor/ruby/1.8/gems/rake-0.8.7/doc/proto_rake.rdoc +127 -0
  68. data/vendor/ruby/1.8/gems/rake-0.8.7/doc/rake.1.gz +0 -0
  69. data/vendor/ruby/1.8/gems/rake-0.8.7/doc/rakefile.rdoc +534 -0
  70. data/vendor/ruby/1.8/gems/rake-0.8.7/doc/rational.rdoc +151 -0
  71. data/vendor/ruby/1.8/gems/rake-0.8.7/doc/release_notes/rake-0.4.14.rdoc +23 -0
  72. data/vendor/ruby/1.8/gems/rake-0.8.7/doc/release_notes/rake-0.4.15.rdoc +35 -0
  73. data/vendor/ruby/1.8/gems/rake-0.8.7/doc/release_notes/rake-0.5.0.rdoc +53 -0
  74. data/vendor/ruby/1.8/gems/rake-0.8.7/doc/release_notes/rake-0.5.3.rdoc +78 -0
  75. data/vendor/ruby/1.8/gems/rake-0.8.7/doc/release_notes/rake-0.5.4.rdoc +46 -0
  76. data/vendor/ruby/1.8/gems/rake-0.8.7/doc/release_notes/rake-0.6.0.rdoc +141 -0
  77. data/vendor/ruby/1.8/gems/rake-0.8.7/doc/release_notes/rake-0.7.0.rdoc +119 -0
  78. data/vendor/ruby/1.8/gems/rake-0.8.7/doc/release_notes/rake-0.7.1.rdoc +59 -0
  79. data/vendor/ruby/1.8/gems/rake-0.8.7/doc/release_notes/rake-0.7.2.rdoc +121 -0
  80. data/vendor/ruby/1.8/gems/rake-0.8.7/doc/release_notes/rake-0.7.3.rdoc +47 -0
  81. data/vendor/ruby/1.8/gems/rake-0.8.7/doc/release_notes/rake-0.8.0.rdoc +114 -0
  82. data/vendor/ruby/1.8/gems/rake-0.8.7/doc/release_notes/rake-0.8.2.rdoc +165 -0
  83. data/vendor/ruby/1.8/gems/rake-0.8.7/doc/release_notes/rake-0.8.3.rdoc +112 -0
  84. data/vendor/ruby/1.8/gems/rake-0.8.7/doc/release_notes/rake-0.8.4.rdoc +147 -0
  85. data/vendor/ruby/1.8/gems/rake-0.8.7/doc/release_notes/rake-0.8.5.rdoc +53 -0
  86. data/vendor/ruby/1.8/gems/rake-0.8.7/doc/release_notes/rake-0.8.6.rdoc +55 -0
  87. data/vendor/ruby/1.8/gems/rake-0.8.7/doc/release_notes/rake-0.8.7.rdoc +55 -0
  88. data/vendor/ruby/1.8/gems/rake-0.8.7/install.rb +88 -0
  89. data/vendor/ruby/1.8/gems/rake-0.8.7/lib/rake/alt_system.rb +108 -0
  90. data/vendor/ruby/1.8/gems/rake-0.8.7/lib/rake/classic_namespace.rb +8 -0
  91. data/vendor/ruby/1.8/gems/rake-0.8.7/lib/rake/clean.rb +33 -0
  92. data/vendor/ruby/1.8/gems/rake-0.8.7/lib/rake/contrib/compositepublisher.rb +24 -0
  93. data/vendor/ruby/1.8/gems/rake-0.8.7/lib/rake/contrib/ftptools.rb +153 -0
  94. data/vendor/ruby/1.8/gems/rake-0.8.7/lib/rake/contrib/publisher.rb +75 -0
  95. data/vendor/ruby/1.8/gems/rake-0.8.7/lib/rake/contrib/rubyforgepublisher.rb +18 -0
  96. data/vendor/ruby/1.8/gems/rake-0.8.7/lib/rake/contrib/sshpublisher.rb +47 -0
  97. data/vendor/ruby/1.8/gems/rake-0.8.7/lib/rake/contrib/sys.rb +209 -0
  98. data/vendor/ruby/1.8/gems/rake-0.8.7/lib/rake/gempackagetask.rb +97 -0
  99. data/vendor/ruby/1.8/gems/rake-0.8.7/lib/rake/loaders/makefile.rb +42 -0
  100. data/vendor/ruby/1.8/gems/rake-0.8.7/lib/rake/packagetask.rb +184 -0
  101. data/vendor/ruby/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb +5 -0
  102. data/vendor/ruby/1.8/gems/rake-0.8.7/lib/rake/rdoctask.rb +209 -0
  103. data/vendor/ruby/1.8/gems/rake-0.8.7/lib/rake/ruby182_test_unit_fix.rb +23 -0
  104. data/vendor/ruby/1.8/gems/rake-0.8.7/lib/rake/runtest.rb +23 -0
  105. data/vendor/ruby/1.8/gems/rake-0.8.7/lib/rake/tasklib.rb +23 -0
  106. data/vendor/ruby/1.8/gems/rake-0.8.7/lib/rake/testtask.rb +161 -0
  107. data/vendor/ruby/1.8/gems/rake-0.8.7/lib/rake/win32.rb +55 -0
  108. data/vendor/ruby/1.8/gems/rake-0.8.7/lib/rake.rb +2506 -0
  109. data/vendor/ruby/1.8/gems/rake-0.8.7/test/capture_stdout.rb +26 -0
  110. data/vendor/ruby/1.8/gems/rake-0.8.7/test/check_expansion.rb +5 -0
  111. data/vendor/ruby/1.8/gems/rake-0.8.7/test/check_no_expansion.rb +5 -0
  112. data/vendor/ruby/1.8/gems/rake-0.8.7/test/contrib/test_sys.rb +47 -0
  113. data/vendor/ruby/1.8/gems/rake-0.8.7/test/data/chains/Rakefile +15 -0
  114. data/vendor/ruby/1.8/gems/rake-0.8.7/test/data/default/Rakefile +19 -0
  115. data/vendor/ruby/1.8/gems/rake-0.8.7/test/data/dryrun/Rakefile +22 -0
  116. data/vendor/ruby/1.8/gems/rake-0.8.7/test/data/file_creation_task/Rakefile +33 -0
  117. data/vendor/ruby/1.8/gems/rake-0.8.7/test/data/imports/Rakefile +19 -0
  118. data/vendor/ruby/1.8/gems/rake-0.8.7/test/data/imports/deps.mf +1 -0
  119. data/vendor/ruby/1.8/gems/rake-0.8.7/test/data/multidesc/Rakefile +17 -0
  120. data/vendor/ruby/1.8/gems/rake-0.8.7/test/data/namespace/Rakefile +57 -0
  121. data/vendor/ruby/1.8/gems/rake-0.8.7/test/data/rakelib/test1.rb +3 -0
  122. data/vendor/ruby/1.8/gems/rake-0.8.7/test/data/rbext/rakefile.rb +3 -0
  123. data/vendor/ruby/1.8/gems/rake-0.8.7/test/data/sample.mf +14 -0
  124. data/vendor/ruby/1.8/gems/rake-0.8.7/test/data/statusreturn/Rakefile +8 -0
  125. data/vendor/ruby/1.8/gems/rake-0.8.7/test/data/unittest/Rakefile +1 -0
  126. data/vendor/ruby/1.8/gems/rake-0.8.7/test/filecreation.rb +32 -0
  127. data/vendor/ruby/1.8/gems/rake-0.8.7/test/functional.rb +15 -0
  128. data/vendor/ruby/1.8/gems/rake-0.8.7/test/in_environment.rb +30 -0
  129. data/vendor/ruby/1.8/gems/rake-0.8.7/test/rake_test_setup.rb +24 -0
  130. data/vendor/ruby/1.8/gems/rake-0.8.7/test/reqfile.rb +3 -0
  131. data/vendor/ruby/1.8/gems/rake-0.8.7/test/reqfile2.rb +3 -0
  132. data/vendor/ruby/1.8/gems/rake-0.8.7/test/session_functional.rb +339 -0
  133. data/vendor/ruby/1.8/gems/rake-0.8.7/test/shellcommand.rb +3 -0
  134. data/vendor/ruby/1.8/gems/rake-0.8.7/test/test_application.rb +675 -0
  135. data/vendor/ruby/1.8/gems/rake-0.8.7/test/test_clean.rb +14 -0
  136. data/vendor/ruby/1.8/gems/rake-0.8.7/test/test_definitions.rb +85 -0
  137. data/vendor/ruby/1.8/gems/rake-0.8.7/test/test_earlytime.rb +35 -0
  138. data/vendor/ruby/1.8/gems/rake-0.8.7/test/test_extension.rb +63 -0
  139. data/vendor/ruby/1.8/gems/rake-0.8.7/test/test_file_creation_task.rb +62 -0
  140. data/vendor/ruby/1.8/gems/rake-0.8.7/test/test_file_task.rb +143 -0
  141. data/vendor/ruby/1.8/gems/rake-0.8.7/test/test_filelist.rb +623 -0
  142. data/vendor/ruby/1.8/gems/rake-0.8.7/test/test_fileutils.rb +251 -0
  143. data/vendor/ruby/1.8/gems/rake-0.8.7/test/test_ftp.rb +59 -0
  144. data/vendor/ruby/1.8/gems/rake-0.8.7/test/test_invocation_chain.rb +81 -0
  145. data/vendor/ruby/1.8/gems/rake-0.8.7/test/test_makefile_loader.rb +26 -0
  146. data/vendor/ruby/1.8/gems/rake-0.8.7/test/test_multitask.rb +45 -0
  147. data/vendor/ruby/1.8/gems/rake-0.8.7/test/test_namespace.rb +55 -0
  148. data/vendor/ruby/1.8/gems/rake-0.8.7/test/test_package_task.rb +118 -0
  149. data/vendor/ruby/1.8/gems/rake-0.8.7/test/test_pathmap.rb +210 -0
  150. data/vendor/ruby/1.8/gems/rake-0.8.7/test/test_pseudo_status.rb +26 -0
  151. data/vendor/ruby/1.8/gems/rake-0.8.7/test/test_rake.rb +41 -0
  152. data/vendor/ruby/1.8/gems/rake-0.8.7/test/test_rdoc_task.rb +88 -0
  153. data/vendor/ruby/1.8/gems/rake-0.8.7/test/test_require.rb +35 -0
  154. data/vendor/ruby/1.8/gems/rake-0.8.7/test/test_rules.rb +349 -0
  155. data/vendor/ruby/1.8/gems/rake-0.8.7/test/test_task_arguments.rb +89 -0
  156. data/vendor/ruby/1.8/gems/rake-0.8.7/test/test_task_manager.rb +173 -0
  157. data/vendor/ruby/1.8/gems/rake-0.8.7/test/test_tasklib.rb +12 -0
  158. data/vendor/ruby/1.8/gems/rake-0.8.7/test/test_tasks.rb +374 -0
  159. data/vendor/ruby/1.8/gems/rake-0.8.7/test/test_test_task.rb +77 -0
  160. data/vendor/ruby/1.8/gems/rake-0.8.7/test/test_top_level_functions.rb +86 -0
  161. data/vendor/ruby/1.8/gems/rake-0.8.7/test/test_win32.rb +72 -0
  162. data/vendor/ruby/1.8/specifications/configuration-1.1.0.gemspec +27 -0
  163. data/vendor/ruby/1.8/specifications/launchy-0.3.7.gemspec +44 -0
  164. data/vendor/ruby/1.8/specifications/rake-0.8.7.gemspec +32 -0
  165. metadata +163 -5
@@ -0,0 +1,53 @@
1
+ == launchy
2
+
3
+ * Homepage[http://copiousfreetime.rubyforge.org/launchy/]
4
+ * {Rubyforge Project}[http://rubyforge.org/projects/copiousfreetime]
5
+ * email jeremy at hinegardner dot org
6
+
7
+ == DESCRIPTION
8
+
9
+ Launchy is helper class for launching cross-platform applications in a
10
+ fire and forget manner.
11
+
12
+ There are application concepts (browser, email client, etc) that are
13
+ common across all platforms, and they may be launched differently on
14
+ each platform. Launchy is here to make a common approach to launching
15
+ external application from within ruby programs.
16
+
17
+ == FEATURES
18
+
19
+ Currently only launching a browser is supported.
20
+
21
+ == SYNOPSIS
22
+
23
+ From within your ruby code you can trust launchy to do the right thing:
24
+
25
+ Launchy.open("http://www.ruby-lang.org/")
26
+
27
+ Or, if you want to launch the application yourself:
28
+
29
+ Launchy::Browser.run("http://www.ruby-lang.org/")
30
+
31
+ OR
32
+
33
+ Launchy::Browser.new.visit("http://www.ruby-lang.org/")
34
+
35
+ == ISC LICENSE
36
+
37
+ http://opensource.org/licenses/isc-license.txt
38
+
39
+ Copyright (c) 2007-2009 Jeremy Hinegardner
40
+
41
+ Permission to use, copy, modify, and/or distribute this software for any
42
+ purpose with or without fee is hereby granted, provided that the above
43
+ copyright notice
44
+ and this permission notice appear in all copies.
45
+
46
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
47
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
48
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
49
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
50
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
51
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
52
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
53
+
@@ -0,0 +1,62 @@
1
+ #--
2
+ # Copyright (c) 2007 Jeremy Hinegardner
3
+ # All rights reserved. See LICENSE and/or COPYING for details.
4
+ #++
5
+
6
+ #-------------------------------------------------------------------------------
7
+ # make sure our project's top level directory and the lib directory are added to
8
+ # the ruby search path.
9
+ #-------------------------------------------------------------------------------
10
+ $: << File.expand_path(File.join(File.dirname(__FILE__),"lib"))
11
+ $: << File.expand_path(File.dirname(__FILE__))
12
+
13
+
14
+ #-------------------------------------------------------------------------------
15
+ # load the global project configuration and add in the top level clean and
16
+ # clobber tasks so that other tasks can utilize those constants if necessary
17
+ # This loads up the defaults for the whole project configuration
18
+ #-------------------------------------------------------------------------------
19
+ require 'rubygems'
20
+ require 'tasks/config.rb'
21
+ require 'rake/clean'
22
+
23
+ #-------------------------------------------------------------------------------
24
+ # Main configuration for the project, these overwrite the items that are in
25
+ # tasks/config.rb
26
+ #-------------------------------------------------------------------------------
27
+ require 'launchy/version'
28
+ require 'launchy/paths'
29
+
30
+ Configuration.for("project") {
31
+ name "launchy"
32
+ version Launchy::VERSION
33
+ author "Jeremy Hinegardner"
34
+ email "jeremy@copiousfreetime.org"
35
+ homepage "http://copiousfreetime.rubyforge.org/launchy/"
36
+ }
37
+
38
+ #-------------------------------------------------------------------------------
39
+ # load up all the project tasks and setup the default task to be the
40
+ # test:default task.
41
+ #-------------------------------------------------------------------------------
42
+ Configuration.for("packaging").files.tasks.each do |tasklib|
43
+ import tasklib
44
+ end
45
+ task :default => 'test:default'
46
+
47
+ #-------------------------------------------------------------------------------
48
+ # Finalize the loading of all pending imports and update the top level clobber
49
+ # task to depend on all possible sub-level tasks that have a name like
50
+ # ':clobber' in other namespaces. This allows us to say:
51
+ #
52
+ # rake clobber
53
+ #
54
+ # and it will get everything.
55
+ #-------------------------------------------------------------------------------
56
+ Rake.application.load_imports
57
+ Rake.application.tasks.each do |t|
58
+ if t.name =~ /:clobber/ then
59
+ task :clobber => [t.name]
60
+ end
61
+ end
62
+
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ begin
4
+ require 'launchy'
5
+ rescue LoadError
6
+ path = File.expand_path(File.join(File.dirname(__FILE__),"..","lib"))
7
+ raise if $:.include? path
8
+ $: << path
9
+ retry
10
+ end
11
+
12
+ Launchy.command_line.run(ARGV)
@@ -0,0 +1,41 @@
1
+ require 'rubygems'
2
+ require 'launchy/version'
3
+ require 'tasks/config'
4
+
5
+ Launchy::GEM_SPEC = Gem::Specification.new do |spec|
6
+ proj = Configuration.for('project')
7
+ spec.name = proj.name
8
+ spec.version = Launchy::VERSION
9
+
10
+ spec.author = proj.author
11
+ spec.email = proj.email
12
+ spec.homepage = proj.homepage
13
+ spec.summary = proj.summary
14
+ spec.description = proj.description
15
+ spec.platform = Gem::Platform::RUBY
16
+
17
+
18
+ pkg = Configuration.for('packaging')
19
+ spec.files = pkg.files.all
20
+ spec.executables = pkg.files.bin.collect { |b| File.basename(b) }
21
+
22
+ # add dependencies here
23
+ spec.add_dependency("rake", ">= 0.8.1")
24
+ spec.add_dependency("configuration", ">= 0.0.5")
25
+
26
+ if rdoc = Configuration.for_if_exist?('rdoc') then
27
+ spec.has_rdoc = true
28
+ spec.extra_rdoc_files = pkg.files.rdoc
29
+ spec.rdoc_options = rdoc.options + [ "--main" , rdoc.main_page ]
30
+ else
31
+ spec.has_rdoc = false
32
+ end
33
+
34
+ if test = Configuration.for_if_exist?('testing') then
35
+ spec.test_files = test.files
36
+ end
37
+
38
+ if rf = Configuration.for_if_exist?('rubyforge') then
39
+ spec.rubyforge_project = rf.project
40
+ end
41
+ end
@@ -0,0 +1,178 @@
1
+ require 'rbconfig'
2
+
3
+ module Launchy
4
+ class Application
5
+ class << self
6
+ def known_os_families
7
+ @known_os_families ||= [ :windows, :darwin, :nix, :cygwin, :testing ]
8
+ end
9
+
10
+ def inherited(sub_class)
11
+ application_classes << sub_class
12
+ end
13
+ def application_classes
14
+ @application_classes ||= []
15
+ end
16
+
17
+ def find_application_class_for(*args)
18
+ Launchy.log "#{self.name} : finding application classes for [#{args.join(' ')}]"
19
+ application_classes.find do |klass|
20
+ Launchy.log "#{self.name} : Trying #{klass.name}"
21
+ if klass.handle?(*args) then
22
+ true
23
+ else
24
+ false
25
+ end
26
+ end
27
+ end
28
+
29
+ # find an executable in the available paths
30
+ # mkrf did such a good job on this I had to borrow it.
31
+ def find_executable(bin,*paths)
32
+ paths = ENV['PATH'].split(File::PATH_SEPARATOR) if paths.empty?
33
+ paths.each do |path|
34
+ file = File.join(path,bin)
35
+ if File.executable?(file) then
36
+ Launchy.log "#{self.name} : found executable #{file}"
37
+ return file
38
+ end
39
+ end
40
+ Launchy.log "#{self.name} : Unable to find `#{bin}' in #{paths.join(', ')}"
41
+ return nil
42
+ end
43
+
44
+ # return the current 'host_os' string from ruby's configuration
45
+ def my_os
46
+ if ENV['LAUNCHY_HOST_OS'] then
47
+ Launchy.log "#{self.name} : Using LAUNCHY_HOST_OS override of '#{ENV['LAUNCHY_HOST_OS']}'"
48
+ return ENV['LAUNCHY_HOST_OS']
49
+ else
50
+ ::Config::CONFIG['host_os']
51
+ end
52
+ end
53
+
54
+ # detect what the current os is and return :windows, :darwin or :nix
55
+ def my_os_family(test_os = my_os)
56
+ case test_os
57
+ when /mingw/i
58
+ family = :windows
59
+ when /mswin/i
60
+ family = :windows
61
+ when /windows/i
62
+ family = :windows
63
+ when /darwin/i
64
+ family = :darwin
65
+ when /mac os/i
66
+ family = :darwin
67
+ when /solaris/i
68
+ family = :nix
69
+ when /bsd/i
70
+ family = :nix
71
+ when /linux/i
72
+ family = :nix
73
+ when /aix/i
74
+ family = :nix
75
+ when /cygwin/i
76
+ family = :cygwin
77
+ when /testing/i
78
+ family = :testing
79
+ else
80
+ $stderr.puts "Unknown OS familiy for '#{test_os}'. Please report this bug to <jeremy at hinegardner dot org>"
81
+ family = :unknown
82
+ end
83
+ end
84
+ end
85
+
86
+
87
+ # Determine the appropriate desktop environment for *nix machine. Currently this is
88
+ # linux centric. The detection is based upon the detection used by xdg-open from
89
+ # http://portland.freedesktop.org/wiki/XdgUtils
90
+ def nix_desktop_environment
91
+ if not defined? @nix_desktop_environment then
92
+ @nix_desktop_environment = :generic
93
+ if ENV["KDE_FULL_SESSION"] || ENV["KDE_SESSION_UID"] then
94
+ @nix_desktop_environment = :kde
95
+ elsif ENV["GNOME_DESKTOP_SESSION_ID"] then
96
+ @nix_desktop_environment = :gnome
97
+ elsif find_executable("xprop") then
98
+ if %x[ xprop -root _DT_SAVE_MODE | grep ' = \"xfce\"$' ].strip.size > 0 then
99
+ @nix_desktop_environment = :xfce
100
+ end
101
+ end
102
+ Launchy.log "#{self.class.name} : nix_desktop_environment => '#{@nix_desktop_environment}'"
103
+ end
104
+ return @nix_desktop_environment
105
+ end
106
+
107
+ # find an executable in the available paths
108
+ def find_executable(bin,*paths)
109
+ Application.find_executable(bin,*paths)
110
+ end
111
+
112
+ # return the current 'host_os' string from ruby's configuration
113
+ def my_os
114
+ Application.my_os
115
+ end
116
+
117
+ # detect what the current os is and return :windows, :darwin, :nix, or :cygwin
118
+ def my_os_family(test_os = my_os)
119
+ Application.my_os_family(test_os)
120
+ end
121
+
122
+ # returns the list of command line application names for the current os. The list
123
+ # returned should only contain appliations or commands that actually exist on the
124
+ # system. The list members should have their full path to the executable.
125
+ def app_list
126
+ @app_list ||= self.send("#{my_os_family}_app_list")
127
+ end
128
+
129
+ # On darwin a good general default is the 'open' executable.
130
+ def darwin_app_list
131
+ Launchy.log "#{self.class.name} : Using 'open' application on darwin."
132
+ [ find_executable('open') ]
133
+ end
134
+
135
+ # On windows a good general default is the 'start' Command Shell command
136
+ def windows_app_list
137
+ Launchy.log "#{self.class.name} : Using 'start' command on windows."
138
+ %w[ start ]
139
+ end
140
+
141
+ # Cygwin uses the windows start but through an explicit execution of the cmd shell
142
+ def cygwin_app_list
143
+ Launchy.log "#{self.class.name} : Using 'cmd /C start' on windows."
144
+ [ "cmd /C start" ]
145
+ end
146
+
147
+ # used only for running tests
148
+ def testing_app_list
149
+ []
150
+ end
151
+
152
+ # run the command
153
+ def run(cmd,*args)
154
+ Launchy.log "#{self.class.name} : Spawning on #{my_os_family} : #{cmd} #{args.inspect}"
155
+
156
+ if my_os_family == :windows then
157
+ # NOTE: the command is purposely omitted here because
158
+ # When "cmd /c start filename" is
159
+ # run, the shell interprets it as two commands:
160
+ # (1) "start" opens a new terminal, and (2)
161
+ # "filename" causes the file to be launched.
162
+ system 'cmd', '/c', cmd, *args
163
+ else
164
+ # fork, and the child process should NOT run any exit handlers
165
+ child_pid = fork do
166
+ # NOTE: we pass a dummy argument *before*
167
+ # the actual command to prevent sh
168
+ # from silently consuming our actual
169
+ # command and assigning it to $0!
170
+ dummy = ''
171
+ system 'sh', '-c', '"$@" >/dev/null 2>&1', dummy, cmd, *args
172
+ exit!
173
+ end
174
+ Process.detach(child_pid)
175
+ end
176
+ end
177
+ end
178
+ end
@@ -0,0 +1,98 @@
1
+ require 'launchy/application'
2
+ require 'uri'
3
+
4
+ module Launchy
5
+ class Browser < Application
6
+
7
+
8
+ class << self
9
+ def desktop_environment_browser_launchers
10
+ @desktop_environment_browser_launchers ||= {
11
+ :kde => "kfmclient",
12
+ :gnome => "gnome-open",
13
+ :xfce => "exo-open",
14
+ :generic => "htmlview"
15
+ }
16
+ end
17
+ def fallback_browsers
18
+ @fallback_browsers ||= %w[ firefox seamonkey opera mozilla netscape galeon ]
19
+ end
20
+ def run(*args)
21
+ Browser.new.visit(args[0])
22
+ end
23
+
24
+ # return true if this class can handle the given parameter(s)
25
+ def handle?(*args)
26
+ begin
27
+ Launchy.log "#{self.name} : testing if [#{args[0]}] (#{args[0].class}) is a url."
28
+ uri = URI.parse(args[0])
29
+ result = [URI::HTTP, URI::HTTPS, URI::FTP].include?(uri.class)
30
+ rescue Exception => e
31
+ # hmm... why does rcov not see that this is executed ?
32
+ Launchy.log "#{self.name} : not a url, #{e}"
33
+ return false
34
+ end
35
+ end
36
+ end
37
+
38
+ def initialize
39
+ @browser = nil
40
+ @nix_app_list = []
41
+ raise "Unable to find browser to launch for os family '#{my_os_family}'." unless browser
42
+ end
43
+
44
+ def desktop_environment_browser_launchers
45
+ self.class.desktop_environment_browser_launchers
46
+ end
47
+
48
+ def fallback_browsers
49
+ self.class.fallback_browsers
50
+ end
51
+
52
+ # Find a list of potential browser applications to run on *nix machines.
53
+ # The order is:
54
+ # 1) What is in ENV['LAUNCHY_BROWSER'] or ENV['BROWSER']
55
+ # 2) xdg-open
56
+ # 3) desktop environment launcher program
57
+ # 4) a list of fallback browsers
58
+ def nix_app_list
59
+ if @nix_app_list.empty?
60
+ browser_cmds = ['xdg-open']
61
+ browser_cmds << desktop_environment_browser_launchers[nix_desktop_environment]
62
+ browser_cmds << fallback_browsers
63
+ browser_cmds.flatten!
64
+ browser_cmds.delete_if { |b| b.nil? || (b.strip.size == 0) }
65
+ Launchy.log "#{self.class.name} : Initial *Nix Browser List: #{browser_cmds.join(', ')}"
66
+ @nix_app_list = browser_cmds.collect { |bin| find_executable(bin) }.find_all { |x| not x.nil? }
67
+ Launchy.log "#{self.class.name} : Filtered *Nix Browser List: #{@nix_app_list.join(', ')}"
68
+ end
69
+ @nix_app_list
70
+ end
71
+
72
+ # return the full command line path to the browser or nil
73
+ def browser
74
+ if not @browser then
75
+ if ENV['LAUNCHY_BROWSER'] and File.exists?(ENV['LAUNCHY_BROWSER']) then
76
+ Launchy.log "#{self.class.name} : Using LAUNCHY_BROWSER environment variable : #{ENV['LAUNCHY_BROWSER']}"
77
+ @browser = ENV['LAUNCHY_BROWSER']
78
+ elsif ENV['BROWSER'] and File.exists?(ENV['BROWSER']) then
79
+ Launchy.log "#{self.class.name} : Using BROWSER environment variable : #{ENV['BROWSER']}"
80
+ @browser = ENV['BROWSER']
81
+ elsif app_list.size > 0 then
82
+ @browser = app_list.first
83
+ Launchy.log "#{self.class.name} : Using application list : #{@browser}"
84
+ else
85
+ msg = "Unable to launch. No Browser application found."
86
+ Launchy.log "#{self.class.name} : #{msg}"
87
+ $stderr.puts msg
88
+ end
89
+ end
90
+ return @browser
91
+ end
92
+
93
+ # launch the browser at the appointed url
94
+ def visit(url)
95
+ run(browser,url)
96
+ end
97
+ end
98
+ end
@@ -0,0 +1,48 @@
1
+ require 'optparse'
2
+
3
+ module Launchy
4
+ class CommandLine
5
+
6
+ def parser
7
+ @parser ||= OptionParser.new do |op|
8
+ op.banner = "Usage: launchy [options] url"
9
+ op.separator ""
10
+ op.on("-d", "--debug", "Force debug, output lots of information.",
11
+ "This sets the LAUNCHY_DEBUG environment variable to 'true'.") do |d|
12
+ ENV["LAUNCHY_DEBUG"] = 'true'
13
+ end
14
+
15
+ op.on("-h", "--help", "Print this message") do |h|
16
+ puts op.to_s
17
+ exit 0
18
+ end
19
+
20
+ op.on("-v", "--version", "Output the version of Launchy") do |v|
21
+ puts "Launchy version #{Launchy::VERSION}"
22
+ exit 0
23
+ end
24
+
25
+ op.on("-o", "--host-os HOST_OS","Force the behavior of a particular host os.",
26
+ "This sets the LAUNCHY_HOST_OS environment variable.") do |os|
27
+ ENV["LAUNCHY_HOST_OS"] = os
28
+ end
29
+
30
+ op.on("-b", "--browser BROWSER", "Force launchy to use a particular browser.",
31
+ "This sets the LAUNCHY_BROWSER environment variable.") do |browser|
32
+ ENV["LAUNCHY_BROWSER"] = browser
33
+ end
34
+ end
35
+ end
36
+
37
+ def run(argv = ARGV)
38
+ begin
39
+ parser.parse!(argv)
40
+ Launchy.open(*argv)
41
+ rescue ::OptionParser::ParseError => pe
42
+ $stderr.puts "#{parser.programn_name}: #{pe}"
43
+ $stderr.puts "Try `#{parser.program_name} --help' for more information."
44
+ exit 1
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,53 @@
1
+ #--
2
+ # Copyright (c) 2007 Jeremy Hinegardner
3
+ # All rights reserved. See LICENSE and/or COPYING for details.
4
+ #++
5
+ #
6
+ module Launchy
7
+ #
8
+ # Access to various paths inside the project programatically
9
+ #
10
+ module Paths
11
+ #
12
+ # :call-seq:
13
+ # Launchy::Paths.root_dir -> String
14
+ #
15
+ # Returns The full expanded path of the parent directory of +lib+
16
+ # going up the path from the current file. A trailing File::SEPARATOR⋅
17
+ # is guaranteed
18
+ #
19
+ def self.root_dir
20
+ @root_dir ||=(
21
+ path_parts = ::File.expand_path( __FILE__ ).split( ::File::SEPARATOR )
22
+ lib_index = path_parts.rindex( "lib" )
23
+ @root_dir = path_parts[0...lib_index].join( ::File::SEPARATOR ) + ::File::SEPARATOR
24
+ )
25
+ end
26
+
27
+ #
28
+ # :call-seq:
29
+ # Launchy::Paths.lib_path( *args ) -> String
30
+ #
31
+ # Returns The full expanded path of the +lib+ directory below
32
+ # _root_dir_. All parameters passed in are joined onto the⋅
33
+ # result. A trailing File::SEPARATOR is guaranteed if⋅
34
+ # _args_ are *not* present.
35
+ #
36
+ def self.lib_path( *args )
37
+ self.sub_path( "lib", *args )
38
+ end
39
+
40
+ #
41
+ # :call-seq:
42
+ # Launchy::Paths.sub_path( sub, *args ) -> String
43
+ #
44
+ # Returns the full expanded path of the +sub+ directory below _root_dir. All
45
+ # _arg_ parameters passed in are joined onto the result. A trailing
46
+ # File::SEPARATOR is guaranteed if _args_ are *not* present.
47
+ #
48
+ def self.sub_path( sub, *args )
49
+ sp = ::File.join( root_dir, sub ) + File::SEPARATOR
50
+ sp = ::File.join( sp, *args ) if args
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,17 @@
1
+ module Launchy
2
+ module Version
3
+ MAJOR = 0
4
+ MINOR = 3
5
+ BUILD = 7
6
+
7
+ def self.to_a
8
+ [MAJOR, MINOR, BUILD]
9
+ end
10
+
11
+ def self.to_s
12
+ to_a.join(".")
13
+ end
14
+ STRING = Version.to_s.freeze
15
+ end
16
+ VERSION = Version.to_s.freeze
17
+ end
@@ -0,0 +1,53 @@
1
+ module Launchy
2
+ #
3
+ # Utility method to require all files ending in .rb in the directory
4
+ # with the same name as this file minus .rb
5
+ #
6
+ def self.require_all_libs_relative_to(fname)
7
+ prepend = File.basename(fname,".rb")
8
+ search_me = File.join(File.dirname(fname),prepend)
9
+
10
+ Dir.entries(search_me).each do |rb|
11
+ if File.extname(rb) == ".rb" then
12
+ require "#{prepend}/#{File.basename(rb,".rb")}"
13
+ end
14
+ end
15
+ end
16
+
17
+ class << self
18
+ #
19
+ # Convenience method to launch an item
20
+ #
21
+ def open(*params)
22
+ begin
23
+ klass = Launchy::Application.find_application_class_for(*params)
24
+ if klass then
25
+ klass.run(*params)
26
+ else
27
+ msg = "Unable to launch #{params.join(' ')}"
28
+ Launchy.log "#{self.name} : #{msg}"
29
+ $stderr.puts msg
30
+ end
31
+ rescue Exception => e
32
+ msg = "Failure in opening #{params.join(' ')} : #{e}"
33
+ Launchy.log "#{self.name} : #{msg}"
34
+ $stderr.puts msg
35
+ end
36
+ end
37
+
38
+ # Setting the LAUNCHY_DEBUG environment variable to 'true' will spew
39
+ # debug information to $stderr
40
+ def log(msg)
41
+ if ENV['LAUNCHY_DEBUG'] == 'true' then
42
+ $stderr.puts "LAUNCHY_DEBUG: #{msg}"
43
+ end
44
+ end
45
+
46
+ # Create an instance of the commandline application of launchy
47
+ def command_line
48
+ Launchy::CommandLine.new
49
+ end
50
+ end
51
+ end
52
+
53
+ Launchy.require_all_libs_relative_to(__FILE__)
@@ -0,0 +1,62 @@
1
+ require File.join(File.dirname(__FILE__),"spec_helper.rb")
2
+ require 'yaml'
3
+
4
+ describe Launchy::Application do
5
+ before(:each) do
6
+ yml = YAML::load(IO.read(File.join(File.dirname(__FILE__),"tattle-host-os.yml")))
7
+ @host_os = yml['host_os']
8
+ @app = Launchy::Application.new
9
+ end
10
+
11
+ YAML::load(IO.read(File.join(File.dirname(__FILE__), "tattle-host-os.yml")))['host_os'].keys.sort.each do |os|
12
+ it "#{os} should be a found os" do
13
+ Launchy::Application::known_os_families.should include(@app.my_os_family(os))
14
+ end
15
+ end
16
+
17
+ it "should not find os of 'dos'" do
18
+ @app.my_os_family('dos').should eql(:unknown)
19
+ end
20
+
21
+ it "my os should have a value" do
22
+ @app.my_os.should_not eql('')
23
+ @app.my_os.should_not eql(nil)
24
+ end
25
+
26
+ it "should find open or curl" do
27
+ r = "found open or curl"
28
+ found = %w[ open curl ].collect do |app|
29
+ @app.find_executable(app).nil?
30
+ end
31
+ found.should be_include( false )
32
+ end
33
+
34
+ it "should not find app xyzzy" do
35
+ @app.find_executable('xyzzy').should eql(nil)
36
+ end
37
+
38
+ it "should find the correct class to launch an ftp url" do
39
+ Launchy::Application.find_application_class_for("ftp://ftp.ruby-lang.org/pub/ruby/").should == Launchy::Browser
40
+ end
41
+
42
+ it "knows when it cannot find an application class" do
43
+ Launchy::Application.find_application_class_for("xyzzy:stuff,things").should == nil
44
+ end
45
+
46
+ it "allows for environmental override of host_os" do
47
+ ENV["LAUNCHY_HOST_OS"] = "hal-9000"
48
+ Launchy::Application.my_os.should eql("hal-9000")
49
+ ENV["LAUNCHY_HOST_OS"] = nil
50
+ end
51
+
52
+ { "KDE_FULL_SESSION" => :kde,
53
+ "KDE_SESSION_UID" => :kde,
54
+ "GNOME_DESKTOP_SESSION_ID" => :gnome }.each_pair do |k,v|
55
+ it "can detect the desktop environment of a *nix machine using #{k}" do
56
+ @app.nix_desktop_environment.should eql(:generic)
57
+ ENV[k] = "launchy-test"
58
+ Launchy::Application.new.nix_desktop_environment.should eql(v)
59
+ ENV[k] = nil
60
+ end
61
+ end
62
+ end