ajmalafif-jumpstart 1.18.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +4 -0
- data/.ruby-version +1 -0
- data/.travis.yml +11 -0
- data/CONTRIBUTING.md +36 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +135 -0
- data/LICENSE +21 -0
- data/NEWS.md +292 -0
- data/README.md +190 -0
- data/Rakefile +8 -0
- data/bin/jumpstart +18 -0
- data/bin/rake +16 -0
- data/bin/rspec +16 -0
- data/bin/setup +13 -0
- data/jumpstart.gemspec +38 -0
- data/lib/jumpstart.rb +4 -0
- data/lib/jumpstart/actions.rb +25 -0
- data/lib/jumpstart/app_builder.rb +398 -0
- data/lib/jumpstart/generators/app_generator.rb +215 -0
- data/lib/jumpstart/version.rb +5 -0
- data/spec/fakes/bin/heroku +5 -0
- data/spec/fakes/bin/hub +5 -0
- data/spec/features/github_spec.rb +10 -0
- data/spec/features/heroku_spec.rb +19 -0
- data/spec/features/new_project_spec.rb +117 -0
- data/spec/spec_helper.rb +24 -0
- data/spec/support/fake_github.rb +21 -0
- data/spec/support/fake_heroku.rb +38 -0
- data/spec/support/jumpstart.rb +49 -0
- data/templates/Gemfile.erb +52 -0
- data/templates/Procfile +2 -0
- data/templates/README.md.erb +35 -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/application.css.scss +7 -0
- data/templates/background_jobs_rspec.rb +19 -0
- data/templates/bin_setup.erb +34 -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/development_seeds.rb +12 -0
- data/templates/disable_xml_params.rb +3 -0
- data/templates/errors.rb +34 -0
- data/templates/factory_girl_rspec.rb +3 -0
- data/templates/i18n.rb +3 -0
- data/templates/jumpstart_gitignore +17 -0
- data/templates/jumpstart_layout.html.erb.erb +16 -0
- data/templates/newrelic.yml.erb +34 -0
- data/templates/postgresql_database.yml.erb +12 -0
- data/templates/rack_timeout.rb +1 -0
- data/templates/rails_helper.rb +23 -0
- data/templates/sample.env +3 -0
- data/templates/secrets.yml +14 -0
- data/templates/smtp.rb +9 -0
- data/templates/spec_helper.rb +16 -0
- data/templates/staging.rb +5 -0
- data/templates/travis.yml.erb +24 -0
- data/templates/unicorn.rb +30 -0
- metadata +223 -0
@@ -0,0 +1,49 @@
|
|
1
|
+
module JumpstartTestHelpers
|
2
|
+
APP_NAME = 'dummy'
|
3
|
+
|
4
|
+
def remove_project_directory
|
5
|
+
FileUtils.rm_rf(project_path)
|
6
|
+
end
|
7
|
+
|
8
|
+
def create_tmp_directory
|
9
|
+
FileUtils.mkdir_p(tmp_path)
|
10
|
+
end
|
11
|
+
|
12
|
+
def run_jumpstart(arguments = nil)
|
13
|
+
Dir.chdir(tmp_path) do
|
14
|
+
Bundler.with_clean_env do
|
15
|
+
ENV['TESTING'] = '1'
|
16
|
+
|
17
|
+
%x(#{jumpstart_bin} #{APP_NAME} #{arguments})
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def drop_dummy_database
|
23
|
+
if File.exist?(project_path)
|
24
|
+
Dir.chdir(project_path) do
|
25
|
+
Bundler.with_clean_env do
|
26
|
+
`rake db:drop`
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def project_path
|
33
|
+
@project_path ||= Pathname.new("#{tmp_path}/#{APP_NAME}")
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def tmp_path
|
39
|
+
@tmp_path ||= Pathname.new("#{root_path}/tmp")
|
40
|
+
end
|
41
|
+
|
42
|
+
def jumpstart_bin
|
43
|
+
File.join(root_path, 'bin', 'jumpstart')
|
44
|
+
end
|
45
|
+
|
46
|
+
def root_path
|
47
|
+
File.expand_path('../../../', __FILE__)
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
3
|
+
ruby "<%= Jumpstart::RUBY_VERSION %>"
|
4
|
+
gem "rails", "~> <%= Jumpstart::RAILS_VERSION %>"
|
5
|
+
|
6
|
+
gem "airbrake"
|
7
|
+
gem "bourbon", "~> 3.2.1"
|
8
|
+
gem "coffee-rails"
|
9
|
+
gem "delayed_job_active_record"
|
10
|
+
gem "email_validator"
|
11
|
+
gem "flutie"
|
12
|
+
gem "high_voltage"
|
13
|
+
gem "i18n-tasks"
|
14
|
+
gem "jquery-rails"
|
15
|
+
gem "neat", "~> 1.5.1"
|
16
|
+
gem "newrelic_rpm"
|
17
|
+
gem "normalize-rails", "~> 3.0.0"
|
18
|
+
gem "pg"
|
19
|
+
gem "rack-timeout"
|
20
|
+
gem "recipient_interceptor"
|
21
|
+
gem "sass-rails", "~> 4.0.3"
|
22
|
+
gem "simple_form"
|
23
|
+
gem "title"
|
24
|
+
gem "uglifier"
|
25
|
+
gem "unicorn"
|
26
|
+
|
27
|
+
group :development do
|
28
|
+
gem "spring"
|
29
|
+
gem "spring-commands-rspec"
|
30
|
+
end
|
31
|
+
|
32
|
+
group :development, :test do
|
33
|
+
gem "awesome_print"
|
34
|
+
gem "byebug"
|
35
|
+
gem "dotenv-rails"
|
36
|
+
gem "factory_girl_rails"
|
37
|
+
gem "pry-rails"
|
38
|
+
gem "rspec-rails", "~> 3.0.0"
|
39
|
+
end
|
40
|
+
|
41
|
+
group :test do
|
42
|
+
gem "capybara-webkit", ">= 1.2.0"
|
43
|
+
gem "database_cleaner"
|
44
|
+
gem "formulaic"
|
45
|
+
gem "launchy"
|
46
|
+
gem "shoulda-matchers", require: false
|
47
|
+
gem "timecop"
|
48
|
+
gem "webmock"
|
49
|
+
end
|
50
|
+
|
51
|
+
group :staging, :production do
|
52
|
+
end
|
data/templates/Procfile
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
<%= app_name.humanize %>
|
2
|
+
<%= '=' * app_name.humanize.length %>
|
3
|
+
|
4
|
+
Getting Started
|
5
|
+
---------------
|
6
|
+
|
7
|
+
After you have cloned this repo, run this setup script to set up your machine
|
8
|
+
with the necessary dependencies to run and test this app:
|
9
|
+
|
10
|
+
% ./bin/setup
|
11
|
+
|
12
|
+
It assumes you have a machine equipped with Ruby, Postgres, etc. If not, set up
|
13
|
+
your machine with [this script].
|
14
|
+
|
15
|
+
[this script]: https://github.com/thoughtbot/laptop
|
16
|
+
|
17
|
+
After setting up, you can run the application using [foreman]:
|
18
|
+
|
19
|
+
% foreman start
|
20
|
+
|
21
|
+
If you don't have `foreman`, see [Foreman's install instructions][foreman]. It
|
22
|
+
is [purposefully excluded from the project's `Gemfile`][exclude].
|
23
|
+
|
24
|
+
[foreman]: https://github.com/ddollar/foreman
|
25
|
+
[exclude]: https://github.com/ddollar/foreman/pull/437#issuecomment-41110407
|
26
|
+
|
27
|
+
Guidelines
|
28
|
+
----------
|
29
|
+
|
30
|
+
Use the following guides for getting things done, programming well, and
|
31
|
+
programming in style.
|
32
|
+
|
33
|
+
* [Protocol](http://github.com/thoughtbot/guides/blob/master/protocol)
|
34
|
+
* [Best Practices](http://github.com/thoughtbot/guides/blob/master/best-practices)
|
35
|
+
* [Style](http://github.com/thoughtbot/guides/blob/master/style)
|
@@ -0,0 +1,7 @@
|
|
1
|
+
<% if ENV["SEGMENT_IO_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.io/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_IO_KEY"] %>");
|
5
|
+
window.analytics.page();
|
6
|
+
</script>
|
7
|
+
<% end %>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module BackgroundJobs
|
2
|
+
def run_background_jobs_immediately
|
3
|
+
delay_jobs = Delayed::Worker.delay_jobs
|
4
|
+
Delayed::Worker.delay_jobs = false
|
5
|
+
yield
|
6
|
+
ensure
|
7
|
+
Delayed::Worker.delay_jobs = delay_jobs
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
RSpec.configure do |config|
|
12
|
+
config.around(:each, type: :feature) do |example|
|
13
|
+
run_background_jobs_immediately do
|
14
|
+
example.run
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
config.include BackgroundJobs
|
19
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
#!/usr/bin/env 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
|
+
bundle --version &> /dev/null || gem install bundler --no-document
|
11
|
+
bundle install
|
12
|
+
|
13
|
+
# Set up configurable environment variables
|
14
|
+
if [ ! -f .env ]; then
|
15
|
+
mv .sample.env .env
|
16
|
+
fi
|
17
|
+
|
18
|
+
# Set up database and add any development seed data
|
19
|
+
bundle exec rake dev:prime
|
20
|
+
|
21
|
+
# Add binstubs to PATH via export PATH=".git/safe/../../bin:$PATH" in ~/.zshenv
|
22
|
+
mkdir -p .git/safe
|
23
|
+
|
24
|
+
# Pick a port for Foreman
|
25
|
+
if ! grep -qs 'port' .foreman; then
|
26
|
+
printf 'port: <%= config[:port_number] %>\n' >> .foreman
|
27
|
+
fi
|
28
|
+
|
29
|
+
# Error out if Foreman is not installed
|
30
|
+
if ! command -v foreman > /dev/null; then
|
31
|
+
printf 'Foreman is not installed.\n'
|
32
|
+
printf 'See https://github.com/ddollar/foreman for install instructions.\n'
|
33
|
+
exit 1
|
34
|
+
fi
|
@@ -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
|
@@ -0,0 +1,12 @@
|
|
1
|
+
if Rails.env.development?
|
2
|
+
require "factory_girl"
|
3
|
+
|
4
|
+
namespace :dev do
|
5
|
+
desc "Seed data for 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
|
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,16 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8" />
|
5
|
+
<meta name="ROBOTS" content="NOODP" />
|
6
|
+
<meta name="viewport" content="initial-scale=1" />
|
7
|
+
<title><%%= title %></title>
|
8
|
+
<%%= stylesheet_link_tag :application, media: "all" %>
|
9
|
+
<%%= csrf_meta_tags %>
|
10
|
+
</head>
|
11
|
+
<body class="<%%= body_class %>">
|
12
|
+
<%%= render "flashes" -%>
|
13
|
+
<%%= yield %>
|
14
|
+
<%%= render "javascript" %>
|
15
|
+
</body>
|
16
|
+
</html>
|
@@ -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
|