yupi 0.1.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 +7 -0
- data/.gitignore +4 -0
- data/.ruby-version +1 -0
- data/.travis.yml +11 -0
- data/CONTRIBUTING.md +33 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +139 -0
- data/LICENSE +21 -0
- data/NEWS.md +8 -0
- data/README.md +72 -0
- data/Rakefile +11 -0
- data/bin/rake +16 -0
- data/bin/rspec +16 -0
- data/bin/setup +9 -0
- data/bin/yupi +13 -0
- data/lib/yupi.rb +4 -0
- data/lib/yupi/actions.rb +33 -0
- data/lib/yupi/app_builder.rb +368 -0
- data/lib/yupi/generators/app_generator.rb +201 -0
- data/lib/yupi/version.rb +5 -0
- data/spec/features/new_project_spec.rb +135 -0
- data/spec/spec_helper.rb +24 -0
- data/spec/support/yupi.rb +51 -0
- data/templates/Gemfile.erb +52 -0
- data/templates/Procfile +2 -0
- data/templates/README.md.erb +32 -0
- data/templates/assets/application.css.scss +4 -0
- data/templates/assets/application.js +3 -0
- data/templates/bin/setup.erb +23 -0
- data/templates/config/application.yml.sample +4 -0
- data/templates/config/i18n_tasks.yml +13 -0
- data/templates/config/initializers/disable_xml_params.rb +3 -0
- data/templates/config/initializers/errors.rb +34 -0
- data/templates/config/initializers/json_encoding.rb +1 -0
- data/templates/config/initializers/mail_interceptor.rb +3 -0
- data/templates/config/initializers/rack_timeout.rb +1 -0
- data/templates/config/locales_en.yml.erb +19 -0
- data/templates/config/newrelic.yml.erb +30 -0
- data/templates/config/postgresql_database.yml.erb +12 -0
- data/templates/config/rails_secrets.yml +11 -0
- data/templates/config/smtp.rb +9 -0
- data/templates/dot_gitignore +15 -0
- data/templates/spec/rails_helper.rb +23 -0
- data/templates/spec/spec_helper.rb +17 -0
- data/templates/spec/support/action_mailer.rb +5 -0
- data/templates/spec/support/database_cleaner_rspec.rb +21 -0
- data/templates/spec/support/factory_girl_rspec.rb +3 -0
- data/templates/spec/support/i18n.rb +3 -0
- data/templates/tasks/bundler_audit.rake +12 -0
- data/templates/tasks/development_seeds.rake +12 -0
- data/templates/views/application/_analytics.html.erb +7 -0
- data/templates/views/application/_flashes.html.erb +6 -0
- data/templates/views/application/_footer.html.erb +17 -0
- data/templates/views/application/_javascript.html.erb +12 -0
- data/templates/views/application/_navigation.html.erb +18 -0
- data/templates/views/application/_navigation_links.html.erb +2 -0
- data/templates/views/layouts/application.html.erb.erb +43 -0
- data/templates/views/pages/home.html.erb +1 -0
- data/yupi.gemspec +36 -0
- metadata +187 -0
data/templates/Procfile
ADDED
@@ -0,0 +1,32 @@
|
|
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 [this script].
|
12
|
+
|
13
|
+
[this script]: https://github.com/thoughtbot/laptop
|
14
|
+
|
15
|
+
After setting up, you can run the application using [foreman]:
|
16
|
+
|
17
|
+
% foreman start
|
18
|
+
|
19
|
+
If you don't have `foreman`, see [Foreman's install instructions][foreman]. It
|
20
|
+
is [purposefully excluded from the project's `Gemfile`][exclude].
|
21
|
+
|
22
|
+
[foreman]: https://github.com/ddollar/foreman
|
23
|
+
[exclude]: https://github.com/ddollar/foreman/pull/437#issuecomment-41110407
|
24
|
+
|
25
|
+
## Guidelines
|
26
|
+
|
27
|
+
Use the following guides for getting things done, programming well, and
|
28
|
+
programming in style.
|
29
|
+
|
30
|
+
* [Protocol](http://github.com/thoughtbot/guides/blob/master/protocol)
|
31
|
+
* [Best Practices](http://github.com/thoughtbot/guides/blob/master/best-practices)
|
32
|
+
* [Style](http://github.com/thoughtbot/guides/blob/master/style)
|
@@ -0,0 +1,23 @@
|
|
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
|
+
gem install bundler --conservative
|
11
|
+
bundle check || bundle install
|
12
|
+
|
13
|
+
# Set up configurable environment variables
|
14
|
+
if [ ! -f config/application.yml ]; then
|
15
|
+
cp config/application.yml.sample config/application.yml
|
16
|
+
fi
|
17
|
+
|
18
|
+
# Set up database and add any development seed data
|
19
|
+
bundle exec rake db:setup dev:prime
|
20
|
+
|
21
|
+
# Only if this isn't CI
|
22
|
+
# if [ -z "$CI" ]; then
|
23
|
+
# fi
|
@@ -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
|
@@ -0,0 +1 @@
|
|
1
|
+
ActiveSupport::JSON::Encoding.time_precision = 0
|
@@ -0,0 +1 @@
|
|
1
|
+
Rack::Timeout.timeout = (ENV["RACK_TIMEOUT"] || 10).to_i
|
@@ -0,0 +1,30 @@
|
|
1
|
+
common: &default_settings
|
2
|
+
app_name: "<%%= ENV.fetch("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
|
@@ -0,0 +1,9 @@
|
|
1
|
+
SMTP_SETTINGS = {
|
2
|
+
address: ENV.fetch("SMTP_ADDRESS"), # example: "smtp.sendgrid.net"
|
3
|
+
authentication: :plain,
|
4
|
+
domain: ENV.fetch("SMTP_DOMAIN"), # example: "heroku.com"
|
5
|
+
enable_starttls_auto: true,
|
6
|
+
password: ENV.fetch("SMTP_PASSWORD"),
|
7
|
+
port: "587",
|
8
|
+
user_name: ENV.fetch("SMTP_USERNAME")
|
9
|
+
}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
ENV["RAILS_ENV"] = "test"
|
2
|
+
|
3
|
+
require File.expand_path("../../config/environment", __FILE__)
|
4
|
+
|
5
|
+
require "rspec/rails"
|
6
|
+
require "shoulda/matchers"
|
7
|
+
|
8
|
+
Dir[Rails.root.join("spec/support/**/*.rb")].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!
|
23
|
+
Capybara.javascript_driver = :webkit
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require "webmock/rspec"
|
2
|
+
|
3
|
+
# http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
4
|
+
RSpec.configure do |config|
|
5
|
+
config.expect_with :rspec do |expectations|
|
6
|
+
expectations.syntax = :expect
|
7
|
+
end
|
8
|
+
|
9
|
+
config.mock_with :rspec do |mocks|
|
10
|
+
mocks.syntax = :expect
|
11
|
+
mocks.verify_partial_doubles = true
|
12
|
+
end
|
13
|
+
|
14
|
+
config.order = :random
|
15
|
+
end
|
16
|
+
|
17
|
+
WebMock.disable_net_connect!(allow_localhost: true)
|
@@ -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? || 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,12 @@
|
|
1
|
+
if Rails.env.development? || Rails.env.test?
|
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
|
@@ -0,0 +1,7 @@
|
|
1
|
+
<% if ENV.key?("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,6 @@
|
|
1
|
+
<% flash.each do |name, msg| %>
|
2
|
+
<div class="alert alert-<%= name == "notice" ? "success" : "danger" %>">
|
3
|
+
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
4
|
+
<%= content_tag :div, msg, :id => "flash_#{name}" %>
|
5
|
+
</div>
|
6
|
+
<% end %>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<div id="footer">
|
2
|
+
<div class="container">
|
3
|
+
|
4
|
+
<div class="row footer-first-row">
|
5
|
+
|
6
|
+
<div class="col-xs-12 text-center">
|
7
|
+
<p><small>
|
8
|
+
© <%= Time.now.year %> - Yourself!
|
9
|
+
<br/>
|
10
|
+
Assembled with <%= link_to "Yupi", "https://github.com/Anadea/yupi" %>
|
11
|
+
</small></p>
|
12
|
+
</div>
|
13
|
+
|
14
|
+
</div>
|
15
|
+
|
16
|
+
</div>
|
17
|
+
</div>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<nav class="navbar navbar-default">
|
2
|
+
<div class="container">
|
3
|
+
<div class="navbar-header">
|
4
|
+
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
|
5
|
+
<span class="sr-only">Toggle navigation</span>
|
6
|
+
<span class="icon-bar"></span>
|
7
|
+
<span class="icon-bar"></span>
|
8
|
+
<span class="icon-bar"></span>
|
9
|
+
</button>
|
10
|
+
<%= link_to 'Home', root_path, class: 'navbar-brand' %>
|
11
|
+
</div>
|
12
|
+
<div class="collapse navbar-collapse">
|
13
|
+
<ul class="nav navbar-nav">
|
14
|
+
<%= render 'navigation_links' %>
|
15
|
+
</ul>
|
16
|
+
</div>
|
17
|
+
</div>
|
18
|
+
</nav>
|
@@ -0,0 +1,43 @@
|
|
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
|
+
<%%#
|
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
|
+
|
17
|
+
<body>
|
18
|
+
<div id="wrap">
|
19
|
+
<header>
|
20
|
+
<%%= render 'navigation' %>
|
21
|
+
</header>
|
22
|
+
|
23
|
+
<div class="container">
|
24
|
+
|
25
|
+
<div class="row">
|
26
|
+
<div class="col-sm-6 col-sm-offset-3 text-center">
|
27
|
+
<%%= render 'flashes' %>
|
28
|
+
</div>
|
29
|
+
</div>
|
30
|
+
|
31
|
+
<div class="row">
|
32
|
+
<div class="col-sm-12">
|
33
|
+
<%%= yield %>
|
34
|
+
</div>
|
35
|
+
</div>
|
36
|
+
|
37
|
+
</div>
|
38
|
+
</div>
|
39
|
+
|
40
|
+
<%%= render 'footer' %>
|
41
|
+
<%%= render 'javascript' %>
|
42
|
+
</body>
|
43
|
+
</html>
|