mcfly 0.0.12 → 0.0.13

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MGZiZTcxYTIwYzcwNTJhODM2ZDFlZjc3ZmY3Y2ZjM2UwMGM0MDBiNQ==
4
+ Yzk5MzU3ZDk0ZDQxNzNkNDhkOTJkOTM2MzVlN2I0ODJhNGJmZmI1Mw==
5
5
  data.tar.gz: !binary |-
6
- MTljMDY5ZGM0MzgxYWM0ODkxNGU2MWI0N2NiNDc5YzA5YTA5ODMxNQ==
6
+ MTYwMTFmODFlMWJkZTdiMDc1NjBhODkwNGQyOGFiMzNiODJiYTlkNA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NzZmZTAxOWMyMTNkNDg2ZDU2YzlkNjVhNTk2NWEzY2FjNWMzMjk0NjFlZTMw
10
- ODRjNzU1MjExMDYwZDMwNDAzNzc4NDFmM2ZlNDBiNDc2MmNkNWZmYWI3ZTY3
11
- ZDM5ZWM3ZDJjOGEwMzA0NzM4MjlkMjM5MTY1ODI4ZDQ1ZDc1YWY=
9
+ ZWIyNTFiOTY1OTNlMjYwNzFlOWIxNTM3ZWEzMTkzYzg0NGNmY2FlNzFkZjI3
10
+ MTlmZWZmZGQ3MTcyMmRhOGY0Y2JmMjQ0NWI2MDk3Y2U5NmFjY2VjNjk3ZmEz
11
+ NjRmNmRmMzZhNTRlYWM3YjlmZTRmYjg3MTRiMDk2MWNjYWFiNjI=
12
12
  data.tar.gz: !binary |-
13
- NzliY2I2NmQ5NTAwNDExNjdjNmViM2NjY2FjYTAzNTg0MDQ5ZDA5MWUxYjY2
14
- ODE4NTc1Y2QyN2Y2NmI4YzM4NmVhNjJhODllOTJlOGExMmU3MjU4MWE0NGY5
15
- OTM4YTg1ZDdkNzRiMGEwZWViYzVlNzEyNjdjZTFmMDE3MzY1M2E=
13
+ N2U5YTkwNjUwNjg1YzI1ZmU1MTg4MGE2ZmM1MDExMGFkNTEyNDU2ZGY0MTI2
14
+ MzYxNzc0ZWNjNDg1NzNjYmE3YzhiOTZkYTVkMTEzM2ViMzc3OWVkMTU0M2Rj
15
+ Yjg1MmIxMGZiYTYxMDQzMjM3MjFiN2YyZjc1OTY1YjhjMmIyYmQ=
data/.gitignore CHANGED
@@ -21,3 +21,4 @@ tmp
21
21
  .ruby-version
22
22
  .ruby-gemset
23
23
  spec/dummy/log
24
+ spec/dummy/config/database.yml
data/lib/mcfly.rb CHANGED
@@ -13,8 +13,7 @@ module Mcfly
13
13
  # with models directly.
14
14
  def self.whodunnit=(value)
15
15
  mcfly_store[:whodunnit] = value
16
-
17
- sval = value.try(:id) || -1
16
+ sval = value[:id] rescue -1
18
17
  ActiveRecord::Base.connection.execute("SET mcfly.whodunnit = #{sval};")
19
18
  end
20
19
 
@@ -1,9 +1,17 @@
1
1
  require 'delorean_lang'
2
2
 
3
3
  module Mcfly
4
- module Model
5
- INFINITIES = Set[Float::INFINITY, 'infinity', 'Infinity']
4
+ INFINITIES = Set[Float::INFINITY, 'infinity', 'Infinity']
5
+
6
+ def self.is_infinity(pt)
7
+ Mcfly::INFINITIES.member? pt
8
+ end
6
9
 
10
+ def self.normalize_infinity(pt)
11
+ Mcfly::INFINITIES.member?(pt) ? 'infinity' : pt
12
+ end
13
+
14
+ module Model
7
15
  class AssociationValidator < ActiveModel::Validator
8
16
  VALSET = Set[nil, Float::INFINITY, 'infinity']
9
17
 
@@ -43,8 +51,7 @@ module Mcfly
43
51
  delorean_fn(name, options) do |ts, *args|
44
52
  raise "time cannot be nil" if ts.nil?
45
53
 
46
- # normalize infinity
47
- ts = 'infinity' if Mcfly::Model::INFINITIES.member? ts
54
+ ts = Mcfly.normalize_infinity(ts)
48
55
 
49
56
  self.where("#{table_name}.obsoleted_dt >= ? AND " +
50
57
  "#{table_name}.created_dt < ?", ts, ts).scoping do
@@ -98,7 +105,7 @@ module Mcfly
98
105
  module InstanceMethods
99
106
  def record_validation
100
107
  if self.changed?
101
- self.user_id = Mcfly.whodunnit.try(:id)
108
+ self.user_id = Mcfly.whodunnit[:id] rescue nil
102
109
  self.obsoleted_dt ||= 'infinity'
103
110
  end
104
111
  end
@@ -107,7 +114,7 @@ module Mcfly
107
114
  # checks against registered associations
108
115
  if self.class.class_variable_defined?(:@@associations)
109
116
  self.class.class_variable_get(:@@associations).each do |klass, fk|
110
- self.errors.add :base,
117
+ self.errors.add :base,
111
118
  "#{self.class.name.demodulize} can't be deleted " +
112
119
  "because #{klass.name.demodulize} records exist" if
113
120
  klass.where("obsoleted_dt = ? AND #{fk} = ?",
data/lib/mcfly/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Mcfly
2
- VERSION = "0.0.12"
2
+ VERSION = "0.0.13"
3
3
  end
@@ -60,6 +60,8 @@ module Dummy
60
60
 
61
61
  # Version of your assets, change this if you want to expire all your assets
62
62
  config.assets.version = '1.0'
63
+
64
+ config.i18n.enforce_available_locales = true
63
65
  end
64
66
  end
65
67
 
@@ -1,7 +1,7 @@
1
1
  common: &common
2
2
  adapter: postgresql
3
- username: arman
4
- password: arman
3
+ username: [user]
4
+ password: [password]
5
5
  host: localhost
6
6
 
7
7
  production:
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mcfly
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12
4
+ version: 0.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arman Bostani
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-08 00:00:00.000000000 Z
11
+ date: 2014-03-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -120,7 +120,7 @@ files:
120
120
  - spec/dummy/config.ru
121
121
  - spec/dummy/config/application.rb
122
122
  - spec/dummy/config/boot.rb
123
- - spec/dummy/config/database.yml
123
+ - spec/dummy/config/database.yml.example
124
124
  - spec/dummy/config/environment.rb
125
125
  - spec/dummy/config/environments/development.rb
126
126
  - spec/dummy/config/environments/production.rb