require 'fileutils'
require 'date'
RUBYENC = "\"C:\\Program Files (x86)\\RubyEncoder\\rgencoder.exe\"" # if you are in linux put path of rgencoder file
RUBYENC_VERSION = '2.0.0'
PATH = 'D:/projects/project1' # path of code to encode
DESTINATION_PATH = 'D:/projects/project1_cript' # path of destination of code
def report(message)
print message + '...'
STDOUT.flush
if block_given?
yield
end
puts ' ok'
end
begin
puts "removing o #{DESTINATION_PATH}"
FileUtils.rm_rf(Dir["#{DESTINATION_PATH}/*"]) if Dir.exists?(DESTINATION_PATH)
puts "Updating repo"
`git pull origin master`
puts "copying o #{PATH} to #{DESTINATION_PATH}"
FileUtils.cp_r(Dir["#{PATH}/*"],DESTINATION_PATH)
# Encoding files
report("Encoding scripts (use --trace to see RubyEncoder output)") do
system("#{RUBYENC} --stop-on-error --encoding UTF-8 -b- -r --expire #{(Date.today + 180).strftime('%d/%m/%Y')} --ruby #{RUBYENC_VERSION} \"#{DESTINATION_PATH}/app/*.rb\"")
Dir.chdir DESTINATION_PATH
system("git add -A .")
system("git commit -m 'crypt'")
system("git push origin master")
end
end