Commit 7b76f7a9e5670dff5a3e5c089946df0c84276a7d
Exists in
colab
and in
4 other branches
Merge pull request #309 from mezuro/update_client
Update kalibro_client
Showing
9 changed files
with
21 additions
and
17 deletions
Show diff stats
.travis.yml
| ... | ... | @@ -9,8 +9,8 @@ before_script: |
| 9 | 9 | - pushd kalibro_install |
| 10 | 10 | # Remove bugged libzmq3 package, see https://github.com/travis-ci/travis-ci/issues/982 and https://github.com/travis-ci/travis-ci/issues/1715 for details |
| 11 | 11 | - sudo apt-get remove libzmq3 |
| 12 | - - export KALIBRO_PROCESSOR_VERSION=v1.1.4 | |
| 13 | - - export KALIBRO_CONFIGURATIONS_VERSION=v1.2.4 | |
| 12 | + - export KALIBRO_PROCESSOR_VERSION=v1.1.7.rc1 | |
| 13 | + - export KALIBRO_CONFIGURATIONS_VERSION=v2.0.0 | |
| 14 | 14 | - bash install.sh |
| 15 | 15 | - popd |
| 16 | 16 | - cp config/database.yml.sample config/database.yml | ... | ... |
Gemfile
Gemfile.lock
| ... | ... | @@ -154,7 +154,7 @@ GEM |
| 154 | 154 | railties (>= 3.2) |
| 155 | 155 | sprockets-rails |
| 156 | 156 | json (1.8.3) |
| 157 | - kalibro_client (2.1.2) | |
| 157 | + kalibro_client (3.0.0) | |
| 158 | 158 | activesupport (>= 2.2.1) |
| 159 | 159 | faraday_middleware (~> 0.10.0) |
| 160 | 160 | konacha (3.7.0) |
| ... | ... | @@ -188,7 +188,7 @@ GEM |
| 188 | 188 | metaclass (0.0.4) |
| 189 | 189 | mime-types (2.6.2) |
| 190 | 190 | mini_portile (0.6.2) |
| 191 | - minitest (5.8.1) | |
| 191 | + minitest (5.8.4) | |
| 192 | 192 | mocha (1.1.0) |
| 193 | 193 | metaclass (~> 0.0.1) |
| 194 | 194 | multi_json (1.11.2) |
| ... | ... | @@ -356,7 +356,7 @@ DEPENDENCIES |
| 356 | 356 | jquery-rails |
| 357 | 357 | jquery-ui-rails (~> 5.0.0) |
| 358 | 358 | js-routes (~> 1.1.0) |
| 359 | - kalibro_client (~> 2.1.2) | |
| 359 | + kalibro_client (~> 3.0.0) | |
| 360 | 360 | konacha |
| 361 | 361 | less-rails (~> 2.7.0) |
| 362 | 362 | mocha | ... | ... |
app/controllers/compound_metric_configurations_controller.rb
| ... | ... | @@ -8,7 +8,7 @@ class CompoundMetricConfigurationsController < BaseMetricConfigurationsControlle |
| 8 | 8 | end |
| 9 | 9 | |
| 10 | 10 | def metric_configuration_params |
| 11 | - params.require(:metric_configuration).permit(:reading_group_id, :weight, :metric => [:name, :description, :script, :scope, :code]) | |
| 11 | + params.require(:metric_configuration).permit(:reading_group_id, :weight, :metric => [:name, :description, :script, :code, :scope => [:type]]) | |
| 12 | 12 | end |
| 13 | 13 | |
| 14 | 14 | def set_metric_configurations | ... | ... |
app/helpers/kalibro_modules_helper.rb
| ... | ... | @@ -17,7 +17,7 @@ module KalibroModulesHelper |
| 17 | 17 | if (a.kalibro_module.granularity == b.kalibro_module.granularity) |
| 18 | 18 | a.kalibro_module.name <=> b.kalibro_module.name |
| 19 | 19 | else |
| 20 | - (ComparableGranularity.new(b.kalibro_module.granularity.to_sym) <=> ComparableGranularity.new(a.kalibro_module.granularity.to_sym)) | |
| 20 | + (ComparableGranularity.new(b.kalibro_module.granularity.type) <=> ComparableGranularity.new(a.kalibro_module.granularity.type)) | |
| 21 | 21 | end |
| 22 | 22 | end |
| 23 | 23 | end | ... | ... |
app/views/compound_metric_configurations/_metric_options.html.erb
| ... | ... | @@ -36,8 +36,10 @@ |
| 36 | 36 | |
| 37 | 37 | <div class="form-row"> |
| 38 | 38 | <div class="field-container"> |
| 39 | - <%= f.label :scope, compound_metric_human_attribute_name('scope'), class: 'control-label' %> | |
| 40 | - <%= f.select( :scope, scope_options, {class: 'form-control', selected: (metric.scope unless metric.nil?)} ) %> | |
| 39 | + <%= f.fields_for :scope do |scope_form| %> | |
| 40 | + <%= scope_form.label :type, compound_metric_human_attribute_name('scope'), class: 'control-label' %> | |
| 41 | + <%= scope_form.select( :type, scope_options, {class: 'form-control', selected: (metric.scope.type unless metric.nil?)} ) %> | |
| 42 | + <% end %> | |
| 41 | 43 | </div> |
| 42 | 44 | <div class="help-container"> |
| 43 | 45 | <p> | ... | ... |
app/views/modules/_module_result.html.erb
| ... | ... | @@ -7,6 +7,6 @@ |
| 7 | 7 | <% end %> |
| 8 | 8 | <%= link_to format_module_name(module_result.kalibro_module.name), "#module_#{module_result.id}", onClick: "Module.Tree.load('#{escape_javascript(image_tag 'loader.gif')} #{escape_javascript(t('loading_data'))}', #{module_result.id});" %> |
| 9 | 9 | </td> |
| 10 | - <td><%= module_result.kalibro_module.granularity["type"] %></td> | |
| 10 | + <td><%= module_result.kalibro_module.granularity %></td> | |
| 11 | 11 | <td><%= format_grade(module_result.grade) %></td> |
| 12 | 12 | </tr> | ... | ... |
app/views/modules/_module_tree.html.erb
| ... | ... | @@ -4,7 +4,7 @@ |
| 4 | 4 | </p> |
| 5 | 5 | <p> |
| 6 | 6 | <strong><%= KalibroModule.human_attribute_name('granularity') %>:</strong> |
| 7 | - <%= @root_module_result.kalibro_module.granularity["type"] %> | |
| 7 | + <%= @root_module_result.kalibro_module.granularity %> | |
| 8 | 8 | </p> |
| 9 | 9 | <p> |
| 10 | 10 | <strong><%= KalibroModule.human_attribute_name('grade') %>:</strong> | ... | ... |
spec/factories/kalibro_modules.rb
| 1 | 1 | FactoryGirl.define do |
| 2 | 2 | factory :kalibro_module, class: KalibroClient::Entities::Processor::KalibroModule do |
| 3 | 3 | name 'Qt-Calculator' |
| 4 | - granularity 'SOFTWARE' | |
| 4 | + granularity { {'type' => 'SOFTWARE'} } | |
| 5 | 5 | |
| 6 | 6 | trait :package do |
| 7 | - granularity 'PACKAGE' | |
| 7 | + granularity { {'type' => 'PACKAGE'} } | |
| 8 | 8 | end |
| 9 | 9 | |
| 10 | 10 | trait :class do |
| 11 | - granularity 'CLASS' | |
| 11 | + granularity { {'type' => 'CLASS'} } | |
| 12 | 12 | end |
| 13 | 13 | |
| 14 | 14 | trait :function do |
| 15 | - granularity 'FUNCTION' | |
| 15 | + granularity { {'type' => 'FUNCTION'} } | |
| 16 | 16 | end |
| 17 | 17 | |
| 18 | 18 | trait :method do |
| 19 | - granularity 'METHOD' | |
| 19 | + granularity { {'type' => 'METHOD'} } | |
| 20 | 20 | end |
| 21 | 21 | |
| 22 | 22 | factory :kalibro_module_package, traits: [:package] |
| 23 | 23 | factory :kalibro_module_class, traits: [:class] |
| 24 | 24 | factory :kalibro_module_function, traits: [:function] |
| 25 | 25 | factory :kalibro_module_method, traits: [:method] |
| 26 | + | |
| 27 | + initialize_with { KalibroClient::Entities::Processor::KalibroModule.new({granularity: granularity, name: name}.stringify_keys) } | |
| 26 | 28 | end |
| 27 | 29 | end | ... | ... |