From 74af75f016a80f4edd57e7ed93b10d8ffb9b510d Mon Sep 17 00:00:00 2001 From: Saurabh Bhatia Date: Thu, 23 Jan 2014 17:23:50 +0800 Subject: [PATCH] Added Git URL to extensions --- app/controllers/extensions_controller.rb | 2 +- app/models/extension.rb | 2 +- app/views/extensions/_form.html.erb | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/controllers/extensions_controller.rb b/app/controllers/extensions_controller.rb index 1d92aed..974c3cf 100644 --- a/app/controllers/extensions_controller.rb +++ b/app/controllers/extensions_controller.rb @@ -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 diff --git a/app/models/extension.rb b/app/models/extension.rb index a6f3b50..ddb7a1f 100644 --- a/app/models/extension.rb +++ b/app/models/extension.rb @@ -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",'') diff --git a/app/views/extensions/_form.html.erb b/app/views/extensions/_form.html.erb index 28b22d8..b5fa3de 100644 --- a/app/views/extensions/_form.html.erb +++ b/app/views/extensions/_form.html.erb @@ -35,6 +35,11 @@ <%= f.text_field :repository %> +
+ <%= f.label :git_url %>

From where to bundle the gem


+ <%= f.text_field :repository %> +
+ <%= f.file_field :preview %> <%= f.hidden_field :preview_cache %>