anadea-spark 0.2.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 +5 -0
- data/.ruby-version +1 -0
- data/.travis.yml +11 -0
- data/CONTRIBUTING.md +32 -0
- data/Gemfile +3 -0
- data/LICENSE +21 -0
- data/NEWS.md +8 -0
- data/README.md +154 -0
- data/Rakefile +11 -0
- data/anadea-spark.gemspec +35 -0
- data/bin/rake +16 -0
- data/bin/rspec +16 -0
- data/bin/setup +9 -0
- data/bin/spark +13 -0
- data/lib/spark.rb +4 -0
- data/lib/spark/actions.rb +33 -0
- data/lib/spark/app_builder.rb +373 -0
- data/lib/spark/generators/app_generator.rb +204 -0
- data/lib/spark/version.rb +5 -0
- data/spec/features/new_project_spec.rb +136 -0
- data/spec/spec_helper.rb +34 -0
- data/spec/support/spark.rb +51 -0
- data/templates/Gemfile.erb +53 -0
- data/templates/Procfile +2 -0
- data/templates/README.md.erb +14 -0
- data/templates/assets/application.css.scss +4 -0
- data/templates/assets/application.js +3 -0
- data/templates/bin/setup.erb +30 -0
- data/templates/config/application.yml.sample +3 -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/exception_notification.rb.erb +8 -0
- data/templates/config/initializers/json_encoding.rb +1 -0
- data/templates/config/initializers/mail_interceptor.rb +4 -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/dot_gitignore +15 -0
- data/templates/spec/rails_helper.rb +23 -0
- data/templates/spec/spec_helper.rb +32 -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.haml +11 -0
- data/templates/views/application/_flashes.html.haml +4 -0
- data/templates/views/application/_footer.html.haml +9 -0
- data/templates/views/application/_javascript.html.haml +8 -0
- data/templates/views/application/_navigation.html.haml +12 -0
- data/templates/views/application/_navigation_links.html.haml +2 -0
- data/templates/views/layouts/application.html.haml +23 -0
- data/templates/views/pages/home.html.haml +4 -0
- metadata +178 -0
data/templates/Procfile
ADDED
@@ -0,0 +1,14 @@
|
|
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.
|
11
|
+
|
12
|
+
After setting up, you can run the application using foreman or via regular:
|
13
|
+
|
14
|
+
% bin/rails s
|
@@ -0,0 +1,30 @@
|
|
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
|
+
# Get mailcatcher up and running
|
22
|
+
gem list -i mailcatcher || gem install mailcatcher --no-ri --no-rdoc
|
23
|
+
nc -z localhost 1025 || mailcatcher
|
24
|
+
|
25
|
+
# Install foreman
|
26
|
+
gem list -i foreman || gem install foreman --no-ri --no-rdoc
|
27
|
+
|
28
|
+
# Only if this isn't CI
|
29
|
+
# if [ -z "$CI" ]; then
|
30
|
+
# 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,8 @@
|
|
1
|
+
if ENV.key?("MAIL_ERRORS_TO")
|
2
|
+
Whatever::Application.config.middleware.use ExceptionNotification::Rack,
|
3
|
+
email: {
|
4
|
+
email_prefix: "[<%= app_name %> Error] ",
|
5
|
+
sender_address: ENV["MAIL_FROM"],
|
6
|
+
exception_recipients: ENV["MAIL_ERRORS_TO"].to_s.split(",")
|
7
|
+
}
|
8
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
ActiveSupport::JSON::Encoding.time_precision = 0
|
@@ -0,0 +1 @@
|
|
1
|
+
Rack::Timeout.timeout = ENV["RACK_TIMEOUT"].to_i if ENV.key?("RACK_TIMEOUT")
|
@@ -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,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 = :poltergeist
|
@@ -0,0 +1,32 @@
|
|
1
|
+
if ENV.fetch("COVERAGE", false)
|
2
|
+
require "simplecov"
|
3
|
+
SimpleCov.start "rails"
|
4
|
+
end
|
5
|
+
|
6
|
+
require "webmock/rspec"
|
7
|
+
|
8
|
+
# http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
9
|
+
RSpec.configure do |config|
|
10
|
+
config.expect_with :rspec do |expectations|
|
11
|
+
expectations.syntax = :expect
|
12
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
13
|
+
end
|
14
|
+
|
15
|
+
config.mock_with :rspec do |mocks|
|
16
|
+
mocks.syntax = :expect
|
17
|
+
mocks.verify_partial_doubles = true
|
18
|
+
end
|
19
|
+
|
20
|
+
config.filter_run :focus
|
21
|
+
config.run_all_when_everything_filtered = true
|
22
|
+
|
23
|
+
if config.files_to_run.one?
|
24
|
+
config.default_formatter = 'doc'
|
25
|
+
end
|
26
|
+
|
27
|
+
config.order = :random
|
28
|
+
|
29
|
+
Kernel.srand config.seed
|
30
|
+
end
|
31
|
+
|
32
|
+
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,11 @@
|
|
1
|
+
- if ENV.key?("GOOGLE_ANALYTICS_KEY")
|
2
|
+
:javascript
|
3
|
+
var _gaq = _gaq || [];
|
4
|
+
_gaq.push(['_setAccount', '#{ENV["GOOGLE_ANALYTICS_KEY"]}']);
|
5
|
+
_gaq.push(['_trackPageview']);
|
6
|
+
|
7
|
+
(function() {
|
8
|
+
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
9
|
+
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
10
|
+
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
11
|
+
})();
|
@@ -0,0 +1,12 @@
|
|
1
|
+
%nav.navbar.navbar-default
|
2
|
+
.container
|
3
|
+
.navbar-header
|
4
|
+
%button.navbar-toggle{"data-target" => ".navbar-collapse", "data-toggle" => "collapse", :type => "button"}
|
5
|
+
%span.sr-only Toggle navigation
|
6
|
+
%span.icon-bar
|
7
|
+
%span.icon-bar
|
8
|
+
%span.icon-bar
|
9
|
+
= link_to 'Home', root_path, class: 'navbar-brand'
|
10
|
+
.collapse.navbar-collapse
|
11
|
+
%ul.nav.navbar-nav
|
12
|
+
= render 'navigation_links'
|
@@ -0,0 +1,23 @@
|
|
1
|
+
!!!
|
2
|
+
%html
|
3
|
+
%head
|
4
|
+
%meta{:content => "text/html; charset=UTF-8", "http-equiv" => "Content-Type"}/
|
5
|
+
%meta{:charset => "utf-8"}/
|
6
|
+
%meta{:content => "NOODP", :name => "ROBOTS"}/
|
7
|
+
%meta{:content => "initial-scale=1", :name => "viewport"}/
|
8
|
+
%title= title
|
9
|
+
= stylesheet_link_tag :application, media: "all"
|
10
|
+
= csrf_meta_tags
|
11
|
+
%body
|
12
|
+
#wrap
|
13
|
+
%header
|
14
|
+
= render 'navigation'
|
15
|
+
.container
|
16
|
+
.row
|
17
|
+
.col-sm-6.col-sm-offset-3.text-center
|
18
|
+
= render 'flashes'
|
19
|
+
.row
|
20
|
+
.col-sm-12
|
21
|
+
= yield
|
22
|
+
= render 'footer'
|
23
|
+
= render 'javascript'
|