Compare commits
1 Commits
master
...
module_sto
Author | SHA1 | Date |
---|---|---|
Saurabh Bhatia | 4c91b20b02 |
|
@ -13,18 +13,19 @@ class Admin::ModuleStoreController < OrbitBackendController
|
|||
def download
|
||||
#get extension related values
|
||||
extension = get_extension(params[:id]) rescue nil
|
||||
download_link = @@store + "/"+ extension["extension"]["extension"]["url"]
|
||||
downloaded_file_name = extension["extension_filename"]
|
||||
module_app_name = downloaded_file_name.split(/(.zip)/).first
|
||||
extension_name = extension["key"].to_s
|
||||
git_repository_url = extension["git_url"]
|
||||
version = extension["version"]
|
||||
module_installed = File.read("downloaded_extensions.rb").include?(extension["key"])
|
||||
|
||||
#check if the directory exists or not
|
||||
@module_status = Dir.exists?("#{Rails.root}/vendor/built_in_modules/#{module_app_name}")
|
||||
if @module_status.eql?(true)
|
||||
flash[:notice] = "This module is already installed"
|
||||
else
|
||||
download_extension(download_link, downloaded_file_name,module_app_name)
|
||||
flash[:notice] = "This module has been successfully installed"
|
||||
if module_installed.eql?(false)
|
||||
@download_link = "gem '#{extension_name}', '#{version}', :git => '#{git_repository_url}'"
|
||||
File.open("downloaded_extensions.rb", 'a') do |file|
|
||||
file.puts @download_link
|
||||
end
|
||||
end
|
||||
%w(bundle install)
|
||||
site_restart
|
||||
redirect_to admin_module_store_path
|
||||
end
|
||||
|
||||
|
@ -37,12 +38,4 @@ class Admin::ModuleStoreController < OrbitBackendController
|
|||
def get_extension(id)
|
||||
JSON.parse(open("#{@@store}/api/extensions/#{id}").read)
|
||||
end
|
||||
|
||||
def download_extension(download_link, downloaded_file_name,module_app_name)
|
||||
puts %x(wget "#{download_link}")
|
||||
puts %x(unzip "#{downloaded_file_name}")
|
||||
puts %x(mv #{module_app_name} "#{Rails.root}/vendor/built_in_modules/")
|
||||
puts %x(rm "#{downloaded_file_name}")
|
||||
site_restart
|
||||
end
|
||||
end
|
|
@ -44,18 +44,12 @@
|
|||
<td>
|
||||
<%= extension["description"].html_safe%> <%= link_to 'Read More', admin_module_store_show_path(extension["_slugs"][0]) %>
|
||||
</td>
|
||||
<!-- <td class="active"><button class="act btn btn-mini" type="button">Uninstall</button></td>
|
||||
-->
|
||||
<% download_link = STORE_CONFIG[:store_settings]["url"] + "/"+ extension["extension"]["extension"]["url"]
|
||||
downloaded_file_name = extension["extension_filename"]
|
||||
module_app_name = downloaded_file_name.split(/(.zip)/).first
|
||||
@module_status = Dir.exists?("#{Rails.root}/vendor/built_in_modules/#{module_app_name}")
|
||||
%>
|
||||
<% if @module_status.eql?(true)%>
|
||||
<td class="active">Installed</td>
|
||||
<% else %>
|
||||
<td class="active"><%= link_to 'Download', admin_module_store_download_path(:id => extension["_slugs"][0]), :class=>"act btn btn-mini btn-success" %></td>
|
||||
<% end %>
|
||||
<% @module_installed = File.read("downloaded_extensions.rb").include?(extension["key"])%>
|
||||
<% if @module_installed.eql?(true)%>
|
||||
<td class="active">Installed</td>
|
||||
<% else %>
|
||||
<td class="active"><%= link_to 'Download', admin_module_store_download_path(:id => extension["_slugs"][0]), :class=>"act btn btn-mini btn-success" %></td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
gem 'archive', '0.0.1', :git => 'git@gitlab.tp.rulingcom.com:root/orbit-archive.git'
|
||||
gem 'calendar', '0.0.1', :git => 'git@gitlab.tp.rulingcom.com:root/orbit-calendar.git'
|
||||
gem 'location', '0.0.1', :git => 'git@gitlab.tp.rulingcom.com:root/orbit-location.git'
|
||||
gem 'ask', '0.0.1', :git => 'git@gitlab.tp.rulingcom.com:root/orbit-ask.git'
|
||||
gem 'video', '0.0.1', :git => 'git@gitlab.tp.rulingcom.com:root/orbit-video.git'
|
||||
gem 'faq', '0.0.1', :git => 'git@gitlab.tp.rulingcom.com:root/orbit-faq.git'
|
||||
gem 'ask', '0.0.1', :git => 'git@gitlab.tp.rulingcom.com:root/orbit-ask.git'
|
||||
|
|
Loading…
Reference in New Issue