potassium 5.2.3 → 6.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 (62) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +22 -9
  3. data/.node-version +1 -0
  4. data/.ruby-version +1 -1
  5. data/CHANGELOG.md +26 -0
  6. data/docs/DSL.md +5 -5
  7. data/lib/potassium/assets/.circleci/config.yml.erb +102 -0
  8. data/lib/potassium/assets/.eslintrc.json +343 -0
  9. data/lib/potassium/assets/.rubocop.yml +515 -0
  10. data/lib/potassium/assets/.stylelintrc.json +46 -0
  11. data/lib/potassium/assets/Dockerfile.ci +1 -1
  12. data/lib/potassium/assets/Makefile.erb +6 -32
  13. data/lib/potassium/assets/README.yml +51 -7
  14. data/lib/potassium/assets/active_admin/admin-component.vue +35 -0
  15. data/lib/potassium/assets/active_admin/admin_application.js +14 -0
  16. data/lib/potassium/assets/active_admin/init_activeadmin_vue.rb +10 -0
  17. data/lib/potassium/assets/api/base_controller.rb +1 -3
  18. data/lib/potassium/assets/app/javascript/app.spec.js +14 -0
  19. data/lib/potassium/assets/app/uploaders/base_uploader.rb +13 -0
  20. data/lib/potassium/assets/app/uploaders/image_uploader.rb +5 -0
  21. data/lib/potassium/assets/bin/cibuild.erb +18 -1
  22. data/lib/potassium/assets/bin/setup.erb +1 -1
  23. data/lib/potassium/assets/config/database_mysql.yml.erb +2 -2
  24. data/lib/potassium/assets/config/database_postgresql.yml.erb +2 -2
  25. data/lib/potassium/assets/config/shrine.rb +33 -0
  26. data/lib/potassium/assets/docker-compose.ci.yml +1 -0
  27. data/lib/potassium/assets/lib/tasks/auto_annotate_models.rake +2 -1
  28. data/lib/potassium/assets/package.json +4 -1
  29. data/lib/potassium/cli/commands/create.rb +1 -0
  30. data/lib/potassium/cli_options.rb +6 -6
  31. data/lib/potassium/helpers/template-helpers.rb +4 -0
  32. data/lib/potassium/recipes/admin.rb +3 -3
  33. data/lib/potassium/recipes/annotate.rb +1 -1
  34. data/lib/potassium/recipes/ci.rb +1 -1
  35. data/lib/potassium/recipes/database_container.rb +5 -4
  36. data/lib/potassium/recipes/draper.rb +1 -1
  37. data/lib/potassium/recipes/file_storage.rb +15 -33
  38. data/lib/potassium/recipes/front_end.rb +128 -5
  39. data/lib/potassium/recipes/mailer.rb +5 -2
  40. data/lib/potassium/recipes/node.rb +21 -0
  41. data/lib/potassium/recipes/rack_cors.rb +18 -15
  42. data/lib/potassium/recipes/schedule.rb +1 -1
  43. data/lib/potassium/recipes/style.rb +21 -3
  44. data/lib/potassium/recipes/vue_admin.rb +124 -0
  45. data/lib/potassium/templates/application.rb +4 -2
  46. data/lib/potassium/version.rb +4 -3
  47. data/potassium.gemspec +6 -5
  48. data/spec/features/database_container_spec.rb +1 -1
  49. data/spec/features/file_storage_spec.rb +12 -16
  50. data/spec/features/front_end_spec.rb +74 -0
  51. data/spec/features/new_project_spec.rb +1 -1
  52. data/spec/features/node_spec.rb +28 -0
  53. data/spec/features/power_types_spec.rb +5 -16
  54. data/spec/features/vue_admin_spec.rb +47 -0
  55. data/spec/support/potassium_test_helpers.rb +23 -9
  56. metadata +56 -29
  57. data/lib/potassium/assets/.circleci/config.yml +0 -20
  58. data/lib/potassium/assets/active_admin/active_admin.js.coffee +0 -4
  59. data/lib/potassium/assets/active_admin/init_activeadmin_angular.rb +0 -8
  60. data/lib/potassium/assets/testing/paperclip.rb +0 -59
  61. data/lib/potassium/recipes/angular_admin.rb +0 -56
  62. data/spec/features/front_end.rb +0 -33
@@ -19,6 +19,7 @@ module PotassiumTestHelpers
19
19
  Dir.chdir(tmp_path) do
20
20
  Bundler.with_clean_env do
21
21
  add_fakes_to_path
22
+ add_project_bin_to_path
22
23
  full_arguments = hash_to_arguments(create_arguments(true).merge(arguments))
23
24
  run_command("#{potassium_bin} create #{APP_NAME} #{full_arguments}")
24
25
  on_project { run_command("hound rules update ruby --local") }
@@ -28,11 +29,16 @@ module PotassiumTestHelpers
28
29
 
29
30
  def drop_dummy_database
30
31
  return unless File.exist?(project_path)
32
+
31
33
  on_project { run_command("bundle exec rails db:drop") }
32
34
  end
33
35
 
36
+ def add_project_bin_to_path
37
+ add_to_path project_bin, true
38
+ end
39
+
34
40
  def add_fakes_to_path
35
- ENV["PATH"] = "#{support_bin}:#{ENV['PATH']}"
41
+ add_to_path support_bin
36
42
  end
37
43
 
38
44
  def project_path
@@ -53,14 +59,6 @@ module PotassiumTestHelpers
53
59
 
54
60
  private
55
61
 
56
- def tmp_path
57
- @tmp_path ||= Pathname.new("#{root_path}/tmp")
58
- end
59
-
60
- def potassium_bin
61
- File.join(root_path, "bin", "potassium")
62
- end
63
-
64
62
  def hash_to_arguments(hash)
65
63
  hash.map do |key, value|
66
64
  if value == true
@@ -73,10 +71,26 @@ module PotassiumTestHelpers
73
71
  end.join(" ")
74
72
  end
75
73
 
74
+ def add_to_path(new_path, append = false)
75
+ ENV['PATH'] = append ? "#{ENV['PATH']}:#{new_path}" : "#{new_path}:#{ENV['PATH']}"
76
+ end
77
+
78
+ def project_bin
79
+ File.join(project_path, 'bin')
80
+ end
81
+
82
+ def potassium_bin
83
+ File.join(root_path, "bin", "potassium")
84
+ end
85
+
76
86
  def support_bin
77
87
  File.join(root_path, "spec", "fakes", "bin")
78
88
  end
79
89
 
90
+ def tmp_path
91
+ @tmp_path ||= Pathname.new("#{root_path}/tmp")
92
+ end
93
+
80
94
  def root_path
81
95
  File.expand_path("../../../", __FILE__)
82
96
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: potassium
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.2.3
4
+ version: 6.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - juliogarciag
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-21 00:00:00.000000000 Z
11
+ date: 2020-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,14 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.7'
19
+ version: '2.0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.7'
26
+ version: '2.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: pry
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 0.10.3
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 0.10.3
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: rake
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -53,19 +67,19 @@ dependencies:
53
67
  - !ruby/object:Gem::Version
54
68
  version: 3.4.0
55
69
  - !ruby/object:Gem::Dependency
56
- name: pry
70
+ name: rspec_junit_formatter
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
- - - "~>"
73
+ - - ">="
60
74
  - !ruby/object:Gem::Version
61
- version: 0.10.3
75
+ version: '0'
62
76
  type: :development
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
- - - "~>"
80
+ - - ">="
67
81
  - !ruby/object:Gem::Version
68
- version: 0.10.3
82
+ version: '0'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: rubocop
71
85
  requirement: !ruby/object:Gem::Requirement
@@ -95,19 +109,19 @@ dependencies:
95
109
  - !ruby/object:Gem::Version
