Added Git URL to extensions
This commit is contained in:
parent
facd8d7dde
commit
74af75f016
|
@ -73,7 +73,7 @@ class ExtensionsController < ApplicationController
|
|||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def extension_params
|
||||
params.require(:extension).permit(:title, :author, :description, :preview, :preview_cache, :extension, :extension_cache, :key, :repository)
|
||||
params.require(:extension).permit(:title, :author, :description, :preview, :preview_cache, :extension, :extension_cache, :key, :repository, :git_url)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -13,6 +13,7 @@ class Extension
|
|||
field :description, type: String
|
||||
field :category_id, type: String
|
||||
field :repository, type: String
|
||||
field :git_url, type: String
|
||||
field :key, type: String
|
||||
field :version, type: String
|
||||
|
||||
|
@ -29,7 +30,6 @@ class Extension
|
|||
|
||||
def get_version_number
|
||||
url = "#{self.repository}/raw/master/lib/#{self.key}/version.rb"
|
||||
Rails.logger.info"@@@@@@@@@@@@@@"+url.inspect
|
||||
response = Net::HTTP.get_response(URI.parse(url)).body
|
||||
data = HTTParty::Parser.new(response, 'rb').parse
|
||||
version = data.gsub!(/\s+/, "").tr!('"','').gsub("module#{self.key.capitalize}VERSION=",'').gsub("end",'')
|
||||
|
|
|
@ -35,6 +35,11 @@
|
|||
<%= f.text_field :repository %>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :git_url %><p>From where to bundle the gem</p><br>
|
||||
<%= f.text_field :repository %>
|
||||
</div>
|
||||
|
||||
<label>Preview</label>
|
||||
<%= f.file_field :preview %>
|
||||
<%= f.hidden_field :preview_cache %>
|
||||
|
|
Loading…
Reference in New Issue