onotole 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +6 -0
- data/.rubocop.yml +44 -0
- data/.ruby-version +1 -0
- data/.travis.yml +11 -0
- data/Gemfile +3 -0
- data/Guardfile +60 -0
- data/LICENSE +19 -0
- data/README.md +288 -0
- data/Rakefile +8 -0
- data/bin/onotole +35 -0
- data/bin/rake +16 -0
- data/bin/rspec +16 -0
- data/bin/setup +13 -0
- data/lib/onotole.rb +6 -0
- data/lib/onotole/actions.rb +33 -0
- data/lib/onotole/adapters/heroku.rb +125 -0
- data/lib/onotole/add_user_gems/after_install_patch.rb +119 -0
- data/lib/onotole/add_user_gems/before_bundle_patch.rb +137 -0
- data/lib/onotole/add_user_gems/edit_menu_questions.rb +80 -0
- data/lib/onotole/add_user_gems/user_gems_menu_questions.rb +17 -0
- data/lib/onotole/app_builder.rb +678 -0
- data/lib/onotole/colors.rb +20 -0
- data/lib/onotole/generators/app_generator.rb +299 -0
- data/lib/onotole/version.rb +6 -0
- data/onotole.gemspec +33 -0
- data/spec/adapters/heroku_spec.rb +52 -0
- data/spec/fakes/bin/heroku +5 -0
- data/spec/fakes/bin/hub +5 -0
- data/spec/features/github_spec.rb +15 -0
- data/spec/features/heroku_spec.rb +93 -0
- data/spec/features/new_project_spec.rb +204 -0
- data/spec/spec_helper.rb +20 -0
- data/spec/support/fake_github.rb +21 -0
- data/spec/support/fake_heroku.rb +51 -0
- data/spec/support/onotole.rb +59 -0
- data/templates/Gemfile.erb +61 -0
- data/templates/Procfile +2 -0
- data/templates/README.md.erb +30 -0
- data/templates/_analytics.html.erb +7 -0
- data/templates/_flashes.html.erb +7 -0
- data/templates/_javascript.html.erb +12 -0
- data/templates/action_mailer.rb +5 -0
- data/templates/app.json.erb +39 -0
- data/templates/application.scss +1 -0
- data/templates/bin_deploy +12 -0
- data/templates/bin_setup +21 -0
- data/templates/bin_setup_review_app.erb +19 -0
- data/templates/browserslist +4 -0
- data/templates/bundler_audit.rake +12 -0
- data/templates/capybara_webkit.rb +3 -0
- data/templates/circle.yml.erb +6 -0
- data/templates/config_locales_en.yml.erb +19 -0
- data/templates/database_cleaner_rspec.rb +22 -0
- data/templates/dev.rake +12 -0
- data/templates/devise_rspec.rb +3 -0
- data/templates/disable_xml_params.rb +1 -0
- data/templates/dotfiles/.ctags +2 -0
- data/templates/dotfiles/.env +13 -0
- data/templates/dotfiles/.rspec +3 -0
- data/templates/errors.rb +34 -0
- data/templates/factories.rb +2 -0
- data/templates/factory_girl_rspec.rb +3 -0
- data/templates/flashes_helper.rb +5 -0
- data/templates/gitignore_file +18 -0
- data/templates/hound.yml +17 -0
- data/templates/i18n.rb +3 -0
- data/templates/json_encoding.rb +1 -0
- data/templates/newrelic.yml.erb +34 -0
- data/templates/onotole_layout.html.erb.erb +21 -0
- data/templates/postgresql_database.yml.erb +22 -0
- data/templates/puma.rb +28 -0
- data/templates/rails_helper.rb +22 -0
- data/templates/rubocop.yml +44 -0
- data/templates/secrets.yml +14 -0
- data/templates/shoulda_matchers_config_rspec.rb +6 -0
- data/templates/smtp.rb +9 -0
- data/templates/spec_helper.rb +23 -0
- data/templates/staging.rb +5 -0
- data/templates/tinymce.yml +6 -0
- metadata +172 -0
@@ -0,0 +1,7 @@
|
|
1
|
+
<% if ENV["SEGMENT_KEY"] %>
|
2
|
+
<script type="text/javascript">
|
3
|
+
window.analytics=window.analytics||[],window.analytics.methods=["identify","group","track","page","pageview","alias","ready","on","once","off","trackLink","trackForm","trackClick","trackSubmit"],window.analytics.factory=function(t){return function(){var a=Array.prototype.slice.call(arguments);return a.unshift(t),window.analytics.push(a),window.analytics}};for(var i=0;i<window.analytics.methods.length;i++){var key=window.analytics.methods[i];window.analytics[key]=window.analytics.factory(key)}window.analytics.load=function(t){if(!document.getElementById("analytics-js")){var a=document.createElement("script");a.type="text/javascript",a.id="analytics-js",a.async=!0,a.src=("https:"===document.location.protocol?"https://":"http://")+"cdn.segment.com/analytics.js/v1/"+t+"/analytics.min.js";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(a,n)}},window.analytics.SNIPPET_VERSION="2.0.9",
|
4
|
+
window.analytics.load("<%= ENV["SEGMENT_KEY"] %>");
|
5
|
+
window.analytics.page();
|
6
|
+
</script>
|
7
|
+
<% end %>
|
@@ -0,0 +1,39 @@
|
|
1
|
+
{
|
2
|
+
"name":"<%= app_name.dasherize %>",
|
3
|
+
"scripts":{},
|
4
|
+
"env":{
|
5
|
+
"AIRBRAKE_API_KEY":{
|
6
|
+
"required":true
|
7
|
+
},
|
8
|
+
"EMAIL_RECIPIENTS":{
|
9
|
+
"required":true
|
10
|
+
},
|
11
|
+
"RACK_ENV":{
|
12
|
+
"required":true
|
13
|
+
},
|
14
|
+
"RAILS_ENV":{
|
15
|
+
"required":true
|
16
|
+
},
|
17
|
+
"SECRET_KEY_BASE":{
|
18
|
+
"generator":"secret"
|
19
|
+
},
|
20
|
+
"SMTP_ADDRESS":{
|
21
|
+
"required":true
|
22
|
+
},
|
23
|
+
"SMTP_DOMAIN":{
|
24
|
+
"required":true
|
25
|
+
},
|
26
|
+
"SMTP_PASSWORD":{
|
27
|
+
"required":true
|
28
|
+
},
|
29
|
+
"SMTP_USERNAME":{
|
30
|
+
"required":true
|
31
|
+
},
|
32
|
+
"WEB_CONCURRENCY":{
|
33
|
+
"required":true
|
34
|
+
}
|
35
|
+
},
|
36
|
+
"addons":[
|
37
|
+
"heroku-postgresql"
|
38
|
+
]
|
39
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
@charset "utf-8";
|
@@ -0,0 +1,12 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
# Run this script to deploy the app to Heroku.
|
4
|
+
|
5
|
+
set -e
|
6
|
+
|
7
|
+
branch="$(git symbolic-ref HEAD --short)"
|
8
|
+
target="${1:-staging}"
|
9
|
+
|
10
|
+
git push "$target" "$branch:master"
|
11
|
+
heroku run rake db:migrate --remote "$target"
|
12
|
+
heroku restart --remote "$target"
|
data/templates/bin_setup
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
# Set up Rails app. Run this script immediately after cloning the codebase.
|
4
|
+
# https://github.com/thoughtbot/guides/tree/master/protocol
|
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 and add any development seed data
|
14
|
+
bin/rake dev:prime
|
15
|
+
|
16
|
+
# Add binstubs to PATH via export PATH=".git/safe/../../bin:$PATH" in ~/.zshenv
|
17
|
+
mkdir -p .git/safe
|
18
|
+
|
19
|
+
# Only if this isn't CI
|
20
|
+
# if [ -z "$CI" ]; then
|
21
|
+
# fi
|
@@ -0,0 +1,19 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
# Run this script to set up a review app's database and worker dyno
|
4
|
+
|
5
|
+
set -e
|
6
|
+
|
7
|
+
if [ -z "$1" ]; then
|
8
|
+
printf "You must provide a review app (same as the pull request) id.\n"
|
9
|
+
exit 64
|
10
|
+
fi
|
11
|
+
|
12
|
+
heroku pg:backups restore \
|
13
|
+
`heroku pg:backups public-url -a <%= app_name.dasherize %>-staging` \
|
14
|
+
DATABASE_URL \
|
15
|
+
--confirm <%= app_name.dasherize %>-staging-pr-$1 \
|
16
|
+
--app <%= app_name.dasherize %>-staging-pr-$1
|
17
|
+
heroku run rake db:migrate --app <%= app_name.dasherize %>-staging-pr-$1
|
18
|
+
heroku ps:scale worker=1 --app <%= app_name.dasherize %>-staging-pr-$1
|
19
|
+
heroku restart --app <%= app_name.dasherize %>-staging-pr-$1
|
@@ -0,0 +1,12 @@
|
|
1
|
+
if Rails.env.development? || Rails.env.test?
|
2
|
+
require 'bundler/audit/cli'
|
3
|
+
|
4
|
+
namespace :bundler do
|
5
|
+
desc 'Updates the ruby-advisory-db and runs audit'
|
6
|
+
task :audit do
|
7
|
+
%w(update check).each do |command|
|
8
|
+
Bundler::Audit::CLI.start [command]
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
RSpec.configure do |config|
|
2
|
+
config.before(:suite) do
|
3
|
+
DatabaseCleaner.clean_with(:deletion)
|
4
|
+
end
|
5
|
+
|
6
|
+
config.before(:each) do
|
7
|
+
DatabaseCleaner.strategy = :transaction
|
8
|
+
end
|
9
|
+
|
10
|
+
config.before(:each, js: true) do
|
11
|
+
DatabaseCleaner.strategy = :deletion
|
12
|
+
end
|
13
|
+
|
14
|
+
config.before(:each) do
|
15
|
+
DatabaseCleaner.start
|
16
|
+
end
|
17
|
+
|
18
|
+
config.after(:each) do
|
19
|
+
DatabaseCleaner.clean
|
20
|
+
Timecop.return
|
21
|
+
end
|
22
|
+
end
|
data/templates/dev.rake
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
if Rails.env.development? || Rails.env.test?
|
2
|
+
require 'factory_girl'
|
3
|
+
|
4
|
+
namespace :dev do
|
5
|
+
desc 'Sample data for local development environment'
|
6
|
+
task prime: 'db:setup' do
|
7
|
+
include FactoryGirl::Syntax::Methods
|
8
|
+
|
9
|
+
# create(:user, email: "user@example.com", password: "password")
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
ActionDispatch::ParamsParser::DEFAULT_PARSERS.delete(Mime::XML)
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# https://github.com/ddollar/forego
|
2
|
+
ASSET_HOST=localhost:3000
|
3
|
+
APPLICATION_HOST=localhost:3000
|
4
|
+
PORT=3000
|
5
|
+
RACK_ENV=development
|
6
|
+
SECRET_KEY_BASE=development_secret
|
7
|
+
EXECJS_RUNTIME=Node
|
8
|
+
SMTP_ADDRESS=smtp.example.com
|
9
|
+
SMTP_DOMAIN=example.com
|
10
|
+
SMTP_PASSWORD=password
|
11
|
+
SMTP_USERNAME=username
|
12
|
+
WEB_CONCURRENCY=1
|
13
|
+
MAX_THREADS=16
|
data/templates/errors.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'net/http'
|
2
|
+
require 'net/smtp'
|
3
|
+
|
4
|
+
# Example:
|
5
|
+
# begin
|
6
|
+
# some http call
|
7
|
+
# rescue *HTTP_ERRORS => error
|
8
|
+
# notify_hoptoad error
|
9
|
+
# end
|
10
|
+
|
11
|
+
HTTP_ERRORS = [
|
12
|
+
EOFError,
|
13
|
+
Errno::ECONNRESET,
|
14
|
+
Errno::EINVAL,
|
15
|
+
Net::HTTPBadResponse,
|
16
|
+
Net::HTTPHeaderSyntaxError,
|
17
|
+
Net::ProtocolError,
|
18
|
+
Timeout::Error
|
19
|
+
].freeze
|
20
|
+
|
21
|
+
SMTP_SERVER_ERRORS = [
|
22
|
+
IOError,
|
23
|
+
Net::SMTPAuthenticationError,
|
24
|
+
Net::SMTPServerBusy,
|
25
|
+
Net::SMTPUnknownError,
|
26
|
+
Timeout::Error
|
27
|
+
].freeze
|
28
|
+
|
29
|
+
SMTP_CLIENT_ERRORS = [
|
30
|
+
Net::SMTPFatalError,
|
31
|
+
Net::SMTPSyntaxError
|
32
|
+
].freeze
|
33
|
+
|
34
|
+
SMTP_ERRORS = SMTP_SERVER_ERRORS + SMTP_CLIENT_ERRORS
|
data/templates/hound.yml
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# See https://houndci.com/configuration for help.
|
2
|
+
coffeescript:
|
3
|
+
# config_file: .coffeescript-style.json
|
4
|
+
enabled: true
|
5
|
+
haml:
|
6
|
+
# config_file: .haml-style.yml
|
7
|
+
enabled: true
|
8
|
+
javascript:
|
9
|
+
# config_file: .javascript-style.json
|
10
|
+
enabled: true
|
11
|
+
# ignore_file: .javascript_ignore
|
12
|
+
ruby:
|
13
|
+
# config_file: .ruby-style.yml
|
14
|
+
enabled: true
|
15
|
+
scss:
|
16
|
+
# config_file: .scss-style.yml
|
17
|
+
enabled: true
|
data/templates/i18n.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ActiveSupport::JSON::Encoding.time_precision = 0
|
@@ -0,0 +1,34 @@
|
|
1
|
+
common: &default_settings
|
2
|
+
app_name: "<%= app_name %>"
|
3
|
+
audit_log:
|
4
|
+
enabled: false
|
5
|
+
browser_monitoring:
|
6
|
+
auto_instrument: true
|
7
|
+
capture_params: false
|
8
|
+
developer_mode: false
|
9
|
+
error_collector:
|
10
|
+
capture_source: true
|
11
|
+
enabled: true
|
12
|
+
ignore_errors: "ActionController::RoutingError,Sinatra::NotFound"
|
13
|
+
license_key: "<%%= ENV["NEW_RELIC_LICENSE_KEY"] %>"
|
14
|
+
log_level: info
|
15
|
+
monitor_mode: true
|
16
|
+
transaction_tracer:
|
17
|
+
enabled: true
|
18
|
+
record_sql: obfuscated
|
19
|
+
stack_trace_threshold: 0.500
|
20
|
+
transaction_threshold: apdex_f
|
21
|
+
development:
|
22
|
+
<<: *default_settings
|
23
|
+
monitor_mode: false
|
24
|
+
developer_mode: true
|
25
|
+
test:
|
26
|
+
<<: *default_settings
|
27
|
+
monitor_mode: false
|
28
|
+
production:
|
29
|
+
<<: *default_settings
|
30
|
+
monitor_mode: true
|
31
|
+
staging:
|
32
|
+
<<: *default_settings
|
33
|
+
app_name: "<%= app_name %> (Staging)"
|
34
|
+
monitor_mode: true
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="<%= I18n.locale %>">
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8" />
|
5
|
+
<meta name="ROBOTS" content="NOODP" />
|
6
|
+
<meta name="viewport" content="initial-scale=1" />
|
7
|
+
<%%#
|
8
|
+
Configure default and controller-, and view-specific titles in
|
9
|
+
config/locales/en.yml. For more see:
|
10
|
+
https://github.com/calebthompson/title#usage
|
11
|
+
%>
|
12
|
+
<title><%%= title %></title>
|
13
|
+
<%%= stylesheet_link_tag :application, media: "all" %>
|
14
|
+
<%%= csrf_meta_tags %>
|
15
|
+
</head>
|
16
|
+
<body class="<%%= body_class %>">
|
17
|
+
<%%= render "flashes" -%>
|
18
|
+
<%%= yield %>
|
19
|
+
<%%= render "javascript" %>
|
20
|
+
</body>
|
21
|
+
</html>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
development: &default
|
2
|
+
adapter: postgresql
|
3
|
+
database: <%= app_name %>_development
|
4
|
+
encoding: utf8
|
5
|
+
host: localhost
|
6
|
+
min_messages: warning
|
7
|
+
pool: <%%= Integer(ENV.fetch("DB_POOL", 5)) %>
|
8
|
+
reaping_frequency: <%%= Integer(ENV.fetch("DB_REAPING_FREQUENCY", 10)) %>
|
9
|
+
timeout: 5000
|
10
|
+
|
11
|
+
test:
|
12
|
+
<<: *default
|
13
|
+
database: <%= app_name %>_test
|
14
|
+
|
15
|
+
production: &deploy
|
16
|
+
encoding: utf8
|
17
|
+
min_messages: warning
|
18
|
+
pool: <%%= [Integer(ENV.fetch("MAX_THREADS", 5)), Integer(ENV.fetch("DB_POOL", 5))].max %>
|
19
|
+
timeout: 5000
|
20
|
+
url: <%%= ENV.fetch("DATABASE_URL", "") %>
|
21
|
+
|
22
|
+
staging: *deploy
|
data/templates/puma.rb
ADDED
@@ -0,0 +1,28 @@
|
|
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(2, threads_count)
|
18
|
+
|
19
|
+
preload_app!
|
20
|
+
|
21
|
+
rackup DefaultRackup
|
22
|
+
environment ENV.fetch('RACK_ENV', 'development')
|
23
|
+
|
24
|
+
on_worker_boot do
|
25
|
+
# Worker specific setup for Rails 4.1+
|
26
|
+
# See: https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server#on-worker-boot
|
27
|
+
ActiveRecord::Base.establish_connection
|
28
|
+
end
|