96
110
  version: '0'
97
111
  - !ruby/object:Gem::Dependency
98
- name: rails
112
+ name: gems
99
113
  requirement: !ruby/object:Gem::Requirement
100
114
  requirements:
101
115
  - - "~>"
102
116
  - !ruby/object:Gem::Version
103
- version: 5.2.1
117
+ version: '0.8'
104
118
  type: :runtime
105
119
  prerelease: false
106
120
  version_requirements: !ruby/object:Gem::Requirement
107
121
  requirements:
108
122
  - - "~>"
109
123
  - !ruby/object:Gem::Version
110
- version: 5.2.1
124
+ version: '0.8'
111
125
  - !ruby/object:Gem::Dependency
112
126
  name: gli
113
127
  requirement: !ruby/object:Gem::Requirement
@@ -137,47 +151,47 @@ dependencies:
137
151
  - !ruby/object:Gem::Version
138
152
  version: '0.2'
139
153
  - !ruby/object:Gem::Dependency
140
- name: gems
154
+ name: levenshtein
141
155
  requirement: !ruby/object:Gem::Requirement
142
156
  requirements:
143
157
  - - "~>"
144
158
  - !ruby/object:Gem::Version
145
- version: '0.8'
159
+ version: '0.2'
146
160
  type: :runtime
147
161
  prerelease: false
148
162
  version_requirements: !ruby/object:Gem::Requirement
149
163
  requirements:
150
164
  - - "~>"
151
165
  - !ruby/object:Gem::Version
152
- version: '0.8'
166
+ version: '0.2'
153
167
  - !ruby/object:Gem::Dependency
154
- name: semantic
168
+ name: rails
155
169
  requirement: !ruby/object:Gem::Requirement
156
170
  requirements:
157
171
  - - "~>"
158
172
  - !ruby/object:Gem::Version
159
- version: '1.4'
173
+ version: 6.0.2
160
174
  type: :runtime
161
175
  prerelease: false
162
176
  version_requirements: !ruby/object:Gem::Requirement
163
177
  requirements:
164
178
  - - "~>"
165
179
  - !ruby/object:Gem::Version
166
- version: '1.4'
180
+ version: 6.0.2
167
181
  - !ruby/object:Gem::Dependency
168
- name: levenshtein
182
+ name: semantic
169
183
  requirement: !ruby/object:Gem::Requirement
170
184
  requirements:
171
185
  - - "~>"
172
186
  - !ruby/object:Gem::Version
173
- version: '0.2'
187
+ version: '1.4'
174
188
  type: :runtime
175
189
  prerelease: false
176
190
  version_requirements: !ruby/object:Gem::Requirement
177
191
  requirements:
178
192
  - - "~>"
179
193
  - !ruby/object:Gem::Version
180
- version: '0.2'
194
+ version: '1.4'
181
195
  description: An application generator from Platanus
182
196
  email:
183
197
  - julioggonz@gmail.com
@@ -190,6 +204,7 @@ files:
190
204
  - ".circleci/config.yml"
191
205
  - ".editorconfig"
192
206
  - ".gitignore"
207
+ - ".node-version"
193
208
  - ".rspec"
194
209
  - ".ruby-version"
195
210
  - CHANGELOG.md
@@ -203,26 +218,33 @@ files:
203
218
  - docs/DSL.md
204
219
  - lib/potassium.rb
205
220
  - lib/potassium/assets/.buildpacks
206
- - lib/potassium/assets/.circleci/config.yml
221
+ - lib/potassium/assets/.circleci/config.yml.erb
207
222
  - lib/potassium/assets/.dockerignore
208
223
  - lib/potassium/assets/.editorconfig
209
224
  - lib/potassium/assets/.env.development.erb
225
+ - lib/potassium/assets/.eslintrc.json
210
226
  - lib/potassium/assets/.pryrc
