Module: Launchy

Defined in:
lib/launchy/gemspec.rb,
lib/launchy.rb,
lib/launchy/version.rb,
lib/launchy/specification.rb,
lib/launchy/spawnable/browser.rb,
lib/launchy/spawnable/application.rb

Overview

The Gem Specification plus some extras for launchy.

Defined Under Namespace

Modules: Spawnable Classes: Specification, Version

Constant Summary collapse

ROOT_DIR =
File.expand_path(File.join(File.dirname(__FILE__),".."))
LIB_DIR =
File.join(ROOT_DIR,"lib").freeze
RESOURCE_DIR =
File.join(ROOT_DIR,"resources").freeze
SPEC =
Launchy::Specification.new do |spec|
     spec.name               = "launchy"
     spec.version            = Launchy::VERSION
     spec.rubyforge_project  = "copiousfreetime"
     spec.author             = "Jeremy Hinegardner"
     spec.email              = "[email protected]"
     spec.homepage           = "http://launchy.rubyforge.org/"

     spec.summary            = "A helper to launch apps from within ruby programs."
     spec.description        = <<-DESC
     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.
     DESC

     spec.extra_rdoc_files   = FileList["[A-Z]*"]
     spec.has_rdoc           = true
     spec.rdoc_main          = "README"
     spec.rdoc_options       = [ "--line-numbers" , "--inline-source" ]

     spec.test_files         = FileList["spec/**/*.rb", "test/**/*.rb"]
     spec.files              = spec.test_files + spec.extra_rdoc_files + 
                               FileList["lib/**/*.rb", "resources/**/*"]
     
     spec.executable         = spec.name

     spec.platform           = Gem::Platform::RUBY
     spec.required_ruby_version  = ">= 1.8.5"

     spec.local_rdoc_dir     = "doc/rdoc"
     spec.remote_rdoc_dir    = ""
     spec.local_coverage_dir = "doc/coverage"
     spec.remote_coverage_dir= "coverage"

     spec.remote_site_dir    = "#{spec.name}/"

end
SPEC_WIN32 =
SPEC.dup
VERSION =
Version.to_s

Class Method Summary collapse

Class Method Details

.do_magic(*params) ⇒ Object



24
25
26
27
28
29
30
31
# File 'lib/launchy.rb', line 24

def do_magic(*params)
    klass = Launchy::Spawnable::Application.find_application_class_for(*params)
    if klass then 
        klass.run(*params)
    else
        $stderr.puts "Unable to launch #{params.join(' ')}"
    end
end

.require_all_libs_relative_to(fname) ⇒ Object

Utility method to require all files ending in .rb in the directory with the same name as this file minus .rb



11
12
13
14
15
16
17
18
19
20
# File 'lib/launchy.rb', line 11

def require_all_libs_relative_to(fname)
    prepend   = File.basename(fname,".rb")
    search_me = File.join(File.dirname(fname),prepend)
 
    Dir.entries(search_me).each do |rb|
        if File.extname(rb) == ".rb" then
            require "#{prepend}/#{File.basename(rb,".rb")}"
        end
    end
end