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
Gemfile.lock
... | ... | @@ -154,9 +154,10 @@ GEM |
154 | 154 | railties (>= 3.2) |
155 | 155 | sprockets-rails |
156 | 156 | json (1.8.3) |
157 | - kalibro_client (3.0.0) | |
157 | + kalibro_client (4.0.0.alpha1) | |
158 | 158 | activesupport (>= 2.2.1) |
159 | - faraday_middleware (~> 0.10.0) | |
159 | + faraday_middleware (~> 0.9) | |
160 | + likeno (~> 1.1) | |
160 | 161 | konacha (3.7.0) |
161 | 162 | actionpack (>= 3.1, < 5) |
162 | 163 | capybara |
... | ... | @@ -172,6 +173,9 @@ GEM |
172 | 173 | sprockets (> 2, < 4) |
173 | 174 | tilt |
174 | 175 | libv8 (3.16.14.11) |
176 | + likeno (1.1.0) | |
177 | + activesupport (>= 2.2.1) | |
178 | + faraday_middleware | |
175 | 179 | loofah (2.0.3) |
176 | 180 | nokogiri (>= 1.5.9) |
177 | 181 | mail (2.6.3) |
... | ... | @@ -356,7 +360,7 @@ DEPENDENCIES |
356 | 360 | jquery-rails |
357 | 361 | jquery-ui-rails (~> 5.0.0) |
358 | 362 | js-routes (~> 1.1.0) |
359 | - kalibro_client (~> 3.0.0) | |
363 | + kalibro_client (~> 4.0.0.alpha1) | |
360 | 364 | konacha |
361 | 365 | less-rails (~> 2.7.0) |
362 | 366 | mocha |
... | ... | @@ -381,4 +385,4 @@ DEPENDENCIES |
381 | 385 | web-console (~> 2.0.0) |
382 | 386 | |
383 | 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 | 11 | before_filter :set_locale |
12 | 12 | |
13 | 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 | 16 | class << self |
17 | 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 | 110 | |
111 | 111 | # Make sure the metric configuration is really from the kalibro configuration we're being told it is |
112 | 112 | if @metric_configuration.kalibro_configuration_id != @kalibro_configuration.id |
113 | - raise KalibroClient::Errors::RecordNotFound | |
113 | + raise Likeno::Errors::RecordNotFound | |
114 | 114 | end |
115 | 115 | end |
116 | 116 | |
... | ... | @@ -136,7 +136,7 @@ class BaseMetricConfigurationsController < ApplicationController |
136 | 136 | def set_reading_group! |
137 | 137 | begin |
138 | 138 | @reading_group = ReadingGroup.find(@metric_configuration.reading_group_id) |
139 | - rescue KalibroClient::Errors::RecordNotFound | |
139 | + rescue Likeno::Errors::RecordNotFound | |
140 | 140 | respond_to do |format| |
141 | 141 | failed_action(format, t('invalid_model', model: ReadingGroup.model_name.human)) |
142 | 142 | end | ... | ... |
app/models/kalibro_configuration.rb
... | ... | @@ -9,7 +9,7 @@ class KalibroConfiguration < KalibroClient::Entities::Configurations::KalibroCon |
9 | 9 | kalibro_configuration_attributes.map { |kalibro_configuration_attribute| |
10 | 10 | begin |
11 | 11 | self.find(kalibro_configuration_attribute.kalibro_configuration_id) |
12 | - rescue KalibroClient::Errors::RecordNotFound | |
12 | + rescue Likeno::Errors::RecordNotFound | |
13 | 13 | nil |
14 | 14 | end |
15 | 15 | }.compact | ... | ... |
app/models/project.rb
... | ... | @@ -10,7 +10,7 @@ class Project < KalibroClient::Entities::Processor::Project |
10 | 10 | project_attributes.map do |attribute| |
11 | 11 | begin |
12 | 12 | self.find(attribute.project_id) |
13 | - rescue KalibroClient::Errors::RecordNotFound | |
13 | + rescue Likeno::Errors::RecordNotFound | |
14 | 14 | nil |
15 | 15 | end |
16 | 16 | end.compact | ... | ... |
app/models/reading_group.rb
... | ... | @@ -9,7 +9,7 @@ class ReadingGroup < KalibroClient::Entities::Configurations::ReadingGroup |
9 | 9 | reading_group_attributes.map { |reading_group_attribute| |
10 | 10 | begin |
11 | 11 | self.find(reading_group_attribute.reading_group_id) |
12 | - rescue KalibroClient::Errors::RecordNotFound | |
12 | + rescue Likeno::Errors::RecordNotFound | |
13 | 13 | nil |
14 | 14 | end |
15 | 15 | }.compact | ... | ... |
db/migrate/20150225170704_create_project_attributes.rb
... | ... | @@ -22,7 +22,7 @@ class CreateProjectAttributes < ActiveRecord::Migration |
22 | 22 | end |
23 | 23 | |
24 | 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 | 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 | 27 | end |
28 | 28 | end | ... | ... |
spec/controllers/metric_configurations_controller_spec.rb
... | ... | @@ -141,7 +141,7 @@ describe MetricConfigurationsController, :type => :controller do |
141 | 141 | |
142 | 142 | context 'with invalid parameters' do |
143 | 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 | 146 | get :show, kalibro_configuration_id: metric_configuration.kalibro_configuration_id.to_s, id: metric_configuration.id |
147 | 147 | end | ... | ... |
spec/controllers/projects_controller_spec.rb
... | ... | @@ -75,7 +75,7 @@ describe ProjectsController, :type => :controller do |
75 | 75 | |
76 | 76 | context 'when the project does not exists' do |
77 | 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 | 79 | end |
80 | 80 | |
81 | 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 | 517 | |
518 | 518 | context 'with an invalid repository' do |
519 | 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 | 521 | post_push |
522 | 522 | end |
523 | 523 | ... | ... |
spec/models/kalibro_configuration_spec.rb
... | ... | @@ -59,7 +59,7 @@ describe KalibroConfiguration, :type => :model do |
59 | 59 | before :each do |
60 | 60 | # Map the kalibro_configuration attributes to the corresponding Kalibro Configuration |
61 | 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 | 63 | end |
64 | 64 | |
65 | 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 | 139 | context 'when no reading groups exist' do |
140 | 140 | before :each do |
141 | 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 | 143 | end |
144 | 144 | |
145 | 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 | 123 | before :each do |
124 | 124 | # Map the reading group attributes to the corresponding Reading Group |
125 | 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 | 127 | end |
128 | 128 | |
129 | 129 | ReadingGroupAttributes.expects(:where).with(public: true).returns(public_attrs) | ... | ... |