Commit 71f29e1e9cbb7714301600dd56285f76bc92eef0

Authored by Luciano Prestes
Committed by David Silva
1 parent 15dc1378

rake create_license dont add already created license

Signed-off-by: Fabio Teixeira <fabio1079@gmail.com>
Signed-off-by: Luciano Prestes <lucianopcbr@gmail.com>
Showing 1 changed file with 10 additions and 4 deletions   Show diff stats
lib/tasks/create_lincences.rake
@@ -6,7 +6,8 @@ namespace :software do @@ -6,7 +6,8 @@ namespace :software do
6 if env.plugin_enabled?("MpogSoftware") or env.plugin_enabled?("MpogSoftwarePlugin") 6 if env.plugin_enabled?("MpogSoftware") or env.plugin_enabled?("MpogSoftwarePlugin")
7 list_file = File.open "plugins/mpog_software/public/static/licences.txt", "r" 7 list_file = File.open "plugins/mpog_software/public/static/licences.txt", "r"
8 8
9 - name_or_link = 'version' 9 + version_or_link = 'version'
  10 + can_save = true
10 licence = nil 11 licence = nil
11 12
12 print 'Creating Licenses: ' 13 print 'Creating Licenses: '
@@ -15,13 +16,18 @@ namespace :software do @@ -15,13 +16,18 @@ namespace :software do
15 16
16 if data.length != 0 17 if data.length != 0
17 if version_or_link == 'version' 18 if version_or_link == 'version'
  19 + can_save = LicenseInfo.find_by_version(data) ? false : true
18 licence = LicenseInfo::new :version => data 20 licence = LicenseInfo::new :version => data
19 -  
20 version_or_link = 'link' 21 version_or_link = 'link'
21 elsif version_or_link == 'link' 22 elsif version_or_link == 'link'
22 licence.link = data 23 licence.link = data
23 - licence.save!  
24 - print '.' 24 +
  25 + if can_save
  26 + licence.save!
  27 + print '.'
  28 + else
  29 + print 'F'
  30 + end
25 31
26 version_or_link = 'version' 32 version_or_link = 'version'
27 end 33 end