Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/controllers/rubygems_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@ def load_gem
private

def params_linkset
params.require(:linkset).permit(:code, :docs, :wiki, :mail, :bugs)
params.require(:linkset).permit(:code, :docs, :wiki, :mail, :bugs, :changelog)
end
end
2 changes: 1 addition & 1 deletion app/models/linkset.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class Linkset < ActiveRecord::Base
belongs_to :rubygem

LINKS = %w(home wiki docs mail code bugs).freeze
LINKS = %w(home wiki docs mail code bugs changelog).freeze

LINKS.each do |url|
validates_formatting_of url.to_sym,
Expand Down
1 change: 1 addition & 0 deletions app/models/rubygem.rb
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ def payload(version = versions.most_recent, protocol = Gemcutter::PROTOCOL,
'mailing_list_uri' => linkset.try(:mail),
'source_code_uri' => linkset.try(:code),
'bug_tracker_uri' => linkset.try(:bugs),
'changelog_uri' => linkset.try(:changelog),
'dependencies' => {
'development' => version.dependencies.development.to_a,
'runtime' => version.dependencies.runtime.to_a
Expand Down
4 changes: 4 additions & 0 deletions app/views/rubygems/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,9 @@
<%= form.label :bugs, :class => 'form__label' %>
<%= form.text_field :bugs, :class => 'form__input' %>
</div>
<div class="url_field">
<%= form.label :changelog, class: 'form__label' %>
<%= form.text_field :changelog, class: 'form__input' %>
</div>
<%= form.submit t('update'), :data => {:disable_with => t('form_disable_with')}, :class => 'form__submit' %>
<% end %>
2 changes: 1 addition & 1 deletion app/views/rubygems/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@

<% if @latest_version.indexed %>
<% if @rubygem.linkset.present? %>
<%- %i{home code docs wiki mail bugs}.each do |link| %>
<%- %i{home code docs wiki mail bugs changelog}.each do |link| %>
<%= link_to_page t("rubygems.show.links.#{link}"), @rubygem.linkset.public_send(link) %>
<%- end %>
<% end %>
Expand Down
2 changes: 2 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ en:
wiki: Wiki
mail: Mailing List
bugs: Bug Tracker
changelog: Change Log
versions_header: Versions
bundler_header: Gemfile
show_all_versions: "Show all versions (%{count} total)"
Expand Down Expand Up @@ -149,6 +150,7 @@ en:
password: Password
linkset:
bugs: Bug Tracker URL
changelog: Change Log URL
code: Source Code URL
docs: Documentation URL
mail: Mailing List URL
Expand Down
5 changes: 5 additions & 0 deletions db/migrate/20150821091456_add_changelog_to_linksets.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddChangelogToLinksets < ActiveRecord::Migration
def change
add_column :linksets, :changelog, :string
end
end
5 changes: 4 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20150407012331) do
ActiveRecord::Schema.define(version: 20150821091456) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
enable_extension "hstore"
Expand Down Expand Up @@ -71,6 +72,7 @@
t.string "bugs"
t.datetime "created_at"
t.datetime "updated_at"
t.string "changelog"
end

add_index "linksets", ["rubygem_id"], name: "index_linksets_on_rubygem_id", using: :btree
Expand Down Expand Up @@ -185,4 +187,5 @@
t.datetime "updated_at"
t.integer "rubygem_id"
end

end
1 change: 1 addition & 0 deletions test/factories.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
mail 'http://example.com'
code 'http://example.com'
bugs 'http://example.com'
changelog 'http://example.com'
end

factory :ownership do
Expand Down
2 changes: 2 additions & 0 deletions test/unit/rubygem_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,7 @@ class RubygemTest < ActiveSupport::TestCase
assert_equal @rubygem.linkset.mail, hash["mailing_list_uri"]
assert_equal @rubygem.linkset.code, hash["source_code_uri"]
assert_equal @rubygem.linkset.bugs, hash["bug_tracker_uri"]
assert_equal @rubygem.linkset.changelog, hash["changelog_uri"]
end

should "return version documentation url if linkset docs is empty" do
Expand All @@ -454,6 +455,7 @@ class RubygemTest < ActiveSupport::TestCase
assert_equal @rubygem.linkset.mail, doc.at_css("mailing-list-uri").content
assert_equal @rubygem.linkset.code, doc.at_css("source-code-uri").content
assert_equal @rubygem.linkset.bugs, doc.at_css("bug-tracker-uri").content
assert_equal @rubygem.linkset.changelog, doc.at_css("changelog-uri").content
end
end
end
Expand Down