Skip to content

Commit

Permalink
Merge pull request #443 from SUSE/remove-beta-from-friendly_name
Browse files Browse the repository at this point in the history
Migration target display with RMT contains release stage
  • Loading branch information
s-leon authored Jul 24, 2019
2 parents bb75ba2 + 0f3837d commit 9ec6a0b
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 5 deletions.
4 changes: 4 additions & 0 deletions app/models/product.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ def product_string
[identifier, version, arch].join('/')
end

def friendly_name
[name, friendly_version, release_type, (arch if arch != 'unknown')].compact.join(' ')
end

def change_repositories_mirroring!(conditions, mirroring_enabled)
repos = repositories.where(conditions)
repo_names = repos.pluck(:name)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class RemoveFriendlyNameFromProducts < ActiveRecord::Migration[5.1]
def change
remove_column :products, :friendly_name, :string
end
end
3 changes: 1 addition & 2 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20190320120959) do
ActiveRecord::Schema.define(version: 20190717114051) do

create_table "activations", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
t.bigint "service_id", null: false
Expand Down Expand Up @@ -56,7 +56,6 @@
create_table "products", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
t.string "name"
t.text "description"
t.string "friendly_name"
t.string "shortname"
t.string "former_identifier"
t.string "product_type"
Expand Down
2 changes: 1 addition & 1 deletion lib/rmt.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module RMT
VERSION ||= '2.3.2'.freeze
VERSION ||= '2.3.3'.freeze

DEFAULT_USER = '_rmt'.freeze
DEFAULT_GROUP = 'nginx'.freeze
Expand Down
8 changes: 8 additions & 0 deletions package/obs/rmt-server.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
-------------------------------------------------------------------
Wed Jul 24 08:19:18 UTC 2019 - Leon Schroeder <[email protected]>

- Version 2.3.3
- Removed release stage from names to be consistent with SCC (bsc#1136168)
* Generate friendly_name as needed
* Drops friendly_name column from database

-------------------------------------------------------------------
Thu Jul 18 08:13:11 UTC 2019 - Ivan Kapelyukhin <[email protected]>

Expand Down
2 changes: 1 addition & 1 deletion package/obs/rmt-server.spec
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
%define ruby_version %{rb_default_ruby_suffix}

Name: rmt-server
Version: 2.3.2
Version: 2.3.3
Release: 0
Summary: Repository mirroring tool and registration proxy for SCC
License: GPL-2.0-or-later
Expand Down
1 change: 0 additions & 1 deletion spec/factories/products.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
sequence(:identifier) { |n| "product-#{n}" }
sequence(:cpe) { |n| "cpe:/o:product:#{n}" }
sequence(:shortname) { |n| "Product #{n}" }
sequence(:friendly_name) { |n| "Product #{n}" }
sequence(:product_class) { |n| n.to_s.ljust(5, 'A') }
free false
product_type :base
Expand Down
11 changes: 11 additions & 0 deletions spec/models/product_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,17 @@
end
end

describe '#friendly_name' do
subject { create(:product, product_attrs).friendly_name }

let(:product_attrs) { { name: 'Dummy Product', friendly_version: '99', release_type: 'Bar', arch: 'x86_64', release_stage: 'bazinga!' } }

it {
is_expected.to eq 'Dummy Product 99 Bar x86_64'
is_expected.not_to include 'bazinga!'
}
end

describe '.modules_for_migration' do
subject { described_class.modules_for_migration([root_product]) }

Expand Down
9 changes: 9 additions & 0 deletions spec/serializers/v3/product_serializer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@
end
end

describe '#friendly_name' do
subject { described_class.new(product).as_json[:friendly_name] }

let(:release_stage) { 'foo' }
let(:product) { create :product, release_stage: release_stage }

it { is_expected.not_to include(release_stage) }
end

describe 'SLES extension tree' do
subject(:serializer) { described_class.new(sles15, root_product: sles15, base_url: base_url) }

Expand Down

0 comments on commit 9ec6a0b

Please sign in to comment.