potassium 5.2.0 → 6.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (120) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +42 -0
  3. data/.editorconfig +3 -0
  4. data/.node-version +1 -0
  5. data/.ruby-version +1 -1
  6. data/CHANGELOG.md +94 -0
  7. data/README.md +41 -47
  8. data/docs/DSL.md +5 -5
  9. data/lib/potassium/assets/.buildpacks +0 -1
  10. data/lib/potassium/assets/.circleci/config.yml.erb +102 -0
  11. data/lib/potassium/assets/.eslintrc.json +352 -0
  12. data/lib/potassium/assets/.github/pull_request_template.md +9 -0
  13. data/lib/potassium/assets/.pryrc +1 -1
  14. data/lib/potassium/assets/.rubocop.yml +515 -0
  15. data/lib/potassium/assets/.stylelintrc.json +46 -0
  16. data/lib/potassium/assets/Dockerfile.ci +1 -1
  17. data/lib/potassium/assets/Makefile.erb +35 -0
  18. data/lib/potassium/assets/Procfile +1 -0
  19. data/lib/potassium/assets/README.yml +60 -11
  20. data/lib/potassium/assets/active_admin/admin-component.vue +35 -0
  21. data/lib/potassium/assets/active_admin/admin_application.js +14 -0
  22. data/lib/potassium/assets/active_admin/init_activeadmin_vue.rb +10 -0
  23. data/lib/potassium/assets/app/graphql/graphql_controller.rb +55 -0
  24. data/lib/potassium/assets/app/graphql/mutations/login_mutation.rb +23 -0
  25. data/lib/potassium/assets/app/graphql/queries/base_query.rb +4 -0
  26. data/lib/potassium/assets/app/graphql/types/base/base_argument.rb +4 -0
  27. data/lib/potassium/assets/app/graphql/types/base/base_enum.rb +4 -0
  28. data/lib/potassium/assets/app/graphql/types/base/base_field.rb +5 -0
  29. data/lib/potassium/assets/app/graphql/types/base/base_input_object.rb +5 -0
  30. data/lib/potassium/assets/app/graphql/types/base/base_interface.rb +7 -0
  31. data/lib/potassium/assets/app/graphql/types/base/base_object.rb +5 -0
  32. data/lib/potassium/assets/app/graphql/types/base/base_scalar.rb +4 -0
  33. data/lib/potassium/assets/app/graphql/types/base/base_union.rb +4 -0
  34. data/lib/potassium/assets/app/graphql/types/mutation_type.rb +10 -0
  35. data/lib/potassium/assets/app/graphql/types/query_type.rb +13 -0
  36. data/lib/potassium/assets/app/javascript/app.spec.js +14 -0
  37. data/lib/potassium/assets/app/uploaders/base_uploader.rb +11 -0
  38. data/lib/potassium/assets/app/uploaders/image_uploader.rb +5 -0
  39. data/lib/potassium/assets/bin/cibuild.erb +24 -7
  40. data/lib/potassium/assets/bin/release +9 -0
  41. data/lib/potassium/assets/bin/setup.erb +3 -0
  42. data/lib/potassium/assets/config/database_mysql.yml.erb +5 -5
  43. data/lib/potassium/assets/config/database_postgresql.yml.erb +5 -5
  44. data/lib/potassium/assets/config/graphql_playground.rb +20 -0
  45. data/lib/potassium/assets/config/puma.rb +5 -1
  46. data/lib/potassium/assets/config/shrine.rb +36 -0
  47. data/lib/potassium/assets/docker-compose.ci.yml +2 -1
  48. data/lib/potassium/assets/docker-compose.yml +6 -0
  49. data/lib/potassium/assets/lib/tasks/auto_annotate_models.rake +34 -33
  50. data/lib/potassium/assets/package.json +4 -1
  51. data/lib/potassium/assets/redis.yml +1 -2
  52. data/lib/potassium/assets/sidekiq_scheduler.yml +1 -1
  53. data/lib/potassium/assets/testing/rails_helper.rb +4 -2
  54. data/lib/potassium/cli/commands/create.rb +12 -19
  55. data/lib/potassium/cli_options.rb +67 -24
  56. data/lib/potassium/helpers/docker-helpers.rb +14 -5
  57. data/lib/potassium/helpers/gem-helpers.rb +1 -1
  58. data/lib/potassium/helpers/template-helpers.rb +4 -0
  59. data/lib/potassium/newest_version_ensurer.rb +19 -36
  60. data/lib/potassium/node_version_ensurer.rb +30 -0
  61. data/lib/potassium/recipes/admin.rb +3 -3
  62. data/lib/potassium/recipes/annotate.rb +1 -1
  63. data/lib/potassium/recipes/api.rb +93 -21
  64. data/lib/potassium/recipes/background_processor.rb +38 -2
  65. data/lib/potassium/recipes/ci.rb +8 -6
  66. data/lib/potassium/recipes/data_migrate.rb +44 -0
  67. data/lib/potassium/recipes/database.rb +6 -2
  68. data/lib/potassium/recipes/database_container.rb +90 -0
  69. data/lib/potassium/recipes/draper.rb +1 -10
  70. data/lib/potassium/recipes/file_storage.rb +66 -0
  71. data/lib/potassium/recipes/front_end.rb +219 -9
  72. data/lib/potassium/recipes/github.rb +93 -15
  73. data/lib/potassium/recipes/heroku.rb +2 -1
  74. data/lib/potassium/recipes/listen.rb +7 -0
  75. data/lib/potassium/recipes/mailer.rb +14 -4
  76. data/lib/potassium/recipes/node.rb +21 -0
  77. data/lib/potassium/recipes/puma.rb +0 -3
  78. data/lib/potassium/recipes/rack_cors.rb +18 -15
  79. data/lib/potassium/recipes/rails.rb +6 -0
  80. data/lib/potassium/recipes/schedule.rb +1 -1
  81. data/lib/potassium/recipes/style.rb +21 -3
  82. data/lib/potassium/recipes/vue_admin.rb +124 -0
  83. data/lib/potassium/templates/application.rb +10 -9
  84. data/lib/potassium/version.rb +7 -4
  85. data/potassium.gemspec +9 -6
  86. data/spec/features/api_spec.rb +25 -0
  87. data/spec/features/background_processor_spec.rb +12 -1
  88. data/spec/features/data_migrate_spec.rb +14 -0
  89. data/spec/features/database_container_spec.rb +35 -0
  90. data/spec/features/draper_spec.rb +1 -6
  91. data/spec/features/file_storage_spec.rb +75 -0
  92. data/spec/features/front_end_spec.rb +88 -0
  93. data/spec/features/github_spec.rb +53 -8
  94. data/spec/features/graphql_spec.rb +71 -0
  95. data/spec/features/heroku_spec.rb +8 -5
  96. data/spec/features/mailer_spec.rb +42 -0
  97. data/spec/features/new_project_spec.rb +6 -14
  98. data/spec/features/node_spec.rb +28 -0
  99. data/spec/features/power_types_spec.rb +5 -16
  100. data/spec/features/vue_admin_spec.rb +47 -0
  101. data/spec/spec_helper.rb +5 -0
  102. data/spec/support/fake_octokit.rb +31 -0
  103. data/spec/support/potassium_test_helpers.rb +26 -8
  104. metadata +126 -45
  105. data/circle.yml +0 -12
  106. data/lib/potassium/assets/.circleci/config.yml +0 -20
  107. data/lib/potassium/assets/active_admin/active_admin.js.coffee +0 -4
  108. data/lib/potassium/assets/active_admin/init_activeadmin_angular.rb +0 -8
  109. data/lib/potassium/assets/api/api_error_concern.rb +0 -32
  110. data/lib/potassium/assets/api/base_controller.rb +0 -9
  111. data/lib/potassium/assets/api/draper_responder.rb +0 -62
  112. data/lib/potassium/assets/api/responder.rb +0 -41
  113. data/lib/potassium/assets/aws.rb +0 -1
  114. data/lib/potassium/assets/testing/paperclip.rb +0 -59
  115. data/lib/potassium/recipes/active_storage.rb +0 -40
  116. data/lib/potassium/recipes/angular_admin.rb +0 -56
  117. data/lib/potassium/recipes/aws_sdk.rb +0 -7
  118. data/lib/potassium/recipes/paperclip.rb +0 -47
  119. data/spec/features/active_storage_spec.rb +0 -30
  120. data/spec/features/front_end.rb +0 -30
