potassium 5.2.1 → 6.2.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.
- checksums.yaml +4 -4
- data/.circleci/config.yml +84 -0
- data/.gitignore +2 -1
- data/.node-version +1 -0
- data/.rubocop.yml +530 -0
- data/.ruby-version +1 -1
- data/CHANGELOG.md +91 -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 +528 -0
- data/lib/potassium/assets/.stylelintrc.json +46 -0
- data/lib/potassium/assets/Dockerfile.ci +1 -1
- data/lib/potassium/assets/Makefile.erb +21 -32
- data/lib/potassium/assets/Procfile +1 -0
- data/lib/potassium/assets/README.yml +58 -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/app/views/shared/_gtm_body.html.erb +4 -0
- data/lib/potassium/assets/app/views/shared/_gtm_head.html.erb +7 -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 +1 -1
- data/lib/potassium/assets/config/database_mysql.yml.erb +2 -2
- data/lib/potassium/assets/config/database_postgresql.yml.erb +2 -2
- data/lib/potassium/assets/config/graphql_playground.rb +20 -0
- data/lib/potassium/assets/config/puma.rb +1 -1
- data/lib/potassium/assets/config/shrine.rb +36 -0
- data/lib/potassium/assets/docker-compose.ci.yml +2 -1
- 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/testing/rails_helper.rb +4 -2
- data/lib/potassium/cli/commands/create.rb +12 -19
- data/lib/potassium/cli_options.rb +77 -26
- 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 +66 -19
- data/lib/potassium/recipes/ci.rb +6 -4
- data/lib/potassium/recipes/data_migrate.rb +44 -0
- data/lib/potassium/recipes/database.rb +4 -0
- data/lib/potassium/recipes/database_container.rb +7 -5
- 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/google_tag_manager.rb +90 -0
- data/lib/potassium/recipes/heroku.rb +44 -30
- data/lib/potassium/recipes/mailer.rb +27 -4
- data/lib/potassium/recipes/node.rb +21 -0
- data/lib/potassium/recipes/rack_cors.rb +18 -15
- data/lib/potassium/recipes/schedule.rb +17 -2
- data/lib/potassium/recipes/style.rb +21 -3
- data/lib/potassium/recipes/vue_admin.rb +124 -0
- data/lib/potassium/templates/application.rb +9 -7
- data/lib/potassium/version.rb +6 -4
- data/potassium.gemspec +11 -6
- data/spec/features/api_spec.rb +25 -0
- data/spec/features/background_processor_spec.rb +19 -6
- data/spec/features/data_migrate_spec.rb +14 -0
- data/spec/features/database_container_spec.rb +2 -5
- 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/google_tag_manager_spec.rb +59 -0
- data/spec/features/graphql_spec.rb +71 -0
- data/spec/features/heroku_spec.rb +8 -5
- data/spec/features/mailer_spec.rb +58 -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/schedule_spec.rb +11 -4
- 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 -9
- data/tmp/.keep +0 -0
- metadata +157 -48
- 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/sidekiq_scheduler.yml +0 -9
- 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
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
module Types
|
|
2
|
+
class QueryType < Types::Base::BaseObject
|
|
3
|
+
# Add root-level fields here.
|
|
4
|
+
# They will be entry points for queries on your schema.
|
|
5
|
+
|
|
6
|
+
# TODO: remove me
|
|
7
|
+
field :test_field, String, null: false,
|
|
8
|
+
description: "An example field added by the generator"
|
|
9
|
+
def test_field
|
|
10
|
+
"Hello World!"
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { shallowMount } from '@vue/test-utils';
|
|
2
|
+
import App from 'app';
|
|
3
|
+
|
|
4
|
+
describe('App', () => {
|
|
5
|
+
test('is a Vue instance', () => {
|
|
6
|
+
const wrapper = shallowMount(App);
|
|
7
|
+
expect(wrapper.isVueInstance()).toBeTruthy();
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
it('displays message on load', () => {
|
|
11
|
+
const wrapper = shallowMount(App);
|
|
12
|
+
expect(wrapper.find('p').text()).toEqual('Hello Vue!');
|
|
13
|
+
});
|
|
14
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<!-- Google Tag Manager -->
|
|
2
|
+
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
|
|
3
|
+
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
|
|
4
|
+
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
|
|
5
|
+
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
|
|
6
|
+
})(window,document,'script','dataLayer','<%=ENV['GTM_CONTAINER_ID']%>');</script>
|
|
7
|
+
<!-- End Google Tag Manager -->
|
|
@@ -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,6 +1,6 @@
|
|
|
1
1
|
development: &default
|
|
2
2
|
adapter: mysql2
|
|
3
|
-
database: <%= get(:
|
|
3
|
+
database: <%= get(:dasherized_app_name) %>_development
|
|
4
4
|
encoding: utf8
|
|
5
5
|
host: <%%= ENV["DB_HOST"] || "127.0.0.1" %>
|
|
6
6
|
port: <%%= ENV["DB_PORT"] || 3306 %>
|
|
@@ -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,6 +1,6 @@
|
|
|
1
1
|
development: &default
|
|
2
2
|
adapter: postgresql
|
|
3
|
-
database: <%= get(:
|
|
3
|
+
database: <%= get(:dasherized_app_name) %>_development
|
|
4
4
|
encoding: utf8
|
|
5
5
|
host: <%%= ENV["DB_HOST"] || "127.0.0.1" %>
|
|
6
6
|
port: <%%= ENV["DB_PORT"] || 5432 %>
|
|
@@ -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
|
|
@@ -24,7 +24,7 @@ rack_env = ENV.fetch("RACK_ENV", "development")
|
|
|
24
24
|
environment rack_env
|
|
25
25
|
|
|
26
26
|
# Set 1 day timeout for workers while developing
|
|
27
|
-
worker_timeout
|
|
27
|
+
worker_timeout 24 * 60 * 60 if rack_env == "development"
|
|
28
28
|
|
|
29
29
|
on_worker_boot do
|
|
30
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
|