fx 0.1.0 → 0.2.0

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: 07cc76f1310a1982698708c2022bbfae7853263a
4
- data.tar.gz: a598bd9efd102a6d8b2789379c46f865a4319f86
3
+ metadata.gz: 6938f7995ea791b0cae6efb9198d707e1c844933
4
+ data.tar.gz: 3f636e55ea8dc7c4d858ba4f178233eafe2af09a
5
5
  SHA512:
6
- metadata.gz: b9b0b8012f86bb96300811e6e7f3eaf0ae03f437da774bb8751759cd7c3546556d5bd3ed195410e97db0a808f55e118c88deca1887d570bd6752308aabd254b0
7
- data.tar.gz: 022f693c2da994f7204e6320b4bf73b606df63d8d2c5a9f28bce6cb596d035ce949f2c39a3b6111aa6f926079a5b1b67ed73cd989b7ec1567aa5b3d2113a0e74
6
+ metadata.gz: 024d66a1780024f26d6ba5b8e619d398e9d30a838a7427a13b054b63e7376baf8c530251ace8ab74c963772c191aeca7b2f65212024e6a9eb3a2e2dd0574701e
7
+ data.tar.gz: b28ac249704b43766fd76e9110d1fee6c1098c3811d6736f3eb56a23a1fc043a5d40e159cb969edf103cc66e51b8861c5a1167650d44eded8e7bdba6f5a68922
@@ -60,29 +60,29 @@ GEM
60
60
  activesupport (= 4.0.13)
61
61
  rake (>= 0.8.7)
62
62
  thor (>= 0.18.1, < 2.0)
63
- rake (11.1.2)
63
+ rake (11.2.2)
64
64
  redcarpet (3.3.4)
65
- rspec (3.4.0)
66
- rspec-core (~> 3.4.0)
67
- rspec-expectations (~> 3.4.0)
68
- rspec-mocks (~> 3.4.0)
69
- rspec-core (3.4.4)
70
- rspec-support (~> 3.4.0)
71
- rspec-expectations (3.4.0)
65
+ rspec (3.5.0)
66
+ rspec-core (~> 3.5.0)
67
+ rspec-expectations (~> 3.5.0)
68
+ rspec-mocks (~> 3.5.0)
69
+ rspec-core (3.5.4)
70
+ rspec-support (~> 3.5.0)
71
+ rspec-expectations (3.5.0)
72
72
  diff-lcs (>= 1.2.0, < 2.0)
73
- rspec-support (~> 3.4.0)
74
- rspec-mocks (3.4.1)
73
+ rspec-support (~> 3.5.0)
74
+ rspec-mocks (3.5.0)
75
75
  diff-lcs (>= 1.2.0, < 2.0)
76
- rspec-support (~> 3.4.0)
77
- rspec-rails (3.4.2)
78
- actionpack (>= 3.0, < 4.3)
79
- activesupport (>= 3.0, < 4.3)
80
- railties (>= 3.0, < 4.3)
81
- rspec-core (~> 3.4.0)
82
- rspec-expectations (~> 3.4.0)
83
- rspec-mocks (~> 3.4.0)
84
- rspec-support (~> 3.4.0)
85
- rspec-support (3.4.1)
76
+ rspec-support (~> 3.5.0)
77
+ rspec-rails (3.5.2)
78
+ actionpack (>= 3.0)
79
+ activesupport (>= 3.0)
80
+ railties (>= 3.0)
81
+ rspec-core (~> 3.5.0)
82
+ rspec-expectations (~> 3.5.0)
83
+ rspec-mocks (~> 3.5.0)
84
+ rspec-support (~> 3.5.0)
85
+ rspec-support (3.5.0)
86
86
  slop (3.6.0)
87
87
  thor (0.19.1)
88
88
  thread_safe (0.3.5)
@@ -108,4 +108,4 @@ DEPENDENCIES
108
108
  yard
109
109
 
110
110
  BUNDLED WITH
111
- 1.12.4
111
+ 1.13.6
@@ -47,7 +47,7 @@ GEM
47
47
  i18n (0.7.0)
48
48
  json (1.8.3)
49
49
  method_source (0.8.2)
50
- minitest (5.9.0)
50
+ minitest (5.9.1)
51
51
  pg (0.18.4)
52
52
  pry (0.10.3)
53
53
  coderay (~> 1.1.0)
@@ -61,29 +61,29 @@ GEM
61
61
  activesupport (= 4.1.15)
62
62
  rake (>= 0.8.7)
63
63
  thor (>= 0.18.1, < 2.0)
64
- rake (11.1.2)
64
+ rake (11.2.2)
65
65
  redcarpet (3.3.4)