@@ -0,0 +1,71 @@
1
+ require "spec_helper"
2
+
3
+ RSpec.describe "GraphQL" do
4
+ context 'when using only graphql' do
5
+ before :all do
6
+ drop_dummy_database
7
+ remove_project_directory
8
+ create_dummy_project("api" => :graphql)
9
+ end
10
+
11
+ it "adds graphql related gems to Gemfile" do
12
+ gemfile_content = IO.read("#{project_path}/Gemfile")
13
+ expect(gemfile_content).to include("gem 'graphql'")
14
+ expect(gemfile_content).to include("gem 'graphql_playground-rails'")
15
+ expect(gemfile_content).not_to include("gem 'graphiql'")
16
+ end
17
+
18
+ it 'installs and sets up graphql' do
19
+ schema = IO.read(
20
+ "#{project_path}/app/graphql/#{PotassiumTestHelpers::APP_NAME.dasherize.tr('-', '_')}_schema.rb"
21
+ )
22
+ expect(schema).to include(
23
+ "class #{PotassiumTestHelpers::APP_NAME.titleize.delete(' ')}Schema < GraphQL::Schema"
24
+ )
25
+
26
+ base_mutation = IO.read("#{project_path}/app/graphql/mutations/base_mutation.rb")
27
+ expect(base_mutation).to include('Types::Base::Base')
28
+ expect(base_mutation).not_to include('input_object_class')
29
+ expect(base_mutation).not_to include('RelayClassic')
30
+
31
+ controller = IO.read("#{project_path}/app/controllers/graphql_controller.rb")
32
+ expect(controller).to include('skip_before_action :verify_authenticity_token')
33
+ end
34
+
35
+ it 'sets up graphql playground' do
36
+ routes = IO.read("#{project_path}/config/routes.rb")
37
+ expect(routes).to include(
38
+ 'mount GraphqlPlayground::Rails::Engine, at: "/graphiql", graphql_path: "/graphql"'
39
+ )
40
+ config = IO.read("#{project_path}/config/initializers/graphql_playground.rb")
41
+ expect(config).to include('GraphqlPlayground::Rails.configure do |config|')
42
+ end
43
+ end
44
+
45
+ context 'when using authentication' do
46
+ before :all do
47
+ drop_dummy_database
48
+ remove_project_directory
49
+ create_dummy_project("api" => :graphql, "devise": true)
50
+ end
51
+
52
+ it 'gathers jwt gem' do
53
+ gemfile_content = IO.read("#{project_path}/Gemfile")
54
+ expect(gemfile_content).to include("gem 'jwt'")
55
+ end
56
+
57
+ it 'Adds auth related mutation and controller' do
58
+ controller = IO.read("#{project_path}/app/controllers/graphql_controller.rb")
59
+ expect(controller).to include('get_current_user')
60
+ expect(controller).to include(
61
+ "#{PotassiumTestHelpers::APP_NAME.titleize.delete(' ')}Schema.execute"
62
+ )
63
+
64
+ mutation_type = IO.read("#{project_path}/app/graphql/types/mutation_type.rb")
65
+ expect(mutation_type).to include('field :login, mutation: Mutations::LoginMutation')
66
+
67
+ login_mutation = IO.read("#{project_path}/app/graphql/mutations/login_mutation.rb")
68
+ expect(login_mutation).to include('class Mutations::LoginMutation < Mutations::BaseMutation')
69
+ end
70
+ end
71
+ end
@@ -18,6 +18,7 @@ RSpec.describe "Heroku" do
18
18
  procfile = IO.read(procfile_path)