227
+ - lib/potassium/assets/.rubocop.yml
228
+ - lib/potassium/assets/.stylelintrc.json
211
229
  - lib/potassium/assets/Dockerfile.ci
212
230
  - lib/potassium/assets/Makefile.erb
213
231
  - lib/potassium/assets/Procfile
214
232
  - lib/potassium/assets/README.md.erb
215
233
  - lib/potassium/assets/README.yml
216
- - lib/potassium/assets/active_admin/active_admin.js.coffee
234
+ - lib/potassium/assets/active_admin/admin-component.vue
235
+ - lib/potassium/assets/active_admin/admin_application.js
217
236
  - lib/potassium/assets/active_admin/admin_user_policy.rb
218
237
  - lib/potassium/assets/active_admin/comment_policy.rb
219
- - lib/potassium/assets/active_admin/init_activeadmin_angular.rb
238
+ - lib/potassium/assets/active_admin/init_activeadmin_vue.rb
220
239
  - lib/potassium/assets/active_admin/pundit_page_policy.rb
221
240
  - lib/potassium/assets/api/api_error_concern.rb
222
241
  - lib/potassium/assets/api/base_controller.rb
223
242
  - lib/potassium/assets/api/draper_responder.rb
224
243
  - lib/potassium/assets/api/responder.rb
244
+ - lib/potassium/assets/app/javascript/app.spec.js
225
245
  - lib/potassium/assets/app/mailers/application_mailer.rb
246
+ - lib/potassium/assets/app/uploaders/base_uploader.rb
247
+ - lib/potassium/assets/app/uploaders/image_uploader.rb
226
248
  - lib/potassium/assets/bin/cibuild.erb
227
249
  - lib/potassium/assets/bin/release
228
250
  - lib/potassium/assets/bin/setup.erb
@@ -234,6 +256,7 @@ files:
234
256
  - lib/potassium/assets/config/puma.rb
235
257
  - lib/potassium/assets/config/secrets.yml.erb
236
258
  - lib/potassium/assets/config/sentry.rb.erb
259
+ - lib/potassium/assets/config/shrine.rb
237
260
  - lib/potassium/assets/config/storage.yml
238
261
  - lib/potassium/assets/docker-compose.ci.yml
239
262
  - lib/potassium/assets/docker-compose.yml
@@ -249,7 +272,6 @@ files:
249
272
  - lib/potassium/assets/sidekiq.yml
250
273
  - lib/potassium/assets/sidekiq_scheduler.yml
251
274
  - lib/potassium/assets/testing/.rspec
252
- - lib/potassium/assets/testing/paperclip.rb
253
275
  - lib/potassium/assets/testing/platanus.png
254
276
  - lib/potassium/assets/testing/rails_helper.rb
255
277
  - lib/potassium/cli.rb
@@ -272,7 +294,6 @@ files:
272
294
  - lib/potassium/newest_version_ensurer.rb
273
295
  - lib/potassium/recipe.rb
274
296
  - lib/potassium/recipes/admin.rb
275
- - lib/potassium/recipes/angular_admin.rb
276
297
  - lib/potassium/recipes/annotate.rb
277
298
  - lib/potassium/recipes/api.rb
278
299
  - lib/potassium/recipes/background_processor.rb
@@ -294,6 +315,7 @@ files:
294
315
  - lib/potassium/recipes/i18n.rb
295
316
  - lib/potassium/recipes/listen.rb
296
317
  - lib/potassium/recipes/mailer.rb
318
+ - lib/potassium/recipes/node.rb
297
319
  - lib/potassium/recipes/power_types.rb
298
320
  - lib/potassium/recipes/pry.rb
299
321
  - lib/potassium/recipes/puma.rb
@@ -309,6 +331,7 @@ files:
309
331
  - lib/potassium/recipes/style.rb
310
332
  - lib/potassium/recipes/testing.rb
311
333
  - lib/potassium/recipes/tzinfo.rb
