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,12 +5,12 @@ class CreateSoftware < Task | ||
| 5 | validates_presence_of :name | 5 | validates_presence_of :name |
| 6 | 6 | ||
| 7 | attr_accessible :name, :finality, :repository_link, :requestor, :environment, | 7 | attr_accessible :name, :finality, :repository_link, :requestor, :environment, |
| 8 | - :reject_explanation, :license_info | 8 | + :reject_explanation, :license_info, :identifier |
| 9 | 9 | ||
| 10 | alias :environment :target | 10 | alias :environment :target |
| 11 | alias :environment= :target= | 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 | DATA_FIELDS.each do |field| | 14 | DATA_FIELDS.each do |field| |
| 15 | settings_items field.to_sym | 15 | settings_items field.to_sym |
| 16 | end | 16 | end |
| @@ -21,7 +21,11 @@ class CreateSoftware < Task | @@ -21,7 +21,11 @@ class CreateSoftware < Task | ||
| 21 | template_id = software_template.id | 21 | template_id = software_template.id |
| 22 | end | 22 | end |
| 23 | 23 | ||
| 24 | + identifier = self.identifier | ||
| 25 | + identifier ||= self.name.to_slug | ||
| 26 | + | ||
| 24 | community = Community.create!(:name => self.name, | 27 | community = Community.create!(:name => self.name, |
| 28 | + :identifier => identifier, | ||
| 25 | :template_id => template_id) | 29 | :template_id => template_id) |
| 26 | 30 | ||
| 27 | community.environment = self.environment | 31 | community.environment = self.environment |
lib/software_info.rb
| @@ -172,6 +172,7 @@ class SoftwareInfo < ActiveRecord::Base | @@ -172,6 +172,7 @@ class SoftwareInfo < ActiveRecord::Base | ||
| 172 | :requestor => requestor, | 172 | :requestor => requestor, |
| 173 | :environment => environment, | 173 | :environment => environment, |
| 174 | :name => name, | 174 | :name => name, |
| 175 | + :identifier => identifier, | ||
| 175 | :license_info => license_info | 176 | :license_info => license_info |
| 176 | ) | 177 | ) |
| 177 | ) | 178 | ) |
test/unit/software_info_validation_test.rb
| @@ -49,6 +49,7 @@ class SoftwareInfoValidationTest < ActiveSupport::TestCase | @@ -49,6 +49,7 @@ class SoftwareInfoValidationTest < ActiveSupport::TestCase | ||
| 49 | 49 | ||
| 50 | @software_info.features = "Do a lot of things" | 50 | @software_info.features = "Do a lot of things" |
| 51 | @software_info.objectives = "All tests should pass !" | 51 | @software_info.objectives = "All tests should pass !" |
| 52 | + @software_info.community = @community | ||
| 52 | end | 53 | end |
| 53 | 54 | ||
| 54 | def teardown | 55 | def teardown |