initiate 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +5 -0
- data/.ruby-version +1 -0
- data/.travis.yml +11 -0
- data/CONTRIBUTING.md +48 -0
- data/Gemfile +3 -0
- data/LICENSE +21 -0
- data/NEWS.md +444 -0
- data/README.md +129 -0
- data/Rakefile +8 -0
- data/bin/initiate +18 -0
- data/bin/rake +16 -0
- data/bin/rspec +16 -0
- data/bin/setup +13 -0
- data/lib/initiate.rb +6 -0
- data/lib/initiate/actions.rb +33 -0
- data/lib/initiate/app_builder.rb +341 -0
- data/lib/initiate/config.rb +9 -0
- data/lib/initiate/generators/app_generator.rb +174 -0
- data/lib/initiate/version.rb +5 -0
- data/spec/features/new_project_spec.rb +131 -0
- data/spec/spec_helper.rb +14 -0
- data/spec/support/initiate.rb +51 -0
- data/suspenders.gemspec +35 -0
- data/templates/Gemfile.erb +53 -0
- data/templates/Procfile +2 -0
- data/templates/README.md.erb +18 -0
- data/templates/_flashes.html.erb +7 -0
- data/templates/_javascript.html.erb +6 -0
- data/templates/action_mailer.rb +5 -0
- data/templates/annotate.rake +4 -0
- data/templates/application.html.slim.erb +10 -0
- data/templates/application.scss +1 -0
- data/templates/bin_setup.erb +32 -0
- data/templates/browserslist +4 -0
- data/templates/bugsnag.rb +5 -0
- data/templates/bundler_audit.rake +12 -0
- data/templates/capybara_webkit.rb +5 -0
- data/templates/config_i18n_tasks.yml +13 -0
- data/templates/config_locales_en.yml.erb +19 -0
- data/templates/database_cleaner_rspec.rb +21 -0
- data/templates/deploy.rb +95 -0
- data/templates/dev.rake +12 -0
- data/templates/disable_xml_params.rb +1 -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/i18n.rb +3 -0
- data/templates/json_encoding.rb +1 -0
- data/templates/postgresql_database.yml.erb +23 -0
- data/templates/rails_helper.rb +22 -0
- data/templates/sample.env +9 -0
- data/templates/secrets.yml +15 -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 +9 -0
- data/templates/suspenders_gitignore +13 -0
- metadata +167 -0
data/templates/Procfile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# <%= app_name.humanize %>
|
2
|
+
|
3
|
+
## Getting Started
|
4
|
+
|
5
|
+
After you have cloned this repo, run this setup script to set up your machine
|
6
|
+
with the necessary dependencies to run and test this app:
|
7
|
+
|
8
|
+
% ./bin/setup
|
9
|
+
|
10
|
+
It assumes you have a machine equipped with Ruby, Postgres, etc. If not, set up
|
11
|
+
your machine with our setup script placed in our internal guides.
|
12
|
+
|
13
|
+
## Guidelines
|
14
|
+
|
15
|
+
Use the following guides for getting things done, programming well, and
|
16
|
+
programming in style.
|
17
|
+
|
18
|
+
* [Infinum Developer Handbook](https://developer-handbook.infinum.co)
|
@@ -0,0 +1,10 @@
|
|
1
|
+
doctype html
|
2
|
+
html
|
3
|
+
head
|
4
|
+
title <%%= @app_name.titleize %>
|
5
|
+
= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true
|
6
|
+
= javascript_include_tag 'application', 'data-turbolinks-track' => true
|
7
|
+
= csrf_meta_tags
|
8
|
+
body class="<%%= body_class %>"
|
9
|
+
= render 'flashes'
|
10
|
+
= yield
|
@@ -0,0 +1 @@
|
|
1
|
+
@charset "utf-8";
|
@@ -0,0 +1,32 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'pathname'
|
3
|
+
|
4
|
+
# path to your application root.
|
5
|
+
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
6
|
+
|
7
|
+
Dir.chdir APP_ROOT do
|
8
|
+
# This script is a starting point to setup your application.
|
9
|
+
# Add necessary setup steps to this file:
|
10
|
+
|
11
|
+
puts '== Installing dependencies =='
|
12
|
+
system 'gem install bundler --conservative'
|
13
|
+
system 'bundle check || bundle install'
|
14
|
+
|
15
|
+
# puts "\n== Copying sample files =="
|
16
|
+
# unless File.exist?("config/database.yml")
|
17
|
+
# system "cp config/database.yml.sample config/database.yml"
|
18
|
+
# end
|
19
|
+
|
20
|
+
puts "\n== Preparing database =="
|
21
|
+
system 'bin/rake db:setup'
|
22
|
+
system 'bundle exec rake dev:prime'
|
23
|
+
|
24
|
+
puts "\n== Removing old logs and tempfiles =="
|
25
|
+
system 'rm -f log/*'
|
26
|
+
system 'rm -rf tmp/cache'
|
27
|
+
end
|
28
|
+
# Set up database and add any development seed data
|
29
|
+
bin/rake dev:prime
|
30
|
+
|
31
|
+
# Add binstubs to PATH via export PATH=".git/safe/../../bin:$PATH" in ~/.zshenv
|
32
|
+
mkdir -p .git/safe
|
@@ -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,21 @@
|
|
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
|
+
end
|
21
|
+
end
|
data/templates/deploy.rb
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
require 'mina/bundler'
|
2
|
+
require 'mina/rails'
|
3
|
+
require 'mina/git'
|
4
|
+
# require 'mina/rbenv' # for rbenv support. (http://rbenv.org)
|
5
|
+
# require 'mina/rvm' # for rvm support. (http://rvm.io)
|
6
|
+
|
7
|
+
# Basic settings:
|
8
|
+
# domain - The hostname to SSH to.
|
9
|
+
# deploy_to - Path to deploy into.
|
10
|
+
# repository - Git repo to clone from. (needed by mina/git)
|
11
|
+
# branch - Branch name to deploy. (needed by mina/git)
|
12
|
+
set :repository, ENV['GIT_REPOSITORY']
|
13
|
+
set :user, ENV['USERNAME']
|
14
|
+
set :port, ENV['PORT_NUMBER']
|
15
|
+
|
16
|
+
task :production do
|
17
|
+
set :domain, ENV['PRODUCTION_DOMAIN']
|
18
|
+
set :deploy_to, ENV['PRODUCTION_DEPLOY_FOLDER']
|
19
|
+
set :branch, 'master'
|
20
|
+
end
|
21
|
+
|
22
|
+
task :staging do
|
23
|
+
set :domain, ENV['STAGING_DOMAIN']
|
24
|
+
set :deploy_to, ENV['STAGING_DEPLOY_FOLDER']
|
25
|
+
set :branch, 'master'
|
26
|
+
end
|
27
|
+
|
28
|
+
# For system-wide RVM install.
|
29
|
+
# set :rvm_path, '/usr/local/rvm/bin/rvm'
|
30
|
+
|
31
|
+
# Manually create these paths in shared/ (eg: shared/config/database.yml) in your server.
|
32
|
+
# They will be linked in the 'deploy:link_shared_paths' step.
|
33
|
+
set :shared_paths, ['log']
|
34
|
+
|
35
|
+
# Optional settings:
|
36
|
+
# set :user, 'foobar' # Username in the server to SSH to.
|
37
|
+
# set :port, '30000' # SSH port number.
|
38
|
+
# set :forward_agent, true # SSH forward_agent.
|
39
|
+
|
40
|
+
# This task is the environment that is loaded for most commands, such as
|
41
|
+
# `mina deploy` or `mina rake`.
|
42
|
+
task :environment do
|
43
|
+
# If you're using rbenv, use this to load the rbenv environment.
|
44
|
+
# Be sure to commit your .rbenv-version to your repository.
|
45
|
+
# invoke :'rbenv:load'
|
46
|
+
|
47
|
+
# For those using RVM, use this to load an RVM version@gemset.
|
48
|
+
# invoke :'rvm:use[ruby-1.9.3-p125@default]'
|
49
|
+
end
|
50
|
+
|
51
|
+
# Put any custom mkdir's in here for when `mina setup` is ran.
|
52
|
+
# For Rails apps, we'll make some of the shared paths that are shared between
|
53
|
+
# all releases.
|
54
|
+
task :setup => :environment do
|
55
|
+
queue! %[mkdir -p "#{deploy_to}/#{shared_path}/log"]
|
56
|
+
queue! %[chmod g+rx,u+rwx "#{deploy_to}/#{shared_path}/log"]
|
57
|
+
end
|
58
|
+
|
59
|
+
desc "Deploys the current version to the server."
|
60
|
+
task :deploy => :environment do
|
61
|
+
deploy do
|
62
|
+
|
63
|
+
to :prepare do
|
64
|
+
queue! %[echo "-----> Stopping jobs"]
|
65
|
+
queue! %[mkdir log]
|
66
|
+
queue "RAILS_ENV=#{rails_env} #{deploy_to}/#{current_path}/bin/delayed_job stop"
|
67
|
+
queue! %[rm -r log]
|
68
|
+
end
|
69
|
+
|
70
|
+
to :default do
|
71
|
+
invoke :'git:clone'
|
72
|
+
invoke :'deploy:link_shared_paths'
|
73
|
+
invoke :'bundle:install'
|
74
|
+
invoke :'rails:db_migrate'
|
75
|
+
invoke :'rails:assets_precompile'
|
76
|
+
invoke :'deploy:cleanup'
|
77
|
+
end
|
78
|
+
|
79
|
+
to :launch do
|
80
|
+
queue %[echo "-----> Retarting jobs"]
|
81
|
+
queue! %[mkdir -p #{deploy_to}/#{current_path}/tmp/pids]
|
82
|
+
queue "RAILS_ENV=#{rails_env} #{deploy_to}/#{current_path}/bin/delayed_job restart"
|
83
|
+
|
84
|
+
queue "mkdir -p #{deploy_to}/#{current_path}/tmp/"
|
85
|
+
queue "touch #{deploy_to}/#{current_path}/tmp/restart.txt"
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
# For help in making your deploy script, see the Mina documentation:
|
91
|
+
#
|
92
|
+
# - http://nadarei.co/mina
|
93
|
+
# - http://nadarei.co/mina/tasks
|
94
|
+
# - http://nadarei.co/mina/settings
|
95
|
+
# - http://nadarei.co/mina/helpers
|
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)
|
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
|
+
]
|
20
|
+
|
21
|
+
SMTP_SERVER_ERRORS = [
|
22
|
+
IOError,
|
23
|
+
Net::SMTPAuthenticationError,
|
24
|
+
Net::SMTPServerBusy,
|
25
|
+
Net::SMTPUnknownError,
|
26
|
+
TimeoutError
|
27
|
+
]
|
28
|
+
|
29
|
+
SMTP_CLIENT_ERRORS = [
|
30
|
+
Net::SMTPFatalError,
|
31
|
+
Net::SMTPSyntaxError
|
32
|
+
]
|
33
|
+
|
34
|
+
SMTP_ERRORS = SMTP_SERVER_ERRORS + SMTP_CLIENT_ERRORS
|
data/templates/i18n.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ActiveSupport::JSON::Encoding.time_precision = 0
|
@@ -0,0 +1,23 @@
|
|
1
|
+
default: &default
|
2
|
+
encoding: utf8
|
3
|
+
adapter: postgresql
|
4
|
+
pool: 5
|
5
|
+
timeout: 5000
|
6
|
+
host: localhost
|
7
|
+
username: postgres
|
8
|
+
|
9
|
+
development:
|
10
|
+
<<: *default
|
11
|
+
database: <%= @app_path %>_development
|
12
|
+
|
13
|
+
test:
|
14
|
+
<<: *default
|
15
|
+
database: <%= @app_path %>_test
|
16
|
+
|
17
|
+
staging:
|
18
|
+
<<: *default
|
19
|
+
database: <%= @app_path %>_staging
|
20
|
+
|
21
|
+
production:
|
22
|
+
<<: *default
|
23
|
+
database: <%= @app_path %>_production
|
@@ -0,0 +1,22 @@
|
|
1
|
+
ENV["RAILS_ENV"] = "test"
|
2
|
+
|
3
|
+
require File.expand_path("../../config/environment", __FILE__)
|
4
|
+
abort("DATABASE_URL environment variable is set") if ENV["DATABASE_URL"]
|
5
|
+
|
6
|
+
require "rspec/rails"
|
7
|
+
|
8
|
+
Dir[Rails.root.join("spec/support/**/*.rb")].sort.each { |file| require file }
|
9
|
+
|
10
|
+
module Features
|
11
|
+
# Extend this module in spec/support/features/*.rb
|
12
|
+
include Formulaic::Dsl
|
13
|
+
end
|
14
|
+
|
15
|
+
RSpec.configure do |config|
|
16
|
+
config.include Features, type: :feature
|
17
|
+
config.infer_base_class_for_anonymous_controllers = false
|
18
|
+
config.infer_spec_type_from_file_location!
|
19
|
+
config.use_transactional_fixtures = false
|
20
|
+
end
|
21
|
+
|
22
|
+
ActiveRecord::Migration.maintain_test_schema!
|
@@ -0,0 +1,15 @@
|
|
1
|
+
default: &default
|
2
|
+
secret_key_base: <%%= ENV.fetch('SECRET_KEY_BASE') %>
|
3
|
+
bugsnag_api_key: <%%= ENV.fetch('BUGSNAG_API_KEY') %>
|
4
|
+
|
5
|
+
development:
|
6
|
+
<<: *default
|
7
|
+
|
8
|
+
test:
|
9
|
+
<<: *default
|
10
|
+
|
11
|
+
staging:
|
12
|
+
<<: *default
|
13
|
+
|
14
|
+
production:
|
15
|
+
<<: *default
|