rake file to build pmUI & mafe JS projects into processmaker
This commit is contained in:
252
Rakefile
252
Rakefile
@@ -1,6 +1,5 @@
|
|||||||
require 'rubygems'
|
require 'rubygems'
|
||||||
|
|
||||||
|
|
||||||
desc "Default Task - Build Library"
|
desc "Default Task - Build Library"
|
||||||
task :default => [:required] do
|
task :default => [:required] do
|
||||||
Rake::Task['build'].execute
|
Rake::Task['build'].execute
|
||||||
@@ -8,7 +7,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
task :required do
|
task :required do
|
||||||
puts "Executind task: required"
|
#puts "Executind task: required"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@@ -24,9 +23,6 @@ task :build => [:required] do
|
|||||||
exit(1)
|
exit(1)
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
|
||||||
# Build PMUI Library
|
|
||||||
#
|
|
||||||
if mode == "production"
|
if mode == "production"
|
||||||
targetDir = publicDir + "/lib"
|
targetDir = publicDir + "/lib"
|
||||||
pmUIFontsDir = targetDir + "/css/fonts"
|
pmUIFontsDir = targetDir + "/css/fonts"
|
||||||
@@ -41,68 +37,118 @@ task :build => [:required] do
|
|||||||
imgTargetDir = targetDir + "/img"
|
imgTargetDir = targetDir + "/img"
|
||||||
|
|
||||||
pmUIDir = targetDir + "/pmUI"
|
pmUIDir = targetDir + "/pmUI"
|
||||||
|
mafeDir = targetDir + "/mafe"
|
||||||
|
|
||||||
prepareDirs([pmUIDir, jsTargetDir, cssTargetDir, cssImagesTargetDir, imgTargetDir, pmUIFontsDir])
|
prepareDirs([pmUIDir, mafeDir, jsTargetDir, cssTargetDir, cssImagesTargetDir, imgTargetDir, pmUIFontsDir])
|
||||||
|
|
||||||
buildPmUi(targetDir, mode)
|
buildPmUi(Dir.pwd + "/vendor/colosa/pmUI", targetDir, mode)
|
||||||
|
buildMafe(Dir.pwd + "/vendor/colosa/MichelangeloFE", targetDir, mode)
|
||||||
|
|
||||||
|
hashVendors = getHash(Dir.pwd + "/vendor/colosa/pmUI")+'-'+getHash(Dir.pwd + "/vendor/colosa/MichelangeloFE")
|
||||||
|
|
||||||
|
## Building minified JS Files
|
||||||
|
puts "Building file: " + "/js/mafe-#{hashVendors}.js".cyan
|
||||||
|
mafeCompresedFile = targetDir + "/js/mafe-#{hashVendors}.js"
|
||||||
|
mafeCompresedContent = ""
|
||||||
|
|
||||||
|
getJsIncludeFiles().each do |filename|
|
||||||
|
mafeCompresedContent += File.read filename
|
||||||
|
mafeCompresedContent += "\n"
|
||||||
|
end
|
||||||
|
|
||||||
|
File.open(mafeCompresedFile, 'w+') do |writeFile|
|
||||||
|
writeFile.write mafeCompresedContent
|
||||||
|
end
|
||||||
|
|
||||||
|
#Building minified CSS Files
|
||||||
|
puts "Building file: " + "/css/mafe-#{hashVendors}.css".cyan
|
||||||
|
mafeCompresedFile = targetDir + "/css/mafe-#{hashVendors}.css"
|
||||||
|
mafeCompresedContent = ""
|
||||||
|
|
||||||
|
getCssIncludeFiles().each do |filename|
|
||||||
|
mafeCompresedContent += File.read filename
|
||||||
|
mafeCompresedContent += "\n"
|
||||||
|
end
|
||||||
|
|
||||||
|
File.open(mafeCompresedFile, 'w+') do |writeFile|
|
||||||
|
writeFile.write mafeCompresedContent
|
||||||
|
end
|
||||||
|
|
||||||
|
# Create buildhash file
|
||||||
|
puts "Generated file: " + "/buildhash".cyan
|
||||||
|
File.open(targetDir+"/buildhash", 'w+') do |writeFile|
|
||||||
|
writeFile.write hashVendors
|
||||||
|
end
|
||||||
|
|
||||||
|
puts "-- DONE --\n".bold
|
||||||
#task argv1.to_sym do ; end
|
#task argv1.to_sym do ; end
|
||||||
end
|
end
|
||||||
|
|
||||||
def buildPmUi(targetDir, mode)
|
def buildPmUi(homeDir, targetDir, mode)
|
||||||
|
puts "\nBuilding PMUI library".green.bold
|
||||||
|
|
||||||
# Defining target directories
|
# Defining target directories
|
||||||
homeDir = Dir.pwd + "/vendor/colosa/pmUI"
|
|
||||||
pmUIDir = targetDir + "/pmUI"
|
pmUIDir = targetDir + "/pmUI"
|
||||||
pmUIFontsDir = targetDir + "/fonts"
|
pmUIFontsDir = targetDir + "/fonts"
|
||||||
jsTargetDir = targetDir + "/js"
|
jsTargetDir = targetDir + "/js"
|
||||||
cssTargetDir = targetDir + "/css"
|
cssTargetDir = targetDir + "/css"
|
||||||
imgTargetDir = targetDir + "/img"
|
imgTargetDir = targetDir + "/img"
|
||||||
version = getVersion(homeDir)
|
version = getVersion(homeDir)
|
||||||
#
|
|
||||||
|
|
||||||
puts "Generating Theme files"
|
puts "Generating Theme files"
|
||||||
executeInto(homeDir, ["compileTheme[mafe]", "js"])
|
executeInto(homeDir, ["compileTheme[mafe]", "js"])
|
||||||
|
|
||||||
puts "\nCopying lib files into: #{pmUIDir}"
|
puts "\nCopying lib files into: #{pmUIDir}".bold
|
||||||
|
|
||||||
puts "*Copy build/js/min/pmui-#{version}.min.js -> pmui.min.js"
|
copyFiles({
|
||||||
system "cp #{homeDir}/build/js/pmui-#{version}.js #{pmUIDir}/pmui.min.js"
|
"#{homeDir}/build/js/pmui-#{version}.js" => "#{pmUIDir}/pmui.min.js",
|
||||||
|
"#{homeDir}/themes/mafe/build/pmui-mafe.css" => "#{pmUIDir}/pmui.min.css",
|
||||||
|
"#{homeDir}/themes/mafe/build/images/*.png" => "#{targetDir}/css/images/",
|
||||||
|
"#{homeDir}/img/*" => "#{imgTargetDir}"
|
||||||
|
})
|
||||||
|
|
||||||
puts "*Copy themes/mafe/build/pmui-mafe.css -> pmui.min.css"
|
puts "\nCopying lib files into: #{jsTargetDir}".bold
|
||||||
system "cp #{homeDir}/themes/mafe/build/pmui-mafe.css #{pmUIDir}/pmui.min.css"
|
copyFiles({homeDir + "/libraries/restclient/restclient-min.js" => "#{jsTargetDir}/restclient.min.js"})
|
||||||
|
|
||||||
puts "*Copy themes/mafe/build/images/*.png -> css/images/"
|
puts "\nCopying font files into: #{pmUIFontsDir}".bold
|
||||||
system "cp -Rf #{homeDir}/themes/mafe/build/images/*.png #{targetDir}/css/images/"
|
theme = "mafe"
|
||||||
|
copyFiles({"#{homeDir}/themes/#{theme}/fonts/*" => "#{targetDir}"})
|
||||||
|
|
||||||
puts "*Copy img/* to #{imgTargetDir}"
|
puts "\nPMUI Build Finished".magenta
|
||||||
system "cp -Rf #{homeDir}/img/* #{imgTargetDir}"
|
|
||||||
|
|
||||||
|
|
||||||
jsLibFiles = {
|
|
||||||
homeDir + "/libraries/restclient/restclient-min.js" => "restclient.min.js"
|
|
||||||
}
|
|
||||||
|
|
||||||
puts ""
|
|
||||||
puts "Copying lib files into: #{jsTargetDir}"
|
|
||||||
|
|
||||||
jsLibFiles.each do |src, target|
|
|
||||||
puts "*Copy #{src} -> #{target}"
|
|
||||||
system "cp #{src} #{jsTargetDir}/#{target}"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
puts ""
|
def buildMafe(homeDir, targetDir, mode)
|
||||||
puts "Copying font files into: #{pmUIFontsDir}"
|
puts "\nBuilding PM Michelangelo FE".green.bold
|
||||||
#targetConfFiles = [
|
|
||||||
# homeDir + "/config/fonts.json"
|
|
||||||
#]
|
|
||||||
|
|
||||||
theme ="mafe"
|
###
|
||||||
|
# Defining target directories
|
||||||
|
mafeDir = targetDir + "/mafe"
|
||||||
|
jsTargetDir = targetDir + "/js"
|
||||||
|
cssTargetDir = targetDir + "/css"
|
||||||
|
imgTargetDir = targetDir + "/img"
|
||||||
|
##
|
||||||
|
|
||||||
puts "Copying fonts"
|
executeInto(homeDir, ["rmdir", "compass", "compress_js_files", "compress_app_files"])
|
||||||
puts "*Copy themes/#{theme}/fonts/* -> #{targetDir}"
|
|
||||||
system "cp -R #{homeDir}/themes/#{theme}/fonts/* #{targetDir}"
|
|
||||||
|
|
||||||
|
puts "\nCopying files into: #{mafeDir}".bold
|
||||||
|
copyFiles({
|
||||||
|
"#{homeDir}/build/js/designer.js" => "#{mafeDir}/designer.min.js",
|
||||||
|
"#{homeDir}/build/js/mafe.js" => "#{mafeDir}/mafe.min.js",
|
||||||
|
"#{homeDir}/build/css/mafe.css" => "#{mafeDir}/mafe.min.css",
|
||||||
|
"#{homeDir}/img/*.*" => "#{imgTargetDir}"
|
||||||
|
})
|
||||||
|
|
||||||
|
puts "\nCopying lib files into: #{jsTargetDir}".bold
|
||||||
|
copyFiles({
|
||||||
|
"#{homeDir}/lib/wz_jsgraphics/wz_jsgraphics.js" => "#{jsTargetDir}/wz_jsgraphics.js",
|
||||||
|
"#{homeDir}/lib/jQuery/jquery-1.10.2.min.js" => "#{jsTargetDir}/jquery-1.10.2.min.js",
|
||||||
|
"#{homeDir}/lib/underscore/underscore-min.js" => "#{jsTargetDir}/underscore-min.js",
|
||||||
|
"#{homeDir}/lib/jQueryUI/jquery-ui-1.10.3.custom.min.js" => "#{jsTargetDir}/jquery-ui-1.10.3.custom.min.js",
|
||||||
|
"#{homeDir}/lib/jQueryLayout/jquery.layout.min.js" => "#{jsTargetDir}/jquery.layout.min.js",
|
||||||
|
"#{homeDir}/lib/modernizr/modernizr.js" => "#{jsTargetDir}/modernizr.js"
|
||||||
|
})
|
||||||
|
|
||||||
|
puts "\nMichelangelo FE Build Finished\n".magenta
|
||||||
end
|
end
|
||||||
|
|
||||||
def prepareDirs(dirs)
|
def prepareDirs(dirs)
|
||||||
@@ -115,7 +161,8 @@ def prepareDirs(dirs)
|
|||||||
puts "Removing #{dir}"
|
puts "Removing #{dir}"
|
||||||
system "rm -rf #{dir}"
|
system "rm -rf #{dir}"
|
||||||
end
|
end
|
||||||
Dir.mkdir(dir)
|
#Dir.mkdir(dir)
|
||||||
|
system("mkdir -p #{dir}")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -131,6 +178,11 @@ def getVersion(path)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
def getHash(path)
|
||||||
|
hash = `git rev-parse --short HEAD`
|
||||||
|
return hash.strip
|
||||||
|
end
|
||||||
|
|
||||||
def executeInto(path, tasks)
|
def executeInto(path, tasks)
|
||||||
Dir.chdir(path) do
|
Dir.chdir(path) do
|
||||||
tasks.each do |task|
|
tasks.each do |task|
|
||||||
@@ -138,3 +190,121 @@ def executeInto(path, tasks)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
def copyFiles(files)
|
||||||
|
files.each do |from, to|
|
||||||
|
print " Copy ".green + from.gsub(Dir.pwd+'/vendor/colosa/', '')+' -> '.brown+to.gsub(Dir.pwd, '').gray
|
||||||
|
system('cp -Rf '+from+' '+to+' 2>&1')
|
||||||
|
|
||||||
|
if $? == 0
|
||||||
|
puts " (ok)".green
|
||||||
|
else
|
||||||
|
puts " (failed)".red
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def getJsIncludeFiles
|
||||||
|
includeFiles = [
|
||||||
|
"workflow/public_html/lib/js/wz_jsgraphics.js",
|
||||||
|
"workflow/public_html/lib/js/jquery-1.10.2.min.js",
|
||||||
|
"workflow/public_html/lib/js/underscore-min.js",
|
||||||
|
"workflow/public_html/lib/js/jquery-ui-1.10.3.custom.min.js",
|
||||||
|
"workflow/public_html/lib/js/jquery.layout.min.js",
|
||||||
|
"workflow/public_html/lib/js/modernizr.js",
|
||||||
|
"workflow/public_html/lib/js/restclient.min.js",
|
||||||
|
"workflow/public_html/lib/pmUI/pmui.min.js",
|
||||||
|
"workflow/public_html/lib/mafe/mafe.min.js",
|
||||||
|
"workflow/public_html/lib/mafe/designer.min.js",
|
||||||
|
"gulliver/js/tinymce/jscripts/tiny_mce/tiny_mce.js",
|
||||||
|
|
||||||
|
"gulliver/js/tinymce/jscripts/tiny_mce/plugins/pmGrids/editor_plugin.js",
|
||||||
|
"gulliver/js/tinymce/jscripts/tiny_mce/plugins/pmSimpleUploader/editor_plugin.js",
|
||||||
|
"gulliver/js/tinymce/jscripts/tiny_mce/plugins/pmVariablePicker/editor_plugin.js",
|
||||||
|
"gulliver/js/tinymce/jscripts/tiny_mce/plugins/visualchars/editor_plugin.js",
|
||||||
|
"gulliver/js/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/editor_plugin.js",
|
||||||
|
"gulliver/js/tinymce/jscripts/tiny_mce/plugins/wordcount/editor_plugin.js",
|
||||||
|
"gulliver/js/tinymce/jscripts/tiny_mce/plugins/visualblocks/editor_plugin.js",
|
||||||
|
"gulliver/js/tinymce/jscripts/tiny_mce/plugins/table/editor_plugin.js",
|
||||||
|
"gulliver/js/tinymce/jscripts/tiny_mce/plugins/template/editor_plugin.js",
|
||||||
|
"gulliver/js/tinymce/jscripts/tiny_mce/plugins/visualblocks/editor_plugin.js",
|
||||||
|
"gulliver/js/tinymce/jscripts/tiny_mce/plugins/preview/editor_plugin.js",
|
||||||
|
"gulliver/js/tinymce/jscripts/tiny_mce/plugins/print/editor_plugin.js",
|
||||||
|
"gulliver/js/tinymce/jscripts/tiny_mce/plugins/style/editor_plugin.js",
|
||||||
|
"gulliver/js/tinymce/jscripts/tiny_mce/plugins/save/editor_plugin.js",
|
||||||
|
"gulliver/js/tinymce/jscripts/tiny_mce/plugins/tabfocus/editor_plugin.js",
|
||||||
|
"gulliver/js/tinymce/jscripts/tiny_mce/plugins/searchreplace/editor_plugin.js",
|
||||||
|
"gulliver/js/tinymce/jscripts/tiny_mce/plugins/paste/editor_plugin.js",
|
||||||
|
"gulliver/js/tinymce/jscripts/tiny_mce/plugins/media/editor_plugin.js",
|
||||||
|
"gulliver/js/tinymce/jscripts/tiny_mce/plugins/lists/editor_plugin.js",
|
||||||
|
"gulliver/js/tinymce/jscripts/tiny_mce/plugins/insertdatetime/editor_plugin.js",
|
||||||
|
"gulliver/js/tinymce/jscripts/tiny_mce/plugins/example/editor_plugin.js",
|
||||||
|
"gulliver/js/tinymce/jscripts/tiny_mce/plugins/pagebreak/editor_plugin.js",
|
||||||
|
"gulliver/js/tinymce/jscripts/tiny_mce/plugins/example_dependency/editor_plugin.js",
|
||||||
|
"gulliver/js/tinymce/jscripts/tiny_mce/plugins/noneditable/editor_plugin.js",
|
||||||
|
"gulliver/js/tinymce/jscripts/tiny_mce/plugins/fullpage/editor_plugin.js",
|
||||||
|
"gulliver/js/tinymce/jscripts/tiny_mce/plugins/layer/editor_plugin.js",
|
||||||
|
"gulliver/js/tinymce/jscripts/tiny_mce/plugins/legacyoutput/editor_plugin.js",
|
||||||
|
"gulliver/js/tinymce/jscripts/tiny_mce/plugins/fullscreen/editor_plugin.js",
|
||||||
|
"gulliver/js/tinymce/jscripts/tiny_mce/plugins/iespell/editor_plugin.js",
|
||||||
|
"gulliver/js/tinymce/jscripts/tiny_mce/plugins/inlinepopups/editor_plugin.js",
|
||||||
|
"gulliver/js/tinymce/jscripts/tiny_mce/plugins/autoresize/editor_plugin.js",
|
||||||
|
"gulliver/js/tinymce/jscripts/tiny_mce/plugins/contextmenu/editor_plugin.js",
|
||||||
|
"gulliver/js/tinymce/jscripts/tiny_mce/plugins/advlist/editor_plugin.js",
|
||||||
|
"gulliver/js/tinymce/jscripts/tiny_mce/plugins/autolink/editor_plugin.js",
|
||||||
|
"gulliver/js/tinymce/jscripts/tiny_mce/plugins/directionality/editor_plugin.js",
|
||||||
|
"gulliver/js/tinymce/jscripts/tiny_mce/plugins/emotions/editor_plugin.js",
|
||||||
|
"gulliver/js/tinymce/jscripts/tiny_mce/themes/advanced/editor_template.js",
|
||||||
|
"gulliver/js/tinymce/jscripts/tiny_mce/plugins/advhr/editor_plugin.js",
|
||||||
|
"gulliver/js/tinymce/jscripts/tiny_mce/plugins/advlink/editor_plugin.js",
|
||||||
|
"gulliver/js/tinymce/jscripts/tiny_mce/plugins/advimage/editor_plugin.js",
|
||||||
|
"gulliver/js/tinymce/jscripts/tiny_mce/plugins/nonbreaking/editor_plugin.js",
|
||||||
|
|
||||||
|
"gulliver/js/codemirror/lib/codemirror.js",
|
||||||
|
"gulliver/js/codemirror/mode/javascript/javascript.js",
|
||||||
|
"gulliver/js/codemirror/addon/edit/matchbrackets.js",
|
||||||
|
"gulliver/js/codemirror/mode/htmlmixed/htmlmixed.js",
|
||||||
|
"gulliver/js/codemirror/mode/xml/xml.js",
|
||||||
|
"gulliver/js/codemirror/mode/css/css.js",
|
||||||
|
"gulliver/js/codemirror/mode/clike/clike.js",
|
||||||
|
"gulliver/js/codemirror/mode/php/php.js",
|
||||||
|
]
|
||||||
|
|
||||||
|
return includeFiles
|
||||||
|
end
|
||||||
|
|
||||||
|
def getCssIncludeFiles
|
||||||
|
return [
|
||||||
|
"gulliver/js/codemirror/lib/codemirror.css",
|
||||||
|
|
||||||
|
"gulliver/js/tinymce/jscripts/tiny_mce/themes/advanced/skins/o2k7/ui.css",
|
||||||
|
"gulliver/js/tinymce/jscripts/tiny_mce/themes/advanced/skins/o2k7/ui_silver.css",
|
||||||
|
"gulliver/js/tinymce/jscripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/window.css",
|
||||||
|
"gulliver/js/tinymce/jscripts/tiny_mce/themes/advanced/skins/o2k7/content.css",
|
||||||
|
|
||||||
|
"workflow/public_html/lib/pmUI/pmui.min.css",
|
||||||
|
"workflow/public_html/lib/mafe/mafe.min.css"
|
||||||
|
]
|
||||||
|
end
|
||||||
|
|
||||||
|
class String
|
||||||
|
def black; "\033[30m#{self}\033[0m" end
|
||||||
|
def red; "\033[31m#{self}\033[0m" end
|
||||||
|
def green; "\033[32m#{self}\033[0m" end
|
||||||
|
def brown; "\033[33m#{self}\033[0m" end
|
||||||
|
def blue; "\033[34m#{self}\033[0m" end
|
||||||
|
def magenta; "\033[35m#{self}\033[0m" end
|
||||||
|
def cyan; "\033[36m#{self}\033[0m" end
|
||||||
|
def gray; "\033[37m#{self}\033[0m" end
|
||||||
|
def bg_black; "\033[40m#{self}\0330m" end
|
||||||
|
def bg_red; "\033[41m#{self}\033[0m" end
|
||||||
|
def bg_green; "\033[42m#{self}\033[0m" end
|
||||||
|
def bg_brown; "\033[43m#{self}\033[0m" end
|
||||||
|
def bg_blue; "\033[44m#{self}\033[0m" end
|
||||||
|
def bg_magenta; "\033[45m#{self}\033[0m" end
|
||||||
|
def bg_cyan; "\033[46m#{self}\033[0m" end
|
||||||
|
def bg_gray; "\033[47m#{self}\033[0m" end
|
||||||
|
def bold; "\033[1m#{self}\033[22m" end
|
||||||
|
def reverse_color; "\033[7m#{self}\033[27m" end
|
||||||
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user