diff --git a/plugins/mezuro/lib/kalibro/repository.rb b/plugins/mezuro/lib/kalibro/repository.rb index d57fbea..053a77c 100644 --- a/plugins/mezuro/lib/kalibro/repository.rb +++ b/plugins/mezuro/lib/kalibro/repository.rb @@ -15,11 +15,11 @@ class Kalibro::Repository < Kalibro::Model end def process_repository - self.class.request(:process_repository, {:repository_id => self.id}); + self.class.request(:process_repository, {:repository_id => self.id}) end def cancel_processing_of_repository - self.class.request(:cancel_processing_of_repository, {:repository_id => self.id}); + self.class.request(:cancel_processing_of_repository, {:repository_id => self.id}) end end diff --git a/plugins/mezuro/lib/mezuro_plugin/project_content.rb b/plugins/mezuro/lib/mezuro_plugin/project_content.rb index da89ed7..f3ce453 100644 --- a/plugins/mezuro/lib/mezuro_plugin/project_content.rb +++ b/plugins/mezuro/lib/mezuro_plugin/project_content.rb @@ -4,7 +4,7 @@ class MezuroPlugin::ProjectContent < Article settings_items :project_id validate_on_create :validate_kalibro_project_name - validate_on_create :validate_repository_url + validate_on_create :validate_repository_address def self.short_description 'Mezuro project' @@ -104,27 +104,23 @@ class MezuroPlugin::ProjectContent < Article value.kind_of?(Hash) ? Kalibro::Repository.new(value) : value end - def validate_repository_url - if(@repositories.nil? || repository_url == "") - errors.add_to_base("Repository URL is mandatory") + def validate_repository_address + if(address.nil? || address == "") + errors.add_to_base("Repository Address is mandatory") end end def send_project_to_service created_project = create_kalibro_project - created_project.process_project(periodicity_in_days) + repositories = Kalibro::Repository.repositories_of(project_id) + repositories.each {|repository| repository.process_repository } end def create_kalibro_project Kalibro::Project.create( + :id => project_id, :name => name, - :license => project_license, - :description => description, - :repository => { - :type => repository_type, - :address => repository_url - }, - :configuration_name => configuration_name + :description => description ) end diff --git a/plugins/mezuro/test/unit/mezuro_plugin/project_content_test.rb b/plugins/mezuro/test/unit/mezuro_plugin/project_content_test.rb index a2f05a0..914d139 100644 --- a/plugins/mezuro/test/unit/mezuro_plugin/project_content_test.rb +++ b/plugins/mezuro/test/unit/mezuro_plugin/project_content_test.rb @@ -106,26 +106,4 @@ class ProjectContentTest < ActiveSupport::TestCase assert_not_nil @project_content.errors[:base] end -=begin - should 'send project to service after saving' do - @project_content.expects :send_project_to_service - @project_content.run_callbacks :after_save - end - - should 'destroy project from service' do - Kalibro::Project.expects(:request).with("Project", :get_project, :project_name => @project.name).returns({:project => @project.to_hash}) - Kalibro::Project.expects(:request).with("Project", :remove_project, {:project_name => @project.name}) - @project_content.send :destroy_project_from_service - end - - should 'send correct project to service' do - hash = ProjectFixtures.project_hash - hash.delete(:attributes!) - hash.delete(:state) - Kalibro::Project.expects(:create).with(hash).returns(@project) - @project.expects(:process_project).with(@project_content.periodicity_in_days) - @project_content.send :send_project_to_service - end - -=end end -- libgit2 0.21.2