Commit 71f29e1e9cbb7714301600dd56285f76bc92eef0
Committed by
David Silva
1 parent
15dc1378
Exists in
master
and in
5 other branches
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 | 6 | if env.plugin_enabled?("MpogSoftware") or env.plugin_enabled?("MpogSoftwarePlugin") |
| 7 | 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 | 11 | licence = nil |
| 11 | 12 | |
| 12 | 13 | print 'Creating Licenses: ' |
| ... | ... | @@ -15,13 +16,18 @@ namespace :software do |
| 15 | 16 | |
| 16 | 17 | if data.length != 0 |
| 17 | 18 | if version_or_link == 'version' |
| 19 | + can_save = LicenseInfo.find_by_version(data) ? false : true | |
| 18 | 20 | licence = LicenseInfo::new :version => data |
| 19 | - | |
| 20 | 21 | version_or_link = 'link' |
| 21 | 22 | elsif version_or_link == 'link' |
| 22 | 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 | 32 | version_or_link = 'version' |
| 27 | 33 | end | ... | ... |