potassium 5.2.1 → 5.2.2
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 +32 -0
- data/CHANGELOG.md +12 -0
- data/README.md +1 -3
- data/lib/potassium/assets/.buildpacks +0 -1
- data/lib/potassium/assets/.pryrc +1 -1
- data/lib/potassium/assets/Procfile +1 -0
- data/lib/potassium/assets/bin/cibuild.erb +1 -1
- data/lib/potassium/assets/bin/release +9 -0
- data/lib/potassium/assets/lib/tasks/auto_annotate_models.rake +33 -33
- data/lib/potassium/assets/testing/rails_helper.rb +2 -2
- data/lib/potassium/recipes/ci.rb +3 -3
- data/lib/potassium/recipes/heroku.rb +2 -1
- data/lib/potassium/recipes/mailer.rb +9 -2
- data/lib/potassium/version.rb +1 -1
- data/spec/features/database_container_spec.rb +1 -0
- data/spec/features/heroku_spec.rb +8 -5
- data/spec/features/mailer_spec.rb +42 -0
- metadata +7 -5
- data/circle.yml +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 28763549d04fed43f8cbe7206b9ca47dc79b1d631b1fd338a638ca59e18ec70c
|
4
|
+
data.tar.gz: f70e44992829f10fa2e5dff986fc6e56d293ab13b5210575b4da8be95784174b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2714545c45a60fc3981ecb0237f5bbe3ac00f0da0c4384ff8a8f2ee01b37d449008804a196d08b1642c4f931c85f12b8e0b92476cf8bb269fa89c39b18c521ae
|
7
|
+
data.tar.gz: c113ea96c6e0be9a328d92f55a52f90e65d0ced49a621211e5f055a015804a972d8163d713d2c451e42be15ef86626951e300de6e4c3fa9c1fd3d4d10e4ff31b
|
@@ -0,0 +1,32 @@
|
|
1
|
+
version: 2
|
2
|
+
jobs:
|
3
|
+
build:
|
4
|
+
working_directory: ~/app
|
5
|
+
parallelism: 4
|
6
|
+
shell: /bin/bash --login
|
7
|
+
|
8
|
+
docker:
|
9
|
+
- image: circleci/build-image:ubuntu-14.04-XXL-upstart-1189-5614f37
|
10
|
+
command: /sbin/init
|
11
|
+
|
12
|
+
steps:
|
13
|
+
- checkout
|
14
|
+
- run: rm -f app/.rvmrc; echo 2.5.1 > app/.ruby-version; rvm use 2.5.1 --default
|
15
|
+
- run: 'sudo docker info >/dev/null 2>&1 || sudo service docker start; '
|
16
|
+
- run: echo 'export rvm_install_on_use_flag=0' >> /home/ubuntu/.rvmrc
|
17
|
+
|
18
|
+
- restore_cache:
|
19
|
+
keys:
|
20
|
+
- v1-dep-{{ .Branch }}-
|
21
|
+
- v1-dep-master-
|
22
|
+
- run: bundle install
|
23
|
+
- run: gem install hound-cli
|
24
|
+
- save_cache:
|
25
|
+
key: v1-dep-{{ .Branch }}-{{ epoch }}
|
26
|
+
paths:
|
27
|
+
- vendor/bundle
|
28
|
+
- run:
|
29
|
+
command: bundle exec rspec --color --require spec_helper --format=doc --format progress $(circleci tests glob spec/**/*_spec.rb | circleci tests split)
|
30
|
+
environment:
|
31
|
+
RAILS_ENV: test
|
32
|
+
RACK_ENV: test
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -98,13 +98,13 @@ When you choose to deploy to heroku a few extra things are added for the project
|
|
98
98
|
parity between testing and production environments
|
99
99
|
- Adds a `.buildpacks` file with the default buildpacks to use. It use the
|
100
100
|
following buildpacks:
|
101
|
+
- Adds a `bin/release` file with the release phase script to run specific tasks before the app is deployed completely, for example `rails db:migrate`.
|
101
102
|
|
102
103
|
| index | buildpack | description |
|
103
104
|
|-------|-----------|-------------|
|
104
105
|
| 1. | [nodejs][heroku-buildpack-nodejs] | to support javascript package management with `yarn` and `webpack` based asset compiling |
|
105
106
|
| 2. | [ruby-version][heroku-buildpack-ruby-version] | to support the use of `.ruby-version` file to instruct heroku which ruby version to use |
|
106
107
|
| 3. | [ruby][heroku-buildpack-ruby] | the base buildpack to run ruby applications |
|
107
|
-
| 4. | [ruby-deploy-tasks][buildpack-deploy-tasks] | to run rake task after the deployment is complete, for example `db:migrate` |
|
108
108
|
|
109
109
|
Also the heroku applications are created
|
110
110
|
|
@@ -113,7 +113,6 @@ Also the heroku applications are created
|
|
113
113
|
and `production` stages.
|
114
114
|
- Setup initial configuration variables
|
115
115
|
- Set the application buildpack to the [multi-buildpack][heroku-buildpack-multi]
|
116
|
-
- Set **deploy-tasks** buildpack is setup to run `rake db:migrate` after each deploy
|
117
116
|
|
118
117
|
You'll need to manually
|
119
118
|
|
@@ -140,7 +139,6 @@ Go to https://monkeyci.platan.us, choose the repository from the list and hit
|
|
140
139
|
[heroku-buildpack-nodejs]: https://github.com/heroku/heroku-buildpack-nodejs
|
141
140
|
[heroku-buildpack-ruby]: http://github.com/heroku/heroku-buildpack-ruby
|
142
141
|
[heroku-buildpack-multi]: http://github.com/heroku/heroku-buildpack-multi
|
143
|
-
[buildpack-deploy-tasks]: http://github.com/gunpowderlabs/buildpack-ruby-rake-deploy-tasks
|
144
142
|
[circle-ci]: https://circleci.com
|
145
143
|
|
146
144
|
## Development Tools
|
data/lib/potassium/assets/.pryrc
CHANGED
@@ -22,7 +22,7 @@ wait_services(){
|
|
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
|
)
|
@@ -3,40 +3,40 @@ 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
40
|
)
|
41
41
|
end
|
42
42
|
|
@@ -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,7 +20,7 @@ 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.
|
data/lib/potassium/recipes/ci.rb
CHANGED
@@ -36,9 +36,9 @@ class Recipes::Ci < Rails::AppBuilder
|
|
36
36
|
YAML
|
37
37
|
compose.add_service("postgresql", srv)
|
38
38
|
compose.add_link('test', 'postgresql')
|
39
|
-
compose.add_env('test', '
|
40
|
-
compose.add_env('test', '
|
41
|
-
compose.add_env('test', '
|
39
|
+
compose.add_env('test', 'DB_USER', 'postgres')
|
40
|
+
compose.add_env('test', 'DB_HOST', 'postgresql')
|
41
|
+
compose.add_env('test', 'DB_PORT', '5432')
|
42
42
|
end
|
43
43
|
|
44
44
|
add_readme_header :ci
|
@@ -41,6 +41,8 @@ class Recipes::Heroku < Rails::AppBuilder
|
|
41
41
|
|
42
42
|
copy_file '../assets/Procfile', 'Procfile'
|
43
43
|
copy_file '../assets/.buildpacks', '.buildpacks'
|
44
|
+
copy_file '../assets/bin/release', 'bin/release'
|
45
|
+
run 'chmod a+x bin/release'
|
44
46
|
|
45
47
|
template "../assets/bin/setup_heroku.erb", "bin/setup_heroku", force: true
|
46
48
|
run "chmod a+x bin/setup_heroku"
|
@@ -88,7 +90,6 @@ class Recipes::Heroku < Rails::AppBuilder
|
|
88
90
|
run_toolbelt_command "labs:enable runtime-dyno-metadata", staged_app_name
|
89
91
|
run_toolbelt_command "config:add HEROKU_APP_NAME=#{staged_app_name}", staged_app_name
|
90
92
|
run_toolbelt_command "config:add #{rack_env}", staged_app_name
|
91
|
-
run_toolbelt_command "config:add DEPLOY_TASKS=db:migrate", staged_app_name
|
92
93
|
|
93
94
|
set_rails_secrets(environment)
|
94
95
|
set_app_multi_buildpack(environment)
|
@@ -68,7 +68,7 @@ class Recipes::Mailer < Rails::AppBuilder
|
|
68
68
|
|
69
69
|
mailer_config =
|
70
70
|
<<~RUBY
|
71
|
-
require Rails.root.join("config
|
71
|
+
require Rails.root.join("config", "mailer")
|
72
72
|
RUBY
|
73
73
|
|
74
74
|
prepend_file "config/environments/production.rb", mailer_config
|
@@ -81,11 +81,18 @@ class Recipes::Mailer < Rails::AppBuilder
|
|
81
81
|
append_to_file '.env.development', "SENDGRID_API_KEY=\n"
|
82
82
|
sendgrid_settings = <<~RUBY
|
83
83
|
Rails.application.config.action_mailer.sendgrid_settings = {
|
84
|
-
api_key: ENV['
|
84
|
+
api_key: ENV['SENDGRID_API_KEY']
|
85
85
|
}
|
86
86
|
RUBY
|
87
87
|
inject_into_file 'config/mailer.rb', sendgrid_settings,
|
88
88
|
after: "Rails.application.config.action_mailer.delivery_method = :sendgrid\n"
|
89
|
+
sendgrid_dev_settings = <<~RUBY
|
90
|
+
Rails.application.config.action_mailer.sendgrid_dev_settings = {
|
91
|
+
api_key: ENV['SENDGRID_API_KEY']
|
92
|
+
}
|
93
|
+
RUBY
|
94
|
+
application sendgrid_dev_settings, env: "development"
|
95
|
+
application "config.action_mailer.delivery_method = :sendgrid_dev", env: "development"
|
89
96
|
end
|
90
97
|
|
91
98
|
def aws_ses
|
data/lib/potassium/version.rb
CHANGED
@@ -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')
|
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
|
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.
|
4
|
+
version: 5.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- juliogarciag
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-07-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -173,6 +173,7 @@ executables:
|
|
173
173
|
extensions: []
|
174
174
|
extra_rdoc_files: []
|
175
175
|
files:
|
176
|
+
- ".circleci/config.yml"
|
176
177
|
- ".editorconfig"
|
177
178
|
- ".gitignore"
|
178
179
|
- ".rspec"
|
@@ -184,7 +185,6 @@ files:
|
|
184
185
|
- Rakefile
|
185
186
|
- bin/potassium
|
186
187
|
- bin/potassium_test
|
187
|
-
- circle.yml
|
188
188
|
- docs/CONTRIBUTING.md
|
189
189
|
- docs/DSL.md
|
190
190
|
- lib/potassium.rb
|
@@ -211,6 +211,7 @@ files:
|
|
211
211
|
- lib/potassium/assets/app/mailers/application_mailer.rb
|
212
212
|
- lib/potassium/assets/aws.rb
|
213
213
|
- lib/potassium/assets/bin/cibuild.erb
|
214
|
+
- lib/potassium/assets/bin/release
|
214
215
|
- lib/potassium/assets/bin/setup.erb
|
215
216
|
- lib/potassium/assets/bin/setup_heroku.erb
|
216
217
|
- lib/potassium/assets/bin/update.erb
|
@@ -317,6 +318,7 @@ files:
|
|
317
318
|
- spec/features/github_spec.rb
|
318
319
|
- spec/features/heroku_spec.rb
|
319
320
|
- spec/features/i18n_spec.rb
|
321
|
+
- spec/features/mailer_spec.rb
|
320
322
|
- spec/features/new_project_spec.rb
|
321
323
|
- spec/features/power_types_spec.rb
|
322
324
|
- spec/features/schedule_spec.rb
|
@@ -343,8 +345,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
343
345
|
- !ruby/object:Gem::Version
|
344
346
|
version: '0'
|
345
347
|
requirements: []
|
346
|
-
|
347
|
-
rubygems_version: 2.7.6.2
|
348
|
+
rubygems_version: 3.0.4
|
348
349
|
signing_key:
|
349
350
|
specification_version: 4
|
350
351
|
summary: An application generator from Platanus
|
@@ -362,6 +363,7 @@ test_files:
|
|
362
363
|
- spec/features/github_spec.rb
|
363
364
|
- spec/features/heroku_spec.rb
|
364
365
|
- spec/features/i18n_spec.rb
|
366
|
+
- spec/features/mailer_spec.rb
|
365
367
|
- spec/features/new_project_spec.rb
|
366
368
|
- spec/features/power_types_spec.rb
|
367
369
|
- spec/features/schedule_spec.rb
|