kiss 1.8.6 → 1.8.7

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.8.6
1
+ 1.8.7
data/bin/kiss CHANGED
@@ -32,6 +32,8 @@ def main
32
32
  case db_command
33
33
  when 'create'
34
34
  create_db
35
+ when 'schema'
36
+ print_db_schema(ARGV.shift)
35
37
  else
36
38
  open_db_prompt
37
39
  end
@@ -132,6 +134,18 @@ def open_db_prompt
132
134
  Kernel.exec('mysql', '-u', database_config.user, "-p#{database_config.password}", database_config.database)
133
135
  end
134
136
 
137
+ def print_db_schema(table = nil)
138
+ app = load_kiss_project
139
+ database_config = app.config.database
140
+ if database_config.adapter != 'mysql'
141
+ puts 'The Kiss command-line tool supports only MySQL databases.'
142
+ end
143
+
144
+ parts = ['mysqldump', '-u', database_config.user, "-p#{database_config.password}", database_config.database]
145
+ parts << table if table
146
+ Kernel.exec(*parts)
147
+ end
148
+
135
149
  def load_kiss_project
136
150
  Kiss.load
137
151
  end
data/data/scaffold.tgz CHANGED
Binary file
data/lib/kiss/ext/core.rb CHANGED
@@ -319,23 +319,37 @@ end
319
319
 
320
320
  # Enables FixNum conversion to time duration values (in seconds).
321
321
  class Fixnum
322
+ # Not exact
323
+ def years
324
+ self * 365.days
325
+ end
326
+
327
+ # Not exact
328
+ def months
329
+ self * 30.days
330
+ end
331
+
322
332
  # 2.weeks = 14.days
323
333
  def weeks
324
334
  self * 7.days
325
335
  end
336
+
326
337
  # 1.days = 24.hours
327
338
  def days
328
339
  self * 24.hours
329
340
  end
341
+
330
342
  # 1.hours = 60.minutes = 3600 (seconds)
331
343
  def hours
332
344
  self * 60.minutes
333
345
  end
346
+
334
347
  # 1.minutes = 60 (seconds)
335
348
  # 5.minutes = 300 (seconds)
336
349
  def minutes
337
350
  self * 60
338
351
  end
352
+
339
353
  # 5.minutes.ago = Time.now - 300
340
354
  def ago
341
355
  Time.now - self
data/lib/kiss/request.rb CHANGED
@@ -273,7 +273,11 @@ EOT
273
273
  :path => @_config[:cookie_path] || @_app_uri,
274
274
  :domain => @_config[:cookie_domain] || @_request.host
275
275
  }
276
- cookie_vars[:expires] = Time.now + @_config[:cookie_lifespan] if @_config[:cookie_lifespan]
276
+ cookie_lifespan = @_config[:cookie_lifespan]
277
+ if cookie_lifespan
278
+ cookie_lifespan = eval(cookie_lifespan) if cookie_lifespan.is_a?(String)
279
+ cookie_vars[:expires] = Time.now + cookie_lifespan
280
+ end
277
281
 
278
282
  # set_cookie here or at render time
279
283
  @_response.set_cookie @_controller.cookie_name, cookie_vars
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 8
8
- - 6
9
- version: 1.8.6
8
+ - 7
9
+ version: 1.8.7
10
10
  platform: ruby
11
11
  authors:
12
12
  - Shawn Van Ittersum
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2012-03-09 00:00:00 -08:00
17
+ date: 2012-03-18 00:00:00 -07:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency