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://copiousfreetime.rubyforge.org/launchy/"

     spec.summary            = "A helper to launch apps from within ruby programs."
     spec.description        = <<-DESC
     Launchy is helper class for launching cross-platform applications in a
     fire and forget manner.  

     There are application concepts (browser, email client, etc) that are common
     across all platforms, and they may be launched differently on each
     platform.  Launchy is here to make a common approach to launching
     external application from within ruby programs.
     
     DESC

     spec.extra_rdoc_files   = FileList["CHANGES", "LICENSE", "README"]
     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_user        = "jjh"
     spec.remote_site_dir    = "#{spec.name}/"

end
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

.log(msg) ⇒ Object

Setting the LAUNCHY_DEBUG environment variable to ‘true’ will spew debug information to $stderr



35
36
37
38
39
# File 'lib/launchy.rb', line 35

def log(msg)
    if ENV['LAUNCHY_DEBUG'] == 'true' then
        $stderr.puts "LAUNCHY_DEBUG: #{msg}"
    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