Commit 8fb02967117f30e446fd7041a694d8d018223ab6
1 parent
1eeb5ddb
Exists in
master
and in
9 other branches
Fix sisp task
Signed-off-by: Daniela Feitosa <danielafeitosa@colivre.coop.br> Signed-off-by: Gabriel Silva <gabriel93.silva@gmail.com> Signed-off-by: Gustavo Coelho <gust.rod.coelho@gmail.com> Signed-off-by: Tallys Martins <tallysmartins@yahoo.com.br>
Showing
1 changed file
with
6 additions
and
6 deletions
Show diff stats
src/noosfero-spb/software_communities/lib/tasks/import_sisp_software.rake
... | ... | @@ -94,7 +94,7 @@ namespace :sisp do |
94 | 94 | |
95 | 95 | $created_software={} |
96 | 96 | |
97 | - $sisp_template = Community.find_by_identifier("sisp") | |
97 | + $sisp_template = $env.communities.find_by_identifier("sisp") | |
98 | 98 | |
99 | 99 | print 'Creating SISP Softwares: ' |
100 | 100 | $imported_data.keys.each do |key| |
... | ... | @@ -135,7 +135,7 @@ def create_sisp_community name |
135 | 135 | name = name + " copy#{$created_software[identifier]}" if ($created_software[identifier] != 0) |
136 | 136 | identifier = (identifier + "-copy#{$created_software[identifier]}") if ($created_software[identifier] != 0) |
137 | 137 | |
138 | - community = Community.find_or_initialize_by_name(name) | |
138 | + community = $env.communities.find_or_initialize_by_name(name) | |
139 | 139 | |
140 | 140 | community.identifier = identifier |
141 | 141 | community.template = $sisp_template |
... | ... | @@ -161,7 +161,7 @@ def create_sisp_software_info name, finality = "blank", acronym = "" |
161 | 161 | end |
162 | 162 | |
163 | 163 | def set_software_category software, category_name |
164 | - category = Category.find_by_name(category_name) | |
164 | + category = $env.categories.find_by_name(category_name) | |
165 | 165 | category ||= Category.create(:name => category_name, :parent => $software_category, :environment => $env) |
166 | 166 | software.community.categories << category unless software.community.categories.include?(category) |
167 | 167 | end |
... | ... | @@ -189,7 +189,7 @@ def create_identifier name |
189 | 189 | end |
190 | 190 | |
191 | 191 | def create_sisp_user #TODO change user info |
192 | - user = User.find_by_login('sisp') | |
192 | + user = $env.users.find_by_login('sisp-admin') | |
193 | 193 | user ||= User.new(:login => 'sisp-admin', :email => 'sisp_user@changeme.com', :password => 'sisp1234', :password_confirmation => 'sisp1234', :environment => $env) |
194 | 194 | user.save! |
195 | 195 | user.activate if !user.activated? |
... | ... | @@ -204,7 +204,7 @@ def create_institution sisp_hash |
204 | 204 | return nil |
205 | 205 | end |
206 | 206 | |
207 | - institution_community = Community.find_or_initialize_by_identifier(name.to_slug) | |
207 | + institution_community = $env.communities.find_or_initialize_by_identifier(name.to_slug) | |
208 | 208 | |
209 | 209 | #puts institution_community.inspect |
210 | 210 | institution = PublicInstitution.find_or_initialize_by_name(name) |
... | ... | @@ -230,7 +230,7 @@ def create_institution sisp_hash |
230 | 230 | end |
231 | 231 | |
232 | 232 | def create_ratings community_identifier, sisp_hash |
233 | - software_community = Community.find_by_identifier(community_identifier) | |
233 | + software_community = $env.communities.find_by_identifier(community_identifier) | |
234 | 234 | |
235 | 235 | institution = create_institution(sisp_hash) |
236 | 236 | if institution.nil? | ... | ... |