mcfly 0.0.17 → 0.0.18

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 13301c6e573ced175e281c52098e98647a6abfec
4
- data.tar.gz: af09fa9778b5213f0b2f55250efd5c24ec466733
3
+ metadata.gz: 325926858c6b7470e2e8ec190e1687acf2333176
4
+ data.tar.gz: 4954ea54da5a03cd7f792293dd7ce92391ebb07b
5
5
  SHA512:
6
- metadata.gz: 7584d45565e2945d44456c3b15410ad37ac52f210a0a3ebb6e7841364dc70ec6bc64fb3cc32624b09f2f11f9cc17acf8225ce1d8f038c6c4c635c440e769e61b
7
- data.tar.gz: 0301b2a811b417cf785f3d79f3ed52042f52bc22d3082c90d090d353cd19eab2f8d6f5241bf0ef22ba1edc7e87303187b492b7b376d88ea8c447d1f9125b4bf9
6
+ metadata.gz: 2876c9d82c53ce066e856dedd0f4d0d927ba9bd26ba85ebda2dcf03a9d1e75c3662f7581fd4e39c41864a27c8d8e2e04cfc711c2939b1f27c5570b0a7470aeec
7
+ data.tar.gz: 83af740784adc21713e895e61ac6de18192364b570455db37817785a8dfbb96121702bb1a39f0cb3116ab352cf962299896f308507e2ebddf54b429272464e28
@@ -8,64 +8,72 @@ PATH
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- actionpack (3.2.19)
12
- activemodel (= 3.2.19)
13
- activesupport (= 3.2.19)
14
- builder (~> 3.0.0)
11
+ actionpack (4.2.4)
12
+ actionview (= 4.2.4)
13
+ activesupport (= 4.2.4)
14
+ rack (~> 1.6)
15
+ rack-test (~> 0.6.2)
16
+ rails-dom-testing (~> 1.0, >= 1.0.5)
17
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
18
+ actionview (4.2.4)
19
+ activesupport (= 4.2.4)
20
+ builder (~> 3.1)
15
21
  erubis (~> 2.7.0)
16
- journey (~> 1.0.4)
17
- rack (~> 1.4.5)
18
- rack-cache (~> 1.2)
19
- rack-test (~> 0.6.1)
20
- sprockets (~> 2.2.1)
21
- activemodel (3.2.19)
22
- activesupport (= 3.2.19)
23
- builder (~> 3.0.0)
24
- activerecord (3.2.19)
25
- activemodel (= 3.2.19)
26
- activesupport (= 3.2.19)
27
- arel (~> 3.0.2)
28
- tzinfo (~> 0.3.29)
29
- activesupport (3.2.19)
30
- i18n (~> 0.6, >= 0.6.4)
31
- multi_json (~> 1.0)
32
- arel (3.0.3)
33
- builder (3.0.4)
34
- delorean_lang (0.3.17)
22
+ rails-dom-testing (~> 1.0, >= 1.0.5)
23
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
24
+ activemodel (4.2.4)
25
+ activesupport (= 4.2.4)
26
+ builder (~> 3.1)
27
+ activerecord (4.2.4)
28
+ activemodel (= 4.2.4)
29
+ activesupport (= 4.2.4)
30
+ arel (~> 6.0)
31
+ activesupport (4.2.4)
32
+ i18n (~> 0.7)
33
+ json (~> 1.7, >= 1.7.7)
34
+ minitest (~> 5.1)
35
+ thread_safe (~> 0.3, >= 0.3.4)
36
+ tzinfo (~> 1.1)
37
+ arel (6.0.3)
38
+ builder (3.2.2)
39
+ delorean_lang (0.3.21)
35
40
  activerecord (>= 3.2)
36
41
  treetop (~> 1.5)
37
42
  diff-lcs (1.2.5)
38
43
  erubis (2.7.0)
39
- hike (1.2.3)
40
- i18n (0.6.11)
41
- journey (1.0.4)
42
- json (1.8.1)
43
- multi_json (1.10.1)
44
- pg (0.18.1)
44
+ i18n (0.7.0)
45
+ json (1.8.3)
46
+ loofah (2.0.3)
47
+ nokogiri (>= 1.5.9)
48
+ mini_portile (0.6.2)
49
+ minitest (5.8.1)
50
+ nokogiri (1.6.6.2)
51
+ mini_portile (~> 0.6.0)
52
+ pg (0.18.3)
45
53
  polyglot (0.3.5)
46
- rack (1.4.5)
47
- rack-cache (1.2)
48
- rack (>= 0.4)
49
- rack-ssl (1.3.4)
50
- rack
51
- rack-test (0.6.2)
54
+ rack (1.6.4)
55
+ rack-test (0.6.3)
52
56
  rack (>= 1.0)
