fx 0.2.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +1 -0
  3. data/.hound.yml +2 -0
  4. data/.rubocop.yml +648 -0
  5. data/.travis.yml +18 -6
  6. data/Appraisals +21 -10
  7. data/LICENSE +18 -0
  8. data/README.md +45 -13
  9. data/bin/setup +1 -0
  10. data/gemfiles/rails42.gemfile +2 -1
  11. data/gemfiles/rails50.gemfile +1 -1
  12. data/gemfiles/rails51.gemfile +8 -0
  13. data/gemfiles/rails52.gemfile +8 -0
  14. data/gemfiles/rails60.gemfile +8 -0
  15. data/gemfiles/rails_edge.gemfile +8 -0
  16. data/lib/fx.rb +22 -0
  17. data/lib/fx/adapters/postgres.rb +26 -1
  18. data/lib/fx/adapters/postgres/functions.rb +5 -2
  19. data/lib/fx/adapters/postgres/triggers.rb +2 -2
  20. data/lib/fx/command_recorder.rb +0 -5
  21. data/lib/fx/configuration.rb +10 -0
  22. data/lib/fx/definition.rb +13 -3
  23. data/lib/fx/function.rb +2 -0
  24. data/lib/fx/railtie.rb +15 -0
  25. data/lib/fx/schema_dumper.rb +0 -5
  26. data/lib/fx/schema_dumper/function.rb +14 -5
  27. data/lib/fx/statements.rb +0 -5
  28. data/lib/fx/statements/function.rb +4 -2
  29. data/lib/fx/statements/trigger.rb +2 -0
  30. data/lib/fx/trigger.rb +2 -0
  31. data/lib/fx/version.rb +1 -1
  32. data/lib/generators/fx/function/USAGE +2 -0
  33. data/lib/generators/fx/function/function_generator.rb +14 -1
  34. data/lib/generators/fx/trigger/USAGE +2 -0
  35. data/lib/generators/fx/trigger/trigger_generator.rb +14 -1
  36. data/spec/acceptance/user_manages_functions_spec.rb +22 -2
  37. data/spec/acceptance/user_manages_triggers_spec.rb +6 -6
  38. data/spec/acceptance_helper.rb +2 -1
  39. data/spec/dummy/Rakefile +7 -0
  40. data/spec/features/functions/migrations_spec.rb +2 -2
  41. data/spec/features/functions/revert_spec.rb +2 -2
  42. data/spec/features/triggers/migrations_spec.rb +3 -3
  43. data/spec/features/triggers/revert_spec.rb +4 -4
  44. data/spec/fx/adapters/postgres/functions_spec.rb +37 -0
  45. data/spec/fx/adapters/postgres/triggers_spec.rb +45 -0
  46. data/spec/fx/adapters/postgres_spec.rb +46 -49
  47. data/spec/fx/definition_spec.rb +25 -2
  48. data/spec/fx/function_spec.rb +55 -0
  49. data/spec/fx/schema_dumper/function_spec.rb +58 -2
  50. data/spec/fx/schema_dumper/trigger_spec.rb +3 -3
  51. data/spec/fx/trigger_spec.rb +55 -0
  52. data/spec/generators/fx/function/function_generator_spec.rb +12 -0
  53. data/spec/generators/fx/trigger/trigger_generator_spec.rb +12 -0
  54. metadata +19 -11
  55. data/.ruby-version +0 -1
  56. data/gemfiles/rails40.gemfile +0 -8
  57. data/gemfiles/rails40.gemfile.lock +0 -111
  58. data/gemfiles/rails41.gemfile +0 -8
  59. data/gemfiles/rails41.gemfile.lock +0 -113
  60. data/gemfiles/rails42.gemfile.lock +0 -130
  61. data/gemfiles/rails50.gemfile.lock +0 -126
@@ -13,6 +13,18 @@ describe Fx::Generators::FunctionGenerator, :generator do
13
13
  expect(migration_file(migration)).to contain "CreateFunctionTest"
14
14
  end
15
15
 
16
+ context "when passed --no-migration" do
17
+ it "creates a only function definition file" do
18
+ migration = file("db/migrate/create_function_test.rb")
19
+ function_definition = file("db/functions/test_v01.sql")
20
+
21
+ run_generator ["test", "--no-migration"]
22
+
23
+ expect(function_definition).to exist
24
+ expect(migration_file(migration)).not_to exist
25
+ end
26
+ end
27
+
16
28
  it "updates an existing function" do
