Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant into quick_service
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
class License
|
||||
include HTTParty
|
||||
|
||||
base_uri "provision.zsai.ws/api"
|
||||
base_uri "connect.smartsales.dev/api"
|
||||
|
||||
attr_accessor :name, :address_1, :address_2, :township, :city, :country, :email, :phone, :fax, :logo, :subdomain,
|
||||
:plan_activation_date, :plan_next_renewal_date, :plan_max_products,:plan_max_customers, :plan_active_connections,
|
||||
@@ -118,8 +118,11 @@ class License
|
||||
|
||||
response = create_license_file(@activate)
|
||||
if(response[:status])
|
||||
sym_path = "/home/yan/symmetric/"
|
||||
#sym_path = "/home/user/symmetric/"
|
||||
sym_path = File.expand_path("~/symmetric/")
|
||||
|
||||
response = create_symmetric_config(sym_path, db_host, db_schema, db_user, db_password)
|
||||
|
||||
if(response[:status])
|
||||
response = run_symmetric(sym_path)
|
||||
end
|
||||
@@ -183,7 +186,7 @@ class License
|
||||
|
||||
if File.exist?("config/license.yml")
|
||||
File.open("config/license.yml").each do |line|
|
||||
if line.include? (key_name)
|
||||
if line.include? (key_name)
|
||||
decrypted_line_array = line.split(": ")
|
||||
decrypted_line = AESCrypt.decrypt_data(decode_str(decrypted_line_array[1]), decode_str(key), decode_str(iv), ENV['CIPHER_TYPE'])
|
||||
end
|
||||
@@ -325,7 +328,7 @@ class License
|
||||
if File.directory? (sym_location)
|
||||
begin
|
||||
# sx properties create
|
||||
f = File.open(sym_location + "engines/sx.properties", "w")
|
||||
f = File.open(sym_location + "/engines/sx.properties", "w")
|
||||
f.write("engine.name=sx\n")
|
||||
f.write("db.driver=com.mysql.jdbc.Driver\n")
|
||||
f.write("db.url=jdbc:mysql://#{db_host}/#{db_schema}?tinyInt1isBit=false\n")
|
||||
@@ -344,14 +347,15 @@ class License
|
||||
f.close
|
||||
|
||||
# read from license file
|
||||
shop_name = read_license_no_decrypt("shop_name")
|
||||
# shop_name = read_license_no_decrypt("shop_name")
|
||||
shop_name = "cloud"
|
||||
dbhost = read_license("dbhost")
|
||||
dbschema = read_license("dbschema")
|
||||
dbusername = read_license("dbusername")
|
||||
dbpassword = read_license("dbpassword")
|
||||
|
||||
# shop properties create
|
||||
f = File.open(sym_location + "engines/#{shop_name}.properties", "w")
|
||||
f = File.open(sym_location + "/engines/#{shop_name}.properties", "w")
|
||||
f.write("engine.name=#{shop_name}\n")
|
||||
f.write("db.driver=com.mysql.jdbc.Driver\n")
|
||||
f.write("db.url=jdbc:mysql://#{dbhost}/#{dbschema}?tinyInt1isBit=false\n")
|
||||
@@ -390,13 +394,13 @@ class License
|
||||
sym_run_status = check_sym_running(check_sym_proc_str, sym_path)
|
||||
if sym_run_status
|
||||
# Create Sym Table
|
||||
check_sym_table = system("sudo " + sym_path + "bin/symadmin --engine sx create-sym-tables")
|
||||
check_sym_table = system("sudo " + sym_path + "/bin/symadmin --engine sx create-sym-tables")
|
||||
if check_sym_table
|
||||
sym_sql = Rails.root + "db/sym_master.sql"
|
||||
|
||||
if File.exist? (sym_sql)
|
||||
# Import Sym Sql to db and start sym
|
||||
run_sym_sql = system("sudo " + sym_path + "bin/dbimport --engine sx " + sym_sql.to_s)
|
||||
run_sym_sql = system("sudo " + sym_path + "/bin/dbimport --engine sx " + sym_sql.to_s)
|
||||
stop_sym = system("sudo service SymmetricDS stop")
|
||||
run_sym = system("sudo service SymmetricDS start")
|
||||
if run_sym
|
||||
|
||||
Reference in New Issue
Block a user