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/asset/path.rb,
lib/juicer/image_embed.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/minifyer/java_base.rb,
lib/juicer/asset/path_resolver.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/minifyer/closure_compiler.rb,
lib/juicer/install/yui_compressor_installer.rb,
lib/juicer/install/closure_compiler_installer.rb,
lib/juicer/dependency_resolver/dependency_resolver.rb,
lib/juicer/dependency_resolver/css_dependency_resolver.rb,
lib/juicer/dependency_resolver/javascript_dependency_resolver.rb

Overview

Merge several files into one single output file

Defined Under Namespace

Modules: Asset, Binary, CacheBuster, Chainable, Command, Install, Merger, Minifyer Classes: Cli, CssCacheBuster, CssDependencyResolver, DependencyResolver, ImageEmbed, JavaScriptDependencyResolver, JsLint

Constant Summary collapse

VERSION =

:stopdoc:

"1.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_libsObject

Utility method used to require all files ending in .rb that lie in the directory below this file.


55
56
57
58
59
60
61
62
# File 'lib/juicer.rb', line 55

def self.require_all_libs
  dir  = File.dirname(File.expand_path(__FILE__))
  glob = File.join(dir, "juicer", '**', '*.rb')

  # Unexpand paths (avoids requiring the same file twice)
  paths = Dir.glob(glob).map { |path| path.sub("#{dir}/", '').sub(/\.rb$/, "") }
  paths.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