potassium 2.2.0 → 2.3.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/CHANGELOG.md +23 -0
- data/README.md +9 -2
- data/circle.yml +1 -0
- data/lib/potassium/assets/.env.development.erb +1 -0
- data/lib/potassium/assets/Dockerfile.ci +1 -1
- data/lib/potassium/assets/README.md.erb +1 -0
- data/lib/potassium/assets/README.yml +22 -0
- data/lib/potassium/assets/app/mailers/application_mailer.rb +3 -0
- data/lib/potassium/assets/bin/setup.erb +3 -0
- data/lib/potassium/assets/config/clock.rb.erb +16 -0
- data/lib/potassium/assets/config/database_mysql.yml.erb +0 -1
- data/lib/potassium/assets/config/database_postgresql.yml.erb +0 -1
- data/lib/potassium/assets/config/mailer.rb +18 -0
- data/lib/potassium/assets/config/sentry.rb.erb +13 -0
- data/lib/potassium/assets/{es.yml → es-CL.yml} +1 -1
- data/lib/potassium/assets/seeds/admin_data_loader.rb +40 -0
- data/lib/potassium/assets/seeds/fake_data_loader.rake +19 -0
- data/lib/potassium/assets/seeds/fake_data_loader.rb +33 -0
- data/lib/potassium/assets/seeds/seeds.rb +10 -0
- data/lib/potassium/assets/testing/paperclip.rb +59 -0
- data/lib/potassium/assets/testing/platanus.png +0 -0
- data/lib/potassium/assets/testing/rails_helper.rb +1 -3
- data/lib/potassium/cli/commands/create.rb +12 -2
- data/lib/potassium/helpers/gem-helpers.rb +1 -0
- data/lib/potassium/helpers/template-helpers.rb +9 -0
- data/lib/potassium/recipes/annotate.rb +7 -0
- data/lib/potassium/recipes/aws_sdk.rb +1 -1
- data/lib/potassium/recipes/delayed_job.rb +5 -8
- data/lib/potassium/recipes/devise.rb +1 -1
- data/lib/potassium/recipes/error_reporting.rb +26 -0
- data/lib/potassium/recipes/heroku.rb +5 -1
- data/lib/potassium/recipes/i18n.rb +7 -7
- data/lib/potassium/recipes/mailer.rb +97 -0
- data/lib/potassium/recipes/paperclip.rb +11 -3
- data/lib/potassium/recipes/schedule.rb +33 -0
- data/lib/potassium/recipes/script.rb +4 -0
- data/lib/potassium/recipes/seeds.rb +30 -0
- data/lib/potassium/recipes/testing.rb +1 -0
- data/lib/potassium/recipes/tzinfo.rb +7 -0
- data/lib/potassium/templates/application.rb +10 -3
- data/lib/potassium/version.rb +2 -2
- data/spec/features/clockwork_spec.rb +21 -0
- data/spec/features/error_reporting_spec.rb +27 -0
- data/spec/features/i18n_spec.rb +22 -0
- data/spec/features/new_project_spec.rb +20 -0
- data/spec/support/potassium_test_helpers.rb +6 -2
- metadata +27 -7
- data/lib/potassium/recipes/production.rb +0 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3f71e24e05f47b7fb707f13f8c0fca1d2ea0e5c0
|
|
4
|
+
data.tar.gz: c384d34410bc2b3550dbaa9e3b862eeb2e823416
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b0e757d2e989811ed3215629d60470f77958919e028814aed72652ac747d85a4398a92c2772559da40d6488a6152e8fa82cd9e4179d37343c451c90de0a92cc8
|
|
7
|
+
data.tar.gz: 1b8ea264f0c9567348662c020011b548b467d7bb67210ae1db5ad0205436e1d6f3dbb4d1eca25e8cb618715fd12b39cbb4a590afdb2beb797ffe2428abbdcc08
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,29 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 2.3.0
|
|
6
|
+
|
|
7
|
+
Features:
|
|
8
|
+
- Run bin/setup after DB creation
|
|
9
|
+
- Adds `db:fake_data:load` task for development data. It runs after `db:setup` on development environment
|
|
10
|
+
- Configure Sentry as Error Reporting tool
|
|
11
|
+
- Configure clockwork as scheduler
|
|
12
|
+
- Configure mailer for development environment
|
|
13
|
+
- Configure Rspec to work with Paperclip
|
|
14
|
+
- Update [multi buildpack]([multi-buildpack-heroku]) buildback to the heroku version
|
|
15
|
+
- Update ruby version on CI docker image
|
|
16
|
+
- Adds mailer support with AWS-SES and Sendgrid [#103]
|
|
17
|
+
- Remove adapter property from database config on production. The adapter is delegated to the protocol in the url propertie `postgres://` or `mysql2://`
|
|
18
|
+
|
|
19
|
+
Bugfixes:
|
|
20
|
+
- Run db tasks with bundle exec
|
|
21
|
+
|
|
22
|
+
[multi-buildpack-heroku]: http://github.com/ddollar/heroku-buildpack-multi
|
|
23
|
+
|
|
24
|
+
## 2.2.0
|
|
25
|
+
|
|
26
|
+
- Adds tzinfo-data gem [#101]
|
|
27
|
+
|
|
5
28
|
## 2.1.0
|
|
6
29
|
|
|
7
30
|
- Fix discard_gem helper
|
data/README.md
CHANGED
|
@@ -48,6 +48,8 @@ Potassium Rails apps includes the following gems and technologies:
|
|
|
48
48
|
- [Puma](https://github.com/puma/puma) to serve HTTP requests
|
|
49
49
|
- [Rack Timeout](https://github.com/heroku/rack-timeout) to abort requests that are
|
|
50
50
|
taking too long
|
|
51
|
+
- [Tzinfo-Data](https://github.com/tzinfo/tzinfo-data) for update timezone information
|
|
52
|
+
- [Faker](https://github.com/stympy/faker) for create development data
|
|
51
53
|
|
|
52
54
|
The following optional integrations are added too:
|
|
53
55
|
|
|
@@ -56,7 +58,11 @@ The following optional integrations are added too:
|
|
|
56
58
|
- [ActiveAdmin](http://activeadmin.info) for admin interfaces.
|
|
57
59
|
- [ActiveAdminAddons](https://github.com/platanus/activeadmin_addons) for some help with ActiveAdmin.
|
|
58
60
|
- [Pundit](https://github.com/elabs/pundit) for role-based authorization.
|
|
59
|
-
- [DelayedJob](https://github.com/collectiveidea/delayed_job) to execute longer tasks in the background.
|
|
61
|
+
- [DelayedJob](https://github.com/collectiveidea/delayed_job) to execute longer tasks in the background.]
|
|
62
|
+
- Mailing configuration for [AWS SES](https://github.com/aws/aws-sdk-rails)
|
|
63
|
+
and [Sendgrid](https://github.com/platanus/send_grid_mailer) with recipient interceptor support
|
|
64
|
+
- [Clockwork](https://github.com/Rykian/clockwork) to run scheduled processes
|
|
65
|
+
- [Sentry](https://sentry.io) to monitor exceptions and errors
|
|
60
66
|
|
|
61
67
|
A few more things are added to the project:
|
|
62
68
|
|
|
@@ -65,6 +71,7 @@ A few more things are added to the project:
|
|
|
65
71
|
- Create the github repository for the project (it used `hub` under the hood)
|
|
66
72
|
- A `bin/setup` script to setup things on a newly cloned project
|
|
67
73
|
- A `bin/cibuild` script to run continuous integration build on CI
|
|
74
|
+
- A `db:fake_data:load` rake task to load fake data for development
|
|
68
75
|
|
|
69
76
|
[pool]: https://devcenter.heroku.com/articles/concurrency-and-database-connections
|
|
70
77
|
|
|
@@ -130,7 +137,7 @@ Go to https://monkeyci.platan.us, choose the repository from the list and hit
|
|
|
130
137
|
[heroku-buildpack-ruby-version]: http://github.com/platanus/heroku-buildpack-ruby-version
|
|
131
138
|
[heroku-buildpack-bower]: http://github.com/platanus/heroku-buildpack-bower
|
|
132
139
|
[heroku-buildpack-ruby]: http://github.com/heroku/heroku-buildpack-ruby
|
|
133
|
-
[heroku-buildpack-multi]: http://github.com/
|
|
140
|
+
[heroku-buildpack-multi]: http://github.com/heroku/heroku-buildpack-multi
|
|
134
141
|
[buildpack-deploy-tasks]: http://github.com/gunpowderlabs/buildpack-ruby-rake-deploy-tasks
|
|
135
142
|
[circle-ci]: https://circleci.com
|
|
136
143
|
|
data/circle.yml
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
# <%= get(:titleized_app_name) %> <% if selected?(:heroku) %>[%>.svg?style=svg)](https://circleci.com/gh/platanus/<%= get(:dasherized_app_name)%>)<% end-%>
|
|
2
|
+
|
|
2
3
|
This is a Rails application, initially generated using [Potassium](https://github.com/platanus/potassium) by Platanus.
|
|
@@ -66,6 +66,17 @@ readme:
|
|
|
66
66
|
in development runing `rubocop` or just using the rubocop integration for your text editor of choice.
|
|
67
67
|
|
|
68
68
|
You can add custom rules to this project just adding them to the `.ruby-style.yml` file.
|
|
69
|
+
mailing:
|
|
70
|
+
title: "Sending Emails"
|
|
71
|
+
body: |
|
|
72
|
+
The emails can be send through the gem `<%= get(:mailer_gem_name) %>` using the `<%= get(:mailer_delivery_method) %>` delivery method.
|
|
73
|
+
All the `action_mailer` configuration can be found at `config/mailer.rb`, which is loaded only on production environments.
|
|
74
|
+
|
|
75
|
+
All emails should be sent using background jobs, by default we install `delayed_job` for that purpuse.
|
|
76
|
+
|
|
77
|
+
#### Testing in staging
|
|
78
|
+
|
|
79
|
+
If you add the `EMAIL_RECIPIENTS=` environmental variable, the emails will be intercepted and redirected to the email in the variable.
|
|
69
80
|
internal_dependencies:
|
|
70
81
|
title: "Internal dependencies"
|
|
71
82
|
sections:
|
|
@@ -81,3 +92,14 @@ readme:
|
|
|
81
92
|
delayed_job:
|
|
82
93
|
title: "Queue System"
|
|
83
94
|
body: "For managing tasks in the background, this project uses [DelayedJob](https://github.com/collectiveidea/delayed_job)"
|
|
95
|
+
clockwork:
|
|
96
|
+
title: "Scheduled Tasks"
|
|
97
|
+
body: "To schedule recurring work at particular times or dates, this project uses [Clockwork](https://github.com/Rykian/clockwork)"
|
|
98
|
+
sentry:
|
|
99
|
+
title: "Error Reporting"
|
|
100
|
+
body: "To report our errors we use [Sentry](https://github.com/getsentry/raven-ruby)"
|
|
101
|
+
seeds:
|
|
102
|
+
title: "Seeds"
|
|
103
|
+
body: |
|
|
104
|
+
To populate your database with initial data you can add, inside the `/db/seeds.rb` file, the code to generate **only the necessary data** to run the application.
|
|
105
|
+
If you need to generate data with **development purposes**, you can customize the `lib/fake_data_loader.rb` module and then to run the `rake load_fake_data` task from your terminal.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
require 'clockwork'
|
|
2
|
+
require_relative './boot'
|
|
3
|
+
require_relative './environment'
|
|
4
|
+
|
|
5
|
+
module Clockwork
|
|
6
|
+
<% if selected?(:report_error) -%>
|
|
7
|
+
error_handler do |error|
|
|
8
|
+
Raven.capture_exception(error)
|
|
9
|
+
end
|
|
10
|
+
<% end -%>
|
|
11
|
+
# Example
|
|
12
|
+
#
|
|
13
|
+
# every(5.minutes, 'ScheduledJob') do
|
|
14
|
+
# ScheduledJob.perform_later
|
|
15
|
+
# end
|
|
16
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
Rails.application.config.action_mailer.raise_delivery_errors = false
|
|
2
|
+
Rails.application.config.action_mailer.delivery_method = :<%= get(:mailer_delivery_method) %>
|
|
3
|
+
|
|
4
|
+
Rails.application.config.action_mailer.default_url_options = {
|
|
5
|
+
host: ENV.fetch('APPLICATION_HOST'),
|
|
6
|
+
protocol: ENV['FORCE_SSL'] == 'true' ? 'https' : 'http'
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
Rails.application.config.action_mailer.default_options = { from: ENV['DEFAULT_EMAIL_ADDRESS'] }
|
|
10
|
+
ASSET_HOST = ENV.fetch("ASSET_HOST", ENV.fetch("APPLICATION_HOST"))
|
|
11
|
+
Rails.application.config.action_mailer.asset_host = ASSET_HOST
|
|
12
|
+
|
|
13
|
+
if ENV["EMAIL_RECIPIENTS"].present?
|
|
14
|
+
Mail.register_interceptor RecipientInterceptor.new(
|
|
15
|
+
ENV["EMAIL_RECIPIENTS"],
|
|
16
|
+
subject_prefix: "[#{Heroku.stage.upcase}]"
|
|
17
|
+
)
|
|
18
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
if Rails.env.production?
|
|
2
|
+
Raven.configure do |config|
|
|
3
|
+
config.sanitize_fields = Rails.application.config.filter_parameters.map(&:to_s)
|
|
4
|
+
config.tags = { environment: <%= get(:heroku) ? "Heroku.stage" : "Rails.env" %> }
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
# In case you want to group the events with different ids in the
|
|
8
|
+
module RackTimeoutExtensions
|
|
9
|
+
def raven_context
|
|
10
|
+
{ fingerprint: ["{{ default }}", env["REQUEST_PATH"].gsub(/\d/, '')] }
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
es:
|
|
1
|
+
es-CL:
|
|
2
2
|
hello: "Hola mundo"
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Put, inside the load method, the necessary code to generate data with DEVELOPMENT PURPOSES.
|
|
2
|
+
# Whenever you can, use FactoryGirl's methods to keep this code "self updated".
|
|
3
|
+
#
|
|
4
|
+
# For Example:
|
|
5
|
+
#
|
|
6
|
+
# Having a country factory in /spec/factories/countries.rb
|
|
7
|
+
#
|
|
8
|
+
# FactoryGirl.define do
|
|
9
|
+
# factory :country do
|
|
10
|
+
# name "Chile"
|
|
11
|
+
# locale "es-CL"
|
|
12
|
+
# currency "$CLP"
|
|
13
|
+
# end
|
|
14
|
+
# end
|
|
15
|
+
#
|
|
16
|
+
# Choose to do this:
|
|
17
|
+
#
|
|
18
|
+
# create(:country)
|
|
19
|
+
#
|
|
20
|
+
# Instead of this:
|
|
21
|
+
#
|
|
22
|
+
# Country.create(name: "Chile", locale: "es-CL", currency: "$CLP")
|
|
23
|
+
#
|
|
24
|
+
|
|
25
|
+
Faker::Config.locale = I18n.locale
|
|
26
|
+
|
|
27
|
+
module FakeDataLoader
|
|
28
|
+
extend FactoryGirl::Syntax::Methods
|
|
29
|
+
|
|
30
|
+
def self.load
|
|
31
|
+
load_admin
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def self.load_admin
|
|
35
|
+
email = "admin@example.com"
|
|
36
|
+
pass = "password"
|
|
37
|
+
admin = AdminUser.find_by(email: email)
|
|
38
|
+
AdminUser.create!(email: email, password: pass, password_confirmation: pass) unless admin
|
|
39
|
+
end
|
|
40
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Rake::Task['db:setup'].enhance do
|
|
2
|
+
Rake::Task['db:fake_data:load'].invoke if Rails.env.development?
|
|
3
|
+
end
|
|
4
|
+
|
|
5
|
+
namespace :db do
|
|
6
|
+
namespace :fake_data do
|
|
7
|
+
desc "Loads development's fake data."
|
|
8
|
+
task load: :environment do
|
|
9
|
+
require 'fake_data_loader.rb'
|
|
10
|
+
|
|
11
|
+
if Rails.env.production?
|
|
12
|
+
puts "You can't run this task on production environment"
|
|
13
|
+
return
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
FakeDataLoader.load
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Put, inside the load method, the necessary code to generate data with DEVELOPMENT PURPOSES.
|
|
2
|
+
# Whenever you can, use FactoryGirl's methods to keep this code "self updated".
|
|
3
|
+
#
|
|
4
|
+
# For Example:
|
|
5
|
+
#
|
|
6
|
+
# Having a country factory in /spec/factories/countries.rb
|
|
7
|
+
#
|
|
8
|
+
# FactoryGirl.define do
|
|
9
|
+
# factory :country do
|
|
10
|
+
# name "Chile"
|
|
11
|
+
# locale "es-CL"
|
|
12
|
+
# currency "$CLP"
|
|
13
|
+
# end
|
|
14
|
+
# end
|
|
15
|
+
#
|
|
16
|
+
# Choose to do this:
|
|
17
|
+
#
|
|
18
|
+
# create(:country)
|
|
19
|
+
#
|
|
20
|
+
# Instead of this:
|
|
21
|
+
#
|
|
22
|
+
# Country.create(name: "Chile", locale: "es-CL", currency: "$CLP")
|
|
23
|
+
#
|
|
24
|
+
|
|
25
|
+
Faker::Config.locale = I18n.locale
|
|
26
|
+
|
|
27
|
+
module FakeDataLoader
|
|
28
|
+
extend FactoryGirl::Syntax::Methods
|
|
29
|
+
|
|
30
|
+
def self.load
|
|
31
|
+
# Put here the code to generate data with DEVELOPMENT PURPOSES.
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# This file should contain all the record creation needed to seed the database
|
|
2
|
+
# with its default values.
|
|
3
|
+
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
|
|
4
|
+
# Write the code in a way that can be executed multiple times without duplicating the information.
|
|
5
|
+
#
|
|
6
|
+
# For example:
|
|
7
|
+
#
|
|
8
|
+
# Country.create(name: "Chile") # BAD
|
|
9
|
+
# Country.find_or_create_by(name: "Chile") # GOOD
|
|
10
|
+
#
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
require "paperclip/matchers"
|
|
2
|
+
|
|
3
|
+
include ActionDispatch::TestProcess
|
|
4
|
+
|
|
5
|
+
test_files_path = ":rails_root/test_files/:class/:attachment/:id_partition/:filename"
|
|
6
|
+
Paperclip::Attachment.default_options[:path] = test_files_path
|
|
7
|
+
|
|
8
|
+
RSpec.configure do |config|
|
|
9
|
+
config.fixture_path = "#{::Rails.root}/spec/assets"
|
|
10
|
+
|
|
11
|
+
config.include Paperclip::Shoulda::Matchers
|
|
12
|
+
|
|
13
|
+
config.after(:suite) do
|
|
14
|
+
FileUtils.rm_rf("#{Rails.root}/test_files")
|
|
15
|
+
FileUtils.rm_rf("#{Rails.root}/public/uploads")
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def fixture_asset(file_name, mime)
|
|
20
|
+
file_path = Rails.root.to_s + "/spec/assets/" + file_name
|
|
21
|
+
fixture_file_upload(file_path, mime)
|
|
22
|
+
rescue
|
|
23
|
+
fixture_file_upload(file_name, mime)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# GENERAL CONFIG
|
|
27
|
+
# On test environment, paperclip attachments will be generated under /test_files directory.
|
|
28
|
+
# After running all the specs, the test_files folder will be deleted.
|
|
29
|
+
#
|
|
30
|
+
# SHOULDA MATCHERS
|
|
31
|
+
# Including Paperclip::Shoulda::Matchers will allow you to use special matchers
|
|
32
|
+
# to work with paperclip. For example:
|
|
33
|
+
#
|
|
34
|
+
# describe User do
|
|
35
|
+
# it { should have_attached_file(:avatar) }
|
|
36
|
+
# it { should validate_attachment_presence(:avatar) }
|
|
37
|
+
# it { should validate_attachment_content_type(:avatar).
|
|
38
|
+
# allowing('image/png', 'image/gif').
|
|
39
|
+
# rejecting('text/plain', 'text/xml') }
|
|
40
|
+
# it { should validate_attachment_size(:avatar).
|
|
41
|
+
# less_than(2.megabytes) }
|
|
42
|
+
# end
|
|
43
|
+
#
|
|
44
|
+
# ASSETS
|
|
45
|
+
# Your attachments go into /spec/assets directory. You can access them...
|
|
46
|
+
#
|
|
47
|
+
# From your factories:
|
|
48
|
+
#
|
|
49
|
+
# FactoryGirl.define do
|
|
50
|
+
# factory :ticket do
|
|
51
|
+
# attachment { fixture_asset("platanus.png", "image/png") }
|
|
52
|
+
# end
|
|
53
|
+
# end
|
|
54
|
+
#
|
|
55
|
+
# From your specs:
|
|
56
|
+
#
|
|
57
|
+
# it "gets file name" do
|
|
58
|
+
# expect(fixture_asset("platanus.png", "image/png").original_filename).to eq("platanus.png")
|
|
59
|
+
# end
|
|
Binary file
|
|
@@ -4,6 +4,7 @@ require File.expand_path('../../config/environment', __FILE__)
|
|
|
4
4
|
require 'rspec/rails'
|
|
5
5
|
require 'spec_helper'
|
|
6
6
|
require 'shoulda/matchers'
|
|
7
|
+
require 'faker'
|
|
7
8
|
# Add additional requires below this line. Rails is not loaded until this point!
|
|
8
9
|
|
|
9
10
|
# Requires supporting ruby files with custom matchers and macros, etc, in
|
|
@@ -26,9 +27,6 @@ Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
|
|
|
26
27
|
ActiveRecord::Migration.maintain_test_schema!
|
|
27
28
|
|
|
28
29
|
RSpec.configure do |config|
|
|
29
|
-
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
|
30
|
-
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
|
31
|
-
|
|
32
30
|
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
|
33
31
|
# examples within a transaction, remove the following line or assign false
|
|
34
32
|
# instead of true.
|
|
@@ -10,8 +10,10 @@ module Potassium::CLI
|
|
|
10
10
|
|
|
11
11
|
c.flag [:db, :database],
|
|
12
12
|
desc: "Decides which database to use. Available: mysql, postgresql, none"
|
|
13
|
-
c.flag
|
|
14
|
-
desc: "Decides which
|
|
13
|
+
c.flag "locale",
|
|
14
|
+
desc: "Decides which locale to use. Available: es-CL, en"
|
|
15
|
+
c.flag [:email_service, :email],
|
|
16
|
+
desc: "Decides which email adapter to use. Available: aws_ses, sendgrid, none"
|
|
15
17
|
c.switch "devise",
|
|
16
18
|
desc: "Whether to use Devise for authentication or not",
|
|
17
19
|
negatable: true,
|
|
@@ -56,6 +58,14 @@ module Potassium::CLI
|
|
|
56
58
|
desc: "Whether to the github repository is private",
|
|
57
59
|
negatable: true,
|
|
58
60
|
default_value: false
|
|
61
|
+
c.switch "clockwork",
|
|
62
|
+
desc: "Whether to use clockwork as job scheduler",
|
|
63
|
+
negatable: true,
|
|
64
|
+
default_value: "none"
|
|
65
|
+
c.switch "sentry",
|
|
66
|
+
desc: "Whether to use Sentry as error reporting tool",
|
|
67
|
+
negatable: true,
|
|
68
|
+
default_value: "none"
|
|
59
69
|
|
|
60
70
|
c.action do |_global_options, options, _args|
|
|
61
71
|
require "potassium/newest_version_ensurer"
|
|
@@ -84,6 +84,15 @@ module TemplateHelpers
|
|
|
84
84
|
cli_options[:force]
|
|
85
85
|
end
|
|
86
86
|
|
|
87
|
+
def procfile(name, command)
|
|
88
|
+
file = 'Procfile'
|
|
89
|
+
if File.read(file).index(/^#{name}:.*$/m).nil?
|
|
90
|
+
append_file file, "#{name}: #{command}\n"
|
|
91
|
+
else
|
|
92
|
+
gsub_file file, /^name:.*$/m, "#{name}: #{command}\n"
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
|
|
87
96
|
private
|
|
88
97
|
|
|
89
98
|
def get_recipe_class(recipe_name)
|
|
@@ -18,23 +18,20 @@ class Recipes::DelayedJob < Rails::AppBuilder
|
|
|
18
18
|
gem_exists?(/delayed_job_active_record/)
|
|
19
19
|
end
|
|
20
20
|
|
|
21
|
-
private
|
|
22
|
-
|
|
23
21
|
def add_delayed_job
|
|
24
22
|
gather_gem "delayed_job_active_record"
|
|
25
23
|
|
|
26
|
-
|
|
27
|
-
application(
|
|
24
|
+
general_config = "config.active_job.queue_adapter = :delayed_job"
|
|
25
|
+
application(general_config)
|
|
26
|
+
dev_config = "config.active_job.queue_adapter = :inline"
|
|
27
|
+
application dev_config, env: "development"
|
|
28
28
|
|
|
29
29
|
after(:gem_install) do
|
|
30
30
|
generate "delayed_job:active_record"
|
|
31
|
-
run "bundle binstubs delayed_job"
|
|
32
31
|
add_readme_section :internal_dependencies, :delayed_job
|
|
33
32
|
|
|
34
33
|
if selected?(:heroku)
|
|
35
|
-
gsub_file
|
|
36
|
-
"#{match}worker: bundle exec rake jobs:work"
|
|
37
|
-
end
|
|
34
|
+
gsub_file("Procfile", /^.*$/m) { |match| "#{match}worker: bundle exec rake jobs:work" }
|
|
38
35
|
end
|
|
39
36
|
end
|
|
40
37
|
end
|
|
@@ -56,7 +56,7 @@ class Recipes::Devise < Rails::AppBuilder
|
|
|
56
56
|
"# config.pepper = 'onhcylrat7x8bjyr5o15sxaix3vbu0sl'"
|
|
57
57
|
end
|
|
58
58
|
|
|
59
|
-
append_to_file '.env.development',
|
|
59
|
+
append_to_file '.env.development', "DEVISE_SECRET_KEY=\n"
|
|
60
60
|
add_readme_section :internal_dependencies, :devise
|
|
61
61
|
end
|
|
62
62
|
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
class Recipes::ErrorReporting < Rails::AppBuilder
|
|
2
|
+
def ask
|
|
3
|
+
response = answer(:sentry) do
|
|
4
|
+
Ask.confirm("Do you need to report application errors with Sentry?")
|
|
5
|
+
end
|
|
6
|
+
set(:report_error, response)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def create
|
|
10
|
+
if selected?(:report_error)
|
|
11
|
+
gather_gem 'sentry-raven'
|
|
12
|
+
template '../assets/config/sentry.rb.erb', 'config/initializers/sentry.rb'
|
|
13
|
+
append_to_file '.env.development', "SENTRY_DSN=\n"
|
|
14
|
+
add_readme_section :internal_dependencies, :sentry
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def install
|
|
19
|
+
set(:report_error, true)
|
|
20
|
+
create
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def installed?
|
|
24
|
+
gem_exists?(/sentry-raven/) && file_exist?('config/initializers/sentry.rb')
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -38,6 +38,8 @@ class Recipes::Heroku < Rails::AppBuilder
|
|
|
38
38
|
gather_gem('rails_stdout_logging')
|
|
39
39
|
end
|
|
40
40
|
|
|
41
|
+
gather_gem 'heroku-stage'
|
|
42
|
+
|
|
41
43
|
copy_file '../assets/Procfile', 'Procfile'
|
|
42
44
|
copy_file '../assets/.buildpacks', '.buildpacks'
|
|
43
45
|
|
|
@@ -84,6 +86,8 @@ class Recipes::Heroku < Rails::AppBuilder
|
|
|
84
86
|
staged_app_name = app_name_for(environment)
|
|
85
87
|
|
|
86
88
|
run_toolbelt_command "create #{staged_app_name} --remote #{environment}"
|
|
89
|
+
run_toolbelt_command "labs:enable runtime-dyno-metadata", staged_app_name
|
|
90
|
+
run_toolbelt_command "config:add HEROKU_APP_NAME=#{staged_app_name}", staged_app_name
|
|
87
91
|
run_toolbelt_command "config:add #{rack_env}", staged_app_name
|
|
88
92
|
run_toolbelt_command "config:add DEPLOY_TASKS=db:migrate", staged_app_name
|
|
89
93
|
|
|
@@ -101,7 +105,7 @@ class Recipes::Heroku < Rails::AppBuilder
|
|
|
101
105
|
|
|
102
106
|
def set_app_multi_buildpack(environment)
|
|
103
107
|
run_toolbelt_command(
|
|
104
|
-
"buildpacks:set https://github.com/
|
|
108
|
+
"buildpacks:set https://github.com/heroku/heroku-buildpack-multi.git",
|
|
105
109
|
app_name_for(environment)
|
|
106
110
|
)
|
|
107
111
|
end
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
class Recipes::I18n < Rails::AppBuilder
|
|
2
2
|
def ask
|
|
3
3
|
languages = {
|
|
4
|
-
es: "
|
|
5
|
-
en: "
|
|
4
|
+
"es-CL": "es-CL (Chile)",
|
|
5
|
+
en: "en (USA)"
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
lang = answer(:
|
|
9
|
-
languages.keys[Ask.list("What is the main
|
|
8
|
+
lang = answer(:locale) do
|
|
9
|
+
languages.keys[Ask.list("What is the main locale of your app?", languages.values)]
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
set(:lang, lang)
|
|
@@ -15,12 +15,12 @@ class Recipes::I18n < Rails::AppBuilder
|
|
|
15
15
|
def create
|
|
16
16
|
gather_gem('rails-i18n')
|
|
17
17
|
|
|
18
|
-
if equals?(:lang, :es)
|
|
19
|
-
template('../assets/es.yml', 'config/locales/es.yml')
|
|
18
|
+
if equals?(:lang, :"es-CL")
|
|
19
|
+
template('../assets/es-CL.yml', 'config/locales/es-CL.yml')
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
gsub_file 'config/application.rb', /# config\.i18n\.default_locale =[^\n]+\n/ do
|
|
23
|
-
"config.i18n.default_locale =
|
|
23
|
+
"config.i18n.default_locale = '#{get(:lang)}'\n config.i18n.fallbacks = [:es, :en]\n"
|
|
24
24
|
end
|
|
25
25
|
end
|
|
26
26
|
end
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
class Recipes::Mailer < Rails::AppBuilder
|
|
2
|
+
def ask
|
|
3
|
+
info "Note: Emails should be sent on background jobs. We'll install delayed_jobs recipe"
|
|
4
|
+
email_services = {
|
|
5
|
+
aws_ses: "Amazon SES",
|
|
6
|
+
sendgrid: "Sendgrid (beta)",
|
|
7
|
+
none: "None, thanks"
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
email_service = answer(:email_service) do
|
|
11
|
+
email_services.keys[Ask.list("Which email service are you using?", email_services.values)]
|
|
12
|
+
end
|
|
13
|
+
set :email_service, email_service.to_sym
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def create
|
|
17
|
+
email_service = email_services(get(:email_service))
|
|
18
|
+
return if email_service.nil?
|
|
19
|
+
|
|
20
|
+
set(:mailer_delivery_method, email_service[:delivery_method])
|
|
21
|
+
set(:mailer_gem_name, email_service[:gem_name])
|
|
22
|
+
|
|
23
|
+
add_readme_header :mailing
|
|
24
|
+
|
|
25
|
+
dependencies(email_service)
|
|
26
|
+
config(email_service)
|
|
27
|
+
|
|
28
|
+
delayed_job = load_recipe(:delayed_job)
|
|
29
|
+
delayed_job.add_delayed_job unless delayed_job.installed?
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def install
|
|
33
|
+
ask
|
|
34
|
+
create
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
private
|
|
38
|
+
|
|
39
|
+
def email_services(service_name)
|
|
40
|
+
email_services = {
|
|
41
|
+
sendgrid: {
|
|
42
|
+
name: 'sendgrid',
|
|
43
|
+
gem_name: 'send_grid_mailer',
|
|
44
|
+
delivery_method: :sendgrid
|
|
45
|
+
},
|
|
46
|
+
aws_ses: {
|
|
47
|
+
name: 'aws_ses',
|
|
48
|
+
gem_name: 'aws-sdk-rails',
|
|
49
|
+
delivery_method: :aws_sdk
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
email_services[service_name]
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def dependencies(service)
|
|
56
|
+
if service[:version]
|
|
57
|
+
gather_gem service[:gem_name], service[:version]
|
|
58
|
+
else
|
|
59
|
+
gather_gem service[:gem_name]
|
|
60
|
+
end
|
|
61
|
+
gather_gem 'heroku-stage'
|
|
62
|
+
gather_gem 'recipient_interceptor'
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def config(service)
|
|
66
|
+
template "../assets/config/mailer.rb", 'config/mailer.rb'
|
|
67
|
+
gsub_file 'config/environments/production.rb', /$\s*config.action_mailer.*/, ''
|
|
68
|
+
append_to_file '.env.development', "APPLICATION_HOST=localhost:3000\n"
|
|
69
|
+
append_to_file '.env.development', "EMAIL_RECIPIENTS=\n"
|
|
70
|
+
|
|
71
|
+
mailer_config =
|
|
72
|
+
<<~RUBY
|
|
73
|
+
require Rails.root.join("config/mailer")
|
|
74
|
+
RUBY
|
|
75
|
+
|
|
76
|
+
prepend_file "config/environments/production.rb", mailer_config
|
|
77
|
+
copy_file '../assets/app/mailers/application_mailer.rb', 'app/mailers/application_mailer.rb'
|
|
78
|
+
|
|
79
|
+
send(service[:name])
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def sendgrid
|
|
83
|
+
append_to_file '.env.development', "SENDGRID_API_KEY=\n"
|
|
84
|
+
sendgrid_settings = <<~RUBY
|
|
85
|
+
Rails.application.config.action_mailer.sendgrid_settings = {
|
|
86
|
+
api_key: ENV['SENDGRID_API']
|
|
87
|
+
}
|
|
88
|
+
RUBY
|
|
89
|
+
inject_into_file 'config/mailer.rb', sendgrid_settings,
|
|
90
|
+
after: "Rails.application.config.action_mailer.delivery_method = :sendgrid\n"
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def aws_ses
|
|
94
|
+
gather_gems(:development) { gather_gem("letter_opener") }
|
|
95
|
+
application "config.action_mailer.delivery_method = :letter_opener", env: "development"
|
|
96
|
+
end
|
|
97
|
+
end
|
|
@@ -5,11 +5,14 @@ class Recipes::Paperclip < Rails::AppBuilder
|
|
|
5
5
|
end
|
|
6
6
|
|
|
7
7
|
def create
|
|
8
|
-
|
|
8
|
+
return unless selected?(:paperclip)
|
|
9
|
+
add_paperclip
|
|
10
|
+
config_rspec
|
|
9
11
|
end
|
|
10
12
|
|
|
11
13
|
def install
|
|
12
14
|
add_paperclip
|
|
15
|
+
config_rspec if gem_exists?(/rspec-rails/)
|
|
13
16
|
end
|
|
14
17
|
|
|
15
18
|
def installed?
|
|
@@ -25,13 +28,18 @@ class Recipes::Paperclip < Rails::AppBuilder
|
|
|
25
28
|
config.paperclip_defaults = {
|
|
26
29
|
storage: :s3,
|
|
27
30
|
s3_credentials: {
|
|
28
|
-
bucket: ENV['
|
|
31
|
+
bucket: ENV['S3_BUCKET']
|
|
29
32
|
}
|
|
30
33
|
}
|
|
31
34
|
RUBY
|
|
32
35
|
application paperclip_config.strip, env: 'production'
|
|
33
|
-
append_to_file '.env.development',
|
|
36
|
+
append_to_file '.env.development', "S3_BUCKET=\n"
|
|
34
37
|
append_to_file '.gitignore', "/public/system/*\n"
|
|
35
38
|
add_readme_section :internal_dependencies, :paperclip
|
|
36
39
|
end
|
|
40
|
+
|
|
41
|
+
def config_rspec
|
|
42
|
+
copy_file '../assets/testing/platanus.png', 'spec/assets/platanus.png'
|
|
43
|
+
copy_file '../assets/testing/paperclip.rb', 'spec/support/paperclip.rb'
|
|
44
|
+
end
|
|
37
45
|
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
class Recipes::Schedule < Rails::AppBuilder
|
|
2
|
+
def ask
|
|
3
|
+
use_schedule = answer(:clockwork) { Ask.confirm("Do you need to schedule processes or tasks?") }
|
|
4
|
+
set(:scheduled, use_schedule)
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
def create
|
|
8
|
+
if selected?(:scheduled)
|
|
9
|
+
gather_gem 'clockwork'
|
|
10
|
+
template '../assets/config/clock.rb.erb', 'config/clock.rb'
|
|
11
|
+
add_readme_section :internal_dependencies, :clockwork
|
|
12
|
+
|
|
13
|
+
if selected?(:heroku)
|
|
14
|
+
procfile('scheduler', 'bundle exec clockwork config/clock.rb')
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def install
|
|
20
|
+
heroku = load_recipe(:heroku)
|
|
21
|
+
set(:heroku, heroku.installed?)
|
|
22
|
+
|
|
23
|
+
error_reporting = load_recipe(:error_reporting)
|
|
24
|
+
set(:report_error, error_reporting.installed?)
|
|
25
|
+
|
|
26
|
+
set(:scheduled, true)
|
|
27
|
+
create
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def installed?
|
|
31
|
+
gem_exists?(/clock/) && file_exist?('config/clock.rb')
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
class Recipes::Seeds < Rails::AppBuilder
|
|
2
|
+
def create
|
|
3
|
+
recipe = self
|
|
4
|
+
copy_env_seed_file
|
|
5
|
+
|
|
6
|
+
if selected?(:admin_mode)
|
|
7
|
+
after(:admin_install, wrap_in_action: :seeds_config) do
|
|
8
|
+
recipe.override_seed_files
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def install
|
|
14
|
+
copy_env_seed_file
|
|
15
|
+
admin = load_recipe(:admin)
|
|
16
|
+
override_seed_files if admin.installed?
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def copy_env_seed_file
|
|
20
|
+
copy_file '../assets/seeds/seeds.rb', 'db/seeds.rb', force: true
|
|
21
|
+
copy_file '../assets/seeds/fake_data_loader.rb', 'lib/fake_data_loader.rb'
|
|
22
|
+
copy_file '../assets/seeds/fake_data_loader.rake', 'lib/tasks/db/fake_data.rake'
|
|
23
|
+
add_readme_header :seeds
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def override_seed_files
|
|
27
|
+
copy_file '../assets/seeds/seeds.rb', 'db/seeds.rb', force: true
|
|
28
|
+
copy_file '../assets/seeds/admin_data_loader.rb', 'lib/fake_data_loader.rb', force: true
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -14,10 +14,13 @@ run_action(:asking) do
|
|
|
14
14
|
ask :admin
|
|
15
15
|
ask :angular_admin
|
|
16
16
|
ask :delayed_job
|
|
17
|
+
ask :schedule
|
|
18
|
+
ask :error_reporting
|
|
17
19
|
ask :pundit
|
|
18
20
|
ask :i18n
|
|
19
21
|
ask :api
|
|
20
22
|
ask :paperclip
|
|
23
|
+
ask :mailer
|
|
21
24
|
ask :heroku
|
|
22
25
|
ask :github
|
|
23
26
|
end
|
|
@@ -35,20 +38,24 @@ run_action(:recipe_loading) do
|
|
|
35
38
|
create :bower
|
|
36
39
|
create :editorconfig
|
|
37
40
|
create :aws_sdk
|
|
41
|
+
create :schedule
|
|
42
|
+
create :mailer
|
|
38
43
|
create :i18n
|
|
39
44
|
create :pry
|
|
40
45
|
create :devise
|
|
41
46
|
create :admin
|
|
42
47
|
create :angular_admin
|
|
48
|
+
create :seeds
|
|
49
|
+
create :error_reporting
|
|
43
50
|
create :delayed_job
|
|
44
51
|
create :pundit
|
|
45
52
|
create :testing
|
|
46
|
-
create :production
|
|
47
53
|
create :secrets
|
|
48
54
|
create :git
|
|
49
55
|
create :api
|
|
50
56
|
create :rack_cors
|
|
51
57
|
create :paperclip
|
|
58
|
+
create :tzinfo
|
|
52
59
|
create :script
|
|
53
60
|
create :github
|
|
54
61
|
create :cleanup
|
|
@@ -62,6 +69,6 @@ run_action(:gem_install) do
|
|
|
62
69
|
end
|
|
63
70
|
|
|
64
71
|
run_action(:database_creation) do
|
|
65
|
-
run "rake db:create db:migrate"
|
|
66
|
-
run "RACK_ENV=test rake db:create db:migrate"
|
|
72
|
+
run "bundle exec rake db:create db:migrate"
|
|
73
|
+
run "RACK_ENV=test bundle exec rake db:create db:migrate"
|
|
67
74
|
end
|
data/lib/potassium/version.rb
CHANGED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
require "spec_helper"
|
|
2
|
+
|
|
3
|
+
RSpec.describe "Clockwork" do
|
|
4
|
+
before :all do
|
|
5
|
+
drop_dummy_database
|
|
6
|
+
remove_project_directory
|
|
7
|
+
create_dummy_project("clockwork" => true)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
it "adds the Clockwork gem to Gemfile" do
|
|
11
|
+
gemfile_content = IO.read("#{project_path}/Gemfile")
|
|
12
|
+
|
|
13
|
+
expect(gemfile_content).to include("gem 'clockwork'")
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
it "creates the config for clockwork scheduler" do
|
|
17
|
+
initializer_content = IO.read("#{project_path}/config/clock.rb")
|
|
18
|
+
|
|
19
|
+
expect(initializer_content).to include("module Clockwork")
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
require "spec_helper"
|
|
2
|
+
|
|
3
|
+
RSpec.describe "Error Reporting" do
|
|
4
|
+
before :all do
|
|
5
|
+
drop_dummy_database
|
|
6
|
+
remove_project_directory
|
|
7
|
+
create_dummy_project("sentry" => true)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
it "adds the Sentry gem to Gemfile" do
|
|
11
|
+
gemfile_content = IO.read("#{project_path}/Gemfile")
|
|
12
|
+
|
|
13
|
+
expect(gemfile_content).to include("gem 'sentry-raven'")
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
it "creates the initializer" do
|
|
17
|
+
initializer_content = IO.read("#{project_path}/config/initializers/sentry.rb")
|
|
18
|
+
|
|
19
|
+
expect(initializer_content).to include("Raven.configure")
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
it "adds the environment variable to .env.development" do
|
|
23
|
+
env_content = IO.read("#{project_path}/.env.development")
|
|
24
|
+
|
|
25
|
+
expect(env_content).to include("SENTRY_DSN=")
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
require "spec_helper"
|
|
2
|
+
|
|
3
|
+
RSpec.describe "I18n" do
|
|
4
|
+
before :all do
|
|
5
|
+
drop_dummy_database
|
|
6
|
+
remove_project_directory
|
|
7
|
+
create_dummy_project("locale" => "es-CL")
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
it "adds the Clockwork gem to Gemfile" do
|
|
11
|
+
content = IO.read("#{project_path}/Gemfile")
|
|
12
|
+
|
|
13
|
+
expect(content).to include("gem 'rails-i18n'")
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
it "configures application.rb" do
|
|
17
|
+
content = IO.read("#{project_path}/config/application.rb")
|
|
18
|
+
|
|
19
|
+
expect(content).to include("config.i18n.default_locale = 'es-CL'")
|
|
20
|
+
expect(content).to include("config.i18n.fallbacks = [:es, :en]")
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -31,4 +31,24 @@ RSpec.describe "A new project" do
|
|
|
31
31
|
|
|
32
32
|
expect(ruby_version_file).to eq("2.3")
|
|
33
33
|
end
|
|
34
|
+
|
|
35
|
+
context "seeds related issues" do
|
|
36
|
+
it "creates fake data loader module" do
|
|
37
|
+
content = IO.read("#{project_path}/lib/fake_data_loader.rb")
|
|
38
|
+
|
|
39
|
+
expect(content).to include %{module FakeDataLoader}
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
it "creates load fake data task" do
|
|
43
|
+
content = IO.read("#{project_path}/lib/tasks/db/fake_data.rake")
|
|
44
|
+
|
|
45
|
+
expect(content).to include %{FakeDataLoader.load}
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
it "overrides default seed file" do
|
|
49
|
+
content = IO.read("#{project_path}/db/seeds.rb")
|
|
50
|
+
|
|
51
|
+
expect(content).to include %{without duplicating the information}
|
|
52
|
+
end
|
|
53
|
+
end
|
|
34
54
|
end
|
|
@@ -15,6 +15,7 @@ module PotassiumTestHelpers
|
|
|
15
15
|
add_fakes_to_path
|
|
16
16
|
full_arguments = hash_to_arguments(default_arguments.merge(arguments))
|
|
17
17
|
run_command("#{potassium_bin} create #{APP_NAME} #{full_arguments}")
|
|
18
|
+
on_project { run_command("hound rules update ruby --local") }
|
|
18
19
|
end
|
|
19
20
|
end
|
|
20
21
|
end
|
|
@@ -53,16 +54,19 @@ module PotassiumTestHelpers
|
|
|
53
54
|
def default_arguments
|
|
54
55
|
{
|
|
55
56
|
"db" => "postgresql",
|
|
56
|
-
"
|
|
57
|
+
"locale" => "es-CL",
|
|
57
58
|
"heroku" => false,
|
|
58
59
|
"admin" => false,
|
|
59
60
|
"pundit" => false,
|
|
60
61
|
"paperclip" => false,
|
|
62
|
+
"email_service" => "aws_ses",
|
|
61
63
|
"devise" => false,
|
|
62
64
|
"api" => false,
|
|
63
65
|
"delayed-job" => false,
|
|
64
66
|
"github" => false,
|
|
65
|
-
"github-private" => false
|
|
67
|
+
"github-private" => false,
|
|
68
|
+
"clockwork" => false,
|
|
69
|
+
"sentry" => false
|
|
66
70
|
}
|
|
67
71
|
end
|
|
68
72
|
|
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: 2.
|
|
4
|
+
version: 2.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- juliogarciag
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2017-01-27 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -72,14 +72,14 @@ dependencies:
|
|
|
72
72
|
requirements:
|
|
73
73
|
- - "~>"
|
|
74
74
|
- !ruby/object:Gem::Version
|
|
75
|
-
version: 0.
|
|
75
|
+
version: 0.46.0
|
|
76
76
|
type: :development
|
|
77
77
|
prerelease: false
|
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
|
79
79
|
requirements:
|
|
80
80
|
- - "~>"
|
|
81
81
|
- !ruby/object:Gem::Version
|
|
82
|
-
version: 0.
|
|
82
|
+
version: 0.46.0
|
|
83
83
|
- !ruby/object:Gem::Dependency
|
|
84
84
|
name: rails
|
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -204,19 +204,29 @@ files:
|
|
|
204
204
|
- lib/potassium/assets/api/api_error_concern.rb
|
|
205
205
|
- lib/potassium/assets/api/base_controller.rb
|
|
206
206
|
- lib/potassium/assets/api/responder.rb
|
|
207
|
+
- lib/potassium/assets/app/mailers/application_mailer.rb
|
|
207
208
|
- lib/potassium/assets/bin/cibuild.erb
|
|
208
209
|
- lib/potassium/assets/bin/setup.erb
|
|
209
210
|
- lib/potassium/assets/bin/setup_heroku.erb
|
|
210
211
|
- lib/potassium/assets/bower.json
|
|
211
212
|
- lib/potassium/assets/circle.yml
|
|
213
|
+
- lib/potassium/assets/config/clock.rb.erb
|
|
212
214
|
- lib/potassium/assets/config/database_mysql.yml.erb
|
|
213
215
|
- lib/potassium/assets/config/database_postgresql.yml.erb
|
|
216
|
+
- lib/potassium/assets/config/mailer.rb
|
|
214
217
|
- lib/potassium/assets/config/puma.rb
|
|
215
218
|
- lib/potassium/assets/config/secrets.yml.erb
|
|
219
|
+
- lib/potassium/assets/config/sentry.rb.erb
|
|
216
220
|
- lib/potassium/assets/docker-compose.ci.yml
|
|
217
|
-
- lib/potassium/assets/es.yml
|
|
221
|
+
- lib/potassium/assets/es-CL.yml
|
|
218
222
|
- lib/potassium/assets/lib/tasks/auto_annotate_models.rake
|
|
223
|
+
- lib/potassium/assets/seeds/admin_data_loader.rb
|
|
224
|
+
- lib/potassium/assets/seeds/fake_data_loader.rake
|
|
225
|
+
- lib/potassium/assets/seeds/fake_data_loader.rb
|
|
226
|
+
- lib/potassium/assets/seeds/seeds.rb
|
|
219
227
|
- lib/potassium/assets/testing/.rspec
|
|
228
|
+
- lib/potassium/assets/testing/paperclip.rb
|
|
229
|
+
- lib/potassium/assets/testing/platanus.png
|
|
220
230
|
- lib/potassium/assets/testing/rails_helper.rb
|
|
221
231
|
- lib/potassium/cli.rb
|
|
222
232
|
- lib/potassium/cli/commands/create.rb
|
|
@@ -248,22 +258,26 @@ files:
|
|
|
248
258
|
- lib/potassium/recipes/devise.rb
|
|
249
259
|
- lib/potassium/recipes/editorconfig.rb
|
|
250
260
|
- lib/potassium/recipes/env.rb
|
|
261
|
+
- lib/potassium/recipes/error_reporting.rb
|
|
251
262
|
- lib/potassium/recipes/git.rb
|
|
252
263
|
- lib/potassium/recipes/github.rb
|
|
253
264
|
- lib/potassium/recipes/heroku.rb
|
|
254
265
|
- lib/potassium/recipes/i18n.rb
|
|
266
|
+
- lib/potassium/recipes/mailer.rb
|
|
255
267
|
- lib/potassium/recipes/paperclip.rb
|
|
256
|
-
- lib/potassium/recipes/production.rb
|
|
257
268
|
- lib/potassium/recipes/pry.rb
|
|
258
269
|
- lib/potassium/recipes/puma.rb
|
|
259
270
|
- lib/potassium/recipes/pundit.rb
|
|
260
271
|
- lib/potassium/recipes/rack_cors.rb
|
|
261
272
|
- lib/potassium/recipes/readme.rb
|
|
262
273
|
- lib/potassium/recipes/ruby.rb
|
|
274
|
+
- lib/potassium/recipes/schedule.rb
|
|
263
275
|
- lib/potassium/recipes/script.rb
|
|
264
276
|
- lib/potassium/recipes/secrets.rb
|
|
277
|
+
- lib/potassium/recipes/seeds.rb
|
|
265
278
|
- lib/potassium/recipes/style.rb
|
|
266
279
|
- lib/potassium/recipes/testing.rb
|
|
280
|
+
- lib/potassium/recipes/tzinfo.rb
|
|
267
281
|
- lib/potassium/template_finder.rb
|
|
268
282
|
- lib/potassium/templates/application.rb
|
|
269
283
|
- lib/potassium/templates/recipe.rb
|
|
@@ -273,8 +287,11 @@ files:
|
|
|
273
287
|
- spec/fakes/bin/heroku
|
|
274
288
|
- spec/fakes/bin/hub
|
|
275
289
|
- spec/features/ci_spec.rb
|
|
290
|
+
- spec/features/clockwork_spec.rb
|
|
291
|
+
- spec/features/error_reporting_spec.rb
|
|
276
292
|
- spec/features/github_spec.rb
|
|
277
293
|
- spec/features/heroku_spec.rb
|
|
294
|
+
- spec/features/i18n_spec.rb
|
|
278
295
|
- spec/features/new_project_spec.rb
|
|
279
296
|
- spec/spec_helper.rb
|
|
280
297
|
- spec/support/fake_github.rb
|
|
@@ -300,7 +317,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
300
317
|
version: '0'
|
|
301
318
|
requirements: []
|
|
302
319
|
rubyforge_project:
|
|
303
|
-
rubygems_version: 2.5.
|
|
320
|
+
rubygems_version: 2.5.2
|
|
304
321
|
signing_key:
|
|
305
322
|
specification_version: 4
|
|
306
323
|
summary: An application generator from Platanus
|
|
@@ -308,8 +325,11 @@ test_files:
|
|
|
308
325
|
- spec/fakes/bin/heroku
|
|
309
326
|
- spec/fakes/bin/hub
|
|
310
327
|
- spec/features/ci_spec.rb
|
|
328
|
+
- spec/features/clockwork_spec.rb
|
|
329
|
+
- spec/features/error_reporting_spec.rb
|
|
311
330
|
- spec/features/github_spec.rb
|
|
312
331
|
- spec/features/heroku_spec.rb
|
|
332
|
+
- spec/features/i18n_spec.rb
|
|
313
333
|
- spec/features/new_project_spec.rb
|
|
314
334
|
- spec/spec_helper.rb
|
|
315
335
|
- spec/support/fake_github.rb
|