66
- rspec (3.4.0)
67
- rspec-core (~> 3.4.0)
68
- rspec-expectations (~> 3.4.0)
69
- rspec-mocks (~> 3.4.0)
70
- rspec-core (3.4.4)
71
- rspec-support (~> 3.4.0)
72
- rspec-expectations (3.4.0)
66
+ rspec (3.5.0)
67
+ rspec-core (~> 3.5.0)
68
+ rspec-expectations (~> 3.5.0)
69
+ rspec-mocks (~> 3.5.0)
70
+ rspec-core (3.5.4)
71
+ rspec-support (~> 3.5.0)
72
+ rspec-expectations (3.5.0)
73
73
  diff-lcs (>= 1.2.0, < 2.0)
74
- rspec-support (~> 3.4.0)
75
- rspec-mocks (3.4.1)
74
+ rspec-support (~> 3.5.0)
75
+ rspec-mocks (3.5.0)
76
76
  diff-lcs (>= 1.2.0, < 2.0)
77
- rspec-support (~> 3.4.0)
78
- rspec-rails (3.4.2)
79
- actionpack (>= 3.0, < 4.3)
80
- activesupport (>= 3.0, < 4.3)
81
- railties (>= 3.0, < 4.3)
82
- rspec-core (~> 3.4.0)
83
- rspec-expectations (~> 3.4.0)
84
- rspec-mocks (~> 3.4.0)
85
- rspec-support (~> 3.4.0)
86
- rspec-support (3.4.1)
77
+ rspec-support (~> 3.5.0)
78
+ rspec-rails (3.5.2)
79
+ actionpack (>= 3.0)
80
+ activesupport (>= 3.0)
81
+ railties (>= 3.0)
82
+ rspec-core (~> 3.5.0)
83
+ rspec-expectations (~> 3.5.0)
84
+ rspec-mocks (~> 3.5.0)
85
+ rspec-support (~> 3.5.0)
86
+ rspec-support (3.5.0)
87
87
  slop (3.6.0)
88
88
  thor (0.19.1)
89
89
  thread_safe (0.3.5)
@@ -110,4 +110,4 @@ DEPENDENCIES
110
110
  yard
111
111
 
112
112
  BUNDLED WITH
113
- 1.12.4
113
+ 1.13.6
@@ -53,10 +53,10 @@ GEM
53
53
  loofah (2.0.3)
54
54
  nokogiri (>= 1.5.9)
55
55
  method_source (0.8.2)
56
- mini_portile2 (2.0.0)
57
- minitest (5.9.0)
58
- nokogiri (1.6.7.2)
59
- mini_portile2 (~> 2.0.0.rc2)
56
+ mini_portile2 (2.1.0)
57
+ minitest (5.9.1)
58
+ nokogiri (1.6.8.1)
59
+ mini_portile2 (~> 2.1.0)
60
60
  pg (0.18.4)
61
61
  pry (0.10.3)
62
62
  coderay (~> 1.1.0)
@@ -78,29 +78,29 @@ GEM
78
78
  activesupport (= 4.2.6)
79
79
  rake (>= 0.8.7)
80
80
  thor (>= 0.18.1, < 2.0)
81
- rake (11.1.2)
81
+ rake (11.2.2)
82
82
  redcarpet (3.3.4)
83
- rspec (3.4.0)
84
- rspec-core (~> 3.4.0)
85
- rspec-expectations (~> 3.4.0)
86
- rspec-mocks (~> 3.4.0)
87
- rspec-core (3.4.4)
88
- rspec-support (~> 3.4.0)
89
- rspec-expectations (3.4.0)
83
+ rspec (3.5.0)
84
+ rspec-core (~> 3.5.0)
85
+ rspec-expectations (~> 3.5.0)
86
+ rspec-mocks (~> 3.5.0)
87
+ rspec-core (3.5.4)
88
+ rspec-support (~> 3.5.0)
89
+ rspec-expectations (3.5.0)
90
90
  diff-lcs (>= 1.2.0, < 2.0)
91
- rspec-support (~> 3.4.0)
92
- rspec-mocks (3.4.1)
91
+ rspec-support (~> 3.5.0)
92
+ rspec-mocks (3.5.0)
93
93
  diff-lcs (>= 1.2.0, < 2.0)
94
- rspec-support (~> 3.4.0)
95
- rspec-rails (3.4.2)
96
- actionpack (>= 3.0, < 4.3)
97
- activesupport (>= 3.0, < 4.3)
98
- railties (>= 3.0, < 4.3)
99
- rspec-core (~> 3.4.0)
100
- rspec-expectations (~> 3.4.0)
101
- rspec-mocks (~> 3.4.0)
102
- rspec-support (~> 3.4.0)
103
- rspec-support (3.4.1)
94
+ rspec-support (~> 3.5.0)
95
+ rspec-rails (3.5.2)
96
+ actionpack (>= 3.0)
97
+ activesupport (>= 3.0)
98
+ railties (>= 3.0)
99
+ rspec-core (~> 3.5.0)
100
+ rspec-expectations (~> 3.5.0)
101
+ rspec-mocks (~> 3.5.0)
102
+ rspec-support (~> 3.5.0)
103
+ rspec-support (3.5.0)
104
104
  slop (3.6.0)