19
19
 
20
20
  expect(procfile).to include("web: bundle exec puma -C ./config/puma.rb")
21
+ expect(procfile).to include("release: bin/release")
21
22
 
22
23
  buildpacks_path = "#{project_path}/.buildpacks"
23
24
  buildpacks = IO.read(buildpacks_path)
@@ -25,20 +26,15 @@ RSpec.describe "Heroku" do
25
26
  expect(buildpacks).to include("https://github.com/heroku/heroku-buildpack-nodejs")
26
27
  expect(buildpacks).to include("https://github.com/platanus/heroku-buildpack-ruby-version.git")
27
28
  expect(buildpacks).to include("https://github.com/heroku/heroku-buildpack-ruby.git")
28
- expect(buildpacks).to(
29
- include("https://github.com/gunpowderlabs/buildpack-ruby-rake-deploy-tasks.git")
30
- )
31
29
 
32
30
  expect(FakeHeroku).to have_created_app_for("staging")
33
31
  expect(FakeHeroku).to have_created_app_for("production")
34
32
 
35
33
  expect(FakeHeroku).to have_configured_vars("staging", "SECRET_KEY_BASE")
36
34
  expect(FakeHeroku).to have_configured_vars("staging", "RACK_ENV")
37
- expect(FakeHeroku).to have_configured_vars("staging", "DEPLOY_TASKS")
38
35
 
39
36
  expect(FakeHeroku).to have_configured_vars("production", "SECRET_KEY_BASE")
40
37
  expect(FakeHeroku).to have_configured_vars("production", "RACK_ENV")
41
- expect(FakeHeroku).to have_configured_vars("production", "DEPLOY_TASKS")
42
38
 
43
39
  expect(FakeHeroku).to have_created_pipeline_for("staging")
44
40
  expect(FakeHeroku).to have_add_pipeline_for("production")
@@ -55,5 +51,12 @@ RSpec.describe "Heroku" do
55
51
  expect(bin_setup_heroku).to include("heroku apps:info --app pl-#{app_name}-production")
56
52
  expect(bin_setup_heroku).to include("git config heroku.remote staging")
57
53
  expect(File.stat(bin_setup_path)).to be_executable
54
+
55
+ bin_release_path = "#{project_path}/bin/release"
56
+ bin_release = IO.read(bin_release_path)
57
+
58
+ expect(bin_release).to include('set -e')
59
+ expect(bin_release).to include('bundle exec rails db:migrate:with_data')
60
+ expect(File.stat(bin_release_path)).to be_executable
58
61
  end
59
62
  end
