Module: Juicer

Defined in:
lib/juicer/cli.rb,
lib/juicer.rb,
lib/juicer/binary.rb,
lib/juicer/jslint.rb,
lib/juicer/chainable.rb,
lib/juicer/merger/base.rb,
lib/juicer/cache_buster.rb,
lib/juicer/command/list.rb,
lib/juicer/command/util.rb,
lib/juicer/install/base.rb,
lib/juicer/command/merge.rb,
lib/juicer/command/verify.rb,
lib/juicer/command/install.rb,
lib/juicer/css_cache_buster.rb,
lib/juicer/install/rhino_installer.rb,
lib/juicer/minifyer/yui_compressor.rb,
lib/juicer/install/jslint_installer.rb,
lib/juicer/merger/javascript_merger.rb,
lib/juicer/merger/stylesheet_merger.rb,
lib/juicer/merger/dependency_resolver.rb,
lib/juicer/merger/css_dependency_resolver.rb,
lib/juicer/install/yui_compressor_installer.rb,
lib/juicer/merger/javascript_dependency_resolver.rb

Overview

Merge several files into one single output file

Defined Under Namespace

Modules: Binary, CacheBuster, Chainable, Command, Install, Merger, Minifyer Classes: Cli, CssCacheBuster, JsLint

Constant Summary collapse

VERSION =

:stopdoc:

'0.2.0'
LIBPATH =
::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR
PATH =
::File.dirname(LIBPATH) + ::File::SEPARATOR
LOGGER =
Logger.new(STDOUT)
@@home =
nil

Class Method Summary collapse

Class Method Details

.homeObject

Returns the installation directory for Juicer



21
22
23
24
25
26
27
28
29
# File 'lib/juicer.rb', line 21

def self.home
  return @@home if @@home
  return ENV['JUICER_HOME'] if ENV['JUICER_HOME']
  return File.join(ENV['HOME'], ".juicer") if ENV['HOME']
  return File.join(ENV['APPDATA'], "juicer") if ENV['APPDATA']
  return File.join(ENV['HOMEDRIVE'], ENV['HOMEPATH'], "juicer") if ENV['HOMEDRIVE'] && ENV['HOMEPATH']
  return File.join(ENV['USERPROFILE'], "juicer") if ENV['USERPROFILE']
  return File.join(ENV['Personal'], "juicer") if ENV['Personal']
end

.home=(home) ⇒ Object

Set home directory



33
34
35
# File 'lib/juicer.rb', line 33

def self.home=(home)
  @@home = home
end

.libpath(*args) ⇒ Object

Returns the library path for the module. If any arguments are given, they will be joined to the end of the libray path using File.join.



41
42
43
# File 'lib/juicer.rb', line 41

def self.libpath( *args )
  args.empty? ? LIBPATH : ::File.join(LIBPATH, args.flatten)
end

.path(*args) ⇒ Object

Returns the lpath for the module. If any arguments are given, they will be joined to the end of the path using File.join.



49
50
51
# File 'lib/juicer.rb', line 49

def self.path( *args )
  args.empty? ? PATH : ::File.join(PATH, args.flatten)
end

.require_all_libs_relative_to(fname, dir = nil) ⇒ Object

Utility method used to require all files ending in .rb that lie in the directory below this file that has the same name as the filename passed in. Optionally, a specific directory name can be passed in such that the filename does not have to be equivalent to the directory.



58
59
60
61
62
63
# File 'lib/juicer.rb', line 58

def self.require_all_libs_relative_to( fname, dir = nil )
  dir ||= ::File.basename(fname, '.*')
  search_me = ::File.expand_path(::File.join(::File.dirname(fname), dir, '**', '*.rb'))

  Dir.glob(search_me).sort.each { |rb| require rb }
end

.versionObject

Returns the version string for the library.



15
16
17
# File 'lib/juicer.rb', line 15

def self.version
  VERSION
end