Commit 655df80b72c663cafd6e421eeb1bb85613d32f21
Committed by
Thiago Ribeiro
1 parent
a754c9b6
Exists in
refactor_software_info_365
Add identifier into CreateSoftware task
Signed-off-by: Luciano Prestes Cavalcanti <lucianopcbr@gmail.com> Signed-off-by: Marcos Ronaldo <marcos.rpj2@gmail.com>
Showing
3 changed files
with
8 additions
and
2 deletions
Show diff stats
lib/create_software.rb
| ... | ... | @@ -5,12 +5,12 @@ class CreateSoftware < Task |
| 5 | 5 | validates_presence_of :name |
| 6 | 6 | |
| 7 | 7 | attr_accessible :name, :finality, :repository_link, :requestor, :environment, |
| 8 | - :reject_explanation, :license_info | |
| 8 | + :reject_explanation, :license_info, :identifier | |
| 9 | 9 | |
| 10 | 10 | alias :environment :target |
| 11 | 11 | alias :environment= :target= |
| 12 | 12 | |
| 13 | - DATA_FIELDS = ['name', 'finality', 'license_info', 'repository_link'] | |
| 13 | + DATA_FIELDS = ['name', 'identifier', 'finality', 'license_info', 'repository_link'] | |
| 14 | 14 | DATA_FIELDS.each do |field| |
| 15 | 15 | settings_items field.to_sym |
| 16 | 16 | end |
| ... | ... | @@ -21,7 +21,11 @@ class CreateSoftware < Task |
| 21 | 21 | template_id = software_template.id |
| 22 | 22 | end |
| 23 | 23 | |
| 24 | + identifier = self.identifier | |
| 25 | + identifier ||= self.name.to_slug | |
| 26 | + | |
| 24 | 27 | community = Community.create!(:name => self.name, |
| 28 | + :identifier => identifier, | |
| 25 | 29 | :template_id => template_id) |
| 26 | 30 | |
| 27 | 31 | community.environment = self.environment | ... | ... |
lib/software_info.rb
test/unit/software_info_validation_test.rb