@@ -0,0 +1,42 @@
1
+ require "spec_helper"
2
+
3
+ RSpec.describe "Mailer" do
4
+ let(:gemfile) { IO.read("#{project_path}/Gemfile") }
5
+ let(:mailer_config) { IO.read("#{project_path}/config/mailer.rb") }
6
+ let(:dev_config) { IO.read("#{project_path}/config/environments/development.rb") }
7
+
8
+ before(:all) { drop_dummy_database }
9
+
10
+ context "when selecting sendgrid as mailer" do
11
+ before(:all) do
12
+ remove_project_directory
13
+ create_dummy_project("email_service" => "sendgrid")
14
+ end
15
+
16
+ it { expect(gemfile).to include("send_grid_mailer") }
17
+
18
+ it "adds configuration to mailer.rb" do
19
+ expect(mailer_config).to include("delivery_method = :sendgrid")
20
+ expect(mailer_config).to include("sendgrid_settings = {")
21
+ expect(mailer_config).to include("api_key: ENV['SENDGRID_API_KEY']")
22
+ end
23
+
24
+ it "adds configuration to development.rb" do
25
+ expect(dev_config).to include("delivery_method = :sendgrid_dev")
26
+ expect(dev_config).to include("sendgrid_dev_settings = {")
27
+ expect(dev_config).to include("api_key: ENV['SENDGRID_API_KEY']")
28
+ end
29
+ end
30
+
31
+ context "when selecting aws_ses as mailer" do
32
+ before(:all) do
33
+ remove_project_directory
34
+ create_dummy_project("email_service" => "aws_ses")
35
+ end
36
+
37
+ it { expect(gemfile).to include("aws-sdk-rails") }
38
+ it { expect(gemfile).to include("letter_opener") }
39
+ it { expect(mailer_config).to include("delivery_method = :aws_sdk") }
40
+ it { expect(dev_config).to include("delivery_method = :letter_opener") }
41
+ end
42
+ end
@@ -12,11 +12,11 @@ RSpec.describe "A new project" do
12
12
  expect { on_project { `bundle exec rails -v` } }.to_not output.to_stderr
13
13
  end
14
14
 
15
- it "is a valid rubocop project" do
16
- on_project do
17
- expect(run_rubocop).to eq(true)
18
- end
19
- end
15
+ # it "is a valid rubocop project" do
16
+ # on_project do
17
+ # expect(run_rubocop).to eq(true)
18
+ # end
19
+ # end
20
20
 
21
21
  it "configures postgresql" do
22
22
  database_config_file = IO.read("#{project_path}/config/database.yml")
@@ -26,18 +26,10 @@ RSpec.describe "A new project" do
26
26
  expect(gemfile).to include %{gem 'pg'}
27
27
  end
28
28
 
29
- it "configures aws" do
30
- gemfile_content = IO.read("#{project_path}/Gemfile")
31
- expect(gemfile_content).to include("'aws-sdk', '~> 3'")
32
-
33
- initializer = IO.read("#{project_path}/config/initializers/aws.rb")
34
- expect(initializer).to include("Aws::VERSION")
35
- end
36
-
37
29
  it "configures the correct ruby version" do
38
30
  ruby_version_file = IO.read("#{project_path}/.ruby-version")
39
31
 
40
- expect(ruby_version_file).to eq("2.5")
32
+ expect(ruby_version_file).to eq("2.7")
41
33
  end
42
34
 
43
35
  it "setup ssl" do
@@ -0,0 +1,28 @@
1
+ require "spec_helper"
2
+
3
+ RSpec.describe "Node" do
4
+ let(:version) { "12" }
5
+
6
+ before(:all) do
7
+ drop_dummy_database
8
+ remove_project_directory
9
+ create_dummy_project
10
+ end
11
+
12
+ it "adds engine with node version to package.json" do
13
+ package_json_path = "#{project_path}/package.json"
14
+ expect(File).to be_file(package_json_path)
15
+ json_file = File.read(package_json_path)
16
+ js_package = JSON.parse(json_file)
17
+ expect(js_package).to have_key("engines")
18
+ expect(js_package["engines"]).to have_key("node")
19
+ expect(js_package["engines"]["node"]).to eq("#{version}.x")
20
+ end
21
+
22
+ it "adds .node-version with correct version" do
23
+ node_version_path = "#{project_path}/.node-version"
24
+ expect(File).to be_file(node_version_path)
25
+ node_version_file = File.read(node_version_path)
26
+ expect(node_version_file).to eq(version)
27
+ end
28
+ end
@@ -17,21 +17,10 @@ RSpec.describe "PowerTypes" do
17
17
  expect(readme).to include("Power-Types")
18
18
  end
19
19
 
20
- it "adds commands directory" do
21
- commands_directory = "#{project_path}/app/commands"
22
- expect(File.directory?(commands_directory)).to eq(true)
23
- end
24
-
25
- it "adds services directory" do
26
- services_directory = "#{project_path}/app/services"
27
- expect(File.directory?(services_directory)).to eq(true)
28
- end
29
- it "adds utils directory" do
30
- utils_directory = "#{project_path}/app/utils"
31
- expect(File.directory?(utils_directory)).to eq(true)
32
- end
33
- it "adds values directory" do
34
- values_directory = "#{project_path}/app/values"
35
- expect(File.directory?(values_directory)).to eq(true)
20
+ it "adds every power type directory" do
21
+ [:commands, :services, :observers, :utils, :values].each do |type|
22
+ commands_directory = "#{project_path}/app/#{type}"
23
+ expect(File.directory?(commands_directory)).to eq(true)
24
+ end
36
25
  end
37
26
  end
