diff options
author | Carlos Martín Nieto <cmn@dwim.me> | 2012-09-25 17:45:32 +0400 |
---|---|---|
committer | Carlos Martín Nieto <cmn@dwim.me> | 2012-09-25 18:38:30 +0400 |
commit | 2ba9951b20d44b88337d2597c9b3d62d9e5a7d5f (patch) | |
tree | e4828c6449c31c1bc05d56d47c5c7af966298026 /db | |
parent | 1f3b660c82858a6f74d458f1e2bd8a196e15faf4 (diff) |
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.
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20120925124736_add_release_date_to_downloads.rb | 17 | ||||
-rw-r--r-- | db/schema.rb | 3 |
2 files changed, 19 insertions, 1 deletions
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| |