53
- railties (3.2.19)
54
- actionpack (= 3.2.19)
55
- activesupport (= 3.2.19)
56
- rack-ssl (~> 1.3.2)
57
+ rails-deprecated_sanitizer (1.0.3)
58
+ activesupport (>= 4.2.0.alpha)
59
+ rails-dom-testing (1.0.7)
60
+ activesupport (>= 4.2.0.beta, < 5.0)
61
+ nokogiri (~> 1.6.0)
62
+ rails-deprecated_sanitizer (>= 1.0.1)
63
+ rails-html-sanitizer (1.0.2)
64
+ loofah (~> 2.0)
65
+ railties (4.2.4)
66
+ actionpack (= 4.2.4)
67
+ activesupport (= 4.2.4)
57
68
  rake (>= 0.8.7)
58
- rdoc (~> 3.4)
59
- thor (>= 0.14.6, < 2.0)
60
- rake (10.3.2)
61
- rdoc (3.12.2)
62
- json (~> 1.4)
63
- rspec-collection_matchers (1.0.0)
69
+ thor (>= 0.18.1, < 2.0)
70
+ rake (10.4.2)
71
+ rspec-collection_matchers (1.1.2)
64
72
  rspec-expectations (>= 2.99.0.beta1)
65
73
  rspec-core (2.99.2)
66
74
  rspec-expectations (2.99.2)
67
75
  diff-lcs (>= 1.1.3, < 2.0)
68
- rspec-mocks (2.99.2)
76
+ rspec-mocks (2.99.4)
69
77
  rspec-rails (2.99.0)
70
78
  actionpack (>= 3.0)
71
79
  activemodel (>= 3.0)
@@ -75,16 +83,12 @@ GEM
75
83
  rspec-core (~> 2.99.0)
76
84
  rspec-expectations (~> 2.99.0)
77
85
  rspec-mocks (~> 2.99.0)
78
- sprockets (2.2.2)
79
- hike (~> 1.2)
80
- multi_json (~> 1.0)
81
- rack (~> 1.0)
82
- tilt (~> 1.1, != 1.3.0)
83
86
  thor (0.19.1)
84
- tilt (1.4.1)
85
- treetop (1.6.2)
87
+ thread_safe (0.3.5)
88
+ treetop (1.6.3)
86
89
  polyglot (~> 0.3)
87
- tzinfo (0.3.43)
90
+ tzinfo (1.2.2)
91
+ thread_safe (~> 0.1)
88
92
 
89
93
  PLATFORMS
90
94
  ruby
@@ -92,3 +96,6 @@ PLATFORMS
92
96
  DEPENDENCIES
93
97
  mcfly!
94
98
  rspec-rails (~> 2.99)
99
+
100
+ BUNDLED WITH
101
+ 1.10.6
data/README.md CHANGED
@@ -66,7 +66,6 @@ functionality to the class.
66
66
  class SecurityInstrument < ActiveRecord::Base
67
67
  has_mcfly append_only: true
68
68
 
69
- attr_accessible :name, :settlement_class
70
69
  validates_presence_of :name, :settlement_class
71
70
  mcfly_validates_uniqueness_of :name
72
71
 
@@ -1,4 +1,4 @@
1
- CREATE OR REPLACE FUNCTION "%{table}_delete" ()
1
+ CREATE OR REPLACE FUNCTION "tr_delete" ()
2
2
  RETURNS TRIGGER
3
3
  AS $$
4
4
 
@@ -15,8 +15,9 @@ BEGIN
15
15
 
16
16
  now = now();
17
17
 
18
- UPDATE "%{table}"
19
- SET obsoleted_dt = now, o_user_id = whodunnit WHERE id = OLD.id;
18
+ EXECUTE 'UPDATE ' || TG_RELID::regclass ||
19
+ ' SET obsoleted_dt = $1, o_user_id = $2 where id = $3.id'
20
+ USING now, whodunnit, OLD;
20
21
 
21
22
  RETURN NULL; -- the row is not actually deleted
22
23
  END;
@@ -24,4 +25,4 @@ $$ LANGUAGE plpgsql;
24
25
 
25
26
  DROP TRIGGER IF EXISTS %{table}_delete ON %{table};
26
27
  CREATE TRIGGER "%{table}_delete" BEFORE DELETE ON "%{table}" FOR EACH ROW