@@ -0,0 +1,47 @@
1
+ require "spec_helper"
2
+ require "pry"
3
+ RSpec.describe "VueAdmin" do
4
+ before(:all) do
5
+ drop_dummy_database
6
+ remove_project_directory
7
+ create_dummy_project(:vue_admin => true, "admin" => true, "devise" => true)
8
+ end
9
+
10
+ it "adds component integration to active admin initializer" do
11
+ admin_initializer_path = "#{project_path}/config/initializers/active_admin.rb"
12
+ expect(File).to be_file(admin_initializer_path)
13
+ initializer_file = File.read(admin_initializer_path)
14
+ expect(initializer_file).to include("AUTO_BUILD_ELEMENTS")
15
+ end
16
+
17
+ it "adds layout tags to active admin layout initializer" do
18
+ initializer_path = "#{project_path}/config/initializers/init_activeadmin_vue.rb"
19
+ expect(File).to be_file(initializer_path)
20
+ end
21
+
22
+ it "adds vue_component to library" do
23
+ vue_component_lib_path = "#{project_path}/lib/vue_component.rb"
24
+ expect(File).to be_file(vue_component_lib_path)
25
+ vue_component_lib = File.read(vue_component_lib_path)
26
+ expect(vue_component_lib).to include("VueComponent")
27
+ end
28
+
29
+ it "adds admin_application pack to packs" do
30
+ application_pack_path = "#{project_path}/app/javascript/packs/admin_application.js"
31
+ expect(File).to be_file(application_pack_path)
32
+ end
33
+
34
+ it "adds admin_component to vue components" do
35
+ application_pack_path = "#{project_path}/app/javascript/components/admin-component.vue"
36
+ expect(File).to be_file(application_pack_path)
37
+ end
38
+
39
+ it "installs vue to project" do
40
+ package_json_path = "#{project_path}/package.json"
41
+ expect(File).to be_file(package_json_path)
42
+ json_file = File.read(package_json_path)
43
+ js_package = JSON.parse(json_file)
44
+ expect(js_package).to have_key("dependencies")
45
+ expect(js_package["dependencies"]).to have_key("vue")
46
+ end
47
+ end
@@ -26,8 +26,13 @@ RSpec.configure do |config|
26
26
  create_tmp_directory
27
27
  end
28
28
 
29
+ config.after(:each) do
30
+ docker_cleanup
31
+ end
32
+
29
33
  config.before(:each) do
30
34
  FakeGithub.clear!
31
35
  FakeHeroku.clear!
36
+ FakeOctokit.clear!
32
37
  end
33
38
  end
@@ -0,0 +1,31 @@
1
+ class FakeOctokit
2
+ RECORDER = File.expand_path(File.join('..', '..', 'tmp', 'octokit'), File.dirname(__FILE__))
3
+
4
+ def initialize(options); end
5
+
6
+ def create_repository(repo_name, options)
7
+ File.open(RECORDER, 'a') do |file|
8
+ file.write "#{repo_name}, #{options.map { |key, value| "#{key}: #{value}" }}"
9
+ end
10
+ end
11
+
12
+ def self.clear!
13
+ FileUtils.rm_rf RECORDER
14
+ end
15
+
16
+ def self.has_created_repo?(repo_name)
17
+ File.read(RECORDER).include? repo_name
18
+ end
19
+
20
+ def self.has_created_private_repo?(repo_name)
21
+ has_created_repo?(repo_name) && File.read(RECORDER).include?("private: true")
22
+ end
23
+
24
+ def self.has_created_repo_for_org?(repo_name, org_name)
25
+ has_created_repo?(repo_name) && File.read(RECORDER).include?("organization: #{org_name}")
26
+ end
27
+
28
+ def self.has_created_private_repo_for_org?(repo_name, org_name)
29
+ has_created_private_repo?(repo_name) && has_created_repo_for_org?(repo_name, org_name)
30
+ end
31
+ end
@@ -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
@@ -47,15 +53,11 @@ module PotassiumTestHelpers
47
53
  end
48
54
  end
49
55
 
50
- private
51
-
52
- def tmp_path
53
- @tmp_path ||= Pathname.new("#{root_path}/tmp")
56
+ def docker_cleanup
57
+ run_command(`docker-compose -f #{project_path}/docker-compose.yml down --volumes`)
54
58
  end
55
59
 
56
- def potassium_bin
57
- File.join(root_path, "bin", "potassium")
58
- end
60
+ private
59
61
 
60
62
  def hash_to_arguments(hash)
61
63
  hash.map do |key, value|
@@ -69,10 +71,26 @@ module PotassiumTestHelpers
69
71
  end.join(" ")
70
72
  end
71
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
+
72
86
  def support_bin
73
87
  File.join(root_path, "spec", "fakes", "bin")
74
88
  end
75
89
 
90
+ def tmp_path
91
+ @tmp_path ||= Pathname.new("#{root_path}/tmp")
92
+ end
93
+
76
94
  def root_path
77
95
  File.expand_path("../../../", __FILE__)
78
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.0
4
+ version: 6.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - juliogarciag
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-09-07 00:00:00.000000000 Z
11
+ date: 2021-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,28 +16,42 @@ 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
30
44
  requirements:
31
45
  - - "~>"
32
46
  - !ruby/object:Gem::Version
33
- version: '10.0'
47
+ version: '13.0'
34
48
  type: :development
35
49
  prerelease: false
36
50
  version_requirements: !ruby/object:Gem::Requirement
37
51
  requirements:
38
52
  - - "~>"
39
53
  - !ruby/object:Gem::Version
40
- version: '10.0'
54
+ version: '13.0'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: rspec
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -53,47 +67,61 @@ 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
72
86
  requirements:
