chr 0.3.5 → 0.4.9
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 +4 -4
- data/.coveralls.yml +2 -0
- data/.gitignore +6 -1
- data/.ruby-version +1 -0
- data/.travis.yml +18 -0
- data/README.md +4 -0
- data/Rakefile +17 -2
- data/app/assets/javascripts/chr.coffee +13 -26
- data/app/assets/javascripts/chr/{core/chr.coffee → chr.coffee} +4 -1
- data/app/assets/javascripts/chr/{core/chr_router.coffee → chr_router.coffee} +0 -0
- data/app/assets/javascripts/chr/{core/item.coffee → item.coffee} +2 -1
- data/app/assets/javascripts/chr/{core/list.coffee → list.coffee} +1 -1
- data/app/assets/javascripts/chr/{core/list_config.coffee → list_config.coffee} +0 -0
- data/app/assets/javascripts/chr/{core/list_pagination.coffee → list_pagination.coffee} +15 -4
- data/app/assets/javascripts/chr/{core/list_reorder.coffee → list_reorder.coffee} +0 -0
- data/app/assets/javascripts/chr/{core/list_search.coffee → list_search.coffee} +1 -1
- data/app/assets/javascripts/chr/{core/module.coffee → module.coffee} +0 -0
- data/app/assets/javascripts/chr/{core/utils.coffee → utils.coffee} +0 -0
- data/app/assets/javascripts/chr/{core/view.coffee → view.coffee} +21 -9
- data/app/assets/javascripts/chr/{core/view_local-storage.coffee → view_local-storage.coffee} +0 -0
- data/app/assets/javascripts/{chr/store/array-store.coffee → stores/array.coffee} +0 -0
- data/app/assets/javascripts/{chr/store/object-store.coffee → stores/object.coffee} +0 -0
- data/app/assets/javascripts/{chr/store/rails-array-store.coffee → stores/rails-array.coffee} +0 -0
- data/app/assets/javascripts/{chr/store → stores}/rails-form-object-parser.coffee +4 -1
- data/app/assets/javascripts/{chr/store/rails-object-store.coffee → stores/rails-object.coffee} +0 -0
- data/app/assets/javascripts/{chr/store/rest-array-store.coffee → stores/rest-array.coffee} +5 -2
- data/app/assets/javascripts/{chr/store/rest-object-store.coffee → stores/rest-object.coffee} +0 -0
- data/app/assets/stylesheets/{_chr.scss → chr.scss} +2 -7
- data/app/assets/stylesheets/chr/{_icons.scss → icons.scss} +0 -0
- data/app/assets/stylesheets/chr/{_main.scss → main.scss} +10 -3
- data/app/assets/stylesheets/chr/{_mixins.scss → mixins.scss} +0 -77
- data/app/assets/stylesheets/chr/{_settings.scss → settings.scss} +1 -1
- data/bin/chr +13 -0
- data/bin/rake +16 -0
- data/bin/setup +13 -0
- data/chr.gemspec +41 -21
- data/docs/tests.md +64 -0
- data/lib/chr.rb +10 -2
- data/lib/chr/app_builder.rb +385 -0
- data/lib/chr/generators/app_generator.rb +213 -0
- data/lib/chr/version.rb +3 -1
- data/lib/generators/chr/controller_generator.rb +18 -0
- data/templates/Gemfile.erb +38 -0
- data/templates/Procfile +1 -0
- data/templates/README.md.erb +45 -0
- data/templates/_analytics.html.erb +9 -0
- data/templates/_flashes.html.erb +7 -0
- data/templates/_javascript.html.erb +12 -0
- data/templates/application.coffee +2 -0
- data/templates/application.scss +1 -0
- data/templates/application.yml +6 -0
- data/templates/application_gitignore +14 -0
- data/templates/application_layout.html.erb.erb +29 -0
- data/templates/asset_sync.rb +28 -0
- data/templates/bin_setup.erb +36 -0
- data/templates/body_class_helper.rb +19 -0
- data/templates/bundler_audit.rake +12 -0
- data/templates/carrierwave.rb +23 -0
- data/templates/character_admin.coffee.erb +28 -0
- data/templates/character_admin.scss +3 -0
- data/templates/character_admin_index.html.erb +2 -0
- data/templates/character_admin_layout.html.erb +21 -0
- data/templates/character_base_controller.rb +16 -0
- data/templates/development_seeds.rb +12 -0
- data/templates/devise_overrides_passwords_controller.rb +10 -0
- data/templates/devise_overrides_passwords_edit.html.erb +30 -0
- data/templates/devise_overrides_passwords_new.html.erb +21 -0
- data/templates/devise_overrides_sessions_controller.rb +12 -0
- data/templates/devise_overrides_sessions_new.html.erb +31 -0
- data/templates/errors.rb +34 -0
- data/templates/json_encoding.rb +1 -0
- data/templates/newrelic.yml.erb +34 -0
- data/templates/puma.rb +18 -0
- data/templates/routes.rb +90 -0
- data/templates/sample.env +6 -0
- data/templates/secrets.yml +14 -0
- data/templates/smtp.rb +9 -0
- data/templates/staging.rb +5 -0
- data/test/factories/article_factory.rb +19 -0
- data/test/files/test.jpg +0 -0
- data/test/integration/article_fullsize_test.rb +33 -0
- data/test/integration/article_test.rb +33 -0
- data/test/integration/magazine_article_test.rb +33 -0
- data/test/integration/restricted_article_test.rb +33 -0
- data/test/integration/sport_article_test.rb +34 -0
- data/test/rails_app/Rakefile +6 -0
- data/test/rails_app/app/assets/javascripts/admin.coffee +137 -0
- data/test/rails_app/app/assets/javascripts/application.js +1 -0
- data/test/rails_app/app/assets/stylesheets/admin.scss +1 -0
- data/test/rails_app/app/assets/stylesheets/application.css +1 -0
- data/test/rails_app/app/controllers/admin/articles_controller.rb +7 -0
- data/test/rails_app/app/controllers/admin/base_controller.rb +8 -0
- data/test/rails_app/app/controllers/application_controller.rb +5 -0
- data/test/rails_app/app/helpers/application_helper.rb +2 -0
- data/test/rails_app/app/models/article.rb +46 -0
- data/test/rails_app/app/uploaders/article_image_uploader.rb +16 -0
- data/test/rails_app/app/views/admin/index.html.erb +4 -0
- data/test/rails_app/app/views/layouts/admin.html.erb +17 -0
- data/test/rails_app/app/views/layouts/application.html.erb +14 -0
- data/test/rails_app/bin/bundle +3 -0
- data/test/rails_app/bin/rails +8 -0
- data/test/rails_app/bin/rake +8 -0
- data/test/rails_app/bin/setup +29 -0
- data/test/rails_app/bin/spring +15 -0
- data/test/rails_app/config.ru +4 -0
- data/test/rails_app/config/application.rb +36 -0
- data/test/rails_app/config/boot.rb +3 -0
- data/test/rails_app/config/environment.rb +5 -0
- data/test/rails_app/config/environments/development.rb +38 -0
- data/test/rails_app/config/environments/production.rb +76 -0
- data/test/rails_app/config/environments/test.rb +46 -0
- data/test/rails_app/config/initializers/assets.rb +12 -0
- data/test/rails_app/config/initializers/backtrace_silencers.rb +7 -0
- data/test/rails_app/config/initializers/carrierwave.rb +5 -0
- data/test/rails_app/config/initializers/cookies_serializer.rb +3 -0
- data/test/rails_app/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/rails_app/config/initializers/inflections.rb +16 -0
- data/test/rails_app/config/initializers/mime_types.rb +4 -0
- data/test/rails_app/config/initializers/session_store.rb +3 -0
- data/test/rails_app/config/initializers/wrap_parameters.rb +9 -0
- data/test/rails_app/config/locales/en.yml +23 -0
- data/test/rails_app/config/mongoid.yml +9 -0
- data/test/rails_app/config/routes.rb +8 -0
- data/test/rails_app/config/secrets.yml +22 -0
- data/test/rails_app/db/seeds.rb +7 -0
- data/test/rails_app/public/404.html +67 -0
- data/test/rails_app/public/422.html +67 -0
- data/test/rails_app/public/500.html +66 -0
- data/{app/assets/javascripts/form/input-date.coffee → test/rails_app/public/favicon.ico} +0 -0
- data/test/rails_app/public/robots.txt +5 -0
- data/test/support/character_front_end.rb +196 -0
- data/test/support/chr/item.rb +32 -0
- data/test/support/chr/list.rb +31 -0
- data/test/support/chr/list_pagination.rb +163 -0
- data/test/support/chr/list_reorder.rb +46 -0
- data/test/support/chr/list_search.rb +41 -0
- data/test/support/chr/view.rb +112 -0
- data/test/support/stores/array.rb +20 -0
- data/test/support/stores/rest-array.rb +34 -0
- data/test/test_helper.rb +68 -0
- metadata +373 -80
- data/Gruntfile.coffee +0 -101
- data/app/assets/javascripts/form/expandable-group.coffee +0 -30
- data/app/assets/javascripts/form/form.coffee +0 -221
- data/app/assets/javascripts/form/input-checkbox.coffee +0 -83
- data/app/assets/javascripts/form/input-color.coffee +0 -55
- data/app/assets/javascripts/form/input-file.coffee +0 -144
- data/app/assets/javascripts/form/input-form.coffee +0 -171
- data/app/assets/javascripts/form/input-form_reorder.coffee +0 -67
- data/app/assets/javascripts/form/input-hidden.coffee +0 -57
- data/app/assets/javascripts/form/input-list.coffee +0 -154
- data/app/assets/javascripts/form/input-list_reorder.coffee +0 -39
- data/app/assets/javascripts/form/input-list_typeahead.coffee +0 -55
- data/app/assets/javascripts/form/input-password.coffee +0 -32
- data/app/assets/javascripts/form/input-select.coffee +0 -84
- data/app/assets/javascripts/form/input-select2.coffee +0 -33
- data/app/assets/javascripts/form/input-string.coffee +0 -160
- data/app/assets/javascripts/form/input-text.coffee +0 -43
- data/app/assets/javascripts/input-html.coffee +0 -81
- data/app/assets/javascripts/input-markdown.coffee +0 -93
- data/app/assets/javascripts/input-redactor.coffee +0 -1
- data/app/assets/javascripts/redactor/input-redactor.coffee +0 -53
- data/app/assets/javascripts/redactor/input-redactor_character.coffee +0 -83
- data/app/assets/javascripts/redactor/input-redactor_images.coffee +0 -166
- data/app/assets/javascripts/vendor/ace.js +0 -18280
- data/app/assets/javascripts/vendor/jquery.scrollparent.js +0 -14
- data/app/assets/javascripts/vendor/jquery.textarea_autosize.js +0 -55
- data/app/assets/javascripts/vendor/jquery.typeahead.js +0 -1782
- data/app/assets/javascripts/vendor/marked.js +0 -1272
- data/app/assets/javascripts/vendor/mode-html.js +0 -2436
- data/app/assets/javascripts/vendor/mode-markdown.js +0 -2820
- data/app/assets/javascripts/vendor/redactor.fixedtoolbar.js +0 -107
- data/app/assets/javascripts/vendor/select2.js +0 -5274
- data/app/assets/stylesheets/_input-redactor.scss +0 -35
- data/app/assets/stylesheets/form/_expandable-group.scss +0 -16
- data/app/assets/stylesheets/form/_input-select2.scss +0 -94
- data/app/assets/stylesheets/form/_main.scss +0 -180
- data/app/assets/stylesheets/vendor/select2.css +0 -258
- data/bower.json +0 -38
- data/dist/chr.js +0 -5949
- data/dist/input-ace.js +0 -24946
- data/dist/input-redactor.js +0 -1
- data/lib/mongoid/character.rb +0 -30
- data/package.json +0 -10
|
@@ -0,0 +1,36 @@
|
|
|
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 .env ]; then
|
|
15
|
+
cp .sample.env .env
|
|
16
|
+
fi
|
|
17
|
+
|
|
18
|
+
# Set up database and add any development seed data
|
|
19
|
+
bundle exec rake db:setup 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 --quiet --no-messages --fixed-strings 'port' .foreman; then
|
|
26
|
+
printf 'port: <%= config[:port_number] %>\n' >> .foreman
|
|
27
|
+
fi
|
|
28
|
+
|
|
29
|
+
if ! command -v foreman > /dev/null; then
|
|
30
|
+
printf 'Foreman is not installed.\n'
|
|
31
|
+
printf 'See https://github.com/ddollar/foreman for install instructions.\n'
|
|
32
|
+
fi
|
|
33
|
+
|
|
34
|
+
# Only if this isn't CI
|
|
35
|
+
# if [ -z "$CI" ]; then
|
|
36
|
+
# fi
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Body class helper striped our from:
|
|
2
|
+
# https://github.com/thoughtbot/flutie/blob/master/lib/flutie/body_class_helper.rb
|
|
3
|
+
module BodyClassHelper
|
|
4
|
+
def body_class(options = {})
|
|
5
|
+
extra_body_classes_symbol = options[:extra_body_classes_symbol] || :extra_body_classes
|
|
6
|
+
qualified_controller_name = controller.controller_path.gsub('/','-')
|
|
7
|
+
basic_body_class = "#{qualified_controller_name} #{qualified_controller_name}-#{controller.action_name}"
|
|
8
|
+
|
|
9
|
+
if content_for?(extra_body_classes_symbol)
|
|
10
|
+
[basic_body_class, content_for(extra_body_classes_symbol)].join(' ')
|
|
11
|
+
else
|
|
12
|
+
basic_body_class
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
@@ -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,23 @@
|
|
|
1
|
+
CarrierWave.configure do |config|
|
|
2
|
+
|
|
3
|
+
# DEVELOPMENT
|
|
4
|
+
config.storage = :file
|
|
5
|
+
config.cache_dir = "#{Rails.root}/public/uploads/tmp"
|
|
6
|
+
|
|
7
|
+
if Rails.env.test?
|
|
8
|
+
# TEST
|
|
9
|
+
config.cache_dir = "#{Rails.root}/public/uploads/tmp/test"
|
|
10
|
+
config.enable_processing = false
|
|
11
|
+
|
|
12
|
+
elsif Rails.env.production? || Rails.env.staging?
|
|
13
|
+
# PRODUCTION & STAGING
|
|
14
|
+
config.storage = :fog
|
|
15
|
+
config.fog_directory = ENV.fetch('FOG_DIRECTORY')
|
|
16
|
+
config.fog_credentials = {
|
|
17
|
+
provider: 'AWS',
|
|
18
|
+
aws_access_key_id: ENV.fetch('AWS_ACCESS_KEY_ID'),
|
|
19
|
+
aws_secret_access_key: ENV.fetch('AWS_SECRET_ACCESS_KEY'),
|
|
20
|
+
}
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#= require jquery
|
|
2
|
+
#= require jquery_ujs
|
|
3
|
+
|
|
4
|
+
#= require chr
|
|
5
|
+
#= require loft
|
|
6
|
+
#= require ants
|
|
7
|
+
|
|
8
|
+
@settingsConfig = ->
|
|
9
|
+
items:
|
|
10
|
+
admins: Ants.adminsConfig()
|
|
11
|
+
redirects: Ants.redirectsConfig()
|
|
12
|
+
|
|
13
|
+
@getChrConfig = (data) ->
|
|
14
|
+
modules = {}
|
|
15
|
+
all_modules =
|
|
16
|
+
loft: new Loft('Files', 'asset', '/admin/assets')
|
|
17
|
+
settings: settingsConfig()
|
|
18
|
+
|
|
19
|
+
return { modules: all_modules }
|
|
20
|
+
|
|
21
|
+
$ ->
|
|
22
|
+
$.get '/admin/bootstrap.json', (response) ->
|
|
23
|
+
chrConfig = getChrConfig(response)
|
|
24
|
+
|
|
25
|
+
chr.start('<%= app_name %>', chrConfig)
|
|
26
|
+
|
|
27
|
+
# append signout button to the end of sidebar menu
|
|
28
|
+
$('a[data-method=delete]').appendTo(".sidebar .menu").show()
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="ROBOTS" content="NOINDEX, NOFOLLOW">
|
|
6
|
+
|
|
7
|
+
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
|
|
8
|
+
<meta name="apple-mobile-web-app-capable" content="yes">
|
|
9
|
+
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
|
|
10
|
+
|
|
11
|
+
<%= display_meta_tags site: 'hello-world', title: 'CMS' %>
|
|
12
|
+
|
|
13
|
+
<%= csrf_meta_tags %>
|
|
14
|
+
<%= stylesheet_link_tag :admin, media: 'all' %>
|
|
15
|
+
</head>
|
|
16
|
+
|
|
17
|
+
<body class='<%= body_class %>'>
|
|
18
|
+
<%= yield %>
|
|
19
|
+
</body>
|
|
20
|
+
|
|
21
|
+
</html>
|
|
@@ -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
|
+
Admin.create!(name: 'Admin', email: 'user@example.com', password: 'password')
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<% set_meta_tags title: 'CMS — Change Password' %>
|
|
2
|
+
|
|
3
|
+
<p class="notice"><%= notice %></p>
|
|
4
|
+
<p class="alert"><%= alert %></p>
|
|
5
|
+
|
|
6
|
+
<h2>Change your password</h2>
|
|
7
|
+
|
|
8
|
+
<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %>
|
|
9
|
+
<%= devise_error_messages! %>
|
|
10
|
+
<%= f.hidden_field :reset_password_token %>
|
|
11
|
+
|
|
12
|
+
<div class="field">
|
|
13
|
+
<%= f.label :password, "New password" %><br />
|
|
14
|
+
<% if @minimum_password_length %>
|
|
15
|
+
<em>(<%= @minimum_password_length %> characters minimum)</em><br />
|
|
16
|
+
<% end %>
|
|
17
|
+
<%= f.password_field :password, autofocus: true, autocomplete: "off" %>
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
<div class="field">
|
|
21
|
+
<%= f.label :password_confirmation, "Confirm new password" %><br />
|
|
22
|
+
<%= f.password_field :password_confirmation, autocomplete: "off" %>
|
|
23
|
+
</div>
|
|
24
|
+
|
|
25
|
+
<div class="actions">
|
|
26
|
+
<%= f.submit "Change my password" %>
|
|
27
|
+
</div>
|
|
28
|
+
<% end %>
|
|
29
|
+
|
|
30
|
+
<%= link_to 'Sign In', new_session_path(resource_name) %>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<% set_meta_tags title: 'CMS — Reset Password' %>
|
|
2
|
+
|
|
3
|
+
<p class="notice"><%= notice %></p>
|
|
4
|
+
<p class="alert"><%= alert %></p>
|
|
5
|
+
|
|
6
|
+
<h2>Forgot your password?</h2>
|
|
7
|
+
|
|
8
|
+
<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %>
|
|
9
|
+
<%= devise_error_messages! %>
|
|
10
|
+
|
|
11
|
+
<div class="field">
|
|
12
|
+
<%= f.label :email %><br />
|
|
13
|
+
<%= f.email_field :email, autofocus: true %>
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
<div class="actions">
|
|
17
|
+
<%= f.submit "Send me reset password instructions" %>
|
|
18
|
+
</div>
|
|
19
|
+
<% end %>
|
|
20
|
+
|
|
21
|
+
<%= link_to 'Sign In', new_session_path(resource_name) %>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<% set_meta_tags title: 'CMS — Login' %>
|
|
2
|
+
|
|
3
|
+
<p class="notice"><%= notice %></p>
|
|
4
|
+
<p class="alert"><%= alert %></p>
|
|
5
|
+
|
|
6
|
+
<h2>Log in</h2>
|
|
7
|
+
|
|
8
|
+
<%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
|
|
9
|
+
<div class="field">
|
|
10
|
+
<%= f.label :email %><br />
|
|
11
|
+
<%= f.email_field :email, autofocus: true %>
|
|
12
|
+
</div>
|
|
13
|
+
|
|
14
|
+
<div class="field">
|
|
15
|
+
<%= f.label :password %><br />
|
|
16
|
+
<%= f.password_field :password, autocomplete: "off" %>
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
<% if devise_mapping.rememberable? -%>
|
|
20
|
+
<div class="field">
|
|
21
|
+
<%= f.check_box :remember_me %>
|
|
22
|
+
<%= f.label :remember_me %>
|
|
23
|
+
</div>
|
|
24
|
+
<% end -%>
|
|
25
|
+
|
|
26
|
+
<div class="actions">
|
|
27
|
+
<%= f.submit "Log in" %>
|
|
28
|
+
</div>
|
|
29
|
+
<% end %>
|
|
30
|
+
|
|
31
|
+
<%= link_to 'Forgot your password?', new_password_path(resource_name) %>
|
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
|
|
@@ -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
|
data/templates/puma.rb
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
workers Integer(ENV.fetch("WEB_CONCURRENCY", 3))
|
|
7
|
+
threads_count = Integer(ENV.fetch("MAX_THREADS", 5))
|
|
8
|
+
threads(threads_count, threads_count)
|
|
9
|
+
|
|
10
|
+
preload_app!
|
|
11
|
+
|
|
12
|
+
rackup DefaultRackup
|
|
13
|
+
environment ENV.fetch("RACK_ENV", "development")
|
|
14
|
+
|
|
15
|
+
on_worker_boot do
|
|
16
|
+
# Worker specific setup for Rails 4.1+
|
|
17
|
+
# See: https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server#on-worker-boot
|
|
18
|
+
end
|
data/templates/routes.rb
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
Rails.application.routes.draw do
|
|
2
|
+
#-------------------------------------------#
|
|
3
|
+
# App Routes
|
|
4
|
+
#-------------------------------------------#
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
#-------------------------------------------#
|
|
8
|
+
# Admin
|
|
9
|
+
#-------------------------------------------#
|
|
10
|
+
devise_for :admins,
|
|
11
|
+
path: 'admin',
|
|
12
|
+
controllers: {
|
|
13
|
+
passwords: 'admin/devise_overrides/passwords',
|
|
14
|
+
sessions: 'admin/devise_overrides/sessions'
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
namespace :admin do
|
|
18
|
+
get '/' => 'base#index'
|
|
19
|
+
get '/bootstrap.json' => 'base#bootstrap_data'
|
|
20
|
+
|
|
21
|
+
# files
|
|
22
|
+
resources :assets, controller: 'assets' # Loft::Asset
|
|
23
|
+
|
|
24
|
+
# settings
|
|
25
|
+
resources :admins, controller: 'admins' # Ants::Admin
|
|
26
|
+
resources :redirects, controller: 'redirects' # Ants::Redirect
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
#-------------------------------------------#
|
|
31
|
+
# Redirects, ideally this should go last
|
|
32
|
+
#-------------------------------------------#
|
|
33
|
+
get "/*id" => 'redirects#show', :constraints => Constraints::Redirects
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
# The priority is based upon order of creation: first created -> highest priority.
|
|
37
|
+
# See how all your routes lay out with "rake routes".
|
|
38
|
+
|
|
39
|
+
# You can have the root of your site routed with "root"
|
|
40
|
+
# root 'welcome#index'
|
|
41
|
+
|
|
42
|
+
# Example of regular route:
|
|
43
|
+
# get 'products/:id' => 'catalog#view'
|
|
44
|
+
|
|
45
|
+
# Example of named route that can be invoked with purchase_url(id: product.id)
|
|
46
|
+
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
|
|
47
|
+
|
|
48
|
+
# Example resource route (maps HTTP verbs to controller actions automatically):
|
|
49
|
+
# resources :products
|
|
50
|
+
|
|
51
|
+
# Example resource route with options:
|
|
52
|
+
# resources :products do
|
|
53
|
+
# member do
|
|
54
|
+
# get 'short'
|
|
55
|
+
# post 'toggle'
|
|
56
|
+
# end
|
|
57
|
+
#
|
|
58
|
+
# collection do
|
|
59
|
+
# get 'sold'
|
|
60
|
+
# end
|
|
61
|
+
# end
|
|
62
|
+
|
|
63
|
+
# Example resource route with sub-resources:
|
|
64
|
+
# resources :products do
|
|
65
|
+
# resources :comments, :sales
|
|
66
|
+
# resource :seller
|
|
67
|
+
# end
|
|
68
|
+
|
|
69
|
+
# Example resource route with more complex sub-resources:
|
|
70
|
+
# resources :products do
|
|
71
|
+
# resources :comments
|
|
72
|
+
# resources :sales do
|
|
73
|
+
# get 'recent', on: :collection
|
|
74
|
+
# end
|
|
75
|
+
# end
|
|
76
|
+
|
|
77
|
+
# Example resource route with concerns:
|
|
78
|
+
# concern :toggleable do
|
|
79
|
+
# post 'toggle'
|
|
80
|
+
# end
|
|
81
|
+
# resources :posts, concerns: :toggleable
|
|
82
|
+
# resources :photos, concerns: :toggleable
|
|
83
|
+
|
|
84
|
+
# Example resource route within a namespace:
|
|
85
|
+
# namespace :admin do
|
|
86
|
+
# # Directs /admin/products/* to Admin::ProductsController
|
|
87
|
+
# # (app/controllers/admin/products_controller.rb)
|
|
88
|
+
# resources :products
|
|
89
|
+
# end
|
|
90
|
+
end
|