Improvements, adding error raising to handle break the build if something fails
This commit is contained in:
39
Rakefile
39
Rakefile
@@ -13,10 +13,16 @@ task :required do
|
|||||||
puts "JSON gem not found.\nInstall it by running 'gem install json'"
|
puts "JSON gem not found.\nInstall it by running 'gem install json'"
|
||||||
exit(1)
|
exit(1)
|
||||||
end
|
end
|
||||||
|
begin
|
||||||
|
require 'ftools'
|
||||||
|
rescue LoadError
|
||||||
|
puts "JSON gem not found.\nInstall it by running 'gem install ftools'"
|
||||||
|
exit(1)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
desc "Copy Files to ProcessMaker"
|
desc "Build Front-End for ProcessMaker"
|
||||||
task :build => [:required] do
|
task :build => [:required] do
|
||||||
mode = "production"
|
mode = "production"
|
||||||
#argv1 = ARGV.last
|
#argv1 = ARGV.last
|
||||||
@@ -225,17 +231,23 @@ def buildMafe(homeDir, targetDir, mode)
|
|||||||
end
|
end
|
||||||
|
|
||||||
def prepareDirs(dirs)
|
def prepareDirs(dirs)
|
||||||
homeDir = Dir.pwd
|
|
||||||
|
|
||||||
puts "Preparing Directories..."
|
puts "Preparing Directories..."
|
||||||
|
|
||||||
dirs.each do |dir|
|
dirs.each do |dir|
|
||||||
if File.directory?(dir)
|
if File.directory?(dir)
|
||||||
puts "Removing #{dir}"
|
if !File.writable?(dir)
|
||||||
system "rm -rf #{dir}"
|
raise "Error, directory " + dir + " is not writable."
|
||||||
|
end
|
||||||
|
FileUtils.rm_rf(dir)
|
||||||
|
end
|
||||||
|
|
||||||
|
begin
|
||||||
|
puts 'create '.green + dir
|
||||||
|
FileUtils.mkdir_p(dir)
|
||||||
|
rescue Exception => e
|
||||||
|
puts ' (failed)'.red
|
||||||
|
raise RuntimeError, e.message
|
||||||
end
|
end
|
||||||
#Dir.mkdir(dir)
|
|
||||||
system("mkdir -p #{dir}")
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -267,22 +279,17 @@ 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|
|
||||||
system "rake #{task}"
|
system "rake #{task}" or raise "An error was raised executing task '#{task}' into #{path}".red
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
def copyFiles(files)
|
def copyFiles(files)
|
||||||
files.each do |from, to|
|
files.each do |from, to|
|
||||||
print " Copy ".green + from.gsub(Dir.pwd+'/vendor/colosa/', '')+' -> '.brown+to.gsub(Dir.pwd, '').gray
|
puts " copy ".green + from.gsub(Dir.pwd+'/vendor/colosa/', '')
|
||||||
system('cp -Rf '+from+' '+to+' 2>&1')
|
puts ' into '.green + to.gsub(Dir.pwd, '')
|
||||||
|
|
||||||
if $? == 0
|
system('cp -Rf '+from+' '+to+' 2>&1') or raise "Can't copy into directory #{to}".red
|
||||||
puts " (ok)".green
|
|
||||||
else
|
|
||||||
puts " (failed)".red
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user