machinist_redux 3.0.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 (41) hide show
  1. checksums.yaml +7 -0
  2. data/.codeclimate.yml +17 -0
  3. data/.gitignore +24 -0
  4. data/.rspec +2 -0
  5. data/.rubocop.yml +60 -0
  6. data/.rubocop_todo.yml +92 -0
  7. data/.travis.yml +23 -0
  8. data/Appraisals +11 -0
  9. data/Gemfile +32 -0
  10. data/LICENSE.txt +21 -0
  11. data/README.md +307 -0
  12. data/Rakefile +20 -0
  13. data/gemfiles/rails_4.2.gemfile +38 -0
  14. data/gemfiles/rails_4.2.gemfile.lock +232 -0
  15. data/gemfiles/rails_5.0.gemfile +38 -0
  16. data/gemfiles/rails_5.0.gemfile.lock +232 -0
  17. data/gemfiles/rails_5.1.gemfile +34 -0
  18. data/gemfiles/rails_5.1.gemfile.lock +231 -0
  19. data/lib/generators/machinist/install/USAGE +2 -0
  20. data/lib/generators/machinist/install/install_generator.rb +46 -0
  21. data/lib/generators/machinist/install/templates/blueprints.rb +9 -0
  22. data/lib/generators/machinist/install/templates/machinist.rb.erb +7 -0
  23. data/lib/generators/machinist/model/model_generator.rb +11 -0
  24. data/lib/machinist.rb +5 -0
  25. data/lib/machinist/active_record.rb +14 -0
  26. data/lib/machinist/active_record/blueprint.rb +14 -0
  27. data/lib/machinist/active_record/lathe.rb +21 -0
  28. data/lib/machinist/blueprint.rb +84 -0
  29. data/lib/machinist/exceptions.rb +30 -0
  30. data/lib/machinist/lathe.rb +65 -0
  31. data/lib/machinist/machinable.rb +100 -0
  32. data/lib/machinist/version.rb +3 -0
  33. data/machinist.gemspec +23 -0
  34. data/spec/machinist/active_record_spec.rb +106 -0
  35. data/spec/machinist/blueprint_inheritance_spec.rb +101 -0
  36. data/spec/machinist/blueprint_spec.rb +76 -0
  37. data/spec/machinist/exceptions_spec.rb +16 -0
  38. data/spec/machinist/machinable_spec.rb +91 -0
  39. data/spec/spec_helper.rb +110 -0
  40. data/spec/support/active_record_environment.rb +62 -0
  41. metadata +94 -0
