Class: Rays::Worker::Deployer::Content

Inherits:
BaseWorker
  • Object
show all
Includes:
Singleton
Defined in:
lib/rays/workers/deployer.rb

Overview

Content deployer deprecated

Instance Method Summary collapse

Methods inherited from BaseWorker

#execute, register

Instance Method Details

#deploy(app_module) ⇒ Object



96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# File 'lib/rays/workers/deployer.rb', line 96

def deploy(app_module)
  execute('deploy', app_module) do
    env = $rays_config.environment
    base_filenames = []
    deploy_dir = "/tmp/content_sync"
    if env.liferay.remote?
      env.liferay.remote.exec("rm -rf #{deploy_dir} && mkdir #{deploy_dir}")
    else
      rays_exec("rm -rf #{deploy_dir} && mkdir #{deploy_dir}")
    end
    Rays::Utils::FileUtils.find_down("./target/", '.*\\.jar$').each do |file|
      if env.liferay.remote?
        env.liferay.remote.copy_to(file, deploy_dir)
      else
        FileUtils.cp(file, env.liferay.deploy_directory)
      end
      base_filenames << File.basename(file)
    end

    class_path = base_filenames.join ':'
    structures_cmd = "export JAVA_HOME=#{env.liferay.java_home} && cd  #{deploy_dir} && #{env.liferay.java_cmd} -cp #{class_path} com.savoirfairelinux.liferay.client.UpdateStructures"
    templates_cmd = "export JAVA_HOME=#{env.liferay.java_home} && cd #{deploy_dir} && #{env.liferay.java_cmd} -cp #{class_path} com.savoirfairelinux.liferay.client.UpdateTemplates"

    if env.liferay.remote?
      env.liferay.remote.exec(structures_cmd)
      env.liferay.remote.exec(templates_cmd)
    else
      rays_exec(structures_cmd)
      rays_exec(templates_cmd)
    end

  end
end