potassium 5.2.0 → 6.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +42 -0
- data/.editorconfig +3 -0
- data/.node-version +1 -0
- data/.ruby-version +1 -1
- data/CHANGELOG.md +94 -0
- data/README.md +41 -47
- data/docs/DSL.md +5 -5
- data/lib/potassium/assets/.buildpacks +0 -1
- data/lib/potassium/assets/.circleci/config.yml.erb +102 -0
- data/lib/potassium/assets/.eslintrc.json +352 -0
- data/lib/potassium/assets/.github/pull_request_template.md +9 -0
- data/lib/potassium/assets/.pryrc +1 -1
- data/lib/potassium/assets/.rubocop.yml +515 -0
- data/lib/potassium/assets/.stylelintrc.json +46 -0
- data/lib/potassium/assets/Dockerfile.ci +1 -1
- data/lib/potassium/assets/Makefile.erb +35 -0
- data/lib/potassium/assets/Procfile +1 -0
- data/lib/potassium/assets/README.yml +60 -11
- data/lib/potassium/assets/active_admin/admin-component.vue +35 -0
- data/lib/potassium/assets/active_admin/admin_application.js +14 -0
- data/lib/potassium/assets/active_admin/init_activeadmin_vue.rb +10 -0
- data/lib/potassium/assets/app/graphql/graphql_controller.rb +55 -0
- data/lib/potassium/assets/app/graphql/mutations/login_mutation.rb +23 -0
- data/lib/potassium/assets/app/graphql/queries/base_query.rb +4 -0
- data/lib/potassium/assets/app/graphql/types/base/base_argument.rb +4 -0
- data/lib/potassium/assets/app/graphql/types/base/base_enum.rb +4 -0
- data/lib/potassium/assets/app/graphql/types/base/base_field.rb +5 -0
- data/lib/potassium/assets/app/graphql/types/base/base_input_object.rb +5 -0
- data/lib/potassium/assets/app/graphql/types/base/base_interface.rb +7 -0
- data/lib/potassium/assets/app/graphql/types/base/base_object.rb +5 -0
- data/lib/potassium/assets/app/graphql/types/base/base_scalar.rb +4 -0
- data/lib/potassium/assets/app/graphql/types/base/base_union.rb +4 -0
- data/lib/potassium/assets/app/graphql/types/mutation_type.rb +10 -0
- data/lib/potassium/assets/app/graphql/types/query_type.rb +13 -0
- data/lib/potassium/assets/app/javascript/app.spec.js +14 -0
- data/lib/potassium/assets/app/uploaders/base_uploader.rb +11 -0
- data/lib/potassium/assets/app/uploaders/image_uploader.rb +5 -0
- data/lib/potassium/assets/bin/cibuild.erb +24 -7
- data/lib/potassium/assets/bin/release +9 -0
- data/lib/potassium/assets/bin/setup.erb +3 -0
- data/lib/potassium/assets/config/database_mysql.yml.erb +5 -5
- data/lib/potassium/assets/config/database_postgresql.yml.erb +5 -5
- data/lib/potassium/assets/config/graphql_playground.rb +20 -0
- data/lib/potassium/assets/config/puma.rb +5 -1
- data/lib/potassium/assets/config/shrine.rb +36 -0
- data/lib/potassium/assets/docker-compose.ci.yml +2 -1
- data/lib/potassium/assets/docker-compose.yml +6 -0
- data/lib/potassium/assets/lib/tasks/auto_annotate_models.rake +34 -33
- data/lib/potassium/assets/package.json +4 -1
- data/lib/potassium/assets/redis.yml +1 -2
- data/lib/potassium/assets/sidekiq_scheduler.yml +1 -1
- data/lib/potassium/assets/testing/rails_helper.rb +4 -2
- data/lib/potassium/cli/commands/create.rb +12 -19
- data/lib/potassium/cli_options.rb +67 -24
- data/lib/potassium/helpers/docker-helpers.rb +14 -5
- data/lib/potassium/helpers/gem-helpers.rb +1 -1
- data/lib/potassium/helpers/template-helpers.rb +4 -0
- data/lib/potassium/newest_version_ensurer.rb +19 -36
- data/lib/potassium/node_version_ensurer.rb +30 -0
- data/lib/potassium/recipes/admin.rb +3 -3
- data/lib/potassium/recipes/annotate.rb +1 -1
- data/lib/potassium/recipes/api.rb +93 -21
- data/lib/potassium/recipes/background_processor.rb +38 -2
- data/lib/potassium/recipes/ci.rb +8 -6
- data/lib/potassium/recipes/data_migrate.rb +44 -0
- data/lib/potassium/recipes/database.rb +6 -2
- data/lib/potassium/recipes/database_container.rb +90 -0
- data/lib/potassium/recipes/draper.rb +1 -10
- data/lib/potassium/recipes/file_storage.rb +66 -0
- data/lib/potassium/recipes/front_end.rb +219 -9
- data/lib/potassium/recipes/github.rb +93 -15
- data/lib/potassium/recipes/heroku.rb +2 -1
- data/lib/potassium/recipes/listen.rb +7 -0
- data/lib/potassium/recipes/mailer.rb +14 -4
- data/lib/potassium/recipes/node.rb +21 -0
- data/lib/potassium/recipes/puma.rb +0 -3
- data/lib/potassium/recipes/rack_cors.rb +18 -15
- data/lib/potassium/recipes/rails.rb +6 -0
- data/lib/potassium/recipes/schedule.rb +1 -1
- data/lib/potassium/recipes/style.rb +21 -3
- data/lib/potassium/recipes/vue_admin.rb +124 -0
- data/lib/potassium/templates/application.rb +10 -9
- data/lib/potassium/version.rb +7 -4
- data/potassium.gemspec +9 -6
- data/spec/features/api_spec.rb +25 -0
- data/spec/features/background_processor_spec.rb +12 -1
- data/spec/features/data_migrate_spec.rb +14 -0
- data/spec/features/database_container_spec.rb +35 -0
- data/spec/features/draper_spec.rb +1 -6
- data/spec/features/file_storage_spec.rb +75 -0
- data/spec/features/front_end_spec.rb +88 -0
- data/spec/features/github_spec.rb +53 -8
- data/spec/features/graphql_spec.rb +71 -0
- data/spec/features/heroku_spec.rb +8 -5
- data/spec/features/mailer_spec.rb +42 -0
- data/spec/features/new_project_spec.rb +6 -14
- data/spec/features/node_spec.rb +28 -0
- data/spec/features/power_types_spec.rb +5 -16
- data/spec/features/vue_admin_spec.rb +47 -0
- data/spec/spec_helper.rb +5 -0
- data/spec/support/fake_octokit.rb +31 -0
- data/spec/support/potassium_test_helpers.rb +26 -8
- metadata +126 -45
- data/circle.yml +0 -12
- data/lib/potassium/assets/.circleci/config.yml +0 -20
- data/lib/potassium/assets/active_admin/active_admin.js.coffee +0 -4
- data/lib/potassium/assets/active_admin/init_activeadmin_angular.rb +0 -8
- data/lib/potassium/assets/api/api_error_concern.rb +0 -32
- data/lib/potassium/assets/api/base_controller.rb +0 -9
- data/lib/potassium/assets/api/draper_responder.rb +0 -62
- data/lib/potassium/assets/api/responder.rb +0 -41
- data/lib/potassium/assets/aws.rb +0 -1
- data/lib/potassium/assets/testing/paperclip.rb +0 -59
- data/lib/potassium/recipes/active_storage.rb +0 -40
- data/lib/potassium/recipes/angular_admin.rb +0 -56
- data/lib/potassium/recipes/aws_sdk.rb +0 -7
- data/lib/potassium/recipes/paperclip.rb +0 -47
- data/spec/features/active_storage_spec.rb +0 -30
- data/spec/features/front_end.rb +0 -30
@@ -15,14 +15,14 @@ build(){
|
|
15
15
|
# Wait services to be ready
|
16
16
|
wait_services(){
|
17
17
|
function test_service {
|
18
|
-
docker-compose $DOCKER_COMPOSE_ARGS run test sh -c "nc -z $1 $2"
|
18
|
+
docker-compose $DOCKER_COMPOSE_ARGS run --rm test sh -c "nc -z $1 $2"
|
19
19
|
}
|
20
20
|
|
21
21
|
count=0
|
22
22
|
# Chain tests together by using &&
|
23
23
|
until (
|
24
24
|
<% if(selected?(:database, :mysql) || selected?(:database, :postgresql))-%>
|
25
|
-
test_service '
|
25
|
+
test_service '$DB_HOST' '$DB_PORT' && \
|
26
26
|
<% end-%>
|
27
27
|
echo "Services ready"
|
28
28
|
)
|
@@ -41,16 +41,22 @@ wait_services(){
|
|
41
41
|
|
42
42
|
# Prepare dependencies
|
43
43
|
dependencies(){
|
44
|
-
docker-compose $DOCKER_COMPOSE_ARGS run test bundle install
|
44
|
+
docker-compose $DOCKER_COMPOSE_ARGS run --rm test bundle install
|
45
45
|
}
|
46
46
|
|
47
|
+
<% if selected?(:front_end, :vue) %>
|
48
|
+
yarn_dependencies(){
|
49
|
+
docker-compose $DOCKER_COMPOSE_ARGS run --rm test yarn install
|
50
|
+
}
|
51
|
+
<% end %>
|
52
|
+
|
47
53
|
assets() {
|
48
|
-
docker-compose $DOCKER_COMPOSE_ARGS run test /bin/bash -c "bin/setup && bundle exec rake assets:precompile"
|
54
|
+
docker-compose $DOCKER_COMPOSE_ARGS run --rm test /bin/bash -c "bin/setup && bundle exec rake assets:precompile"
|
49
55
|
}
|
50
56
|
|
51
57
|
# Prepare database
|
52
58
|
database(){
|
53
|
-
docker-compose $DOCKER_COMPOSE_ARGS run test bundle exec rake db:create db:schema:load
|
59
|
+
docker-compose $DOCKER_COMPOSE_ARGS run --rm test bundle exec rake db:create db:schema:load
|
54
60
|
}
|
55
61
|
|
56
62
|
# Run the specs
|
@@ -59,9 +65,15 @@ tests(){
|
|
59
65
|
RSPEC_JUNIT_ARGS="-r rspec_junit_formatter --format RspecJunitFormatter -o $HOME/.rspec_reports/junit.xml"
|
60
66
|
RSPEC_FORMAT_ARGS="--format progress --no-color"
|
61
67
|
}
|
62
|
-
docker-compose $DOCKER_COMPOSE_ARGS run test bundle exec rspec spec $RSPEC_FORMAT_ARGS $RSPEC_JUNIT_ARGS
|
68
|
+
docker-compose $DOCKER_COMPOSE_ARGS run --rm test bundle exec rspec spec $RSPEC_FORMAT_ARGS $RSPEC_JUNIT_ARGS
|
63
69
|
}
|
64
70
|
|
71
|
+
<% if selected?(:front_end, :vue) %>
|
72
|
+
js_tests(){
|
73
|
+
docker-compose $DOCKER_COMPOSE_ARGS run --rm test yarn run test
|
74
|
+
}
|
75
|
+
<% end %>
|
76
|
+
|
65
77
|
# Run the complete ci build
|
66
78
|
no_ci(){
|
67
79
|
build
|
@@ -80,7 +92,7 @@ case "$1" in
|
|
80
92
|
wait_services
|
81
93
|
;;
|
82
94
|
"deps"|"dependencies")
|
83
|
-
dependencies
|
95
|
+
dependencies <% if selected?(:front_end, :vue) %>&& yarn_dependencies<% end %>
|
84
96
|
;;
|
85
97
|
"assets")
|
86
98
|
assets
|
@@ -88,6 +100,11 @@ case "$1" in
|
|
88
100
|
"db"|"database")
|
89
101
|
database
|
90
102
|
;;
|
103
|
+
<% if selected?(:front_end, :vue) %>
|
104
|
+
"js_tests")
|
105
|
+
js_tests
|
106
|
+
;;
|
107
|
+
<% end %>
|
91
108
|
"specs"|"tests")
|
92
109
|
tests
|
93
110
|
;;
|
@@ -1,10 +1,10 @@
|
|
1
1
|
development: &default
|
2
2
|
adapter: mysql2
|
3
|
-
database: <%= get(:
|
3
|
+
database: <%= get(:dasherized_app_name) %>_development
|
4
4
|
encoding: utf8
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
host: <%%= ENV["DB_HOST"] || "127.0.0.1" %>
|
6
|
+
port: <%%= ENV["DB_PORT"] || 3306 %>
|
7
|
+
username: <%%= ENV["DB_USER"] || "root" %>
|
8
8
|
min_messages: warning
|
9
9
|
pool: <%%= Integer(ENV.fetch("DB_POOL", 5)) %>
|
10
10
|
reaping_frequency: <%%= Integer(ENV.fetch("DB_REAPING_FREQUENCY", 10)) %>
|
@@ -12,7 +12,7 @@ development: &default
|
|
12
12
|
|
13
13
|
test:
|
14
14
|
<<: *default
|
15
|
-
database: <%= get(:
|
15
|
+
database: <%= get(:dasherized_app_name) %>_test
|
16
16
|
|
17
17
|
production: &deploy
|
18
18
|
encoding: utf8
|
@@ -1,10 +1,10 @@
|
|
1
1
|
development: &default
|
2
2
|
adapter: postgresql
|
3
|
-
database: <%= get(:
|
3
|
+
database: <%= get(:dasherized_app_name) %>_development
|
4
4
|
encoding: utf8
|
5
|
-
host: <%%= ENV["
|
6
|
-
port: <%%= ENV["
|
7
|
-
username: <%%= ENV["
|
5
|
+
host: <%%= ENV["DB_HOST"] || "127.0.0.1" %>
|
6
|
+
port: <%%= ENV["DB_PORT"] || 5432 %>
|
7
|
+
username: <%%= ENV["DB_USER"] || 'postgres' %>
|
8
8
|
min_messages: warning
|
9
9
|
pool: <%%= Integer(ENV.fetch("DB_POOL", 5)) %>
|
10
10
|
reaping_frequency: <%%= Integer(ENV.fetch("DB_REAPING_FREQUENCY", 10)) %>
|
@@ -12,7 +12,7 @@ development: &default
|
|
12
12
|
|
13
13
|
test:
|
14
14
|
<<: *default
|
15
|
-
database: <%= get(:
|
15
|
+
database: <%= get(:dasherized_app_name) %>_test
|
16
16
|
|
17
17
|
production: &deploy
|
18
18
|
encoding: utf8
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# config/initializers/graphql_playground.rb
|
2
|
+
# All config options have a default that should work out of the box
|
3
|
+
if Rails.env.development?
|
4
|
+
GraphqlPlayground::Rails.configure do |config|
|
5
|
+
# config.headers = {
|
6
|
+
# 'X-Auth-Header' => ->(view_context) { "123" }
|
7
|
+
# }
|
8
|
+
# config.title = "Playground"
|
9
|
+
# config.csrf = true
|
10
|
+
# config.playground_version = "latest"
|
11
|
+
# # Ideally the assets would be added to your projects `vendor/assets` directories
|
12
|
+
# config.favicon = "/assets/playground.ico"
|
13
|
+
# config.playground_js_url = "/assets/playground.js"
|
14
|
+
# config.playground_css_url = "/assets/playground.css"
|
15
|
+
# # see: https://github.com/prisma-labs/graphql-playground#settings
|
16
|
+
config.settings = {
|
17
|
+
"schema.polling.enable": false
|
18
|
+
}
|
19
|
+
end
|
20
|
+
end
|
@@ -20,7 +20,11 @@ preload_app!
|
|
20
20
|
|
21
21
|
rackup DefaultRackup
|
22
22
|
port ENV.fetch('PORT', 3000)
|
23
|
-
|
23
|
+
rack_env = ENV.fetch("RACK_ENV", "development")
|
24
|
+
environment rack_env
|
25
|
+
|
26
|
+
# Set 1 day timeout for workers while developing
|
27
|
+
worker_timeout 24 * 60 * 60 if rack_env == "development"
|
24
28
|
|
25
29
|
on_worker_boot do
|
26
30
|
# Worker specific setup for Rails 4.1+
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'shrine'
|
2
|
+
|
3
|
+
if Rails.env.development?
|
4
|
+
require 'shrine/storage/file_system'
|
5
|
+
|
6
|
+
Shrine.storages = {
|
7
|
+
cache: Shrine::Storage::FileSystem.new('public', prefix: 'uploads/cache'),
|
8
|
+
store: Shrine::Storage::FileSystem.new('public', prefix: 'uploads')
|
9
|
+
}
|
10
|
+
elsif Rails.env.production?
|
11
|
+
require 'shrine/storage/s3'
|
12
|
+
|
13
|
+
s3_options = {
|
14
|
+
bucket: ENV.fetch('S3_BUCKET'),
|
15
|
+
region: ENV.fetch('AWS_REGION'),
|
16
|
+
access_key_id: ENV.fetch('AWS_ACCESS_KEY_ID'),
|
17
|
+
secret_access_key: ENV.fetch('AWS_SECRET_ACCESS_KEY')
|
18
|
+
}
|
19
|
+
|
20
|
+
Shrine.storages = {
|
21
|
+
cache: Shrine::Storage::S3.new(prefix: 'cache', **s3_options),
|
22
|
+
store: Shrine::Storage::S3.new(**s3_options)
|
23
|
+
}
|
24
|
+
else
|
25
|
+
require 'shrine/storage/memory'
|
26
|
+
|
27
|
+
Shrine.storages = {
|
28
|
+
cache: Shrine::Storage::Memory.new,
|
29
|
+
store: Shrine::Storage::Memory.new
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
Shrine.plugin :activerecord
|
34
|
+
Shrine.plugin :cached_attachment_data
|
35
|
+
Shrine.plugin :restore_cached_data
|
36
|
+
Shrine.plugin :determine_mime_type, analyzer: :marcel
|
@@ -3,40 +3,41 @@ if Rails.env.development?
|
|
3
3
|
# You can override any of these by setting an environment variable of the
|
4
4
|
# same name.
|
5
5
|
Annotate.set_defaults(
|
6
|
-
'routes'
|
7
|
-
'position_in_routes'
|
8
|
-
'position_in_class'
|
9
|
-
'position_in_test'
|
10
|
-
'position_in_fixture'
|
11
|
-
'position_in_factory'
|
12
|
-
'position_in_serializer'
|
13
|
-
'show_foreign_keys'
|
14
|
-
'show_indexes'
|
15
|
-
'simple_indexes'
|
16
|
-
'model_dir'
|
17
|
-
'root_dir'
|
18
|
-
'include_version'
|
19
|
-
'require'
|
20
|
-
'exclude_tests'
|
21
|
-
'exclude_fixtures'
|
22
|
-
'exclude_factories'
|
23
|
-
'exclude_serializers'
|
24
|
-
'exclude_scaffolds'
|
25
|
-
'exclude_controllers'
|
26
|
-
'exclude_helpers'
|
27
|
-
'ignore_model_sub_dir'
|
28
|
-
'ignore_columns'
|
29
|
-
'ignore_unknown_models'
|
6
|
+
'routes' => 'false',
|
7
|
+
'position_in_routes' => 'after',
|
8
|
+
'position_in_class' => 'after',
|
9
|
+
'position_in_test' => 'after',
|
10
|
+
'position_in_fixture' => 'after',
|
11
|
+
'position_in_factory' => 'after',
|
12
|
+
'position_in_serializer' => 'after',
|
13
|
+
'show_foreign_keys' => 'true',
|
14
|
+
'show_indexes' => 'true',
|
15
|
+
'simple_indexes' => 'false',
|
16
|
+
'model_dir' => 'app/models',
|
17
|
+
'root_dir' => '',
|
18
|
+
'include_version' => 'false',
|
19
|
+
'require' => '',
|
20
|
+
'exclude_tests' => 'true',
|
21
|
+
'exclude_fixtures' => 'true',
|
22
|
+
'exclude_factories' => 'true',
|
23
|
+
'exclude_serializers' => 'true',
|
24
|
+
'exclude_scaffolds' => 'true',
|
25
|
+
'exclude_controllers' => 'true',
|
26
|
+
'exclude_helpers' => 'false',
|
27
|
+
'ignore_model_sub_dir' => 'false',
|
28
|
+
'ignore_columns' => nil,
|
29
|
+
'ignore_unknown_models' => 'false',
|
30
30
|
'hide_limit_column_types' => 'integer,boolean',
|
31
|
-
'skip_on_db_migrate'
|
32
|
-
'format_bare'
|
33
|
-
'format_rdoc'
|
34
|
-
'format_markdown'
|
35
|
-
'sort'
|
36
|
-
'force'
|
37
|
-
'trace'
|
38
|
-
'wrapper_open'
|
39
|
-
'wrapper_close'
|
31
|
+
'skip_on_db_migrate' => 'false',
|
32
|
+
'format_bare' => 'true',
|
33
|
+
'format_rdoc' => 'false',
|
34
|
+
'format_markdown' => 'false',
|
35
|
+
'sort' => 'false',
|
36
|
+
'force' => 'false',
|
37
|
+
'trace' => 'false',
|
38
|
+
'wrapper_open' => nil,
|
39
|
+
'wrapper_close' => nil,
|
40
|
+
'models' => true
|
40
41
|
)
|
41
42
|
end
|
42
43
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
2
2
|
ENV['RACK_ENV'] ||= 'test'
|
3
|
-
require File.expand_path('
|
3
|
+
require File.expand_path('../config/environment', __dir__)
|
4
4
|
require 'rspec/rails'
|
5
5
|
require 'spec_helper'
|
6
6
|
require 'shoulda/matchers'
|
@@ -20,12 +20,14 @@ require 'faker'
|
|
20
20
|
# directory. Alternatively, in the individual `*_spec.rb` files, manually
|
21
21
|
# require only the support files necessary.
|
22
22
|
#
|
23
|
-
Dir[Rails.root.join('spec
|
23
|
+
Dir[Rails.root.join('spec', 'support', '**', '*.rb')].each { |f| require f }
|
24
24
|
|
25
25
|
# Checks for pending migrations before tests are run.
|
26
26
|
# If you are not using ActiveRecord, you can remove this line.
|
27
27
|
ActiveRecord::Migration.maintain_test_schema!
|
28
28
|
|
29
|
+
PowerTypes::Observable.observable_disabled = true
|
30
|
+
|
29
31
|
RSpec.configure do |config|
|
30
32
|
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
31
33
|
# examples within a transaction, remove the following line or assign false
|
@@ -3,36 +3,29 @@ require 'potassium/cli_options'
|
|
3
3
|
module Potassium::CLI
|
4
4
|
extend Potassium::CliOptions
|
5
5
|
|
6
|
-
desc
|
6
|
+
desc 'Create a new Potassium Rails project.'
|
7
7
|
arg 'app_path'
|
8
8
|
command :create do |c|
|
9
|
-
c.default_desc
|
10
|
-
c.switch "version-check",
|
11
|
-
default_value: true,
|
12
|
-
desc: "Performs a version check before running.",
|
13
|
-
negatable: true
|
14
|
-
|
9
|
+
c.default_desc 'Create a new project.'
|
15
10
|
create_options.each { |opts| c.send(opts.delete(:type), opts.delete(:name), opts) }
|
16
11
|
|
17
12
|
c.action do |_global_options, options, _args|
|
18
|
-
require
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
require "potassium/template_finder"
|
13
|
+
require 'potassium/newest_version_ensurer'
|
14
|
+
require 'potassium/node_version_ensurer'
|
15
|
+
require 'potassium/generators/application'
|
16
|
+
require 'potassium/template_finder'
|
23
17
|
|
18
|
+
begin
|
19
|
+
Potassium::NewestVersionEnsurer.new.ensure! if options['version-check']
|
20
|
+
Potassium::NodeVersionEnsurer.new.ensure! if options['node-version-check']
|
24
21
|
template_finder = Potassium::TemplateFinder.new
|
25
22
|
template = template_finder.default_template
|
26
23
|
template.cli_options = options
|
27
24
|
template.source_paths << Rails::Generators::AppGenerator.source_root
|
25
|
+
ARGV.push('--skip-webpack-install', '--skip-bundle')
|
28
26
|
template.start
|
29
|
-
|
30
|
-
|
31
|
-
if options["version-check"]
|
32
|
-
ensurer = Potassium::NewestVersionEnsurer.new
|
33
|
-
ensurer.ensure(&begin_creation)
|
34
|
-
else
|
35
|
-
begin_creation.call
|
27
|
+
rescue VersionError => e
|
28
|
+
print "\nError: #{e.message}" # rubocop:disable Rails/Output
|
36
29
|
end
|
37
30
|
end
|
38
31
|
end
|
@@ -1,5 +1,21 @@
|
|
1
1
|
module Potassium::CliOptions # rubocop:disable Metrics/ModuleLength
|
2
2
|
CREATE_OPTIONS = [
|
3
|
+
{
|
4
|
+
type: :switch,
|
5
|
+
name: 'version-check',
|
6
|
+
desc: 'Performs a version check before running.',
|
7
|
+
negatable: true,
|
8
|
+
default_value: true,
|
9
|
+
default_test_value: true
|
10
|
+
},
|
11
|
+
{
|
12
|
+
type: :switch,
|
13
|
+
name: 'node-version-check',
|
14
|
+
desc: 'Performs a node version check before running.',
|
15
|
+
negatable: true,
|
16
|
+
default_value: true,
|
17
|
+
default_test_value: true
|
18
|
+
},
|
3
19
|
{
|
4
20
|
type: :flag,
|
5
21
|
name: [:db, :database],
|
@@ -16,7 +32,7 @@ module Potassium::CliOptions # rubocop:disable Metrics/ModuleLength
|
|
16
32
|
type: :flag,
|
17
33
|
name: [:email_service, :email],
|
18
34
|
desc: "Decides which email adapter to use. Available: aws_ses, sendgrid, none",
|
19
|
-
default_test_value: "
|
35
|
+
default_test_value: "None"
|
20
36
|
},
|
21
37
|
{
|
22
38
|
type: :switch,
|
@@ -44,8 +60,8 @@ module Potassium::CliOptions # rubocop:disable Metrics/ModuleLength
|
|
44
60
|
},
|
45
61
|
{
|
46
62
|
type: :switch,
|
47
|
-
name:
|
48
|
-
desc: "Whether to use
|
63
|
+
name: :vue_admin,
|
64
|
+
desc: "Whether to use Vue within ActiveAdmin or not",
|
49
65
|
negatable: true,
|
50
66
|
default_value: "none",
|
51
67
|
default_test_value: false
|
@@ -59,28 +75,18 @@ module Potassium::CliOptions # rubocop:disable Metrics/ModuleLength
|
|
59
75
|
default_test_value: false
|
60
76
|
},
|
61
77
|
{
|
62
|
-
type: :
|
78
|
+
type: :flag,
|
63
79
|
name: "api",
|
64
|
-
desc: "
|
65
|
-
negatable: true,
|
66
|
-
default_value: "none",
|
67
|
-
default_test_value: false
|
68
|
-
},
|
69
|
-
{
|
70
|
-
type: :switch,
|
71
|
-
name: "paperclip",
|
72
|
-
desc: "Whether to include Paperclip as dependency",
|
73
|
-
negatable: true,
|
80
|
+
desc: "Which API interface to use",
|
74
81
|
default_value: "none",
|
75
|
-
default_test_value:
|
82
|
+
default_test_value: "None"
|
76
83
|
},
|
77
84
|
{
|
78
|
-
type: :
|
79
|
-
name: "
|
80
|
-
desc: "
|
81
|
-
negatable: true,
|
85
|
+
type: :flag,
|
86
|
+
name: "storage",
|
87
|
+
desc: "Decides which file storage to use. Available: active_storage, shrine, none",
|
82
88
|
default_value: "none",
|
83
|
-
default_test_value:
|
89
|
+
default_test_value: "None"
|
84
90
|
},
|
85
91
|
{
|
86
92
|
type: :switch,
|
@@ -94,7 +100,7 @@ module Potassium::CliOptions # rubocop:disable Metrics/ModuleLength
|
|
94
100
|
type: :flag,
|
95
101
|
name: "background_processor",
|
96
102
|
desc: "Decides which background processor to use. Available: sidekiq, delayed_job, none",
|
97
|
-
default_test_value: "
|
103
|
+
default_test_value: "None"
|
98
104
|
},
|
99
105
|
{
|
100
106
|
type: :switch,
|
@@ -114,12 +120,41 @@ module Potassium::CliOptions # rubocop:disable Metrics/ModuleLength
|
|
114
120
|
},
|
115
121
|
{
|
116
122
|
type: :switch,
|
117
|
-
name: "
|
118
|
-
desc: "Whether
|
123
|
+
name: "github_private",
|
124
|
+
desc: "Whether the github repository is private or not",
|
119
125
|
negatable: true,
|
120
|
-
default_value:
|
126
|
+
default_value: "none",
|
121
127
|
default_test_value: false
|
122
128
|
},
|
129
|
+
{
|
130
|
+
type: :switch,
|
131
|
+
name: "github_has_org",
|
132
|
+
desc: "Whether the github repository should belong to an organization",
|
133
|
+
negatable: true,
|
134
|
+
default_value: "none",
|
135
|
+
default_test_value: false
|
136
|
+
},
|
137
|
+
{
|
138
|
+
type: :flag,
|
139
|
+
name: "github_org",
|
140
|
+
desc: "The github organization where the repository will be created",
|
141
|
+
default_value: "none",
|
142
|
+
default_test_value: "none"
|
143
|
+
},
|
144
|
+
{
|
145
|
+
type: :flag,
|
146
|
+
name: "github_name",
|
147
|
+
desc: "The github repository name",
|
148
|
+
default_value: "none",
|
149
|
+
default_test_value: "none"
|
150
|
+
},
|
151
|
+
{
|
152
|
+
type: :flag,
|
153
|
+
name: "github_access_token",
|
154
|
+
desc: "Github personal access token used to auth to Github API",
|
155
|
+
default_value: "none",
|
156
|
+
default_test_value: "none"
|
157
|
+
},
|
123
158
|
{
|
124
159
|
type: :switch,
|
125
160
|
name: "schedule",
|
@@ -141,6 +176,14 @@ module Potassium::CliOptions # rubocop:disable Metrics/ModuleLength
|
|
141
176
|
name: :front_end,
|
142
177
|
desc: "Decides which front-end framework to use. Available: Vue, Angular 2, None",
|
143
178
|
default_test_value: "None"
|
179
|
+
},
|
180
|
+
{
|
181
|
+
type: :switch,
|
182
|
+
name: "test",
|
183
|
+
desc: "Whether or not it is a test project creation",
|
184
|
+
negatable: true,
|
185
|
+
default_value: false,
|
186
|
+
default_test_value: true
|
144
187
|
}
|
145
188
|
]
|
146
189
|
|