27
- EXECUTE PROCEDURE "%{table}_delete"();
28
+ EXECUTE PROCEDURE "tr_delete"();
@@ -1,4 +1,4 @@
1
- CREATE OR REPLACE FUNCTION "%{table}_insert" ()
1
+ CREATE OR REPLACE FUNCTION "tr_insert" ()
2
2
  RETURNS TRIGGER
3
3
  AS $$
4
4
  BEGIN
@@ -24,4 +24,4 @@ $$ LANGUAGE plpgsql;
24
24
 
25
25
  DROP TRIGGER IF EXISTS %{table}_insert ON %{table};
26
26
  CREATE TRIGGER "%{table}_insert" BEFORE INSERT ON "%{table}" FOR EACH ROW
27
- EXECUTE PROCEDURE "%{table}_insert"();
27
+ EXECUTE PROCEDURE "tr_insert"();
@@ -1,4 +1,4 @@
1
- CREATE OR REPLACE FUNCTION "%{table}_update" ()
1
+ CREATE OR REPLACE FUNCTION "tr_update_append_only" ()
2
2
  RETURNS TRIGGER
3
3
  AS $$
4
4
  DECLARE
@@ -23,4 +23,4 @@ $$ LANGUAGE plpgsql;
23
23
 
24
24
  DROP TRIGGER IF EXISTS %{table}_update ON %{table};
25
25
  CREATE TRIGGER "%{table}_update" BEFORE UPDATE ON "%{table}" FOR EACH ROW
26
- EXECUTE PROCEDURE "%{table}_update"();
26
+ EXECUTE PROCEDURE "tr_update_append_only"();
@@ -1,8 +1,7 @@
1
- CREATE OR REPLACE FUNCTION "%{table}_update" ()
1
+ CREATE OR REPLACE FUNCTION "tr_update" ()
2
2
  RETURNS TRIGGER
3
3
  AS $$
4
4
  DECLARE
5
- rec "%{table}";
6
5
  new_id INT4;
7
6
  whodunnit int;
8
7
 
@@ -20,15 +19,12 @@ BEGIN
20
19
  return OLD;
21
20
  END IF;
22
21
 
23
- -- copy old version of the row into rec
24
- SELECT INTO rec * FROM "%{table}" WHERE "id" = NEW.id;
25
-
26
22
  -- new_id is a new primary key that we'll use for the obsoleted row.
27
- SELECT nextval('"%{table}_id_seq"') INTO new_id;
23
+ SELECT nextval('"' || TG_TABLE_NAME || '_id_seq"') INTO new_id;
28
24
 
29
- rec.id = new_id;
30
- rec.group_id = NEW.id;
31
- rec.o_user_id = NEW.user_id;
25
+ OLD.id = new_id;
26
+ OLD.group_id = NEW.id;
27
+ OLD.o_user_id = NEW.user_id;
32
28
 
33
29
  -- FIXME: The following IF/ELSE handles cases where created_dt is
34
30
  -- sent in on update. This is only useful for debugging. Consider
@@ -38,18 +34,18 @@ BEGIN
38
34
  -- Set the modified row's created_dt. The obsoleted_dt field was
39
35
  -- already infinity, so we don't need to set it.
40
36
  NEW.created_dt = now();
41
- rec.obsoleted_dt = now();
37
+ OLD.obsoleted_dt = now();
42
38
  ELSE
43
39
  IF NEW.created_dt <= OLD.created_dt THEN
44
40
  RAISE EXCEPTION 'new created_dt must be greater than old';
45
41
  END IF;
46
42
 
47
- rec.obsoleted_dt = NEW.created_dt;
43
+ OLD.obsoleted_dt = NEW.created_dt;
48
44
  END IF;
49
45
 
50
46
  -- insert rec, note that the insert trigger will get called. The
51
47
  -- obsoleted_dt is set so INSERT should not do anything with this row.
52
- INSERT INTO "%{table}" VALUES (rec.*);
48
+ EXECUTE 'INSERT INTO ' || TG_RELID::regclass || ' values (($1).*)' USING OLD;
53
49
 
54
50
  RETURN NEW;
55
51
  END;
@@ -57,4 +53,4 @@ $$ LANGUAGE plpgsql;
57
53
 
58
54
  DROP TRIGGER IF EXISTS %{table}_update ON %{table};
59
55
  CREATE TRIGGER "%{table}_update" BEFORE UPDATE ON "%{table}" FOR EACH ROW
60
- EXECUTE PROCEDURE "%{table}_update"();
56
+ EXECUTE PROCEDURE "tr_update"();
@@ -1,3 +1,3 @@
1
1
  module Mcfly
2
- VERSION = "0.0.17"
2
+ VERSION = "0.0.18"
3
3
  end
