Top Level Namespace

Defined Under Namespace

Modules: ActionController, ActionView, ActiveRecord, Compass, Emulators, FlashMessages, Gridify, HandleAttributes, Ical, JqGrid, JqTouch, JqgridJson, JqueryAutoComplete, JqueryAutoCompleteJson, MarkItUp, Mobile, SecretSauce, Tools Classes: Array, Float, Hash, JqTouchTheme, JqueryMobileTheme, JqueryUiTheme

Constant Summary collapse

JQTOUCH_MESSAGE1 =
"# Generated by compass-jquery-plugin/gem-tasks/jqtouch.rake\n# Install with: compass install jquery/jqtouch\n\n"
JQTOUCH_MESSAGE2 =
"// Generated by compass-jquery-plugin/gem-tasks/jqtouch.rake\n\n"
GEM_ROOT =
File.expand_path(File.join(File.dirname(__FILE__), '..'))
GOOGLE_JS_COMPRESSOR =
File.join(GEM_ROOT, 'lib', 'google-compiler-20110615.jar')
YUI_JS_COMPRESSOR =
File.join(GEM_ROOT, 'lib', 'yuicompressor-2.4.4.jar')
JQUERY_MESSAGE1 =
"# Generated by compass-jquery-plugin/gem-tasks/jquery.rake\n# Install with: compass install jquery/jquery . --force\n\n"
JQUERY_MESSAGE2 =
"// Generated by compass-jquery-plugin/gem-tasks/jquery.rake\n"
AUTOCOMPLETE_FIX =
"\n\n/* Fix Autocomplete */\n\n.ui-autocomplete-loading { background: white/*{bgColorLoading}*/ url(images/ui-anim_basic_16x16.gif)/*{bgImgUrlLoading}*/ right/*{bgLoadingXPos}*/ center/*{bgLoadingYPos}*/ no-repeat/*{bgLoadingRepeat}*/; }"
WIDGET_BORDER =
"\n\n/* Add .ui-widget-border*/\n\n.ui-widget-border { border: 1px solid #aaaaaa/*{borderColorContent}*/; }"
MOBILE_MESSAGE1 =
"# Generated by compass-jquery-plugin/gem-tasks/mobile.rake\n# Install with: compass install jquery/mobile\n\n"
MOBILE_MESSAGE2 =
"// Generated by compass-jquery-plugin/gem-tasks/mobile.rake\n"

Instance Method Summary collapse

Instance Method Details

#all_files(pattern) ⇒ Object



34
35
36
# File 'lib/handle_js_files.rb', line 34

def all_files(pattern)
  FileList[pattern].collect { |filename| File.read(filename) }.join "\n\n"
end

#compress_css(src) ⇒ Object



19
20
21
22
23
24
# File 'lib/handle_js_files.rb', line 19

def compress_css(src)
  min_css = ''
  cmd = %Q/java -jar "#{YUI_JS_COMPRESSOR}" --type css --charset utf8/
  IO.popen(cmd, 'r+') { |f| f.print(src); f.close_write; min_css = f.read }
  min_css
end

#compress_js(scripts, compressor) ⇒ Object



8
9
10
11
12
13
14
15
16
17
# File 'lib/handle_js_files.rb', line 8

def compress_js(scripts, compressor)
  min_js = ''
  if (compressor.downcase == "google")
    cmd = %Q/java -jar "#{GOOGLE_JS_COMPRESSOR}" --charset utf8/
  else
    cmd = %Q/java -jar "#{YUI_JS_COMPRESSOR}" --type js --charset utf8/
  end
  IO.popen(cmd, 'r+') { |f| f.print(scripts); f.close_write; min_js = f.read }
  min_js
end

#concat_files(files) ⇒ Object



26
27
28
29
30
31
32
# File 'lib/handle_js_files.rb', line 26

def concat_files(files)
  out = ''
  files.each do |file|
    out += file
  end
  out
end

#handleTinyMCEDir(manifest, srcDir, destDir) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/handle_js_files.rb', line 38

def handleTinyMCEDir(manifest, srcDir, destDir)
  len = srcDir.length
  actualDir = destDir
  FileUtils.mkdir_p(destDir)
  Find.find(srcDir) do |entry|
    if File.directory?(entry) and entry != srcDir and entry != actualDir
      actualDir = File.join(destDir, entry[len, 255])
      FileUtils.mkdir_p(actualDir)
    end
  end
  Find.find(srcDir) do |entry|
    if File.file?(entry)
      ending = entry[len, 255]
      if /\.css$/ =~ entry or  /\.htm$/ =~ entry
        css = File.read entry
        open File.join(destDir, ending), 'w' do |f|
          f.write compress_css(css)
        end
      elsif /\.js$/ =~ entry
        js = File.read entry
        open File.join(destDir, ending), 'w' do |f|
          f.write compress_js(js, "yui")
        end
      else
        FileUtils.cp(entry, File.join(destDir, ending))
      end
      manifest.print "javascript 'tiny_mce/#{ending}'\n"
    end
  end
end