334
+ - lib/potassium/recipes/vue_admin.rb
312
335
  - lib/potassium/recipes/yarn.rb
313
336
  - lib/potassium/template_finder.rb
314
337
  - lib/potassium/templates/application.rb
@@ -327,14 +350,16 @@ files:
327
350
  - spec/features/draper_spec.rb
328
351
  - spec/features/error_reporting_spec.rb
329
352
  - spec/features/file_storage_spec.rb
330
- - spec/features/front_end.rb
353
+ - spec/features/front_end_spec.rb
331
354
  - spec/features/github_spec.rb
332
355
  - spec/features/heroku_spec.rb
333
356
  - spec/features/i18n_spec.rb
334
357
  - spec/features/mailer_spec.rb
335
358
  - spec/features/new_project_spec.rb
359
+ - spec/features/node_spec.rb
336
360
  - spec/features/power_types_spec.rb
337
361
  - spec/features/schedule_spec.rb
362
+ - spec/features/vue_admin_spec.rb
338
363
  - spec/spec_helper.rb
339
364
  - spec/support/fake_github.rb
340
365
  - spec/support/fake_heroku.rb
@@ -358,7 +383,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
358
383
  - !ruby/object:Gem::Version
359
384
  version: '0'
360
385
  requirements: []
361
- rubygems_version: 3.0.3
386
+ rubygems_version: 3.1.2
362
387
  signing_key:
363
388
  specification_version: 4
364
389
  summary: An application generator from Platanus
@@ -373,14 +398,16 @@ test_files:
373
398
  - spec/features/draper_spec.rb
374
399
  - spec/features/error_reporting_spec.rb
375
400
  - spec/features/file_storage_spec.rb
376
- - spec/features/front_end.rb
401
+ - spec/features/front_end_spec.rb
377
402
  - spec/features/github_spec.rb
378
403
  - spec/features/heroku_spec.rb
379
404
  - spec/features/i18n_spec.rb
380
405
  - spec/features/mailer_spec.rb
381
406
  - spec/features/new_project_spec.rb
407
+ - spec/features/node_spec.rb
382
408
  - spec/features/power_types_spec.rb
383
409
  - spec/features/schedule_spec.rb
410
+ - spec/features/vue_admin_spec.rb
384
411
  - spec/spec_helper.rb
385
412
  - spec/support/fake_github.rb
386
413
  - spec/support/fake_heroku.rb