73
87
  - - "~>"
74
88
  - !ruby/object:Gem::Version
75
- version: 0.49.1
89
+ version: 0.65.0
76
90
  type: :development
77
91
  prerelease: false
78
92
  version_requirements: !ruby/object:Gem::Requirement
79
93
  requirements:
80
94
  - - "~>"
81
95
  - !ruby/object:Gem::Version
82
- version: 0.49.1
96
+ version: 0.65.0
83
97
  - !ruby/object:Gem::Dependency
84
- name: rails
98
+ name: rubocop-rspec
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: gems
85
113
  requirement: !ruby/object:Gem::Requirement
86
114
  requirements:
87
115
  - - "~>"
88
116
  - !ruby/object:Gem::Version
89
- version: 5.2.1
117
+ version: '0.8'
90
118
  type: :runtime
91
119
  prerelease: false
92
120
  version_requirements: !ruby/object:Gem::Requirement
93
121
  requirements:
94
122
  - - "~>"
95
123
  - !ruby/object:Gem::Version
96
- version: 5.2.1
124
+ version: '0.8'
97
125
  - !ruby/object:Gem::Dependency
98
126
  name: gli
99
127
  requirement: !ruby/object:Gem::Requirement
@@ -123,47 +151,61 @@ dependencies:
123
151
  - !ruby/object:Gem::Version
124
152
  version: '0.2'
125
153
  - !ruby/object:Gem::Dependency
126
- name: gems
154
+ name: levenshtein
127
155
  requirement: !ruby/object:Gem::Requirement
128
156
  requirements:
129
157
  - - "~>"
130
158
  - !ruby/object:Gem::Version
131
- version: '0.8'
159
+ version: '0.2'
132
160
  type: :runtime
133
161
  prerelease: false
134
162
  version_requirements: !ruby/object:Gem::Requirement
135
163
  requirements:
136
164
  - - "~>"
137
165
  - !ruby/object:Gem::Version
138
- version: '0.8'
166
+ version: '0.2'
139
167
  - !ruby/object:Gem::Dependency
140
- name: semantic
168
+ name: octokit
141
169
  requirement: !ruby/object:Gem::Requirement
142
170
  requirements:
143
171
  - - "~>"
144
172
  - !ruby/object:Gem::Version
145
- version: '1.4'
173
+ version: '4.18'
146
174
  type: :runtime
147
175
  prerelease: false
148
176
  version_requirements: !ruby/object:Gem::Requirement
149
177
  requirements:
150
178
  - - "~>"
151
179
  - !ruby/object:Gem::Version
152
- version: '1.4'
180
+ version: '4.18'
153
181
  - !ruby/object:Gem::Dependency
154
- name: levenshtein
182
+ name: rails
155
183
  requirement: !ruby/object:Gem::Requirement
156
184
  requirements:
157
185
  - - "~>"
158
186
  - !ruby/object:Gem::Version
159
- version: '0.2'
187
+ version: 6.0.2
160
188
  type: :runtime
161
189
  prerelease: false
162
190
  version_requirements: !ruby/object:Gem::Requirement
163
191
  requirements:
164
192
  - - "~>"
165
193
  - !ruby/object:Gem::Version
166
- version: '0.2'
194
+ version: 6.0.2
195
+ - !ruby/object:Gem::Dependency
196
+ name: semantic
197
+ requirement: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - "~>"
200
+ - !ruby/object:Gem::Version
201
+ version: '1.4'
202
+ type: :runtime
203
+ prerelease: false
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - "~>"
207
+ - !ruby/object:Gem::Version
208
+ version: '1.4'
167
209
  description: An application generator from Platanus
168
210
  email:
169
211
  - julioggonz@gmail.com
@@ -173,8 +215,10 @@ executables:
173
215
  extensions: []
174
216
  extra_rdoc_files: []
175
217
  files:
218
+ - ".circleci/config.yml"
176
219
  - ".editorconfig"
177
220
  - ".gitignore"
221
+ - ".node-version"
178
222
  - ".rspec"
179
223
  - ".ruby-version"
180
224
  - CHANGELOG.md
@@ -184,43 +228,63 @@ files:
184
228
  - Rakefile
185
229
  - bin/potassium
186
230
  - bin/potassium_test
187
- - circle.yml
188
231
  - docs/CONTRIBUTING.md
189
232
  - docs/DSL.md
190
233
  - lib/potassium.rb
191
234
  - lib/potassium/assets/.buildpacks
192
- - lib/potassium/assets/.circleci/config.yml
235
+ - lib/potassium/assets/.circleci/config.yml.erb
193
236
  - lib/potassium/assets/.dockerignore
194
237
  - lib/potassium/assets/.editorconfig
195
238
  - lib/potassium/assets/.env.development.erb
239
+ - lib/potassium/assets/.eslintrc.json
240
+ - lib/potassium/assets/.github/pull_request_template.md
196
241
  - lib/potassium/assets/.pryrc
242
+ - lib/potassium/assets/.rubocop.yml
243
+ - lib/potassium/assets/.stylelintrc.json
197
244
  - lib/potassium/assets/Dockerfile.ci