105
105
  thor (0.19.1)
106
106
  thread_safe (0.3.5)
@@ -127,4 +127,4 @@ DEPENDENCIES
127
127
  yard
128
128
 
129
129
  BUNDLED WITH
130
- 1.12.4
130
+ 1.13.6
@@ -123,4 +123,4 @@ DEPENDENCIES
123
123
  yard
124
124
 
125
125
  BUNDLED WITH
126
- 1.13.3
126
+ 1.13.6
@@ -17,7 +17,8 @@ module Fx
17
17
  ON pn.oid = pp.pronamespace
18
18
  LEFT JOIN pg_depend pd
19
19
  ON pd.objid = pp.oid AND pd.deptype = 'e'
20
- WHERE pn.nspname = 'public' AND pd.objid IS NULL;
20
+ WHERE pn.nspname = 'public' AND pd.objid IS NULL
21
+ ORDER BY pp.oid;
21
22
  SQL
22
23
 
23
24
  # Wraps #all as a static facade.
@@ -18,7 +18,8 @@ module Fx
18
18
  JOIN pg_proc pp
19
19
  ON (pp.oid = pt.tgfoid)
20
20
  WHERE pt.tgname
21
- NOT ILIKE '%constraint%' AND pt.tgname NOT ILIKE 'pg%';
21
+ NOT ILIKE '%constraint%' AND pt.tgname NOT ILIKE 'pg%'
22
+ ORDER BY pc.oid;
22
23
  SQL
23
24
 
24
25
  # Wraps #all as a static facade.
@@ -1,4 +1,4 @@
1
1
  module Fx
2
2
  # @api private
3
- VERSION = "0.1.0"
3
+ VERSION = "0.2.0"
4
4
  end
@@ -59,6 +59,14 @@ module Fx
59
59
  end
60
60
  end
61
61
 
62
+ def activerecord_migration_class
63
+ if ActiveRecord::Migration.respond_to?(:current_version)
64
+ "ActiveRecord::Migration[5.0]"
65
+ else
66
+ "ActiveRecord::Migration"
67
+ end
68
+ end
69
+
62
70
  def formatted_name
63
71
  if singular_name.include?(".")
64
72
  "\"#{singular_name}\""
@@ -1,4 +1,4 @@
1
- class <%= migration_class_name %> < ActiveRecord::Migration
1
+ class <%= migration_class_name %> < <%= activerecord_migration_class %>
2
2
  def change
3
3
  create_function <%= formatted_name %>
4
4
  end
@@ -1,4 +1,4 @@
1
- class <%= migration_class_name %> < ActiveRecord::Migration
1
+ class <%= migration_class_name %> < <%= activerecord_migration_class %>
2
2
  def change
3
3
  update_function <%= formatted_name %>, version: <%= version %>, revert_to_version: <%= previous_version %>
4
4
  end
@@ -1,4 +1,4 @@
1
- class <%= migration_class_name %> < ActiveRecord::Migration
1
+ class <%= migration_class_name %> < <%= activerecord_migration_class %>
2
2
  def change
3
3
  create_trigger <%= formatted_name %>, on: <%= formatted_table_name %>
4
4
  end
@@ -1,4 +1,4 @@
1
- class <%= migration_class_name %> < ActiveRecord::Migration
1
+ class <%= migration_class_name %> < <%= activerecord_migration_class %>
2
2
  def change
3
3
  update_trigger <%= formatted_name %>, on: <%= formatted_table_name %>, version: <%= version %>, revert_to_version: <%= previous_version %>
4
4
  end
@@ -56,6 +56,14 @@ module Fx
56
56
  end
57
57
  end
58
58
 
59
+ def activerecord_migration_class
60
+ if ActiveRecord::Migration.respond_to?(:current_version)
61
+ "ActiveRecord::Migration[5.0]"
62
+ else
63
+ "ActiveRecord::Migration"
64
+ end
65
+ end
66
+
59
67
  def formatted_name
60
68
  if singular_name.include?(".")
61
69
  "\"#{singular_name}\""
@@ -16,7 +16,7 @@ describe "Function migrations", :db do
16
16
  end
17
17
 
18
18
  it "can run migrations that create functions" do
19
- migration = Class.new(ActiveRecord::Migration) do
19
+ migration = Class.new(migration_class) do
20
20
  def up
21
21
  create_function :test
22
22
  end
@@ -28,7 +28,7 @@ describe "Function migrations", :db do
28
28
  it "can run migrations that drop functions" do