@@ -1,20 +0,0 @@
1
- version: 2
2
- jobs:
3
- build:
4
- working_directory: ~/app
5
-
6
- docker:
7
- - image: platanus/compose:1.22.0
8
-
9
- steps:
10
- - checkout
11
- - setup_remote_docker
12
-
13
- - run: docker info
14
- - run: docker-compose -f docker-compose.ci.yml pull
15
- - run: docker-compose -f docker-compose.ci.yml build test
16
- - run: bin/cibuild services
17
- - run: bin/cibuild deps
18
-
19
- - run: bin/cibuild db
20
- - run: bin/cibuild tests
@@ -1,4 +0,0 @@
1
- #= require active_admin/base
2
- #= require angular
3
- #= require admin_app
4
- #= require_tree ./admin
@@ -1,8 +0,0 @@
1
- class ActiveAdmin::Views::Pages::Base
2
- alias_method :old_add_classes_to_body, :add_classes_to_body
3
-
4
- def add_classes_to_body
5
- old_add_classes_to_body
6
- @body.set_attribute "ng-app", "ActiveAdmin"
7
- end
8
- end
@@ -1,59 +0,0 @@
1
- require "paperclip/matchers"
2
-
3
- include ActionDispatch::TestProcess
4
-
5
- test_files_path = ":rails_root/test_files/:class/:attachment/:id_partition/:filename"
6
- Paperclip::Attachment.default_options[:path] = test_files_path
7
-
8
- RSpec.configure do |config|
9
- config.fixture_path = "#{::Rails.root}/spec/assets"
10
-
11
- config.include Paperclip::Shoulda::Matchers
12
-
13
- config.after(:suite) do
14
- FileUtils.rm_rf("#{Rails.root}/test_files")
15
- FileUtils.rm_rf("#{Rails.root}/public/uploads")
16
- end
17
- end
18
-
19
- def fixture_asset(file_name, mime)
20
- file_path = Rails.root.to_s + "/spec/assets/" + file_name
21
- fixture_file_upload(file_path, mime)
22
- rescue
23
- fixture_file_upload(file_name, mime)
24
- end
25
-
26
- # GENERAL CONFIG
27
- # On test environment, paperclip attachments will be generated under /test_files directory.
28
- # After running all the specs, the test_files folder will be deleted.
29
- #
30
- # SHOULDA MATCHERS
31
- # Including Paperclip::Shoulda::Matchers will allow you to use special matchers
32
- # to work with paperclip. For example:
33
- #
34
- # describe User do
35
- # it { should have_attached_file(:avatar) }
36
- # it { should validate_attachment_presence(:avatar) }
37
- # it { should validate_attachment_content_type(:avatar).
38
- # allowing('image/png', 'image/gif').
39
- # rejecting('text/plain', 'text/xml') }
40
- # it { should validate_attachment_size(:avatar).
41
- # less_than(2.megabytes) }
42
- # end
43
- #
44
- # ASSETS
45
- # Your attachments go into /spec/assets directory. You can access them...
46
- #
47
- # From your factories:
48
- #
49
- # FactoryBot.define do
50
- # factory :ticket do
51
- # attachment { fixture_asset("platanus.png", "image/png") }
52
- # end
53
- # end
54
- #
55
- # From your specs:
56
- #
57
- # it "gets file name" do
58
- # expect(fixture_asset("platanus.png", "image/png").original_filename).to eq("platanus.png")
59
- # end
@@ -1,56 +0,0 @@
1
- class Recipes::AngularAdmin < Rails::AppBuilder
2
- def ask
3
- if selected?(:admin_mode)
4
- angular_admin = answer(:"angular-admin") do
5
- Ask.confirm "Do you want Angular support for ActiveAdmin?"
6
- end
7
- set(:angular_admin, angular_admin)
8
- end
9
- end
10
-
11
- def create
12
- recipe = self
13
- if selected?(:angular_admin)
14
- after(:admin_install) do
15
- recipe.add_angular_admin
16
- end
17
- end
18
- end
19
-
20
- def install
21
- active_admin = load_recipe(:admin)
22
- if active_admin.installed?
23
- add_angular_admin
24
- else
25
- info "ActiveAdmin can't be installed because Active Admin isn't installed."
26
- end
27
- end
28
-
29
- def installed?
30
- dir_exist?("app/assets/javascripts/admin")
31
- end
32
-
33
- def add_angular_admin
34
- copy_file '../assets/active_admin/init_activeadmin_angular.rb',
35
- 'config/initializers/init_activeadmin_angular.rb'
36
-
37
- create_file 'app/assets/javascripts/admin_app.js', "angular.module('ActiveAdmin', []);"
38
-
39
- copy_file '../assets/active_admin/active_admin.js.coffee',
40
- 'app/assets/javascripts/active_admin.js.coffee',
41
- force: true
42
-
43
- empty_directory 'app/assets/javascripts/admin'
44
- empty_directory 'app/assets/javascripts/admin/controllers'
45
- empty_directory 'app/assets/javascripts/admin/services'
46
- empty_directory 'app/assets/javascripts/admin/directives'
47
-
48
- create_file 'app/assets/javascripts/admin/controllers/.keep'
49
- create_file 'app/assets/javascripts/admin/services/.keep'
50
- create_file 'app/assets/javascripts/admin/directives/.keep'
51
-
52
- inside('.') do
53
- run('bin/yarn add angular --save')
54
- end
55
- end
56
- end