data/Rakefile ADDED
@@ -0,0 +1,20 @@
1
+ begin
2
+ require 'rubygems'
3
+ require 'bundler/setup'
4
+ require 'bundler/gem_tasks'
5
+ require 'rspec/core/rake_task'
6
+
7
+ RSpec::Core::RakeTask.new(:spec)
8
+
9
+ task default: :spec
10
+ rescue LoadError
11
+ puts 'rspec is not available'
12
+ end
13
+
14
+ require 'rdoc/task'
15
+ RDoc::Task.new(:rdoc) do |rdoc|
16
+ rdoc.rdoc_dir = 'doc'
17
+ rdoc.title = 'Machinist'
18
+ rdoc.options << '--line-numbers'
19
+ rdoc.rdoc_files.include('lib')
20
+ end
@@ -0,0 +1,38 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "http://rubygems.org"
4
+
5
+ ruby RUBY_VERSION
6
+
7
+ gem "activerecord", "~> 4.2.8", group: :test, require: false
8
+
9
+ group :development do
10
+ gem 'appraisal', require: false
11
+ gem 'gem-release', require: false
12
+ gem 'github_changelog_generator', require: false
13
+ gem 'guard', require: false
14
+ gem 'guard-rspec', require: false
15
+ gem 'guard-rubocop', require: false
16
+ gem 'guard-rubycritic', require: false
17
+ gem 'rdoc', require: false
18
+ gem 'rubocop-rspec', require: false
19
+ end
20
+
21
+ group :test do
22
+ gem "codeclimate-test-reporter", require: false
23
+ gem "coveralls", require: false
24
+ gem "fuubar", require: false
25
+ gem "rspec", require: false
26
+ gem "rspec_junit_formatter", require: false
27
+ gem "simplecov", "~> 0.14", require: false
28
+ end
29
+
30
+ platforms :ruby do
31
+ gem "sqlite3"
32
+ end
33
+
34
+ platforms :jruby do
35
+ gem "activerecord-jdbcsqlite3-adapter"
36
+ end
37
+
38
+ gemspec path: "../"
@@ -0,0 +1,232 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ machinist_redux (3.0.0)
5
+
6
+ GEM
7
+ remote: http://rubygems.org/
8
+ specs:
9
+ activemodel (4.2.8)
10
+ activesupport (= 4.2.8)
11
+ builder (~> 3.1)
12
+ activerecord (4.2.8)
13
+ activemodel (= 4.2.8)
14
+ activesupport (= 4.2.8)
15
+ arel (~> 6.0)
16
+ activesupport (4.2.8)
17
+ i18n (~> 0.7)
18
+ minitest (~> 5.1)
19
+ thread_safe (~> 0.3, >= 0.3.4)
20
+ tzinfo (~> 1.1)
21
+ addressable (2.5.1)
22
+ public_suffix (~> 2.0, >= 2.0.2)
23
+ appraisal (2.2.0)
24
+ bundler
25
+ rake
26
+ thor (>= 0.14.0)
27
+ arel (6.0.4)
28
+ ast (2.3.0)
29
+ axiom-types (0.1.1)
30
+ descendants_tracker (~> 0.0.4)
31
+ ice_nine (~> 0.11.0)
32
+ thread_safe (~> 0.3, >= 0.3.1)
33
+ builder (3.2.3)
34
+ codeclimate-engine-rb (0.4.0)
35
+ virtus (~> 1.0)
36
+ codeclimate-test-reporter (1.0.7)
37
+ simplecov
38
+ coderay (1.1.1)
39
+ coercible (1.0.0)
40
+ descendants_tracker (~> 0.0.1)
41
+ coveralls (0.8.21)
42
+ json (>= 1.8, < 3)
43
+ simplecov (~> 0.14.1)
44
+ term-ansicolor (~> 1.3)
45
+ thor (~> 0.19.4)
46
+ tins (~> 1.6)
47
+ descendants_tracker (0.0.4)
48
+ thread_safe (~> 0.3, >= 0.3.1)
49
+ diff-lcs (1.3)
50
+ docile (1.1.5)
51
+ equalizer (0.0.11)
52
+ erubis (2.7.0)
53
+ faraday (0.12.1)
54
+ multipart-post (>= 1.2, < 3)
55
+ faraday-http-cache (2.0.0)
56
+ faraday (~> 0.8)
57
+ ffi (1.9.18)
58
+ flay (2.9.0)
59
+ erubis (~> 2.7.0)
60
+ path_expander (~> 1.0)
61
+ ruby_parser (~> 3.0)
62
+ sexp_processor (~> 4.0)
63
+ flog (4.6.1)
64
+ path_expander (~> 1.0)
65
+ ruby_parser (~> 3.1, > 3.1.0)
66
+ sexp_processor (~> 4.8)
67
+ formatador (0.2.5)
68
+ fuubar (2.2.0)
69
+ rspec-core (~> 3.0)
70
+ ruby-progressbar (~> 1.4)
71
+ gem-release (1.0.0)
72
+ github_changelog_generator (1.14.3)
73
+ activesupport
74
+ faraday-http-cache
75
+ multi_json
76
+ octokit (~> 4.6)
77
+ rainbow (>= 2.1)
78
+ rake (>= 10.0)
79
+ retriable (~> 2.1)
80
+ guard (2.14.1)
81
+ formatador (>= 0.2.4)
82
+ listen (>= 2.7, < 4.0)
83
+ lumberjack (~> 1.0)
84
+ nenv (~> 0.1)
85
+ notiffany (~> 0.0)
86
+ pry (>= 0.9.12)
87
+ shellany (~> 0.0)
88
+ thor (>= 0.18.1)
89
+ guard-compat (1.2.1)
90
+ guard-rspec (4.7.3)
91
+ guard (~> 2.1)
92
+ guard-compat (~> 1.1)
93
+ rspec (>= 2.99.0, < 4.0)
94
+ guard-rubocop (1.2.0)
95
+ guard (~> 2.0)
96
+ rubocop (~> 0.20)
97
+ guard-rubycritic (2.9.3)
98
+ guard (~> 2.6)
99
+ rubycritic (>= 2.9.3)
100
+ i18n (0.8.1)
101
+ ice_nine (0.11.2)
102
+ json (2.1.0)
103
+ launchy (2.4.3)
104
+ addressable (~> 2.3)
105
+ listen (3.1.5)
106
+ rb-fsevent (~> 0.9, >= 0.9.4)
107
+ rb-inotify (~> 0.9, >= 0.9.7)
108
+ ruby_dep (~> 1.2)
109
+ lumberjack (1.0.12)
110
+ method_source (0.8.2)
111
+ minitest (5.10.2)
112
+ multi_json (1.12.1)
113
+ multipart-post (2.0.0)
114
+ nenv (0.3.0)
115
+ notiffany (0.1.1)
116
+ nenv (~> 0.1)
117
+ shellany (~> 0.0)
118
+ octokit (4.7.0)
119
+ sawyer (~> 0.8.0, >= 0.5.3)
120
+ parser (2.4.0.0)
121
+ ast (~> 2.2)
122
+ path_expander (1.0.2)
123
+ powerpack (0.1.1)
124
+ pry (0.10.4)
125
+ coderay (~> 1.1.0)
126
+ method_source (~> 0.8.1)
127
+ slop (~> 3.4)
128
+ public_suffix (2.0.5)
129
+ rainbow (2.2.2)
130
+ rake
131
+ rake (12.0.0)
132
+ rb-fsevent (0.9.8)
133
+ rb-inotify (0.9.8)
134
+ ffi (>= 0.5.0)
135
+ rdoc (5.1.0)
136
+ reek (4.6.2)
137
+ codeclimate-engine-rb (~> 0.4.0)
138
+ parser (>= 2.4.0.0, < 2.5)
139
+ rainbow (~> 2.0)
140
+ retriable (2.1.0)
141
+ rspec (3.6.0)
142
+ rspec-core (~> 3.6.0)
143
+ rspec-expectations (~> 3.6.0)
144
+ rspec-mocks (~> 3.6.0)
145
+ rspec-core (3.6.0)
146
+ rspec-support (~> 3.6.0)
147
+ rspec-expectations (3.6.0)
148
+ diff-lcs (>= 1.2.0, < 2.0)
149
+ rspec-support (~> 3.6.0)
150
+ rspec-mocks (3.6.0)
151
+ diff-lcs (>= 1.2.0, < 2.0)
152
+ rspec-support (~> 3.6.0)
153
+ rspec-support (3.6.0)
154
+ rspec_junit_formatter (0.2.3)
155
+ builder (< 4)
156
+ rspec-core (>= 2, < 4, != 2.12.0)
157
+ rubocop (0.48.1)
158
+ parser (>= 2.3.3.1, < 3.0)
159
+ powerpack (~> 0.1)
160
+ rainbow (>= 1.99.1, < 3.0)
161
+ ruby-progressbar (~> 1.7)
162
+ unicode-display_width (~> 1.0, >= 1.0.1)
163
+ rubocop-rspec (1.15.1)
164
+ rubocop (>= 0.42.0)
165
+ ruby-progressbar (1.8.1)
166
+ ruby_dep (1.5.0)
167
+ ruby_parser (3.9.0)
168
+ sexp_processor (~> 4.1)
169
+ rubycritic (3.2.1)
170
+ flay (~> 2.8)
171
+ flog (~> 4.4)
172
+ launchy (= 2.4.3)
173
+ parser (= 2.4.0)
174
+ rainbow (~> 2.1)
175
+ reek (~> 4.4)
176
+ ruby_parser (~> 3.8)
177
+ virtus (~> 1.0)
178
+ sawyer (0.8.1)
179
+ addressable (>= 2.3.5, < 2.6)
180
+ faraday (~> 0.8, < 1.0)
181
+ sexp_processor (4.9.0)
182
+ shellany (0.0.1)
183
+ simplecov (0.14.1)
184
+ docile (~> 1.1.0)
185
+ json (>= 1.8, < 3)
186
+ simplecov-html (~> 0.10.0)
187
+ simplecov-html (0.10.0)
188
+ slop (3.6.0)
189
+ sqlite3 (1.3.13)
190
+ term-ansicolor (1.6.0)
191
+ tins (~> 1.0)
192
+ thor (0.19.4)
193
+ thread_safe (0.3.6)
194
+ tins (1.14.0)
195
+ tzinfo (1.2.3)
196
+ thread_safe (~> 0.1)
197
+ unicode-display_width (1.2.1)
198
+ virtus (1.0.5)
199
+ axiom-types (~> 0.1)
200
+ coercible (~> 1.0)
201
+ descendants_tracker (~> 0.0, >= 0.0.3)
202
+ equalizer (~> 0.0, >= 0.0.9)
203
+
204
+ PLATFORMS
205
+ ruby
206
+
207
+ DEPENDENCIES
208
+ activerecord (~> 4.2.8)
209
+ activerecord-jdbcsqlite3-adapter
210
+ appraisal
211
+ codeclimate-test-reporter
212
+ coveralls
213
+ fuubar
214
+ gem-release
215
+ github_changelog_generator
216
+ guard
217
+ guard-rspec
218
+ guard-rubocop
219
+ guard-rubycritic
220
+ machinist_redux!
221
+ rdoc
222
+ rspec
223
+ rspec_junit_formatter
224
+ rubocop-rspec
225
+ simplecov (~> 0.14)
226
+ sqlite3
227
+
228
+ RUBY VERSION
229
+ ruby 2.3.4p301
230
+
231
+ BUNDLED WITH
232
+ 1.14.6
@@ -0,0 +1,38 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "http://rubygems.org"
4
+
5
+ ruby RUBY_VERSION
6
+
7
+ gem "activerecord", "~> 5.0.3", group: :test, require: false
8
+
9
+ group :development do
10
+ gem 'appraisal', require: false
11
+ gem 'gem-release', require: false
12
+ gem 'github_changelog_generator', require: false
13
+ gem 'guard', require: false
14
+ gem 'guard-rspec', require: false
15
+ gem 'guard-rubocop', require: false
16
+ gem 'guard-rubycritic', require: false
17
+ gem 'rdoc', require: false
18
+ gem 'rubocop-rspec', require: false
19
+ end
20
+
21
+ group :test do
22
+ gem "codeclimate-test-reporter", require: false
23
+ gem "coveralls", require: false
24
+ gem "fuubar", require: false
25
+ gem "rspec", require: false
26
+ gem "rspec_junit_formatter", require: false
27
+ gem "simplecov", "~> 0.14", require: false
28
+ end
29
+
30
+ platforms :ruby do
31
+ gem "sqlite3"
32
+ end
33
+
34
+ platforms :jruby do
35
+ gem "activerecord-jdbcsqlite3-adapter"
36
+ end
37
+
38
+ gemspec path: "../"
@@ -0,0 +1,232 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ machinist_redux (3.0.0)
5
+
6
+ GEM
7
+ remote: http://rubygems.org/
8
+ specs:
9
+ activemodel (5.0.3)
10
+ activesupport (= 5.0.3)
11
+ activerecord (5.0.3)
12
+ activemodel (= 5.0.3)
13
+ activesupport (= 5.0.3)
14
+ arel (~> 7.0)
15
+ activesupport (5.0.3)
16
+ concurrent-ruby (~> 1.0, >= 1.0.2)
17
+ i18n (~> 0.7)
18
+ minitest (~> 5.1)
19
+ tzinfo (~> 1.1)
20
+ addressable (2.5.1)
21
+ public_suffix (~> 2.0, >= 2.0.2)
22
+ appraisal (2.2.0)
23
+ bundler
24
+ rake
25
+ thor (>= 0.14.0)
26
+ arel (7.1.4)
27
+ ast (2.3.0)
28
+ axiom-types (0.1.1)
29
+ descendants_tracker (~> 0.0.4)
30
+ ice_nine (~> 0.11.0)
31
+ thread_safe (~> 0.3, >= 0.3.1)
32
+ builder (3.2.3)
33
+ codeclimate-engine-rb (0.4.0)
34
+ virtus (~> 1.0)
35
+ codeclimate-test-reporter (1.0.7)
36
+ simplecov
37
+ coderay (1.1.1)
38
+ coercible (1.0.0)
39
+ descendants_tracker (~> 0.0.1)
40
+ concurrent-ruby (1.0.5)
41
+ coveralls (0.8.21)
42
+ json (>= 1.8, < 3)
43
+ simplecov (~> 0.14.1)
44
+ term-ansicolor (~> 1.3)
45
+ thor (~> 0.19.4)
46
+ tins (~> 1.6)
47
+ descendants_tracker (0.0.4)
48
+ thread_safe (~> 0.3, >= 0.3.1)
49
+ diff-lcs (1.3)
50
+ docile (1.1.5)
51
+ equalizer (0.0.11)
52
+ erubis (2.7.0)
53
+ faraday (0.12.1)
54
+ multipart-post (>= 1.2, < 3)
55
+ faraday-http-cache (2.0.0)
56
+ faraday (~> 0.8)
57
+ ffi (1.9.18)
58
+ flay (2.9.0)
59
+ erubis (~> 2.7.0)
60
+ path_expander (~> 1.0)
61
+ ruby_parser (~> 3.0)
62
+ sexp_processor (~> 4.0)
63
+ flog (4.6.1)
64
+ path_expander (~> 1.0)
65
+ ruby_parser (~> 3.1, > 3.1.0)
66
+ sexp_processor (~> 4.8)
67
+ formatador (0.2.5)
68
+ fuubar (2.2.0)
69
+ rspec-core (~> 3.0)
70
+ ruby-progressbar (~> 1.4)
71
+ gem-release (1.0.0)
72
+ github_changelog_generator (1.14.3)
73
+ activesupport
74
+ faraday-http-cache
75
+ multi_json
76
+ octokit (~> 4.6)
77
+ rainbow (>= 2.1)
78
+ rake (>= 10.0)
79
+ retriable (~> 2.1)
80
+ guard (2.14.1)
81
+ formatador (>= 0.2.4)
82
+ listen (>= 2.7, < 4.0)
83
+ lumberjack (~> 1.0)
84
+ nenv (~> 0.1)
85
+ notiffany (~> 0.0)
86
+ pry (>= 0.9.12)
87
+ shellany (~> 0.0)
88
+ thor (>= 0.18.1)
89
+ guard-compat (1.2.1)
90
+ guard-rspec (4.7.3)
91
+ guard (~> 2.1)
92
+ guard-compat (~> 1.1)
93
+ rspec (>= 2.99.0, < 4.0)
94
+ guard-rubocop (1.2.0)
95
+ guard (~> 2.0)
96
+ rubocop (~> 0.20)
97
+ guard-rubycritic (2.9.3)
98
+ guard (~> 2.6)
99
+ rubycritic (>= 2.9.3)
100
+ i18n (0.8.1)
101
+ ice_nine (0.11.2)
102
+ json (2.1.0)
103
+ launchy (2.4.3)
104
+ addressable (~> 2.3)
105
+ listen (3.1.5)
106
+ rb-fsevent (~> 0.9, >= 0.9.4)
107
+ rb-inotify (~> 0.9, >= 0.9.7)
108
+ ruby_dep (~> 1.2)
109
+ lumberjack (1.0.12)
110
+ method_source (0.8.2)
111
+ minitest (5.10.2)
112
+ multi_json (1.12.1)
113
+ multipart-post (2.0.0)
114
+ nenv (0.3.0)
115
+ notiffany (0.1.1)
116
+ nenv (~> 0.1)
117
+ shellany (~> 0.0)
118
+ octokit (4.7.0)
119
+ sawyer (~> 0.8.0, >= 0.5.3)
120
+ parser (2.4.0.0)
121
+ ast (~> 2.2)
122
+ path_expander (1.0.2)
123
+ powerpack (0.1.1)
124
+ pry (0.10.4)
125
+ coderay (~> 1.1.0)
126
+ method_source (~> 0.8.1)
127
+ slop (~> 3.4)
128
+ public_suffix (2.0.5)
129
+ rainbow (2.2.2)
130
+ rake
131
+ rake (12.0.0)
132
+ rb-fsevent (0.9.8)
133
+ rb-inotify (0.9.8)
134
+ ffi (>= 0.5.0)
135
+ rdoc (5.1.0)
136
+ reek (4.6.2)
137
+ codeclimate-engine-rb (~> 0.4.0)
138
+ parser (>= 2.4.0.0, < 2.5)
139
+ rainbow (~> 2.0)
140
+ retriable (2.1.0)
141
+ rspec (3.6.0)
142
+ rspec-core (~> 3.6.0)
143
+ rspec-expectations (~> 3.6.0)
144
+ rspec-mocks (~> 3.6.0)
145
+ rspec-core (3.6.0)
146
+ rspec-support (~> 3.6.0)
147
+ rspec-expectations (3.6.0)
148
+ diff-lcs (>= 1.2.0, < 2.0)
149
+ rspec-support (~> 3.6.0)
150
+ rspec-mocks (3.6.0)
151
+ diff-lcs (>= 1.2.0, < 2.0)
152
+ rspec-support (~> 3.6.0)
153
+ rspec-support (3.6.0)
154
+ rspec_junit_formatter (0.2.3)
155
+ builder (< 4)
156
+ rspec-core (>= 2, < 4, != 2.12.0)
157
+ rubocop (0.48.1)
158
+ parser (>= 2.3.3.1, < 3.0)
159
+ powerpack (~> 0.1)
160
+ rainbow (>= 1.99.1, < 3.0)
161
+ ruby-progressbar (~> 1.7)
162
+ unicode-display_width (~> 1.0, >= 1.0.1)
163
+ rubocop-rspec (1.15.1)
164
+ rubocop (>= 0.42.0)
165
+ ruby-progressbar (1.8.1)
166
+ ruby_dep (1.5.0)
167
+ ruby_parser (3.9.0)
168
+ sexp_processor (~> 4.1)
169
+ rubycritic (3.2.1)
170
+ flay (~> 2.8)
171
+ flog (~> 4.4)
172
+ launchy (= 2.4.3)
173
+ parser (= 2.4.0)
174
+ rainbow (~> 2.1)
175
+ reek (~> 4.4)
176
+ ruby_parser (~> 3.8)
177
+ virtus (~> 1.0)
178
+ sawyer (0.8.1)
179
+ addressable (>= 2.3.5, < 2.6)
180
+ faraday (~> 0.8, < 1.0)
181
+ sexp_processor (4.9.0)
182
+ shellany (0.0.1)
183
+ simplecov (0.14.1)
184
+ docile (~> 1.1.0)
185
+ json (>= 1.8, < 3)
186
+ simplecov-html (~> 0.10.0)
187
+ simplecov-html (0.10.0)
188
+ slop (3.6.0)
189
+ sqlite3 (1.3.13)
190
+ term-ansicolor (1.6.0)
191
+ tins (~> 1.0)
192
+ thor (0.19.4)
193
+ thread_safe (0.3.6)
194
+ tins (1.14.0)
195
+ tzinfo (1.2.3)
196
+ thread_safe (~> 0.1)
197
+ unicode-display_width (1.2.1)
198
+ virtus (1.0.5)
199
+ axiom-types (~> 0.1)
200
+ coercible (~> 1.0)
201
+ descendants_tracker (~> 0.0, >= 0.0.3)
202
+ equalizer (~> 0.0, >= 0.0.9)
203
+
204
+ PLATFORMS
205
+ ruby
206
+
207
+ DEPENDENCIES
208
+ activerecord (~> 5.0.3)
209
+ activerecord-jdbcsqlite3-adapter
210
+ appraisal
211
+ codeclimate-test-reporter
212
+ coveralls
213
+ fuubar
214
+ gem-release
215
+ github_changelog_generator
216
+ guard
217
+ guard-rspec
218
+ guard-rubocop
219
+ guard-rubycritic
220
+ machinist_redux!
221
+ rdoc
222
+ rspec
223
+ rspec_junit_formatter
224
+ rubocop-rspec
225
+ simplecov (~> 0.14)
226
+ sqlite3
227
+
228
+ RUBY VERSION
229
+ ruby 2.3.4p301
230
+
231
+ BUNDLED WITH
232
+ 1.14.6