launchy 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES ADDED
@@ -0,0 +1,13 @@
1
+ = launchy Changelog
2
+ === Version 0.1.0
3
+
4
+ * Initial public release
5
+ * switched to using fork to spawn process and require 'win32/process' if on windows
6
+
7
+ === Version 0.0.2
8
+
9
+ * First attempt at using systemu to spawn processes
10
+
11
+ === Version 0.0.1
12
+
13
+ * Initially working release
data/LICENSE ADDED
@@ -0,0 +1,31 @@
1
+ Copyright (c) 2007, Jeremy Hinegardner
2
+
3
+ All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are met:
7
+
8
+ * Redistributions of source code must retain the above copyright notice,
9
+ this list of conditions and the following disclaimer.
10
+
11
+ * Redistributions in binary form must reproduce the above copyright notice,
12
+ this list of conditions and the following disclaimer in the
13
+ documentation and/or other materials provided with the
14
+ distribution.
15
+
16
+ * Neither the name of Jeremy Hinegardner nor the
17
+ names of its contributors may be used to endorse or promote
18
+ products derived from this software without specific prior written
19
+ permission.
20
+
21
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
22
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
23
+ TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
24
+ PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
25
+ OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
26
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
27
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
28
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
29
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
data/README ADDED
@@ -0,0 +1,66 @@
1
+ == launchy
2
+
3
+ * Homepage[http://copiousfreetime.rubyforge.org/launcy/]
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.
10
+
11
+ There are application concepts (browser, email client, etc) that are
12
+ common across all platforms, and they may be launched in different
13
+ manners. Launchy is here to assist in launching the appropriate
14
+ application on the appropriate platform from within your ruby projects.
15
+
16
+ == FEATURES
17
+
18
+ Currently only launching a browser is supported.
19
+
20
+ == SYNOPSIS
21
+
22
+ From within your ruby code you can trust launchy to do the right thing:
23
+
24
+ Launchy.do_magic("http://www.ruby-lang.org/")
25
+
26
+ Or, if you want to launch the application yourself:
27
+
28
+ Launchy::Spawnable::Browser.run("http://www.ruby-lang.org/")
29
+
30
+ OR
31
+
32
+ Launchy::Spawnable::Browser.new.visit("http://www.ruby-lang.org/")
33
+
34
+ == LICENSE
35
+
36
+ Copyright (c) 2007, Jeremy Hinegardner
37
+
38
+ All rights reserved.
39
+
40
+ Redistribution and use in source and binary forms, with or without
41
+ modification, are permitted provided that the following conditions are met:
42
+
43
+ * Redistributions of source code must retain the above copyright notice,
44
+ this list of conditions and the following disclaimer.
45
+
46
+ * Redistributions in binary form must reproduce the above copyright notice,
47
+ this list of conditions and the following disclaimer in the
48
+ documentation and/or other materials provided with the
49
+ distribution.
50
+
51
+ * Neither the name of Jeremy Hinegardner nor the
52
+ names of its contributors may be used to endorse or promote
53
+ products derived from this software without specific prior written
54
+ permission.
55
+
56
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
57
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
58
+ TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
59
+ PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
60
+ OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
61
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
62
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
63
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
64
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
65
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
66
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,93 @@
1
+ require 'rubygems'
2
+ require 'rake/gempackagetask'
3
+ require 'rake/clean'
4
+ require 'rake/rdoctask'
5
+
6
+ $: << File.join(File.dirname(__FILE__),"lib")
7
+ require 'launchy'
8
+
9
+ # load all the extra tasks for the project
10
+ TASK_DIR = File.join(File.dirname(__FILE__),"tasks")
11
+ FileList[File.join(TASK_DIR,"*.rb")].each do |tasklib|
12
+ require "tasks/#{File.basename(tasklib)}"
13
+ end
14
+
15
+ task :default => "test:default"
16
+
17
+ #-----------------------------------------------------------------------
18
+ # Documentation
19
+ #-----------------------------------------------------------------------
20
+ namespace :doc do
21
+
22
+ # generating documentation locally
23
+ Rake::RDocTask.new do |rdoc|
24
+ rdoc.rdoc_dir = Launchy::SPEC.local_rdoc_dir
25
+ rdoc.options = Launchy::SPEC.rdoc_options
26
+ rdoc.rdoc_files = Launchy::SPEC.rdoc_files
27
+ end
28
+
29
+ desc "View the RDoc documentation locally"
30
+ task :view => :rdoc do
31
+ show_files Launchy::SPEC.local_rdoc_dir
32
+ end
33
+
34
+ end
35
+
36
+ #-----------------------------------------------------------------------
37
+ # Packaging and Distribution
38
+ #-----------------------------------------------------------------------
39
+ namespace :dist do
40
+
41
+ GEM_SPEC = eval(Launchy::SPEC.to_ruby)
42
+
43
+ gem_task = Rake::GemPackageTask.new(GEM_SPEC) do |pkg|
44
+ pkg.need_tar = Launchy::SPEC.need_tar
45
+ pkg.need_zip = Launchy::SPEC.need_zip
46
+ end
47
+
48
+ GEM_SPEC_WIN32 = eval(Launchy::SPEC_WIN32.to_ruby)
49
+
50
+ desc "Build the Win32 gem"
51
+ task :gem_win32 => [ "#{gem_task.package_dir}/#{GEM_SPEC_WIN32.file_name}" ]
52
+ file "#{gem_task.package_dir}/#{GEM_SPEC_WIN32.file_name}" => [gem_task.package_dir] + GEM_SPEC_WIN32.files do
53
+ gem_file = Gem::Builder.new(GEM_SPEC_WIN32).build
54
+ mv gem_file, "#{gem_task.package_dir}/#{gem_file}"
55
+ end
56
+ task :package => [:gem_win32]
57
+
58
+ desc "Install as a gem"
59
+ task :install => [:clobber, :package] do
60
+ sh "sudo gem install pkg/#{Launchy::SPEC.full_name}.gem"
61
+ end
62
+
63
+ # uninstall the gem and all executables
64
+ desc "Uninstall gem"
65
+ task :uninstall do
66
+ sh "sudo gem uninstall #{Launchy::SPEC.name} -x"
67
+ end
68
+
69
+ desc "dump gemspec"
70
+ task :gemspec do
71
+ puts Launchy::SPEC.to_ruby
72
+ end
73
+
74
+ desc "dump win32 gemspec"
75
+ task :gemspec_win32 do
76
+ puts Launchy::SPEC_WIN32.to_ruby
77
+ end
78
+
79
+ desc "reinstall gem"
80
+ task :reinstall => [:install, :uninstall]
81
+
82
+ end
83
+
84
+ #-----------------------------------------------------------------------
85
+ # update the top level clobber task to depend on all possible sub-level
86
+ # tasks that have a name like ':clobber' in other namespaces
87
+ #-----------------------------------------------------------------------
88
+ Rake.application.tasks.each do |t|
89
+ if t.name =~ /:clobber/ then
90
+ task :clobber => [t.name]
91
+ end
92
+ end
93
+
@@ -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.do_magic(*ARGV)
@@ -0,0 +1,35 @@
1
+ module Launchy
2
+
3
+ ROOT_DIR = File.expand_path(File.join(File.dirname(__FILE__),".."))
4
+ LIB_DIR = File.join(ROOT_DIR,"lib").freeze
5
+ RESOURCE_DIR = File.join(ROOT_DIR,"resources").freeze
6
+
7
+ #
8
+ # Utility method to require all files ending in .rb in the directory
9
+ # with the same name as this file minus .rb
10
+ #
11
+ def require_all_libs_relative_to(fname)
12
+ prepend = File.basename(fname,".rb")
13
+ search_me = File.join(File.dirname(fname),prepend)
14
+
15
+ Dir.entries(search_me).each do |rb|
16
+ if File.extname(rb) == ".rb" then
17
+ require "#{prepend}/#{File.basename(rb,".rb")}"
18
+ end
19
+ end
20
+ end
21
+ module_function :require_all_libs_relative_to
22
+
23
+ class << self
24
+ def do_magic(*params)
25
+ klass = Launchy::Spawnable::Application.find_application_class_for(*params)
26
+ if klass then
27
+ klass.run(*params)
28
+ else
29
+ $stderr.puts "Unable to launch #{params.join(' ')}"
30
+ end
31
+ end
32
+ end
33
+ end
34
+
35
+ Launchy.require_all_libs_relative_to(__FILE__)
@@ -0,0 +1,56 @@
1
+ require 'rubygems'
2
+ require 'launchy/specification'
3
+ require 'launchy/version'
4
+ require 'rake'
5
+
6
+ # The Gem Specification plus some extras for launchy.
7
+ module Launchy
8
+ SPEC = Launchy::Specification.new do |spec|
9
+ spec.name = "launchy"
10
+ spec.version = Launchy::VERSION
11
+ spec.rubyforge_project = "copiousfreetime"
12
+ spec.author = "Jeremy Hinegardner"
13
+ spec.email = "jeremy@hinegardner.org"
14
+ spec.homepage = "http://launchy.rubyforge.org/"
15
+
16
+ spec.summary = "A helper to launch apps from within ruby programs."
17
+ spec.description = <<-DESC
18
+ Launchy is helper class for launching +cross-platform+
19
+ applications.
20
+
21
+ There are application concepts (browser, email client,
22
+ etc) that are common across all platforms, and they may
23
+ be launched in different manners. Launchy is here to
24
+ assist in launching the appropriate application on the
25
+ appropriate platform from within your ruby projects.
26
+ DESC
27
+
28
+ spec.extra_rdoc_files = FileList["[A-Z]*"]
29
+ spec.has_rdoc = true
30
+ spec.rdoc_main = "README"
31
+ spec.rdoc_options = [ "--line-numbers" , "--inline-source" ]
32
+
33
+ spec.test_files = FileList["spec/**/*.rb", "test/**/*.rb"]
34
+ spec.files = spec.test_files + spec.extra_rdoc_files +
35
+ FileList["lib/**/*.rb", "resources/**/*"]
36
+
37
+ spec.executable = spec.name
38
+
39
+ spec.platform = Gem::Platform::RUBY
40
+ spec.required_ruby_version = ">= 1.8.5"
41
+
42
+ spec.local_rdoc_dir = "doc/rdoc"
43
+ spec.remote_rdoc_dir = ""
44
+ spec.local_coverage_dir = "doc/coverage"
45
+ spec.remote_coverage_dir= "coverage"
46
+
47
+ spec.remote_site_dir = "#{spec.name}/"
48
+
49
+ end
50
+
51
+ SPEC_WIN32 = SPEC.dup
52
+ SPEC_WIN32.add_dependency("win32-process")
53
+ SPEC_WIN32.platform = Gem::Platform::WIN32
54
+ end
55
+
56
+
@@ -0,0 +1,2 @@
1
+ require 'launchy/spawnable/application'
2
+ require 'launchy/spawnable/browser'
@@ -0,0 +1,76 @@
1
+ require 'launchy/spawnable'
2
+ require 'rbconfig'
3
+
4
+ module Launchy
5
+ module Spawnable
6
+ class Application
7
+
8
+ KNOWN_OS_FAMILIES = [ :windows, :darwin, :nix ]
9
+
10
+ class << self
11
+ def inherited(sub_class)
12
+ application_classes << sub_class
13
+ end
14
+ def application_classes
15
+ @application_classes ||= []
16
+ end
17
+
18
+ def find_application_class_for(*args)
19
+ application_classes.find { |klass| klass.handle?(*args) }
20
+ end
21
+ end
22
+
23
+ # find an executable in the available paths
24
+ # mkrf did such a good job on this I had to borrow it.
25
+ def find_executable(bin,*paths)
26
+ paths = ENV['PATH'].split(File::PATH_SEPARATOR) if paths.empty?
27
+ paths.each do |path|
28
+ file = File.join(path,bin)
29
+ return file if File.executable?(file)
30
+ end
31
+ return nil
32
+ end
33
+
34
+ # return the current 'host_os' string from ruby's configuration
35
+ def my_os
36
+ ::Config::CONFIG['host_os']
37
+ end
38
+
39
+ # detect what the current os is and return :windows, :darwin, :nix or :java
40
+ def my_os_family(test_os = my_os)
41
+ case test_os
42
+ when /mswin/i
43
+ family = :windows
44
+ when /windows/i
45
+ family = :windows
46
+ when /darwin/i
47
+ family = :darwin
48
+ when /mac os/i
49
+ family = :darwin
50
+ when /solaris/i
51
+ family = :nix
52
+ when /bsd/i
53
+ family = :nix
54
+ when /linux/i
55
+ family = :nix
56
+ when /cygwin/i
57
+ family = :nix
58
+ else
59
+ $stderr.puts "Unknown OS familiy for '#{test_os}'. Please report this bug."
60
+ family = :unknown
61
+ end
62
+ end
63
+
64
+ # run the command
65
+ def run(cmd,*args)
66
+ args.unshift(cmd)
67
+ if my_os_family == :windows then
68
+ require 'win32/process'
69
+ end
70
+ child_pid = fork { system args.join(' ') }
71
+ Process.detach(child_pid)
72
+ end
73
+ end
74
+ end
75
+ end
76
+
@@ -0,0 +1,50 @@
1
+ require 'launchy/spawnable/application'
2
+ require 'uri'
3
+
4
+ module Launchy
5
+ module Spawnable
6
+ class Browser < Application
7
+ APP_LIST = {
8
+ :windows => %w[ firefox iexplore ],
9
+ :darwin => %w[ open ],
10
+ :nix => %w[ firefox ],
11
+ :unknown => [],
12
+ }
13
+ class << self
14
+ def run(*args)
15
+ Browser.new.visit(args[0])
16
+ end
17
+
18
+ # return true if this class can handle the given parameter(s)
19
+ def handle?(*args)
20
+ begin
21
+ uri = URI.parse(args[0])
22
+ return [URI::HTTP, URI::HTTPS, URI::FTP].include?(uri.class)
23
+ rescue Exception
24
+ return false
25
+ end
26
+ end
27
+ end
28
+
29
+ def initialize
30
+ raise "Unable to find browser to launch for os family '#{my_os_family}'." unless browser
31
+ end
32
+
33
+ # returns the list of command line application names for the current os
34
+ def app_list
35
+ APP_LIST[my_os_family]
36
+ end
37
+
38
+ # return the full command line path to the browser or nil
39
+ def browser
40
+ @browser ||= app_list.collect { |bin| find_executable(bin) }.reject { |x| x.nil? }.first
41
+ end
42
+
43
+ # launch the browser at the appointed url
44
+ def visit(url)
45
+ run(browser,url)
46
+ end
47
+
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,133 @@
1
+ require 'rubygems'
2
+ require 'rubygems/specification'
3
+ require 'rake'
4
+
5
+ module Launchy
6
+ # Add some additional items to Gem::Specification
7
+ # A Launchy::Specification adds additional pieces of information the
8
+ # typical gem specification
9
+ class Specification
10
+
11
+ RUBYFORGE_ROOT = "/var/www/gforge-projects/"
12
+
13
+ # user that accesses remote site
14
+ attr_accessor :remote_user
15
+
16
+ # remote host, default 'rubyforge.org'
17
+ attr_accessor :remote_host
18
+
19
+ # name the rdoc main
20
+ attr_accessor :rdoc_main
21
+
22
+ # local directory in development holding the generated rdoc
23
+ # default 'doc'
24
+ attr_accessor :local_rdoc_dir
25
+
26
+ # remote directory for storing rdoc, default 'doc'
27
+ attr_accessor :remote_rdoc_dir
28
+
29
+ # local directory for coverage report
30
+ attr_accessor :local_coverage_dir
31
+
32
+ # remote directory for storing coverage reports
33
+ # This defaults to 'coverage'
34
+ attr_accessor :remote_coverage_dir
35
+
36
+ # local directory for generated website, default +site/public+
37
+ attr_accessor :local_site_dir
38
+
39
+ # remote directory relative to +remote_root+ for the website.
40
+ # website.
41
+ attr_accessor :remote_site_dir
42
+
43
+ # is a .tgz to be created?, default 'true'
44
+ attr_accessor :need_tar
45
+
46
+ # is a .zip to be created, default 'true'
47
+ attr_accessor :need_zip
48
+
49
+
50
+ def initialize
51
+ @remote_user = nil
52
+ @remote_host = "rubyforge.org"
53
+
54
+ @rdoc_main = "README"
55
+ @local_rdoc_dir = "doc"
56
+ @remote_rdoc_dir = "doc"
57
+ @local_coverage_dir = "coverage"
58
+ @remote_coverage_dir = "coverage"
59
+ @local_site_dir = "site/public"
60
+ @remote_site_dir = "."
61
+
62
+ @need_tar = true
63
+ @need_zip = true
64
+
65
+ @spec = Gem::Specification.new
66
+
67
+ yield self if block_given?
68
+
69
+ # update rdoc options to take care of the rdoc_main if it is
70
+ # there, and add a default title if one is not given
71
+ if not @spec.rdoc_options.include?("--main") then
72
+ @spec.rdoc_options.concat(["--main", rdoc_main])
73
+ end
74
+
75
+ if not @spec.rdoc_options.include?("--title") then
76
+ @spec.rdoc_options.concat(["--title","'#{name} -- #{summary}'"])
77
+ end
78
+ end
79
+
80
+ # if this gets set then it overwrites what would be the
81
+ # rubyforge default. If rubyforge project is not set then use
82
+ # name. If rubyforge project and name are set, but they are
83
+ # different then assume that name is a subproject of the
84
+ # rubyforge project
85
+ def remote_root
86
+ if rubyforge_project.nil? or
87
+ rubyforge_project == name then
88
+ return RUBYFORGE_ROOT + "#{name}/"
89
+ else
90
+ return RUBYFORGE_ROOT + "#{rubyforge_project}/#{name}/"
91
+ end
92
+ end
93
+
94
+ # rdoc files is the same as what would be generated during gem
95
+ # installation. That is, everything in the require paths plus
96
+ # the rdoc_extra_files
97
+ #
98
+ def rdoc_files
99
+ flist = extra_rdoc_files.dup
100
+ @spec.require_paths.each do |rp|
101
+ flist << FileList["#{rp}/**/*.rb"]
102
+ end
103
+ flist.flatten.uniq
104
+ end
105
+
106
+ # calculate the remote directories
107
+ def remote_root_location
108
+ "#{remote_user}@#{remote_host}:#{remote_root}"
109
+ end
110
+
111
+ def remote_rdoc_location
112
+ remote_root_location + @remote_rdoc_dir
113
+ end
114
+
115
+ def remote_coverage_location
116
+ remote_root_loation + @remote_coverage_dir
117
+ end
118
+
119
+ def remote_site_location
120
+ remote_root_location + @remote_site_dir
121
+ end
122
+
123
+ # we delegate any other calls to spec
124
+ def method_missing(method_id,*params,&block)
125
+ @spec.send method_id, *params, &block
126
+ end
127
+
128
+ # deep copy for duplication
129
+ def dup
130
+ Marshal.load(Marshal.dump(self))
131
+ end
132
+ end
133
+ end
@@ -0,0 +1,18 @@
1
+ module Launchy
2
+ class Version
3
+ MAJOR = 0
4
+ MINOR = 1
5
+ BUILD = 0
6
+
7
+ class << self
8
+ def to_a
9
+ [MAJOR, MINOR, BUILD]
10
+ end
11
+
12
+ def to_s
13
+ to_a.join(".")
14
+ end
15
+ end
16
+ end
17
+ VERSION = Version.to_s
18
+ end
@@ -0,0 +1,23 @@
1
+ require File.join(File.dirname(__FILE__),"spec_helper.rb")
2
+
3
+ describe Launchy::Spawnable::Browser do
4
+ it "should find a path to a executable" do
5
+ File.executable?(Launchy::Spawnable::Browser.new.browser).should == true
6
+ end
7
+
8
+ it "should handle an http url" do
9
+ Launchy::Spawnable::Browser.handle?("http://www.example.com") == true
10
+ end
11
+
12
+ it "should handle an https url" do
13
+ Launchy::Spawnable::Browser.handle?("https://www.example.com") == true
14
+ end
15
+
16
+ it "should handle an ftp url" do
17
+ Launchy::Spawnable::Browser.handle?("ftp://download.example.com") == true
18
+ end
19
+
20
+ it "should not handle a mailto url" do
21
+ Launchy::Spawnable::Browser.handle?("mailto:jeremy@example.com") == false
22
+ end
23
+ end
@@ -0,0 +1,38 @@
1
+ require File.join(File.dirname(__FILE__),"spec_helper.rb")
2
+ require 'yaml'
3
+
4
+ describe Launchy::Spawnable::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::Spawnable::Application.new
9
+
10
+ end
11
+
12
+ it "should find all tattled os" do
13
+ @host_os.keys.each do |os|
14
+ Launchy::Spawnable::Application::KNOWN_OS_FAMILIES.should include(@app.my_os_family(os))
15
+ end
16
+ end
17
+
18
+ it "should not find os of 'dos'" do
19
+ @app.my_os_family('dos').should == :unknown
20
+ end
21
+
22
+ it "my os should have a value" do
23
+ @app.my_os.should_not == ''
24
+ @app.my_os.should_not == nil
25
+ end
26
+
27
+ it "should find open" do
28
+ @app.find_executable('open').should == "/usr/bin/open"
29
+ end
30
+
31
+ it "should not find app xyzzy" do
32
+ @app.find_executable('xyzzy').should == nil
33
+ end
34
+
35
+ it "should find the correct class to launch an ftp url" do
36
+ Launchy::Spawnable::Application.find_application_class_for("ftp://download.fedora.redhat.com").should == Launchy::Spawnable::Browser
37
+ end
38
+ end
@@ -0,0 +1,5 @@
1
+ require 'rubygems'
2
+ require 'spec'
3
+
4
+ $: << File.expand_path(File.join(File.dirname(__FILE__),"..","lib"))
5
+ require 'launchy'
@@ -0,0 +1,11 @@
1
+ require File.join(File.dirname(__FILE__),"spec_helper.rb")
2
+ require 'yaml'
3
+
4
+ describe "Launchy::VERSION" do
5
+ it "should have 2 dots and have 3 numbers" do
6
+ Launchy::VERSION.split('.').size.should == 3
7
+ Launchy::Version.to_a.each do |n|
8
+ n.to_i.should >= 0
9
+ end
10
+ end
11
+ end
metadata ADDED
@@ -0,0 +1,72 @@
1
+ --- !ruby/object:Gem::Specification
2
+ rubygems_version: 0.9.4
3
+ specification_version: 1
4
+ name: launchy
5
+ version: !ruby/object:Gem::Version
6
+ version: 0.1.0
7
+ date: 2007-08-09 00:00:00 -06:00
8
+ summary: A helper to launch apps from within ruby programs.
9
+ require_paths:
10
+ - lib
11
+ email: jeremy@hinegardner.org
12
+ homepage: http://launchy.rubyforge.org/
13
+ rubyforge_project: copiousfreetime
14
+ description: Launchy is helper class for launching +cross-platform+ applications. There are application concepts (browser, email client, etc) that are common across all platforms, and they may be launched in different manners. Launchy is here to assist in launching the appropriate application on the appropriate platform from within your ruby projects.
15
+ autorequire:
16
+ default_executable: launchy
17
+ bindir: bin
18
+ has_rdoc: true
19
+ required_ruby_version: !ruby/object:Gem::Version::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 1.8.5
24
+ version:
25
+ platform: ruby
26
+ signing_key:
27
+ cert_chain:
28
+ post_install_message:
29
+ authors:
30
+ - Jeremy Hinegardner
31
+ files:
32
+ - spec/spawnable_application_spec.rb
33
+ - spec/browser_spec.rb
34
+ - spec/version_spec.rb
35
+ - spec/spec_helper.rb
36
+ - Rakefile
37
+ - README
38
+ - LICENSE
39
+ - CHANGES
40
+ - lib/launchy/specification.rb
41
+ - lib/launchy/gemspec.rb
42
+ - lib/launchy/version.rb
43
+ - lib/launchy/spawnable.rb
44
+ - lib/launchy/spawnable/browser.rb
45
+ - lib/launchy/spawnable/application.rb
46
+ - lib/launchy.rb
47
+ - bin/launchy
48
+ test_files:
49
+ - spec/spawnable_application_spec.rb
50
+ - spec/browser_spec.rb
51
+ - spec/version_spec.rb
52
+ - spec/spec_helper.rb
53
+ rdoc_options:
54
+ - --line-numbers
55
+ - --inline-source
56
+ - --main
57
+ - README
58
+ - --title
59
+ - "'launchy -- A helper to launch apps from within ruby programs.'"
60
+ extra_rdoc_files:
61
+ - Rakefile
62
+ - README
63
+ - LICENSE
64
+ - CHANGES
65
+ executables:
66
+ - launchy
67
+ extensions: []
68
+
69
+ requirements: []
70
+
71
+ dependencies: []
72
+