245
+ - lib/potassium/assets/Makefile.erb
198
246
  - lib/potassium/assets/Procfile
199
247
  - lib/potassium/assets/README.md.erb
200
248
  - lib/potassium/assets/README.yml
201
- - lib/potassium/assets/active_admin/active_admin.js.coffee
249
+ - lib/potassium/assets/active_admin/admin-component.vue
250
+ - lib/potassium/assets/active_admin/admin_application.js
202
251
  - lib/potassium/assets/active_admin/admin_user_policy.rb
203
252
  - lib/potassium/assets/active_admin/comment_policy.rb
204
- - lib/potassium/assets/active_admin/init_activeadmin_angular.rb
253
+ - lib/potassium/assets/active_admin/init_activeadmin_vue.rb
205
254
  - lib/potassium/assets/active_admin/pundit_page_policy.rb
206
- - lib/potassium/assets/api/api_error_concern.rb
207
- - lib/potassium/assets/api/base_controller.rb
208
- - lib/potassium/assets/api/draper_responder.rb
209
- - lib/potassium/assets/api/responder.rb
255
+ - lib/potassium/assets/app/graphql/graphql_controller.rb
256
+ - lib/potassium/assets/app/graphql/mutations/login_mutation.rb
257
+ - lib/potassium/assets/app/graphql/queries/base_query.rb
258
+ - lib/potassium/assets/app/graphql/types/base/base_argument.rb
259
+ - lib/potassium/assets/app/graphql/types/base/base_enum.rb
260
+ - lib/potassium/assets/app/graphql/types/base/base_field.rb
261
+ - lib/potassium/assets/app/graphql/types/base/base_input_object.rb
262
+ - lib/potassium/assets/app/graphql/types/base/base_interface.rb
263
+ - lib/potassium/assets/app/graphql/types/base/base_object.rb
264
+ - lib/potassium/assets/app/graphql/types/base/base_scalar.rb
265
+ - lib/potassium/assets/app/graphql/types/base/base_union.rb
266
+ - lib/potassium/assets/app/graphql/types/mutation_type.rb
267
+ - lib/potassium/assets/app/graphql/types/query_type.rb
268
+ - lib/potassium/assets/app/javascript/app.spec.js
210
269
  - lib/potassium/assets/app/mailers/application_mailer.rb
211
- - lib/potassium/assets/aws.rb
270
+ - lib/potassium/assets/app/uploaders/base_uploader.rb
271
+ - lib/potassium/assets/app/uploaders/image_uploader.rb
212
272
  - lib/potassium/assets/bin/cibuild.erb
273
+ - lib/potassium/assets/bin/release
213
274
  - lib/potassium/assets/bin/setup.erb
214
275
  - lib/potassium/assets/bin/setup_heroku.erb
215
276
  - lib/potassium/assets/bin/update.erb
216
277
  - lib/potassium/assets/config/database_mysql.yml.erb
217
278
  - lib/potassium/assets/config/database_postgresql.yml.erb
279
+ - lib/potassium/assets/config/graphql_playground.rb
218
280
  - lib/potassium/assets/config/mailer.rb.erb
219
281
  - lib/potassium/assets/config/puma.rb
220
282
  - lib/potassium/assets/config/secrets.yml.erb
221
283
  - lib/potassium/assets/config/sentry.rb.erb
284
+ - lib/potassium/assets/config/shrine.rb
222
285
  - lib/potassium/assets/config/storage.yml
223
286
  - lib/potassium/assets/docker-compose.ci.yml
287
+ - lib/potassium/assets/docker-compose.yml
224
288
  - lib/potassium/assets/es-CL.yml
225
289
  - lib/potassium/assets/lib/tasks/auto_annotate_models.rake
226
290
  - lib/potassium/assets/package.json
@@ -233,7 +297,6 @@ files:
233
297
  - lib/potassium/assets/sidekiq.yml
234
298
  - lib/potassium/assets/sidekiq_scheduler.yml
235
299
  - lib/potassium/assets/testing/.rspec
236
- - lib/potassium/assets/testing/paperclip.rb
237
300
  - lib/potassium/assets/testing/platanus.png
238
301
  - lib/potassium/assets/testing/rails_helper.rb
239
302
  - lib/potassium/cli.rb
@@ -254,29 +317,31 @@ files:
254
317
  - lib/potassium/helpers/template-helpers.rb
255
318
  - lib/potassium/helpers/variable-helpers.rb
256
319
  - lib/potassium/newest_version_ensurer.rb
320
+ - lib/potassium/node_version_ensurer.rb
257
321
  - lib/potassium/recipe.rb
258
- - lib/potassium/recipes/active_storage.rb
259
322
  - lib/potassium/recipes/admin.rb
260
- - lib/potassium/recipes/angular_admin.rb
261
323
  - lib/potassium/recipes/annotate.rb
262
324
  - lib/potassium/recipes/api.rb
263
- - lib/potassium/recipes/aws_sdk.rb
264
325
  - lib/potassium/recipes/background_processor.rb
265
326
  - lib/potassium/recipes/better_errors.rb
266
327
  - lib/potassium/recipes/ci.rb
267
328
  - lib/potassium/recipes/cleanup.rb
329
+ - lib/potassium/recipes/data_migrate.rb
268
330
  - lib/potassium/recipes/database.rb
331
+ - lib/potassium/recipes/database_container.rb
269
332
  - lib/potassium/recipes/devise.rb
270
333
  - lib/potassium/recipes/draper.rb
271
334
  - lib/potassium/recipes/editorconfig.rb
272
335
  - lib/potassium/recipes/env.rb
273
336
  - lib/potassium/recipes/error_reporting.rb
337
+ - lib/potassium/recipes/file_storage.rb
274
338
  - lib/potassium/recipes/front_end.rb
275
339
  - lib/potassium/recipes/github.rb
276
340
  - lib/potassium/recipes/heroku.rb
277
341
  - lib/potassium/recipes/i18n.rb
342
+ - lib/potassium/recipes/listen.rb
278
343
  - lib/potassium/recipes/mailer.rb
279
- - lib/potassium/recipes/paperclip.rb
344
+ - lib/potassium/recipes/node.rb
280
345
  - lib/potassium/recipes/power_types.rb
281
346
  - lib/potassium/recipes/pry.rb
282
347
  - lib/potassium/recipes/puma.rb
@@ -292,6 +357,7 @@ files:
292
357
  - lib/potassium/recipes/style.rb
293
358
  - lib/potassium/recipes/testing.rb
294
359
  - lib/potassium/recipes/tzinfo.rb
360
+ - lib/potassium/recipes/vue_admin.rb
295
361
  - lib/potassium/recipes/yarn.rb
296
362
  - lib/potassium/template_finder.rb
297
363
  - lib/potassium/templates/application.rb
@@ -302,22 +368,30 @@ files:
302
368
  - potassium.gemspec
303
369
  - spec/fakes/bin/heroku
304
370
  - spec/fakes/bin/hub
305
- - spec/features/active_storage_spec.rb
371
+ - spec/features/api_spec.rb
306
372
  - spec/features/background_processor_spec.rb
307
373
  - spec/features/ci_spec.rb
374
+ - spec/features/data_migrate_spec.rb
375
+ - spec/features/database_container_spec.rb
308
376
  - spec/features/database_spec.rb
309
377
  - spec/features/draper_spec.rb
310
378
  - spec/features/error_reporting_spec.rb
311
- - spec/features/front_end.rb
379
+ - spec/features/file_storage_spec.rb
380
+ - spec/features/front_end_spec.rb
312
381
  - spec/features/github_spec.rb
382
+ - spec/features/graphql_spec.rb
313
383
  - spec/features/heroku_spec.rb
314
384
  - spec/features/i18n_spec.rb
385
+ - spec/features/mailer_spec.rb
315
386
  - spec/features/new_project_spec.rb
387
+ - spec/features/node_spec.rb
316
388
  - spec/features/power_types_spec.rb
317
389
  - spec/features/schedule_spec.rb
390
+ - spec/features/vue_admin_spec.rb
318
391
  - spec/spec_helper.rb
319
392
  - spec/support/fake_github.rb
320
393
  - spec/support/fake_heroku.rb
394
+ - spec/support/fake_octokit.rb
321
395
  - spec/support/potassium_test_helpers.rb
322
396
  homepage: https://github.com/platanus/potassium
323
397
  licenses:
@@ -338,28 +412,35 @@ required_rubygems_version: !ruby/object:Gem::Requirement
338
412
  - !ruby/object:Gem::Version
339
413
  version: '0'
340
414
  requirements: []
341
- rubyforge_project:
342
- rubygems_version: 2.7.6
415
+ rubygems_version: 3.1.2
343
416
  signing_key:
344
417
  specification_version: 4
345
418
  summary: An application generator from Platanus
346
419
  test_files:
347
420
  - spec/fakes/bin/heroku
348
421
  - spec/fakes/bin/hub
349
- - spec/features/active_storage_spec.rb
422
+ - spec/features/api_spec.rb
350
423
  - spec/features/background_processor_spec.rb
351
424
  - spec/features/ci_spec.rb
425
+ - spec/features/data_migrate_spec.rb
426
+ - spec/features/database_container_spec.rb
352
427
  - spec/features/database_spec.rb
353
428
  - spec/features/draper_spec.rb
354
429
  - spec/features/error_reporting_spec.rb
355
- - spec/features/front_end.rb
430
+ - spec/features/file_storage_spec.rb
431
+ - spec/features/front_end_spec.rb
356
432
  - spec/features/github_spec.rb
433
+ - spec/features/graphql_spec.rb
357
434
  - spec/features/heroku_spec.rb
358
435
  - spec/features/i18n_spec.rb
436
+ - spec/features/mailer_spec.rb
359
437
  - spec/features/new_project_spec.rb
438
+ - spec/features/node_spec.rb
360
439
  - spec/features/power_types_spec.rb
361
440
  - spec/features/schedule_spec.rb
441
+ - spec/features/vue_admin_spec.rb
362
442
  - spec/spec_helper.rb
363
443
  - spec/support/fake_github.rb
364
444
  - spec/support/fake_heroku.rb
445
+ - spec/support/fake_octokit.rb
365
446
  - spec/support/potassium_test_helpers.rb