17
29
  with_function_definition(
18
30
  name: "test",
@@ -14,6 +14,18 @@ describe Fx::Generators::TriggerGenerator, :generator do
14
14
  expect(migration_file(migration)).to contain "on: :some_table"
15
15
  end
16
16
 
17
+ context "when passed --no-migration" do
18
+ it "creates a only trigger definition file" do
19
+ migration = file("db/migrate/create_trigger_test.rb")
20
+ trigger_definition = file("db/triggers/test_v01.sql")
21
+
22
+ run_generator ["test", "--no-migration"]
23
+
24
+ expect(trigger_definition).to exist
25
+ expect(migration_file(migration)).not_to exist
26
+ end
27
+ end
28
+
17
29
  it "supports naming the table as `on` aswell as `table_name`" do
18
30
  migration = file("db/migrate/create_trigger_test.rb")
19
31
  trigger_definition = file("db/triggers/test_v01.sql")
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.2.0
4
+ version: 0.6.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-11-17 00:00:00.000000000 Z
11
+ date: 2020-10-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: appraisal
@@ -188,13 +188,15 @@ extensions: []
188
188
  extra_rdoc_files: []
189
189
  files:
190
190
  - ".gitignore"
191
+ - ".hound.yml"
191
192
  - ".rspec"
192
- - ".ruby-version"
193
+ - ".rubocop.yml"
193
194
  - ".travis.yml"
194
195
  - ".yardopts"
195
196
  - Appraisals
196
197
  - CONTRIBUTING.md
197
198
  - Gemfile
199
+ - LICENSE
198
200
  - README.md
199
201
  - Rakefile
200
202
  - bin/appraisal
@@ -204,14 +206,12 @@ files:
204
206
  - bin/setup
205
207
  - bin/yard
206
208
  - fx.gemspec
207
- - gemfiles/rails40.gemfile
208
- - gemfiles/rails40.gemfile.lock
209
- - gemfiles/rails41.gemfile
210
- - gemfiles/rails41.gemfile.lock
211
209
  - gemfiles/rails42.gemfile
212
- - gemfiles/rails42.gemfile.lock
213
210
  - gemfiles/rails50.gemfile
214
- - gemfiles/rails50.gemfile.lock
211
+ - gemfiles/rails51.gemfile
212
+ - gemfiles/rails52.gemfile
213
+ - gemfiles/rails60.gemfile
214
+ - gemfiles/rails_edge.gemfile
215
215
  - lib/fx.rb
216
216
  - lib/fx/adapters/postgres.rb
217
217
  - lib/fx/adapters/postgres/connection.rb
@@ -224,6 +224,7 @@ files:
224
224
  - lib/fx/configuration.rb
225
225
  - lib/fx/definition.rb
226
226
  - lib/fx/function.rb
227
+ - lib/fx/railtie.rb
227
228
  - lib/fx/schema_dumper.rb
228
229
  - lib/fx/schema_dumper/function.rb
229
230
  - lib/fx/schema_dumper/trigger.rb
@@ -259,15 +260,19 @@ files:
259
260
  - spec/features/functions/revert_spec.rb
260
261
  - spec/features/triggers/migrations_spec.rb
261
262
  - spec/features/triggers/revert_spec.rb
263
+ - spec/fx/adapters/postgres/functions_spec.rb
264
+ - spec/fx/adapters/postgres/triggers_spec.rb
262
265
  - spec/fx/adapters/postgres_spec.rb
263
266
  - spec/fx/command_recorder/arguments_spec.rb
264
267
  - spec/fx/command_recorder_spec.rb
265
268
  - spec/fx/configuration_spec.rb
266
269
  - spec/fx/definition_spec.rb
270
+ - spec/fx/function_spec.rb
267
271
  - spec/fx/schema_dumper/function_spec.rb
268
272
  - spec/fx/schema_dumper/trigger_spec.rb
269
273
  - spec/fx/statements/function_spec.rb
270
274
  - spec/fx/statements/trigger_spec.rb
275
+ - spec/fx/trigger_spec.rb
271
276
  - spec/generators/fx/function/function_generator_spec.rb
272
277
  - spec/generators/fx/trigger/trigger_generator_spec.rb
273
278
  - spec/spec_helper.rb
@@ -293,8 +298,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
293
298
  - !ruby/object:Gem::Version
294
299
  version: '0'
295
300
  requirements: []
296
- rubyforge_project:
297
- rubygems_version: 2.5.1
301
+ rubygems_version: 3.1.4
298
302
  signing_key:
299
303
  specification_version: 4
300
304
  summary: Support for database functions and triggers in Rails migrations
@@ -317,15 +321,19 @@ test_files:
317
321
  - spec/features/functions/revert_spec.rb
318
322
  - spec/features/triggers/migrations_spec.rb
319
323
  - spec/features/triggers/revert_spec.rb
324
+ - spec/fx/adapters/postgres/functions_spec.rb
325
+ - spec/fx/adapters/postgres/triggers_spec.rb
320
326
  - spec/fx/adapters/postgres_spec.rb
321
327
  - spec/fx/command_recorder/arguments_spec.rb
322
328
  - spec/fx/command_recorder_spec.rb
323
329
  - spec/fx/configuration_spec.rb
324
330
  - spec/fx/definition_spec.rb
331
+ - spec/fx/function_spec.rb
325
332
  - spec/fx/schema_dumper/function_spec.rb
326
333
  - spec/fx/schema_dumper/trigger_spec.rb
327
334
  - spec/fx/statements/function_spec.rb
328
335
  - spec/fx/statements/trigger_spec.rb
336
+ - spec/fx/trigger_spec.rb
329
337
  - spec/generators/fx/function/function_generator_spec.rb
330
338
  - spec/generators/fx/trigger/trigger_generator_spec.rb
331
339
  - spec/spec_helper.rb
@@ -1 +0,0 @@
1
- 2.3
@@ -1,8 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "activerecord", "~> 4.0.0"
6
- gem "railties", "~> 4.0.0"
7
-
8
- gemspec :path => "../"
@@ -1,111 +0,0 @@
1
- PATH
2
- remote: ../
3
- specs:
4
- fx (0.1.0)
5
- activerecord (>= 4.0.0)
6
- railties (>= 4.0.0)
7
-
8
- GEM
9
- remote: https://rubygems.org/
10
- specs:
11
- actionpack (4.0.13)
12
- activesupport (= 4.0.13)
13
- builder (~> 3.1.0)
14
- erubis (~> 2.7.0)
15
- rack (~> 1.5.2)
16
- rack-test (~> 0.6.2)
17
- activemodel (4.0.13)
18
- activesupport (= 4.0.13)
19
- builder (~> 3.1.0)
20
- activerecord (4.0.13)
21
- activemodel (= 4.0.13)
22
- activerecord-deprecated_finders (~> 1.0.2)
23
- activesupport (= 4.0.13)
24
- arel (~> 4.0.0)
25
- activerecord-deprecated_finders (1.0.4)
26
- activesupport (4.0.13)
27
- i18n (~> 0.6, >= 0.6.9)
28
- minitest (~> 4.2)
29
- multi_json (~> 1.3)
30
- thread_safe (~> 0.1)
31
- tzinfo (~> 0.3.37)
32
- ammeter (1.1.3)
33
- activesupport (>= 3.0)
34
- railties (>= 3.0)
35
- rspec-rails (>= 2.2)
36
- appraisal (2.1.0)
37
- bundler
38
- rake
39
- thor (>= 0.14.0)
40
- arel (4.0.2)
41
- builder (3.1.4)
42
- coderay (1.1.1)
43
- database_cleaner (1.5.3)
44
- diff-lcs (1.2.5)
45
- erubis (2.7.0)
46
- i18n (0.7.0)
47
- method_source (0.8.2)
48
- minitest (4.7.5)
49
- multi_json (1.12.1)
50
- pg (0.18.4)
51
- pry (0.10.3)
52
- coderay (~> 1.1.0)
53
- method_source (~> 0.8.1)
54
- slop (~> 3.4)
55
- rack (1.5.5)
56
- rack-test (0.6.3)
57
- rack (>= 1.0)
58
- railties (4.0.13)
59
- actionpack (= 4.0.13)
60
- activesupport (= 4.0.13)
61
- rake (>= 0.8.7)
62
- thor (>= 0.18.1, < 2.0)
63
- rake (11.2.2)
64
- redcarpet (3.3.4)
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
- diff-lcs (>= 1.2.0, < 2.0)
73
- rspec-support (~> 3.5.0)
74
- rspec-mocks (3.5.0)
75
- diff-lcs (>= 1.2.0, < 2.0)
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
- slop (3.6.0)
87
- thor (0.19.1)
88
- thread_safe (0.3.5)
89
- tzinfo (0.3.49)
90
- yard (0.8.7.6)
91
-
92
- PLATFORMS
93
- ruby
94
-
95
- DEPENDENCIES
96
- activerecord (~> 4.0.0)
97
- ammeter (>= 1.1.3)
98
- appraisal
99
- bundler (>= 1.5)
100
- database_cleaner
101
- fx!
102
- pg
103
- pry
104
- railties (~> 4.0.0)
105
- rake
106
- redcarpet
107
- rspec (>= 3.3)
108
- yard
109
-
110
- BUNDLED WITH
111
- 1.13.6
@@ -1,8 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "activerecord", "~> 4.1.0"
6
- gem "railties", "~> 4.1.0"
7
-
8
- gemspec :path => "../"
@@ -1,113 +0,0 @@
1
- PATH
2
- remote: ../
3
- specs:
4
- fx (0.1.0)
5
- activerecord (>= 4.0.0)
6
- railties (>= 4.0.0)
7
-
8
- GEM
9
- remote: https://rubygems.org/
10
- specs:
11
- actionpack (4.1.15)
12
- actionview (= 4.1.15)
13
- activesupport (= 4.1.15)
14
- rack (~> 1.5.2)
15
- rack-test (~> 0.6.2)
16
- actionview (4.1.15)
17
- activesupport (= 4.1.15)
18
- builder (~> 3.1)
19
- erubis (~> 2.7.0)
20
- activemodel (4.1.15)
21
- activesupport (= 4.1.15)
22
- builder (~> 3.1)
23
- activerecord (4.1.15)
24
- activemodel (= 4.1.15)
25
- activesupport (= 4.1.15)
26
- arel (~> 5.0.0)
27
- activesupport (4.1.15)
28
- i18n (~> 0.6, >= 0.6.9)
29
- json (~> 1.7, >= 1.7.7)
30
- minitest (~> 5.1)
31
- thread_safe (~> 0.1)
32
- tzinfo (~> 1.1)
33
- ammeter (1.1.3)
34
- activesupport (>= 3.0)
35
- railties (>= 3.0)
36
- rspec-rails (>= 2.2)
37
- appraisal (2.1.0)
38
- bundler
39
- rake
40
- thor (>= 0.14.0)
41
- arel (5.0.1.20140414130214)
42
- builder (3.2.2)
43
- coderay (1.1.1)
44
- database_cleaner (1.5.3)
45
- diff-lcs (1.2.5)
46
- erubis (2.7.0)
47
- i18n (0.7.0)
48
- json (1.8.3)
49
- method_source (0.8.2)
50
- minitest (5.9.1)
51
- pg (0.18.4)
52
- pry (0.10.3)
53
- coderay (~> 1.1.0)
54
- method_source (~> 0.8.1)
55
- slop (~> 3.4)
56
- rack (1.5.5)
57
- rack-test (0.6.3)
58
- rack (>= 1.0)
59
- railties (4.1.15)
60
- actionpack (= 4.1.15)
61
- activesupport (= 4.1.15)
62
- rake (>= 0.8.7)
63
- thor (>= 0.18.1, < 2.0)
64
- rake (11.2.2)
65
- redcarpet (3.3.4)
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
- diff-lcs (>= 1.2.0, < 2.0)
74
- rspec-support (~> 3.5.0)
75
- rspec-mocks (3.5.0)
76
- diff-lcs (>= 1.2.0, < 2.0)
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
- slop (3.6.0)
88
- thor (0.19.1)
89
- thread_safe (0.3.5)
90
- tzinfo (1.2.2)
91
- thread_safe (~> 0.1)
92
- yard (0.8.7.6)
93
-
94
- PLATFORMS
95
- ruby
96
-
97
- DEPENDENCIES
98
- activerecord (~> 4.1.0)
99
- ammeter (>= 1.1.3)
100
- appraisal
101
- bundler (>= 1.5)
102
- database_cleaner
103
- fx!
104
- pg
105
- pry
106
- railties (~> 4.1.0)
107
- rake
108
- redcarpet
109
- rspec (>= 3.3)
110
- yard
111
-
112
- BUNDLED WITH
113
- 1.13.6
@@ -1,130 +0,0 @@
1
- PATH
2
- remote: ../
3
- specs:
4
- fx (0.1.0)
5
- activerecord (>= 4.0.0)
6
- railties (>= 4.0.0)
7
-
8
- GEM
9
- remote: https://rubygems.org/
10
- specs:
11
- actionpack (4.2.6)
12
- actionview (= 4.2.6)
13
- activesupport (= 4.2.6)
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.6)
19
- activesupport (= 4.2.6)
20
- builder (~> 3.1)
21
- erubis (~> 2.7.0)
22
- rails-dom-testing (~> 1.0, >= 1.0.5)
23
- rails-html-sanitizer (~> 1.0, >= 1.0.2)
24
- activemodel (4.2.6)
25
- activesupport (= 4.2.6)
26
- builder (~> 3.1)
27
- activerecord (4.2.6)
28
- activemodel (= 4.2.6)
29
- activesupport (= 4.2.6)
30
- arel (~> 6.0)
31
- activesupport (4.2.6)
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
- ammeter (1.1.3)
38
- activesupport (>= 3.0)
39
- railties (>= 3.0)
40
- rspec-rails (>= 2.2)
41
- appraisal (2.1.0)
42
- bundler
43
- rake
44
- thor (>= 0.14.0)
45
- arel (6.0.3)
46
- builder (3.2.2)
47
- coderay (1.1.1)
48
- database_cleaner (1.5.3)
49
- diff-lcs (1.2.5)
50
- erubis (2.7.0)
51
- i18n (0.7.0)
52
- json (1.8.3)
53
- loofah (2.0.3)
54
- nokogiri (>= 1.5.9)
55
- method_source (0.8.2)
56
- mini_portile2 (2.1.0)
57
- minitest (5.9.1)
58
- nokogiri (1.6.8.1)
59
- mini_portile2 (~> 2.1.0)
60
- pg (0.18.4)
61
- pry (0.10.3)
62
- coderay (~> 1.1.0)
63
- method_source (~> 0.8.1)
64
- slop (~> 3.4)
65
- rack (1.6.4)
66
- rack-test (0.6.3)
67
- rack (>= 1.0)
68
- rails-deprecated_sanitizer (1.0.3)
69
- activesupport (>= 4.2.0.alpha)
70
- rails-dom-testing (1.0.7)
71
- activesupport (>= 4.2.0.beta, < 5.0)
72
- nokogiri (~> 1.6.0)
73
- rails-deprecated_sanitizer (>= 1.0.1)
74
- rails-html-sanitizer (1.0.3)
75
- loofah (~> 2.0)
76
- railties (4.2.6)
77
- actionpack (= 4.2.6)
78
- activesupport (= 4.2.6)
79
- rake (>= 0.8.7)
80
- thor (>= 0.18.1, < 2.0)
81
- rake (11.2.2)
82
- redcarpet (3.3.4)
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
- diff-lcs (>= 1.2.0, < 2.0)
91
- rspec-support (~> 3.5.0)
92
- rspec-mocks (3.5.0)
93
- diff-lcs (>= 1.2.0, < 2.0)
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
- slop (3.6.0)
105
- thor (0.19.1)
106
- thread_safe (0.3.5)
107
- tzinfo (1.2.2)
108
- thread_safe (~> 0.1)
109
- yard (0.8.7.6)
110
-
111
- PLATFORMS
112
- ruby
113
-
114
- DEPENDENCIES
115
- activerecord (~> 4.2.0)
116
- ammeter (>= 1.1.3)
117
- appraisal
118
- bundler (>= 1.5)
119
- database_cleaner
120
- fx!
121
- pg
122
- pry
123
- railties (~> 4.2.0)
124
- rake
125
- redcarpet
126
- rspec (>= 3.3)
127
- yard
128
-
129
- BUNDLED WITH
130
- 1.13.6