Commit 7f2ab5e0738cd831dcd1445c087cdaf359174830
1 parent
e67fa4b1
Exists in
colab
and in
2 other branches
Adjust Prezento to the new KalibroClient's API
Update KalibroClient to version v4.0.0.alpha1 Signed-off-by: Daniel Miranda <danielkza2@gmail.com>
Showing
14 changed files
with
22 additions
and
18 deletions
Show diff stats
Gemfile
| @@ -28,7 +28,7 @@ gem 'jbuilder', '~> 2.0' | @@ -28,7 +28,7 @@ gem 'jbuilder', '~> 2.0' | ||
| 28 | gem 'devise', '~> 3.5.1' | 28 | gem 'devise', '~> 3.5.1' |
| 29 | 29 | ||
| 30 | # Kalibro integration | 30 | # Kalibro integration |
| 31 | -gem 'kalibro_client', '~> 3.0.0' | 31 | +gem 'kalibro_client', '~> 4.0.0.alpha1' |
| 32 | 32 | ||
| 33 | # PostgreSQL integration | 33 | # PostgreSQL integration |
| 34 | gem "pg", "~> 0.18.1" | 34 | gem "pg", "~> 0.18.1" |
Gemfile.lock
| @@ -154,9 +154,10 @@ GEM | @@ -154,9 +154,10 @@ GEM | ||
| 154 | railties (>= 3.2) | 154 | railties (>= 3.2) |
| 155 | sprockets-rails | 155 | sprockets-rails |
| 156 | json (1.8.3) | 156 | json (1.8.3) |
| 157 | - kalibro_client (3.0.0) | 157 | + kalibro_client (4.0.0.alpha1) |
| 158 | activesupport (>= 2.2.1) | 158 | activesupport (>= 2.2.1) |
| 159 | - faraday_middleware (~> 0.10.0) | 159 | + faraday_middleware (~> 0.9) |
| 160 | + likeno (~> 1.1) | ||
| 160 | konacha (3.7.0) | 161 | konacha (3.7.0) |
| 161 | actionpack (>= 3.1, < 5) | 162 | actionpack (>= 3.1, < 5) |
| 162 | capybara | 163 | capybara |
| @@ -172,6 +173,9 @@ GEM | @@ -172,6 +173,9 @@ GEM | ||
| 172 | sprockets (> 2, < 4) | 173 | sprockets (> 2, < 4) |
| 173 | tilt | 174 | tilt |
| 174 | libv8 (3.16.14.11) | 175 | libv8 (3.16.14.11) |
| 176 | + likeno (1.1.0) | ||
| 177 | + activesupport (>= 2.2.1) | ||
| 178 | + faraday_middleware | ||
| 175 | loofah (2.0.3) | 179 | loofah (2.0.3) |
| 176 | nokogiri (>= 1.5.9) | 180 | nokogiri (>= 1.5.9) |
| 177 | mail (2.6.3) | 181 | mail (2.6.3) |
| @@ -356,7 +360,7 @@ DEPENDENCIES | @@ -356,7 +360,7 @@ DEPENDENCIES | ||
| 356 | jquery-rails | 360 | jquery-rails |
| 357 | jquery-ui-rails (~> 5.0.0) | 361 | jquery-ui-rails (~> 5.0.0) |
| 358 | js-routes (~> 1.1.0) | 362 | js-routes (~> 1.1.0) |
| 359 | - kalibro_client (~> 3.0.0) | 363 | + kalibro_client (~> 4.0.0.alpha1) |
| 360 | konacha | 364 | konacha |
| 361 | less-rails (~> 2.7.0) | 365 | less-rails (~> 2.7.0) |
| 362 | mocha | 366 | mocha |
| @@ -381,4 +385,4 @@ DEPENDENCIES | @@ -381,4 +385,4 @@ DEPENDENCIES | ||
| 381 | web-console (~> 2.0.0) | 385 | web-console (~> 2.0.0) |
| 382 | 386 | ||
| 383 | BUNDLED WITH | 387 | BUNDLED WITH |
| 384 | - 1.10.6 | 388 | + 1.11.2 |
app/controllers/application_controller.rb
| @@ -11,7 +11,7 @@ class ApplicationController < ActionController::Base | @@ -11,7 +11,7 @@ class ApplicationController < ActionController::Base | ||
| 11 | before_filter :set_locale | 11 | before_filter :set_locale |
| 12 | 12 | ||
| 13 | rescue_from ActiveRecord::RecordNotFound, with: :not_found | 13 | rescue_from ActiveRecord::RecordNotFound, with: :not_found |
| 14 | - rescue_from KalibroClient::Errors::RecordNotFound, with: :not_found | 14 | + rescue_from Likeno::Errors::RecordNotFound, with: :not_found |
| 15 | 15 | ||
| 16 | class << self | 16 | class << self |
| 17 | # This is necessary for correct devise routing with locales: https://github.com/plataformatec/devise/wiki/How-To:--Redirect-with-locale-after-authentication-failure | 17 | # This is necessary for correct devise routing with locales: https://github.com/plataformatec/devise/wiki/How-To:--Redirect-with-locale-after-authentication-failure |
app/controllers/base_metric_configurations_controller.rb
| @@ -110,7 +110,7 @@ class BaseMetricConfigurationsController < ApplicationController | @@ -110,7 +110,7 @@ class BaseMetricConfigurationsController < ApplicationController | ||
| 110 | 110 | ||
| 111 | # Make sure the metric configuration is really from the kalibro configuration we're being told it is | 111 | # Make sure the metric configuration is really from the kalibro configuration we're being told it is |
| 112 | if @metric_configuration.kalibro_configuration_id != @kalibro_configuration.id | 112 | if @metric_configuration.kalibro_configuration_id != @kalibro_configuration.id |
| 113 | - raise KalibroClient::Errors::RecordNotFound | 113 | + raise Likeno::Errors::RecordNotFound |
| 114 | end | 114 | end |
| 115 | end | 115 | end |
| 116 | 116 | ||
| @@ -136,7 +136,7 @@ class BaseMetricConfigurationsController < ApplicationController | @@ -136,7 +136,7 @@ class BaseMetricConfigurationsController < ApplicationController | ||
| 136 | def set_reading_group! | 136 | def set_reading_group! |
| 137 | begin | 137 | begin |
| 138 | @reading_group = ReadingGroup.find(@metric_configuration.reading_group_id) | 138 | @reading_group = ReadingGroup.find(@metric_configuration.reading_group_id) |
| 139 | - rescue KalibroClient::Errors::RecordNotFound | 139 | + rescue Likeno::Errors::RecordNotFound |
| 140 | respond_to do |format| | 140 | respond_to do |format| |
| 141 | failed_action(format, t('invalid_model', model: ReadingGroup.model_name.human)) | 141 | failed_action(format, t('invalid_model', model: ReadingGroup.model_name.human)) |
| 142 | end | 142 | end |
app/models/kalibro_configuration.rb
| @@ -9,7 +9,7 @@ class KalibroConfiguration < KalibroClient::Entities::Configurations::KalibroCon | @@ -9,7 +9,7 @@ class KalibroConfiguration < KalibroClient::Entities::Configurations::KalibroCon | ||
| 9 | kalibro_configuration_attributes.map { |kalibro_configuration_attribute| | 9 | kalibro_configuration_attributes.map { |kalibro_configuration_attribute| |
| 10 | begin | 10 | begin |
| 11 | self.find(kalibro_configuration_attribute.kalibro_configuration_id) | 11 | self.find(kalibro_configuration_attribute.kalibro_configuration_id) |
| 12 | - rescue KalibroClient::Errors::RecordNotFound | 12 | + rescue Likeno::Errors::RecordNotFound |
| 13 | nil | 13 | nil |
| 14 | end | 14 | end |
| 15 | }.compact | 15 | }.compact |
app/models/project.rb
| @@ -10,7 +10,7 @@ class Project < KalibroClient::Entities::Processor::Project | @@ -10,7 +10,7 @@ class Project < KalibroClient::Entities::Processor::Project | ||
| 10 | project_attributes.map do |attribute| | 10 | project_attributes.map do |attribute| |
| 11 | begin | 11 | begin |
| 12 | self.find(attribute.project_id) | 12 | self.find(attribute.project_id) |
| 13 | - rescue KalibroClient::Errors::RecordNotFound | 13 | + rescue Likeno::Errors::RecordNotFound |
| 14 | nil | 14 | nil |
| 15 | end | 15 | end |
| 16 | end.compact | 16 | end.compact |
app/models/reading_group.rb
| @@ -9,7 +9,7 @@ class ReadingGroup < KalibroClient::Entities::Configurations::ReadingGroup | @@ -9,7 +9,7 @@ class ReadingGroup < KalibroClient::Entities::Configurations::ReadingGroup | ||
| 9 | reading_group_attributes.map { |reading_group_attribute| | 9 | reading_group_attributes.map { |reading_group_attribute| |
| 10 | begin | 10 | begin |
| 11 | self.find(reading_group_attribute.reading_group_id) | 11 | self.find(reading_group_attribute.reading_group_id) |
| 12 | - rescue KalibroClient::Errors::RecordNotFound | 12 | + rescue Likeno::Errors::RecordNotFound |
| 13 | nil | 13 | nil |
| 14 | end | 14 | end |
| 15 | }.compact | 15 | }.compact |
db/migrate/20150225170704_create_project_attributes.rb
| @@ -22,7 +22,7 @@ class CreateProjectAttributes < ActiveRecord::Migration | @@ -22,7 +22,7 @@ class CreateProjectAttributes < ActiveRecord::Migration | ||
| 22 | end | 22 | end |
| 23 | 23 | ||
| 24 | ProjectAttributes.create(user_id: project_ownership.user_id, project_id: project_ownership.project_id, image_url: image_url, hidden: hidden) | 24 | ProjectAttributes.create(user_id: project_ownership.user_id, project_id: project_ownership.project_id, image_url: image_url, hidden: hidden) |
| 25 | - rescue KalibroClient::Errors::RecordNotFound | 25 | + rescue Likeno::Errors::RecordNotFound |
| 26 | puts "Could not find project with id #{project_ownership.project_id} owned by user with #{project_ownership.user_id} and image url #{image_url}" | 26 | puts "Could not find project with id #{project_ownership.project_id} owned by user with #{project_ownership.user_id} and image url #{image_url}" |
| 27 | end | 27 | end |
| 28 | end | 28 | end |
spec/controllers/metric_configurations_controller_spec.rb
| @@ -141,7 +141,7 @@ describe MetricConfigurationsController, :type => :controller do | @@ -141,7 +141,7 @@ describe MetricConfigurationsController, :type => :controller do | ||
| 141 | 141 | ||
| 142 | context 'with invalid parameters' do | 142 | context 'with invalid parameters' do |
| 143 | before :each do | 143 | before :each do |
| 144 | - ReadingGroup.expects(:find).with(metric_configuration.reading_group_id).raises(KalibroClient::Errors::RecordNotFound) | 144 | + ReadingGroup.expects(:find).with(metric_configuration.reading_group_id).raises(Likeno::Errors::RecordNotFound) |
| 145 | 145 | ||
| 146 | get :show, kalibro_configuration_id: metric_configuration.kalibro_configuration_id.to_s, id: metric_configuration.id | 146 | get :show, kalibro_configuration_id: metric_configuration.kalibro_configuration_id.to_s, id: metric_configuration.id |
| 147 | end | 147 | end |
spec/controllers/projects_controller_spec.rb
| @@ -75,7 +75,7 @@ describe ProjectsController, :type => :controller do | @@ -75,7 +75,7 @@ describe ProjectsController, :type => :controller do | ||
| 75 | 75 | ||
| 76 | context 'when the project does not exists' do | 76 | context 'when the project does not exists' do |
| 77 | before :each do | 77 | before :each do |
| 78 | - Project.expects(:find).with(project.id).raises(KalibroClient::Errors::RecordNotFound) | 78 | + Project.expects(:find).with(project.id).raises(Likeno::Errors::RecordNotFound) |
| 79 | end | 79 | end |
| 80 | 80 | ||
| 81 | context 'when the request format is known' do | 81 | context 'when the request format is known' do |
spec/controllers/repositories_controller_spec.rb
| @@ -517,7 +517,7 @@ describe RepositoriesController, :type => :controller do | @@ -517,7 +517,7 @@ describe RepositoriesController, :type => :controller do | ||
| 517 | 517 | ||
| 518 | context 'with an invalid repository' do | 518 | context 'with an invalid repository' do |
| 519 | before :each do | 519 | before :each do |
| 520 | - Repository.expects(:find).with(repository.id).raises(KalibroClient::Errors::RecordNotFound) | 520 | + Repository.expects(:find).with(repository.id).raises(Likeno::Errors::RecordNotFound) |
| 521 | post_push | 521 | post_push |
| 522 | end | 522 | end |
| 523 | 523 |
spec/models/kalibro_configuration_spec.rb
| @@ -59,7 +59,7 @@ describe KalibroConfiguration, :type => :model do | @@ -59,7 +59,7 @@ describe KalibroConfiguration, :type => :model do | ||
| 59 | before :each do | 59 | before :each do |
| 60 | # Map the kalibro_configuration attributes to the corresponding Kalibro Configuration | 60 | # Map the kalibro_configuration attributes to the corresponding Kalibro Configuration |
| 61 | kalibro_configurations.each do |kc| | 61 | kalibro_configurations.each do |kc| |
| 62 | - KalibroConfiguration.stubs(:find).with(kc.id).raises(KalibroClient::Errors::RecordNotFound) | 62 | + KalibroConfiguration.stubs(:find).with(kc.id).raises(Likeno::Errors::RecordNotFound) |
| 63 | end | 63 | end |
| 64 | 64 | ||
| 65 | KalibroConfigurationAttributes.expects(:where).with(public: true).returns(public_attrs) | 65 | KalibroConfigurationAttributes.expects(:where).with(public: true).returns(public_attrs) |
spec/models/project_spec.rb
| @@ -139,7 +139,7 @@ describe Project, :type => :model do | @@ -139,7 +139,7 @@ describe Project, :type => :model do | ||
| 139 | context 'when no reading groups exist' do | 139 | context 'when no reading groups exist' do |
| 140 | before :each do | 140 | before :each do |
| 141 | all_projects.each do |project| | 141 | all_projects.each do |project| |
| 142 | - described_class.stubs(:find).with(project.id).raises(KalibroClient::Errors::RecordNotFound) | 142 | + described_class.stubs(:find).with(project.id).raises(Likeno::Errors::RecordNotFound) |
| 143 | end | 143 | end |
| 144 | 144 | ||
| 145 | ProjectAttributes.expects(:where).with(public: true).returns(public_attrs) | 145 | ProjectAttributes.expects(:where).with(public: true).returns(public_attrs) |
spec/models/reading_group_spec.rb
| @@ -123,7 +123,7 @@ describe ReadingGroup, :type => :model do | @@ -123,7 +123,7 @@ describe ReadingGroup, :type => :model do | ||
| 123 | before :each do | 123 | before :each do |
| 124 | # Map the reading group attributes to the corresponding Reading Group | 124 | # Map the reading group attributes to the corresponding Reading Group |
| 125 | all_reading_groups.each do |reading_group| | 125 | all_reading_groups.each do |reading_group| |
| 126 | - ReadingGroup.stubs(:find).with(reading_group.id).raises(KalibroClient::Errors::RecordNotFound) | 126 | + ReadingGroup.stubs(:find).with(reading_group.id).raises(Likeno::Errors::RecordNotFound) |
| 127 | end | 127 | end |
| 128 | 128 | ||
| 129 | ReadingGroupAttributes.expects(:where).with(public: true).returns(public_attrs) | 129 | ReadingGroupAttributes.expects(:where).with(public: true).returns(public_attrs) |