vmail 2.3.0 → 2.3.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -15,6 +15,17 @@ module Vmail
15
15
  exit
16
16
  end
17
17
 
18
+ # check database version
19
+ print "Checking vmail.db version... "
20
+ db = Sequel.connect 'sqlite://vmail.db'
21
+ if (r = db[:version].first) && r[:vmail_version] != Vmail::VERSION
22
+ print "Vmail database version is outdated. Recreating.\n"
23
+ `rm vmail.db`
24
+ `sqlite3 vmail.db < #{CREATE_TABLE_SCRIPT}`
25
+ else
26
+ print "OK\n"
27
+ end
28
+
18
29
  vim = ENV['VMAIL_VIM'] || 'vim'
19
30
  ENV['VMAIL_BROWSER'] ||= if RUBY_PLATFORM.downcase.include?('linux')
20
31
  tools = ['gnome-open', 'kfmclient-exec', 'konqueror']
@@ -1,8 +1,9 @@
1
1
  require 'sequel'
2
2
 
3
+ CREATE_TABLE_SCRIPT = File.expand_path("../../../db/create.sql", __FILE__)
4
+
3
5
  if !File.size?('vmail.db')
4
- create_table_script = File.expand_path("../../../db/create.sql", __FILE__)
5
- puts `sqlite3 vmail.db < #{create_table_script}`
6
+ puts `sqlite3 vmail.db < #{CREATE_TABLE_SCRIPT}`
6
7
  end
7
8
 
8
9
  DB = Sequel.connect 'sqlite://vmail.db'
@@ -11,6 +12,19 @@ if DB[:version].count == 0
11
12
  DB[:version].insert(:vmail_version => Vmail::VERSION)
12
13
  end
13
14
 
15
+ module Vmail
16
+ class Message < Sequel::Model(:messages)
17
+ set_primary_key :message_id
18
+ one_to_many :labelings
19
+ many_to_many :labels, :join_table => 'labelings'
20
+ end
21
+ end
22
+
23
+ if DB[:version].count == 0
24
+ DB[:version].insert(:vmail_version => Vmail::VERSION)
25
+ end
26
+
27
+
14
28
  module Vmail
15
29
  class Message < Sequel::Model(:messages)
16
30
  set_primary_key :message_id
@@ -1,3 +1,3 @@
1
1
  module Vmail
2
- VERSION = '2.3.0'
2
+ VERSION = '2.3.2'
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: vmail
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 2.3.0
5
+ version: 2.3.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Daniel Choi
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-08-08 00:00:00 -04:00
13
+ date: 2011-08-10 00:00:00 -04:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency