From 2ba9951b20d44b88337d2597c9b3d62d9e5a7d5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Tue, 25 Sep 2012 15:45:32 +0200 Subject: donloads: show the installer/package release date Yet Another Msygit Fix. Store the installer's release date as a separate field, as it's not always the date that the version was tagged. This allows us to report the correct release date in the /download/win page. Unfortunately the msysgit downloads aren't always uploaded to github on the date that the installer has, so we need to parse it to get the release date. --- .../20120925124736_add_release_date_to_downloads.rb | 17 +++++++++++++++++ db/schema.rb | 3 ++- 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20120925124736_add_release_date_to_downloads.rb (limited to 'db') diff --git a/db/migrate/20120925124736_add_release_date_to_downloads.rb b/db/migrate/20120925124736_add_release_date_to_downloads.rb new file mode 100644 index 00000000..5b3e263e --- /dev/null +++ b/db/migrate/20120925124736_add_release_date_to_downloads.rb @@ -0,0 +1,17 @@ +class AddReleaseDateToDownloads < ActiveRecord::Migration + def change + add_column :downloads, :release_date, :timestamp + + Download.all.each do |d| + time = d.version.committed # best guess + + if d.platform == 'windows' # for Windows, take it from the filename + d.filename =~ /Git-(.*?)-(.*?)(\d{4})(\d{2})(\d{2})\.exe/ + time = Time.utc($3, $4, $5) + end + + d.release_date = time + d.save + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 90294ce3..c9ec3e8f 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20120423150252) do +ActiveRecord::Schema.define(:version => 20120925124736) do create_table "books", :force => true do |t| t.string "code" @@ -64,6 +64,7 @@ ActiveRecord::Schema.define(:version => 20120423150252) do t.integer "version_id" t.datetime "created_at", :null => false t.datetime "updated_at", :null => false + t.datetime "release_date" end create_table "related_items", :force => true do |t| -- cgit v1.2.3