29
29
  connection.create_function(:test)
30
30
 
31
- migration = Class.new(ActiveRecord::Migration) do
31
+ migration = Class.new(migration_class) do
32
32
  def up
33
33
  drop_function :test
34
34
  end
@@ -53,7 +53,7 @@ describe "Function migrations", :db do
53
53
  version: 2,
54
54
  sql_definition: sql_definition,
55
55
  ) do
56
- migration = Class.new(ActiveRecord::Migration) do
56
+ migration = Class.new(migration_class) do
57
57
  def change
58
58
  update_function :test, version: 2, revert_to_version: 1
59
59
  end
@@ -16,7 +16,7 @@ describe "Reverting migrations", :db do
16
16
  end
17
17
 
18
18
  it "can run reversible migrations for creating functions" do
19
- migration = Class.new(ActiveRecord::Migration) do
19
+ migration = Class.new(migration_class) do
20
20
  def change
21
21
  create_function :test
22
22
  end
@@ -28,12 +28,12 @@ describe "Reverting migrations", :db do
28
28
  it "can run reversible migrations for dropping functions" do
29
29
  connection.create_function(:test)
30
30
 
31
- good_migration = Class.new(ActiveRecord::Migration) do
31
+ good_migration = Class.new(migration_class) do
32
32
  def change
33
33
  drop_function :test, revert_to_version: 1
34
34
  end
35
35
  end
36
- bad_migration = Class.new(ActiveRecord::Migration) do
36
+ bad_migration = Class.new(migration_class) do
37
37
  def change
38
38
  drop_function :test
39
39
  end
@@ -63,7 +63,7 @@ describe "Reverting migrations", :db do
63
63
  version: 2,
64
64
  sql_definition: sql_definition,
65
65
  ) do
66
- migration = Class.new(ActiveRecord::Migration) do
66
+ migration = Class.new(migration_class) do
67
67
  def change
68
68
  update_function :test, version: 2, revert_to_version: 1
69
69
  end
@@ -33,7 +33,7 @@ describe "Trigger migrations", :db do
33
33
  end
34
34
 
35
35
  it "can run migrations that create triggers" do
36
- migration = Class.new(ActiveRecord::Migration) do
36
+ migration = Class.new(migration_class) do
37
37
  def up
38
38
  create_trigger :uppercase_users_name
39
39
  end
@@ -45,7 +45,7 @@ describe "Trigger migrations", :db do
45
45
  it "can run migrations that drop triggers" do
46
46
  connection.create_trigger(:uppercase_users_name)
47
47
 
48
- migration = Class.new(ActiveRecord::Migration) do
48
+ migration = Class.new(migration_class) do
49
49
  def up
50
50
  drop_trigger :uppercase_users_name, on: :users
51
51
  end
@@ -33,7 +33,7 @@ describe "Reverting migrations", :db do
33
33
  end
34
34
 
35
35
  it "can run reversible migrations for creating triggers" do
36
- migration = Class.new(ActiveRecord::Migration) do
36
+ migration = Class.new(migration_class) do
37
37
  def change
38
38
  create_trigger :uppercase_users_name, on: :users
39
39
  end
@@ -45,12 +45,12 @@ describe "Reverting migrations", :db do
45
45
  it "can run reversible migrations for dropping triggers" do
46
46
  connection.create_trigger(:uppercase_users_name, on: :users)
47
47
 
48
- good_migration = Class.new(ActiveRecord::Migration) do
48
+ good_migration = Class.new(migration_class) do
49
49
  def change
50
50
  drop_trigger :uppercase_users_name, on: :users, revert_to_version: 1
51
51
  end
52
52
  end
53
- bad_migration = Class.new(ActiveRecord::Migration) do
53
+ bad_migration = Class.new(migration_class) do
54
54
  def change
55
55
  drop_trigger :uppercase_users_name, on: :users
56
56
  end
@@ -78,7 +78,7 @@ describe "Reverting migrations", :db do
78
78
  sql_definition: sql_definition,
79
79
  version: 2,
80
80
  ) do
81
- migration = Class.new(ActiveRecord::Migration) do
81
+ migration = Class.new(migration_class) do
82
82
  def change
83
83
  update_trigger(
84
84
  :uppercase_users_name,
@@ -7,6 +7,14 @@ module MigrationsHelper
7
7
  end
8
8
  end
9
9
 
10
+ def migration_class
11
+ if Rails::VERSION::MAJOR >= 5
12
+ ::ActiveRecord::Migration[5.0]
13
+ else
14
+ ::ActiveRecord::Migration
15
+ end
16
+ end
17
+
10
18
  def connection
11
19
  @_connection ||= ActiveRecord::Base.connection
12
20
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fx
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Teo Ljungberg
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-12 00:00:00.000000000 Z
11
+ date: 2016-11-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: appraisal