@@ -3,9 +3,7 @@ require 'mcfly'
3
3
  class MarketPrice < ActiveRecord::Base
4
4
  has_mcfly
5
5
 
6
- attr_accessible :security_instrument_id, :coupon,
7
- :settlement_mm, :settlement_yy, :price
8
- validates_presence_of :security_instrument_id, :coupon,
6
+ validates_presence_of :security_instrument_id, :coupon,
9
7
  :settlement_mm, :settlement_yy
10
8
 
11
9
  mcfly_validates_uniqueness_of :security_instrument_id,
@@ -1,6 +1,5 @@
1
1
  class SecurityInstrument < ActiveRecord::Base
2
2
  has_mcfly append_only: true
3
- attr_accessible :name, :settlement_class
4
3
  validates_presence_of :name, :settlement_class
5
4
  mcfly_validates_uniqueness_of :name
6
5
 
@@ -49,12 +49,6 @@ module Dummy
49
49
  # like if you have constraints or database-specific column types
50
50
  # config.active_record.schema_format = :sql
51
51
 
52
- # Enforce whitelist mode for mass assignment.
53
- # This will create an empty whitelist of attributes available for mass-assignment for all models
54
- # in your app. As such, your models will need to explicitly whitelist or blacklist accessible
55
- # parameters by using an attr_accessible or attr_protected declaration.
56
- config.active_record.whitelist_attributes = true
57
-
58
52
  # Enable the asset pipeline
59
53
  config.assets.enabled = true
60
54
 
@@ -22,9 +22,6 @@ Dummy::Application.configure do
22
22
  # Only use best-standards-support built into browsers
23
23
  config.action_dispatch.best_standards_support = :builtin
24
24
 
25
- # Raise exception on mass assignment protection for Active Record models
26
- config.active_record.mass_assignment_sanitizer = :strict
27
-
28
25
  # Log the query plan for queries taking more than this (works
29
26
  # with SQLite, MySQL, and PostgreSQL)
30
27
  config.active_record.auto_explain_threshold_in_seconds = 0.5
@@ -34,4 +31,6 @@ Dummy::Application.configure do
34
31
 
35
32
  # Expands the lines which load the assets
36
33
  config.assets.debug = true
34
+
35
+ config.eager_load = false
37
36
  end
@@ -9,7 +9,7 @@ Dummy::Application.configure do
9
9
  config.action_controller.perform_caching = true
10
10
 
11
11
  # Disable Rails's static asset server (Apache or nginx will already do this)
12
- config.serve_static_assets = false
12
+ config.serve_static_files = false
13
13
 
14
14
  # Compress JavaScripts and CSS
15
15
  config.assets.compress = true
@@ -64,4 +64,6 @@ Dummy::Application.configure do
64
64
  # Log the query plan for queries taking more than this (works
65
65
  # with SQLite, MySQL, and PostgreSQL)
66
66
  # config.active_record.auto_explain_threshold_in_seconds = 0.5
67
+
68
+ config.eager_load = true
67
69
  end
@@ -8,7 +8,7 @@ Dummy::Application.configure do
8
8
  config.cache_classes = true
9
9
 
10
10
  # Configure static asset server for tests with Cache-Control for performance
11
- config.serve_static_assets = true
11
+ config.serve_static_files = true
12
12
  config.static_cache_control = "public, max-age=3600"
13
13
 
14
14
  # Log error messages when you accidentally call methods on nil
@@ -29,9 +29,8 @@ Dummy::Application.configure do
29
29
  # ActionMailer::Base.deliveries array.
30
30
  # config.action_mailer.delivery_method = :test
31
31
 
32
- # Raise exception on mass assignment protection for Active Record models
33
- config.active_record.mass_assignment_sanitizer = :strict
34
-
35
32
  # Print deprecation notices to the stderr
36
33
  config.active_support.deprecation = :stderr
34
+
35
+ config.eager_load = false
37
36
  end
@@ -40,4 +40,6 @@ RSpec.configure do |config|
40
40
  # the seed, which is printed after each run.
41
41
  # --seed 1234
42
42
  config.order = "random"
43
+
44
+ config.infer_spec_type_from_file_location!
43
45
  end
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.17
4
+ version: 0.0.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arman Bostani
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-29 00:00:00.000000000 Z
11
+ date: 2015-12-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg
@@ -139,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
139
139
  version: '0'
140
140
  requirements: []
141
141
  rubyforge_project:
142
- rubygems_version: 2.4.3
142
+ rubygems_version: 2.4.8
143
143
  signing_key:
144
144
  specification_version: 4
145
145
  summary: A database table versioning system.