Sha256: dc24978696284e99ff58846fa910ffe62852a0fc32a78156eb435889a5e2122f
Contents?: true
Size: 1.72 KB
Versions: 4
Compression:
Stored size: 1.72 KB
Contents
module ScmsUtils require 'find' require 'fileutils' require 'maruku' require 'open-uri' def ScmsUtils.run(cmd, params) if system("#{cmd} #{params}") ScmsUtils.successLog( "**#{cmd} ran successfully**" ) else raise "Error running #{cmd}" end end def ScmsUtils.errLog(msg) if !msg.nil? if $html == "true" doc = Maruku.new(msg) puts "<span style='color: red;'>#{doc.to_html}</span>" else puts msg end end end def ScmsUtils.successLog(msg) if !msg.nil? if $html == "true" doc = Maruku.new(msg) puts "<span style='color: green;'>#{doc.to_html}</span>" else puts msg end end end def ScmsUtils.log(msg) if !msg.nil? if $html == "true" doc = Maruku.new(msg) puts doc.to_html else puts msg end end end def ScmsUtils.writelog(pub, log) if !pub.nil? && !log.nil? open(File.join(pub, "build.log"), 'a') { |f| f.puts log } end end def ScmsUtils.txt_2_html(rawsnippet) if rawsnippet != nil rawsnippet.gsub!(/(http:\/\/\S+)/, '<a href="\1" target="_blank" ref="external">\1</a>') rawsnippet.gsub!(/\n/, "<br />") end return rawsnippet end def ScmsUtils.uriEncode(uri) return uri.gsub(" ", "%20") end def ScmsUtils.uriDecode(uri) return uri.gsub("%20", " ") end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
scms-1.8.7 | lib/scms/scms_utils.rb |
scms-1.8.6 | lib/scms/scms_utils.rb |
scms-1.7.9 | lib/scms/scms_utils.rb |
scms-1.7.8 | lib/scms/scms_utils.rb |