potassium 1.3.5 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rspec +3 -0
- data/.rubocop.yml +1 -1
- data/.ruby_style.yml +6 -2
- data/CHANGELOG.md +19 -1
- data/README.md +79 -74
- data/circle.yml +9 -0
- data/docs/CONTRIBUTING.md +132 -0
- data/docs/{dsl.md → DSL.md} +146 -18
- data/lib/potassium/{templates/application/assets → assets}/.bowerrc +0 -0
- data/lib/potassium/assets/.buildpacks +3 -0
- data/lib/potassium/{templates/application/assets → assets}/.editorconfig +0 -0
- data/lib/potassium/assets/.env.example.erb +8 -0
- data/lib/potassium/assets/.hound.yml +2 -0
- data/lib/potassium/{templates/application/assets → assets}/.pryrc +0 -0
- data/lib/potassium/assets/.rubocop.yml +3 -0
- data/lib/potassium/assets/.ruby_style.yml +0 -0
- data/lib/potassium/assets/Dockerfile.ci +4 -0
- data/lib/potassium/assets/Procfile +1 -0
- data/lib/potassium/assets/README.md.erb +2 -0
- data/lib/potassium/assets/README.yml +83 -0
- data/lib/potassium/{templates/application/assets → assets}/active_admin/active_admin.js.coffee +0 -0
- data/lib/potassium/{templates/application/assets → assets}/active_admin/admin_user_policy.rb +0 -0
- data/lib/potassium/{templates/application/assets → assets}/active_admin/comment_policy.rb +0 -0
- data/lib/potassium/{templates/application/assets → assets}/active_admin/init_activeadmin_angular.rb +0 -0
- data/lib/potassium/{templates/application/assets → assets}/active_admin/pundit_page_policy.rb +0 -0
- data/lib/potassium/{templates/application/assets → assets}/api/api_error_concern.rb +0 -0
- data/lib/potassium/{templates/application/assets → assets}/api/base_controller.rb +0 -0
- data/lib/potassium/{templates/application/assets → assets}/api/responder.rb +0 -0
- data/lib/potassium/assets/bin/cibuild.erb +27 -0
- data/lib/potassium/assets/bin/setup.erb +22 -0
- data/lib/potassium/assets/bin/setup_heroku.erb +21 -0
- data/lib/potassium/{templates/application/assets → assets}/bower.json +0 -0
- data/lib/potassium/assets/circle.yml +16 -0
- data/lib/potassium/assets/config/database_mysql.yml.erb +25 -0
- data/lib/potassium/assets/config/database_postgresql.yml.erb +25 -0
- data/lib/potassium/assets/config/environments/staging.rb +5 -0
- data/lib/potassium/assets/config/puma.rb +29 -0
- data/lib/potassium/assets/config/secrets.yml.erb +14 -0
- data/lib/potassium/assets/docker-compose.ci.yml +6 -0
- data/lib/potassium/{templates/application/assets → assets}/es.yml +0 -0
- data/lib/potassium/{templates/application/assets → assets}/testing/.rspec +0 -0
- data/lib/potassium/{templates/application/assets → assets}/testing/rails_helper.rb +0 -0
- data/lib/potassium/cli/commands/create.rb +55 -4
- data/lib/potassium/cli/commands/install.rb +27 -13
- data/lib/potassium/{templates/application/generator.rb → generators/application.rb} +7 -2
- data/lib/potassium/{templates/application/recipe_generator.rb → generators/recipe.rb} +11 -2
- data/lib/potassium/helpers/answer-helpers.rb +21 -0
- data/lib/potassium/{templates/application/helpers → helpers}/callback-helpers.rb +0 -0
- data/lib/potassium/helpers/docker-helpers.rb +37 -0
- data/lib/potassium/{templates/application/helpers → helpers}/environment-helpers.rb +0 -0
- data/lib/potassium/{templates/application/helpers → helpers}/gem-helpers.rb +6 -2
- data/lib/potassium/helpers/info-helpers.rb +16 -0
- data/lib/potassium/helpers/readme-helpers.rb +85 -0
- data/lib/potassium/{templates/application/helpers → helpers}/template-dsl.rb +8 -0
- data/lib/potassium/helpers/template-helpers.rb +97 -0
- data/lib/potassium/{templates/application/helpers → helpers}/variable-helpers.rb +0 -0
- data/lib/potassium/recipe.rb +2 -0
- data/lib/potassium/{templates/application/recipes → recipes}/admin.rb +36 -6
- data/lib/potassium/recipes/angular_admin.rb +56 -0
- data/lib/potassium/recipes/api.rb +43 -0
- data/lib/potassium/recipes/aws_sdk.rb +5 -0
- data/lib/potassium/recipes/bower.rb +13 -0
- data/lib/potassium/recipes/ci.rb +42 -0
- data/lib/potassium/recipes/cleanup.rb +10 -0
- data/lib/potassium/recipes/database.rb +42 -0
- data/lib/potassium/recipes/delayed_job.rb +41 -0
- data/lib/potassium/recipes/devise.rb +64 -0
- data/lib/potassium/recipes/editorconfig.rb +5 -0
- data/lib/potassium/recipes/env.rb +10 -0
- data/lib/potassium/recipes/git.rb +13 -0
- data/lib/potassium/recipes/github.rb +27 -0
- data/lib/potassium/recipes/heroku.rb +138 -0
- data/lib/potassium/recipes/i18n.rb +26 -0
- data/lib/potassium/recipes/paperclip.rb +37 -0
- data/lib/potassium/recipes/production.rb +7 -0
- data/lib/potassium/recipes/pry.rb +10 -0
- data/lib/potassium/recipes/puma.rb +19 -0
- data/lib/potassium/recipes/pundit.rb +61 -0
- data/lib/potassium/recipes/rack_cors.rb +21 -0
- data/lib/potassium/recipes/readme.rb +7 -0
- data/lib/potassium/recipes/ruby.rb +23 -0
- data/lib/potassium/recipes/script.rb +16 -0
- data/lib/potassium/recipes/secrets.rb +5 -0
- data/lib/potassium/recipes/staging.rb +5 -0
- data/lib/potassium/recipes/style.rb +13 -0
- data/lib/potassium/recipes/testing.rb +37 -0
- data/lib/potassium/templates/application.rb +67 -0
- data/lib/potassium/templates/recipe.rb +12 -0
- data/lib/potassium/text_spinner.rb +0 -5
- data/lib/potassium/version.rb +2 -1
- data/potassium.gemspec +3 -0
- data/spec/fakes/bin/heroku +5 -0
- data/spec/fakes/bin/hub +5 -0
- data/spec/features/ci_spec.rb +14 -0
- data/spec/features/github_spec.rb +22 -0
- data/spec/features/heroku_spec.rb +61 -0
- data/spec/features/new_project_spec.rb +38 -0
- data/spec/spec_helper.rb +33 -0
- data/spec/support/fake_github.rb +25 -0
- data/spec/support/fake_heroku.rb +77 -0
- data/spec/support/potassium_test_helpers.rb +98 -0
- metadata +149 -62
- data/lib/potassium/templates/application/assets/.rbenv-vars.example +0 -8
- data/lib/potassium/templates/application/assets/config/database_mysql.yml +0 -40
- data/lib/potassium/templates/application/assets/config/database_postgresql.yml +0 -26
- data/lib/potassium/templates/application/helpers/recipe-helpers.rb +0 -5
- data/lib/potassium/templates/application/helpers/template-helpers.rb +0 -35
- data/lib/potassium/templates/application/recipe_template.rb +0 -23
- data/lib/potassium/templates/application/recipes/angular_admin.rb +0 -26
- data/lib/potassium/templates/application/recipes/api.rb +0 -22
- data/lib/potassium/templates/application/recipes/asks/admin.rb +0 -9
- data/lib/potassium/templates/application/recipes/asks/api.rb +0 -2
- data/lib/potassium/templates/application/recipes/asks/database.rb +0 -9
- data/lib/potassium/templates/application/recipes/asks/devise.rb +0 -10
- data/lib/potassium/templates/application/recipes/asks/i18n.rb +0 -8
- data/lib/potassium/templates/application/recipes/asks/paperclip.rb +0 -2
- data/lib/potassium/templates/application/recipes/asks/pundit.rb +0 -4
- data/lib/potassium/templates/application/recipes/aws_sdk.rb +0 -1
- data/lib/potassium/templates/application/recipes/bower.rb +0 -3
- data/lib/potassium/templates/application/recipes/checks/devise.rb +0 -1
- data/lib/potassium/templates/application/recipes/database.rb +0 -22
- data/lib/potassium/templates/application/recipes/dependencies/admin.rb +0 -3
- data/lib/potassium/templates/application/recipes/devise.rb +0 -28
- data/lib/potassium/templates/application/recipes/editorconfig.rb +0 -1
- data/lib/potassium/templates/application/recipes/git.rb +0 -9
- data/lib/potassium/templates/application/recipes/i18n.rb +0 -9
- data/lib/potassium/templates/application/recipes/paperclip.rb +0 -20
- data/lib/potassium/templates/application/recipes/production.rb +0 -3
- data/lib/potassium/templates/application/recipes/pry.rb +0 -6
- data/lib/potassium/templates/application/recipes/pundit.rb +0 -33
- data/lib/potassium/templates/application/recipes/rack-cors.rb +0 -15
- data/lib/potassium/templates/application/recipes/rbenv.rb +0 -23
- data/lib/potassium/templates/application/recipes/readme.rb +0 -2
- data/lib/potassium/templates/application/recipes/testing.rb +0 -32
- data/lib/potassium/templates/application/recipes/unicorn.rb +0 -5
- data/lib/potassium/templates/application/template.rb +0 -58
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
web: bundle exec puma -C ./config/puma.rb
|
@@ -0,0 +1,2 @@
|
|
1
|
+
# <%= get(:titleized_app_name) %> <% if selected?(:heroku) %>[![Circle CI](https://circleci.com/gh/platanus/<%= get(:dasherized_app_name)%>.svg?style=svg)](https://circleci.com/gh/platanus/<%= get(:dasherized_app_name)%>)<% end-%>
|
2
|
+
This is a Rails application, initially generated using [Potassium](https://github.com/platanus/potassium) by Platanus.
|
@@ -0,0 +1,83 @@
|
|
1
|
+
readme:
|
2
|
+
headers:
|
3
|
+
installation:
|
4
|
+
title: "Local installation"
|
5
|
+
body: |
|
6
|
+
Assuming you've just cloned the repo, run this script to setup the project in your
|
7
|
+
machine:
|
8
|
+
|
9
|
+
$ ./bin/setup
|
10
|
+
|
11
|
+
It assumes you have a machine equipped with Ruby, <%= get(:database).to_s.titleize %>, etc. If not, set up
|
12
|
+
your machine with [boxen].
|
13
|
+
|
14
|
+
The script will do the following among other things:
|
15
|
+
|
16
|
+
- Install the dependecies
|
17
|
+
- Prepare your database
|
18
|
+
- Adds heroku remotes
|
19
|
+
|
20
|
+
After the app setup is done you can run it with [Heroku Local]
|
21
|
+
|
22
|
+
$ heroku local
|
23
|
+
|
24
|
+
[Heroku Local]: https://devcenter.heroku.com/articles/heroku-local
|
25
|
+
[boxen]: http://github.com/platanus/our-boxen
|
26
|
+
ci:
|
27
|
+
title: "Continuous Integrations"
|
28
|
+
body: |
|
29
|
+
The project is setup to run tests
|
30
|
+
in [CircleCI](https://circleci.com/gh/platanus/<%= get(:dasherized_app_name) %>/tree/master)
|
31
|
+
|
32
|
+
You can also run the test locally simulating the production environment using docker.
|
33
|
+
Just make sure you have docker installed and run:
|
34
|
+
|
35
|
+
bin/cibuild
|
36
|
+
deployment:
|
37
|
+
title: "Deployment"
|
38
|
+
body: |
|
39
|
+
This project is pre-configured to be (easily) deployed to Heroku servers, but needs you to have the Potassium binary installed. If you don't, then run:
|
40
|
+
|
41
|
+
$ gem install potassium
|
42
|
+
|
43
|
+
Then, make sure you are logged in to the Heroku account where you want to create the app and run
|
44
|
+
|
45
|
+
$ potassium install heroku --force
|
46
|
+
|
47
|
+
this will create the app on heroku, create a pipeline and link the app to the pipeline.
|
48
|
+
|
49
|
+
You'll still have to manually log in to the heroku dahsboard, go to the new pipeline and 'configure automatic deploys' using Github
|
50
|
+
You can run the following command to open the dashboard in the pipeline page
|
51
|
+
|
52
|
+
$ heroku pipelines:open
|
53
|
+
|
54
|
+
![Hint](https://cloud.githubusercontent.com/assets/313750/13019759/fa86c8ca-d1af-11e5-8869-cd2efb5513fa.png)
|
55
|
+
|
56
|
+
Remember to connect each stage to the corresponding branch:
|
57
|
+
|
58
|
+
1. Staging -> Master
|
59
|
+
2. Production -> Production
|
60
|
+
|
61
|
+
That's it. You should already have a running app and each time you push to the corresponding branch, the system will (hopefully) update accordingly.
|
62
|
+
style_guide:
|
63
|
+
title: "Style Guides"
|
64
|
+
body: |
|
65
|
+
The style guides are enforced through a self hosted version of [Hound CI](http://monkyeci.platan.us). The style configuration can also be used locally
|
66
|
+
in development runing `rubocop` or just using the rubocop integration for your text editor of choice.
|
67
|
+
|
68
|
+
You can add custom rules to this project just adding them to the `.ruby-style.yml` file.
|
69
|
+
internal_dependencies:
|
70
|
+
title: "Internal dependencies"
|
71
|
+
sections:
|
72
|
+
devise:
|
73
|
+
title: "Authentication"
|
74
|
+
body: "We are using the great [Devise](https://github.com/plataformatec/devise) library by [PlataformaTec](http://plataformatec.com.br/)"
|
75
|
+
paperclip:
|
76
|
+
title: "Uploads"
|
77
|
+
body: "For managing uploads, this project uses [Paperclip](https://github.com/thoughtbot/paperclip), a gem made by the awesome [Thoughbot](https://thoughtbot.com/) team."
|
78
|
+
pundit:
|
79
|
+
title: "Authorization"
|
80
|
+
body: "For defining which parts of the system each user has access to, we have chosen to include the [Pundit](https://github.com/elabs/pundit) gem, by [Elabs](http://elabs.se/)."
|
81
|
+
delayed_job:
|
82
|
+
title: "Queue System"
|
83
|
+
body: "For managing tasks in the background, this project uses [DelayedJob](https://github.com/collectiveidea/delayed_job)"
|
data/lib/potassium/{templates/application/assets → assets}/active_admin/active_admin.js.coffee
RENAMED
File without changes
|
data/lib/potassium/{templates/application/assets → assets}/active_admin/admin_user_policy.rb
RENAMED
File without changes
|
File without changes
|
data/lib/potassium/{templates/application/assets → assets}/active_admin/init_activeadmin_angular.rb
RENAMED
File without changes
|
data/lib/potassium/{templates/application/assets → assets}/active_admin/pundit_page_policy.rb
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,27 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
DOCKE_COMPOSE_ARGS="-f docker-compose.ci.yml run"
|
4
|
+
|
5
|
+
<% if(selected?(:database, :mysql) || selected?(:database, :postgresql))-%>
|
6
|
+
function test_<%=get(:database).to_s%> {
|
7
|
+
docker-compose $DOCKE_COMPOSE_ARGS test sh -c 'nc -z $<%=get(:database).to_s.upcase%>_HOST $<%=get(:database).to_s.upcase%>_PORT'
|
8
|
+
}
|
9
|
+
|
10
|
+
count=0
|
11
|
+
# Chain tests together by using &&
|
12
|
+
until ( test_<%=get(:database).to_s%> && echo "Services ready" )
|
13
|
+
do
|
14
|
+
((count++))
|
15
|
+
if [ ${count} -gt 50 ]
|
16
|
+
then
|
17
|
+
echo "Services didn't become ready in time"
|
18
|
+
exit 1
|
19
|
+
else
|
20
|
+
echo "Waiting for services to become ready..."
|
21
|
+
fi
|
22
|
+
sleep 0.2
|
23
|
+
done
|
24
|
+
<% end-%>
|
25
|
+
|
26
|
+
docker-compose $DOCKE_COMPOSE_ARGS test /exec bundle exec rake db:setup
|
27
|
+
docker-compose $DOCKE_COMPOSE_ARGS test /exec bundle exec rspec spec
|
@@ -0,0 +1,22 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
# Set up Rails app. Run this script immediately after cloning the codebase.
|
4
|
+
# https://la-guia.platan.us/code/rails.html#getting-started
|
5
|
+
|
6
|
+
# Exit if any subcommand fails
|
7
|
+
set -e
|
8
|
+
|
9
|
+
# Set up Ruby dependencies via Bundler
|
10
|
+
gem install bundler --conservative
|
11
|
+
bundle check || bundle install
|
12
|
+
|
13
|
+
# Set up database
|
14
|
+
bin/rake db:setup
|
15
|
+
|
16
|
+
# Add binstubs to PATH via export PATH=".git/safe/../../bin:$PATH" in ~/.zshenv
|
17
|
+
mkdir -p .git/safe
|
18
|
+
|
19
|
+
<% if selected?(:heroku) -%>
|
20
|
+
# Setup heroku remotes
|
21
|
+
bin/setup_heroku
|
22
|
+
<% end-%>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
# Setup heroku application remotes
|
4
|
+
if heroku auth:whoami &> /dev/null; then
|
5
|
+
if heroku apps:info --app <%= get(:heroku_app_name_staging) %> &> /dev/null; then
|
6
|
+
git remote add staging git@heroku.com:<%= get(:heroku_app_name_staging) %>.git || true
|
7
|
+
git config heroku.remote staging
|
8
|
+
echo 'You are a collaborator on the "<%= get(:heroku_app_name_staging) %>" Heroku app'
|
9
|
+
else
|
10
|
+
echo 'Ask for access to the "<%= get(:heroku_app_name_staging) %>" Heroku app'
|
11
|
+
fi
|
12
|
+
|
13
|
+
if heroku apps:info --app <%= get(:heroku_app_name_production) %> &> /dev/null; then
|
14
|
+
git remote add production git@heroku.com:<%= get(:heroku_app_name_production) %>.git || true
|
15
|
+
echo 'You are a collaborator on the "<%= get(:heroku_app_name_production) %>" Heroku app'
|
16
|
+
else
|
17
|
+
echo 'Ask for access to the "<%= get(:heroku_app_name_production) %>" Heroku app'
|
18
|
+
fi
|
19
|
+
else
|
20
|
+
echo 'You need to login to heroku. Run "heroku login"'
|
21
|
+
fi
|
File without changes
|
@@ -0,0 +1,16 @@
|
|
1
|
+
machine:
|
2
|
+
services:
|
3
|
+
- docker
|
4
|
+
|
5
|
+
dependencies:
|
6
|
+
override:
|
7
|
+
- docker-compose -f docker-compose.ci.yml pull
|
8
|
+
- docker-compose -f docker-compose.ci.yml build test
|
9
|
+
|
10
|
+
database:
|
11
|
+
override:
|
12
|
+
- echo "Skipping database"
|
13
|
+
|
14
|
+
test:
|
15
|
+
override:
|
16
|
+
- bin/cibuild
|
@@ -0,0 +1,25 @@
|
|
1
|
+
development: &default
|
2
|
+
adapter: mysql2
|
3
|
+
database: <%= get(:underscorized_app_name) %>_development
|
4
|
+
encoding: utf8
|
5
|
+
username: root
|
6
|
+
host: <%%= ENV["BOXEN_MYSQL_HOST"] || ENV["MYSQL_HOST"] || "127.0.0.1" %>
|
7
|
+
port: <%%= ENV["BOXEN_MYSQL_PORT"] || ENV["MYSQL_PORT"] || 3306 %>
|
8
|
+
min_messages: warning
|
9
|
+
pool: <%%= Integer(ENV.fetch("DB_POOL", 5)) %>
|
10
|
+
reaping_frequency: <%%= Integer(ENV.fetch("DB_REAPING_FREQUENCY", 10)) %>
|
11
|
+
timeout: 5000
|
12
|
+
|
13
|
+
test:
|
14
|
+
<<: *default
|
15
|
+
database: <%= get(:underscorized_app_name) %>_test
|
16
|
+
|
17
|
+
production: &deploy
|
18
|
+
adapter: mysql2
|
19
|
+
encoding: utf8
|
20
|
+
min_messages: warning
|
21
|
+
pool: <%%= [Integer(ENV.fetch("MAX_THREADS", 5)), Integer(ENV.fetch("DB_POOL", 5))].max %>
|
22
|
+
timeout: 5000
|
23
|
+
url: <%%= ENV.fetch("DATABASE_URL", "") %>
|
24
|
+
|
25
|
+
staging: *deploy
|
@@ -0,0 +1,25 @@
|
|
1
|
+
development: &default
|
2
|
+
adapter: postgresql
|
3
|
+
database: <%= get(:underscorized_app_name) %>_development
|
4
|
+
encoding: utf8
|
5
|
+
host: <%%= ENV["BOXEN_POSTGRESQL_HOST"] || ENV["POSTGRESQL_HOST"] || "127.0.0.1" %>
|
6
|
+
port: <%%= ENV["BOXEN_POSTGRESQL_PORT"] || ENV["POSTGRESQL_PORT"] || 5432 %>
|
7
|
+
username: <%%= ENV["POSTGRESQL_USER"] %>
|
8
|
+
min_messages: warning
|
9
|
+
pool: <%%= Integer(ENV.fetch("DB_POOL", 5)) %>
|
10
|
+
reaping_frequency: <%%= Integer(ENV.fetch("DB_REAPING_FREQUENCY", 10)) %>
|
11
|
+
timeout: 5000
|
12
|
+
|
13
|
+
test:
|
14
|
+
<<: *default
|
15
|
+
database: <%= get(:underscorized_app_name) %>_test
|
16
|
+
|
17
|
+
production: &deploy
|
18
|
+
adapter: mysql2
|
19
|
+
encoding: utf8
|
20
|
+
min_messages: warning
|
21
|
+
pool: <%%= [Integer(ENV.fetch("MAX_THREADS", 5)), Integer(ENV.fetch("DB_POOL", 5))].max %>
|
22
|
+
timeout: 5000
|
23
|
+
url: <%%= ENV.fetch("DATABASE_URL", "") %>
|
24
|
+
|
25
|
+
staging: *deploy
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server
|
2
|
+
|
3
|
+
# The environment variable WEB_CONCURRENCY may be set to a default value based
|
4
|
+
# on dyno size. To manually configure this value use heroku config:set
|
5
|
+
# WEB_CONCURRENCY.
|
6
|
+
#
|
7
|
+
# Increasing the number of workers will increase the amount of resting memory
|
8
|
+
# your dynos use. Increasing the number of threads will increase the amount of
|
9
|
+
# potential bloat added to your dynos when they are responding to heavy
|
10
|
+
# requests.
|
11
|
+
#
|
12
|
+
# Starting with a low number of workers and threads provides adequate
|
13
|
+
# performance for most applications, even under load, while maintaining a low
|
14
|
+
# risk of overusing memory.
|
15
|
+
workers Integer(ENV.fetch("WEB_CONCURRENCY", 2))
|
16
|
+
threads_count = Integer(ENV.fetch("MAX_THREADS", 2))
|
17
|
+
threads(threads_count, threads_count)
|
18
|
+
|
19
|
+
preload_app!
|
20
|
+
|
21
|
+
rackup DefaultRackup
|
22
|
+
port ENV.fetch('PORT', 3000)
|
23
|
+
environment ENV.fetch("RAILS_ENV", "development")
|
24
|
+
|
25
|
+
on_worker_boot do
|
26
|
+
# Worker specific setup for Rails 4.1+
|
27
|
+
# See: https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server#on-worker-boot
|
28
|
+
ActiveRecord::Base.establish_connection
|
29
|
+
end
|
File without changes
|
File without changes
|
File without changes
|
@@ -3,19 +3,70 @@ module Potassium::CLI
|
|
3
3
|
arg 'app_path'
|
4
4
|
command :create do |c|
|
5
5
|
c.default_desc "Create a new project."
|
6
|
-
c.switch "version-check",
|
7
|
-
|
8
|
-
|
6
|
+
c.switch "version-check",
|
7
|
+
default_value: true,
|
8
|
+
desc: "Performs a version check before running.",
|
9
|
+
negatable: true
|
10
|
+
|
11
|
+
c.flag [:db, :database],
|
12
|
+
desc: "Decides which database to use. Available: mysql, postgresql, none"
|
13
|
+
c.flag [:lang, :language],
|
14
|
+
desc: "Decides which language to use. Available: es, en"
|
15
|
+
c.switch "devise",
|
16
|
+
desc: "Whether to use Devise for authentication or not",
|
17
|
+
negatable: true,
|
18
|
+
default_value: "none"
|
19
|
+
c.switch "devise-user-model",
|
20
|
+
desc: "Whether to create a User model for Devise",
|
21
|
+
negatable: true,
|
22
|
+
default_value: "none"
|
23
|
+
c.switch "admin",
|
24
|
+
desc: "Whether to use ActiveAdmin or not",
|
25
|
+
negatable: true,
|
26
|
+
default_value: "none"
|
27
|
+
c.switch "angular-admin",
|
28
|
+
desc: "Whether to use Angular within ActiveAdmin or not",
|
29
|
+
negatable: true,
|
30
|
+
default_value: "none"
|
31
|
+
c.switch "pundit",
|
32
|
+
desc: "Whether to use Pundit for authorization or not",
|
33
|
+
negatable: true,
|
34
|
+
default_value: "none"
|
35
|
+
c.switch "api",
|
36
|
+
desc: "Whether to apply the API mode or not",
|
37
|
+
negatable: true,
|
38
|
+
default_value: "none"
|
39
|
+
c.switch "paperclip",
|
40
|
+
desc: "Whether to include Paperclip as dependency",
|
41
|
+
negatable: true,
|
42
|
+
default_value: "none"
|
43
|
+
c.switch "heroku",
|
44
|
+
desc: "Whether to prepare to application for Heroku or not",
|
45
|
+
negatable: true,
|
46
|
+
default_value: "none"
|
47
|
+
c.switch "delayed-job",
|
48
|
+
desc: "Whether to use DelayedJob or not",
|
49
|
+
negatable: true,
|
50
|
+
default_value: "none"
|
51
|
+
c.switch "github",
|
52
|
+
desc: "Whether to create a github repository",
|
53
|
+
negatable: true,
|
54
|
+
default_value: "none"
|
55
|
+
c.switch "github-private",
|
56
|
+
desc: "Whether to the github repository is private",
|
57
|
+
negatable: true,
|
58
|
+
default_value: false
|
9
59
|
|
10
60
|
c.action do |_global_options, options, _args|
|
11
61
|
require "potassium/newest_version_ensurer"
|
12
62
|
|
13
63
|
begin_creation = -> do
|
14
|
-
require "potassium/
|
64
|
+
require "potassium/generators/application"
|
15
65
|
require "potassium/template_finder"
|
16
66
|
|
17
67
|
template_finder = Potassium::TemplateFinder.new
|
18
68
|
template = template_finder.default_template
|
69
|
+
template.cli_options = options
|
19
70
|
template.source_paths << Rails::Generators::AppGenerator.source_root
|
20
71
|
template.start
|
21
72
|
end
|