sapience 1.0.11 → 1.0.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/sapience/extensions/grape/middleware/logging.rb +4 -11
- data/lib/sapience/extensions/grape/notifications.rb +4 -1
- data/lib/sapience/extensions/grape/request_format_helper.rb +12 -0
- data/lib/sapience/version.rb +1 -1
- data/sapience.gemspec +1 -1
- metadata +3 -115
- data/test_apps/grape/.gitignore +0 -41
- data/test_apps/grape/.rspec +0 -1
- data/test_apps/grape/.simplecov +0 -25
- data/test_apps/grape/Appraisals +0 -9
- data/test_apps/grape/Gemfile +0 -31
- data/test_apps/grape/Rakefile +0 -8
- data/test_apps/grape/config.ru +0 -5
- data/test_apps/grape/gemfiles/grape_0.16.2.gemfile +0 -26
- data/test_apps/grape/gemfiles/grape_0.16.2.gemfile.lock +0 -140
- data/test_apps/grape/gemfiles/grape_0.17.0.gemfile +0 -25
- data/test_apps/grape/gemfiles/grape_0.17.0.gemfile.lock +0 -138
- data/test_apps/grape/lib/ping/api.rb +0 -21
- data/test_apps/grape/lib/ping.rb +0 -3
- data/test_apps/grape/spec/lib/ping/api_spec.rb +0 -81
- data/test_apps/grape/spec/spec_helper.rb +0 -26
- data/test_apps/rails/.gitignore +0 -37
- data/test_apps/rails/.rspec +0 -1
- data/test_apps/rails/.ruby-version +0 -1
- data/test_apps/rails/.simplecov +0 -25
- data/test_apps/rails/Gemfile +0 -48
- data/test_apps/rails/README.md +0 -24
- data/test_apps/rails/Rakefile +0 -12
- data/test_apps/rails/app/assets/config/manifest.js +0 -2
- data/test_apps/rails/app/assets/images/.keep +0 -0
- data/test_apps/rails/app/assets/javascripts/posts.js +0 -2
- data/test_apps/rails/app/assets/stylesheets/application.css +0 -15
- data/test_apps/rails/app/assets/stylesheets/posts.css +0 -4
- data/test_apps/rails/app/assets/stylesheets/scaffold.css +0 -84
- data/test_apps/rails/app/channels/application_cable/channel.rb +0 -4
- data/test_apps/rails/app/channels/application_cable/connection.rb +0 -4
- data/test_apps/rails/app/controllers/application_controller.rb +0 -3
- data/test_apps/rails/app/controllers/concerns/.keep +0 -0
- data/test_apps/rails/app/controllers/posts_controller.rb +0 -59
- data/test_apps/rails/app/helpers/application_helper.rb +0 -2
- data/test_apps/rails/app/helpers/posts_helper.rb +0 -2
- data/test_apps/rails/app/jobs/application_job.rb +0 -2
- data/test_apps/rails/app/jobs/test_job.rb +0 -12
- data/test_apps/rails/app/mailers/application_mailer.rb +0 -4
- data/test_apps/rails/app/models/application_record.rb +0 -3
- data/test_apps/rails/app/models/concerns/.keep +0 -0
- data/test_apps/rails/app/models/post.rb +0 -3
- data/test_apps/rails/app/models/user.rb +0 -3
- data/test_apps/rails/app/views/layouts/application.html.erb +0 -13
- data/test_apps/rails/app/views/layouts/mailer.html.erb +0 -13
- data/test_apps/rails/app/views/layouts/mailer.text.erb +0 -1
- data/test_apps/rails/app/views/posts/_form.html.slim +0 -18
- data/test_apps/rails/app/views/posts/edit.html.slim +0 -8
- data/test_apps/rails/app/views/posts/index.html.slim +0 -25
- data/test_apps/rails/app/views/posts/new.html.slim +0 -5
- data/test_apps/rails/app/views/posts/show.html.slim +0 -15
- data/test_apps/rails/app/workers/test_worker.rb +0 -17
- data/test_apps/rails/bin/bundle +0 -3
- data/test_apps/rails/bin/rails +0 -4
- data/test_apps/rails/bin/rake +0 -4
- data/test_apps/rails/bin/setup +0 -34
- data/test_apps/rails/bin/sneakers +0 -10
- data/test_apps/rails/bin/update +0 -29
- data/test_apps/rails/config/application.rb +0 -25
- data/test_apps/rails/config/boot.rb +0 -3
- data/test_apps/rails/config/cable.yml +0 -9
- data/test_apps/rails/config/database.yml +0 -24
- data/test_apps/rails/config/environment.rb +0 -5
- data/test_apps/rails/config/environments/development.rb +0 -49
- data/test_apps/rails/config/environments/production.rb +0 -78
- data/test_apps/rails/config/environments/test.rb +0 -42
- data/test_apps/rails/config/initializers/application_controller_renderer.rb +0 -6
- data/test_apps/rails/config/initializers/backtrace_silencers.rb +0 -7
- data/test_apps/rails/config/initializers/cookies_serializer.rb +0 -5
- data/test_apps/rails/config/initializers/filter_parameter_logging.rb +0 -4
- data/test_apps/rails/config/initializers/inflections.rb +0 -16
- data/test_apps/rails/config/initializers/mime_types.rb +0 -4
- data/test_apps/rails/config/initializers/new_framework_defaults.rb +0 -24
- data/test_apps/rails/config/initializers/session_store.rb +0 -3
- data/test_apps/rails/config/initializers/sneakers.rb +0 -14
- data/test_apps/rails/config/initializers/wrap_parameters.rb +0 -14
- data/test_apps/rails/config/locales/en.yml +0 -23
- data/test_apps/rails/config/puma.rb +0 -45
- data/test_apps/rails/config/routes.rb +0 -3
- data/test_apps/rails/config/sapience_example.yml +0 -24
- data/test_apps/rails/config/secrets.yml +0 -22
- data/test_apps/rails/config.ru +0 -5
- data/test_apps/rails/db/migrate/20160812092236_create_users.rb +0 -13
- data/test_apps/rails/db/migrate/20160902141445_create_posts.rb +0 -17
- data/test_apps/rails/db/schema.rb +0 -37
- data/test_apps/rails/db/seeds.rb +0 -7
- data/test_apps/rails/lib/assets/.keep +0 -0
- data/test_apps/rails/lib/external_sneaker.rb +0 -46
- data/test_apps/rails/lib/tasks/.keep +0 -0
- data/test_apps/rails/lib/tasks/sneakers.rake +0 -21
- data/test_apps/rails/public/404.html +0 -67
- data/test_apps/rails/public/422.html +0 -67
- data/test_apps/rails/public/500.html +0 -66
- data/test_apps/rails/public/apple-touch-icon-precomposed.png +0 -0
- data/test_apps/rails/public/apple-touch-icon.png +0 -0
- data/test_apps/rails/public/favicon.ico +0 -0
- data/test_apps/rails/public/robots.txt +0 -5
- data/test_apps/rails/spec/controllers/posts_controller_spec.rb +0 -7
- data/test_apps/rails/spec/factories/posts.rb +0 -7
- data/test_apps/rails/spec/factories/users.rb +0 -8
- data/test_apps/rails/spec/fixtures/sapience.yml +0 -15
- data/test_apps/rails/spec/integration/sapience_spec.rb +0 -14
- data/test_apps/rails/spec/jobs/test_job_spec.rb +0 -36
- data/test_apps/rails/spec/models/post_spec.rb +0 -14
- data/test_apps/rails/spec/rails_helper.rb +0 -45
- data/test_apps/rails/spec/requests/posts_spec.rb +0 -44
- data/test_apps/rails/spec/routing/posts_routing_spec.rb +0 -37
- data/test_apps/rails/spec/spec_helper.rb +0 -16
- data/test_apps/rails/spec/views/posts/edit.html.slim_spec.rb +0 -17
- data/test_apps/rails/spec/views/posts/index.html.slim_spec.rb +0 -17
- data/test_apps/rails/spec/views/posts/new.html.slim_spec.rb +0 -17
- data/test_apps/rails/spec/views/posts/show.html.slim_spec.rb +0 -14
- data/test_apps/rails/spec/workers/test_worker_spec.rb +0 -41
- data/test_apps/rails/vendor/assets/stylesheets/.keep +0 -0
@@ -1,24 +0,0 @@
|
|
1
|
-
---
|
2
|
-
default:
|
3
|
-
log_level: error
|
4
|
-
appenders:
|
5
|
-
- stream:
|
6
|
-
file_name: log/error.log
|
7
|
-
formatter: default
|
8
|
-
|
9
|
-
development:
|
10
|
-
log_level: debug
|
11
|
-
appenders:
|
12
|
-
- stream:
|
13
|
-
io: STDOUT
|
14
|
-
formatter: color
|
15
|
-
- stream:
|
16
|
-
file_name: log/development.log
|
17
|
-
formatter: color
|
18
|
-
|
19
|
-
test:
|
20
|
-
log_level: fatal
|
21
|
-
appenders:
|
22
|
-
- stream:
|
23
|
-
file_name: log/fatal.log
|
24
|
-
formatter: json
|
@@ -1,22 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
|
3
|
-
# Your secret key is used for verifying the integrity of signed cookies.
|
4
|
-
# If you change this key, all old signed cookies will become invalid!
|
5
|
-
|
6
|
-
# Make sure the secret is at least 30 characters and all random,
|
7
|
-
# no regular words or you'll be exposed to dictionary attacks.
|
8
|
-
# You can use `rails secret` to generate a secure secret key.
|
9
|
-
|
10
|
-
# Make sure the secrets in this file are kept private
|
11
|
-
# if you're sharing your code publicly.
|
12
|
-
|
13
|
-
development:
|
14
|
-
secret_key_base: 350b0c3f0d5a9b24d6ea55d960fae4bceb04dc2177cbf32aff5f373b2ee8d37f552e825a08887153d48508b4b075c35f221afa960bbdb7832da47dc3055e5d76
|
15
|
-
|
16
|
-
test:
|
17
|
-
secret_key_base: ccbb906568d5eac40cd110164eefab3b2983656db6475e91a1f04f673edd1e65c57d46a6e7a625f39510acf08864aafeae86e9e250422c414fc58be1bf1c441b
|
18
|
-
|
19
|
-
# Do not keep production secrets in the repository,
|
20
|
-
# instead read values from the environment.
|
21
|
-
production:
|
22
|
-
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
|
data/test_apps/rails/config.ru
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
class CreateUsers < ActiveRecord::Migration[5.0]
|
2
|
-
def change
|
3
|
-
create_table :users do |t|
|
4
|
-
t.string :username
|
5
|
-
t.string :email
|
6
|
-
|
7
|
-
t.timestamps
|
8
|
-
end
|
9
|
-
|
10
|
-
add_index :users, [:username], unique: true, name: :users_username_key
|
11
|
-
add_index :users, [:email], unique: true, name: :users_email_key
|
12
|
-
end
|
13
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
class CreatePosts < ActiveRecord::Migration[5.0]
|
2
|
-
def change
|
3
|
-
create_table :posts do |t|
|
4
|
-
t.string :title
|
5
|
-
t.string :body
|
6
|
-
t.belongs_to :author, foreign_key: {
|
7
|
-
to_table: :users,
|
8
|
-
column: :author_id,
|
9
|
-
name: :posts_author_fk,
|
10
|
-
on_delete: :cascade,
|
11
|
-
on_update: :restrict,
|
12
|
-
}
|
13
|
-
|
14
|
-
t.timestamps
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
# This file is auto-generated from the current state of the database. Instead
|
2
|
-
# of editing this file, please use the migrations feature of Active Record to
|
3
|
-
# incrementally modify your database, and then regenerate this schema definition.
|
4
|
-
#
|
5
|
-
# Note that this schema.rb definition is the authoritative source for your
|
6
|
-
# database schema. If you need to create the application database on another
|
7
|
-
# system, you should be using db:schema:load, not running all the migrations
|
8
|
-
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
9
|
-
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
10
|
-
#
|
11
|
-
# It's strongly recommended that you check this file into your version control system.
|
12
|
-
|
13
|
-
ActiveRecord::Schema.define(version: 20160902141445) do
|
14
|
-
|
15
|
-
# These are extensions that must be enabled in order to support this database
|
16
|
-
enable_extension "plpgsql"
|
17
|
-
|
18
|
-
create_table "posts", force: :cascade do |t|
|
19
|
-
t.string "title"
|
20
|
-
t.string "body"
|
21
|
-
t.integer "author_id"
|
22
|
-
t.datetime "created_at", null: false
|
23
|
-
t.datetime "updated_at", null: false
|
24
|
-
t.index ["author_id"], name: "index_posts_on_author_id", using: :btree
|
25
|
-
end
|
26
|
-
|
27
|
-
create_table "users", force: :cascade do |t|
|
28
|
-
t.string "username"
|
29
|
-
t.string "email"
|
30
|
-
t.datetime "created_at", null: false
|
31
|
-
t.datetime "updated_at", null: false
|
32
|
-
t.index ["email"], name: "users_email_key", unique: true, using: :btree
|
33
|
-
t.index ["username"], name: "users_username_key", unique: true, using: :btree
|
34
|
-
end
|
35
|
-
|
36
|
-
add_foreign_key "posts", "users", column: "author_id", name: "posts_author_fk", on_update: :restrict, on_delete: :cascade
|
37
|
-
end
|
data/test_apps/rails/db/seeds.rb
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
# This file should contain all the record creation needed to seed the database with its default values.
|
2
|
-
# The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup).
|
3
|
-
#
|
4
|
-
# Examples:
|
5
|
-
#
|
6
|
-
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
|
7
|
-
# Character.create(name: 'Luke', movie: movies.first)
|
File without changes
|
@@ -1,46 +0,0 @@
|
|
1
|
-
require "timeout"
|
2
|
-
|
3
|
-
class ExternalSneaker
|
4
|
-
attr_accessor :worker_pid, :start_command, :workers
|
5
|
-
|
6
|
-
def initialize(start_command, *workers)
|
7
|
-
fail ArgumentError, "start_command was expected" if start_command.nil?
|
8
|
-
self.workers = workers.map(&:to_s).join(",")
|
9
|
-
self.start_command = start_command
|
10
|
-
end
|
11
|
-
|
12
|
-
def start
|
13
|
-
puts "Trying to start #{start_command}..."
|
14
|
-
self.worker_pid = fork do
|
15
|
-
start_child
|
16
|
-
end
|
17
|
-
|
18
|
-
at_exit do
|
19
|
-
stop_child
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
private
|
24
|
-
|
25
|
-
def start_child
|
26
|
-
exec({ "RAILS_ENV" => Rails.env, "WORKERS" => workers }, start_command)
|
27
|
-
end
|
28
|
-
|
29
|
-
def stop_child # rubocop:disable AbcSize
|
30
|
-
puts "Trying to stop #{start_command}, pid: #{worker_pid}"
|
31
|
-
|
32
|
-
# send TERM and wait for exit
|
33
|
-
Process.kill("TERM", worker_pid)
|
34
|
-
|
35
|
-
begin
|
36
|
-
Timeout.timeout(10) do
|
37
|
-
Process.waitpid(worker_pid)
|
38
|
-
puts "Process #{start_command} stopped successfully"
|
39
|
-
end
|
40
|
-
rescue Timeout::Error
|
41
|
-
# Kill process if could not exit in 10 seconds
|
42
|
-
puts "Sending KILL signal to #{start_command}, pid: #{worker_pid}"
|
43
|
-
Process.kill("KILL", worker_pid)
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
File without changes
|
@@ -1,21 +0,0 @@
|
|
1
|
-
require "sneakers/runner"
|
2
|
-
|
3
|
-
task :environment
|
4
|
-
|
5
|
-
namespace :sneakers do
|
6
|
-
desc "Start processing jobs with all workers"
|
7
|
-
task work: :environment do
|
8
|
-
silence_warnings do
|
9
|
-
Rails.application.eager_load! unless Rails.application.config.eager_load
|
10
|
-
end
|
11
|
-
|
12
|
-
workers = ApplicationJob.subclasses.map do |klass|
|
13
|
-
klass.const_set("Wrapper", Class.new(ActiveJob::QueueAdapters::SneakersAdapter::JobWrapper) do
|
14
|
-
from_queue klass.queue_name
|
15
|
-
end)
|
16
|
-
end
|
17
|
-
|
18
|
-
|
19
|
-
Sneakers::Runner.new(workers).run
|
20
|
-
end
|
21
|
-
end
|
@@ -1,67 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>The page you were looking for doesn't exist (404)</title>
|
5
|
-
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
-
<style>
|
7
|
-
body {
|
8
|
-
background-color: #EFEFEF;
|
9
|
-
color: #2E2F30;
|
10
|
-
text-align: center;
|
11
|
-
font-family: arial, sans-serif;
|
12
|
-
margin: 0;
|
13
|
-
}
|
14
|
-
|
15
|
-
div.dialog {
|
16
|
-
width: 95%;
|
17
|
-
max-width: 33em;
|
18
|
-
margin: 4em auto 0;
|
19
|
-
}
|
20
|
-
|
21
|
-
div.dialog > div {
|
22
|
-
border: 1px solid #CCC;
|
23
|
-
border-right-color: #999;
|
24
|
-
border-left-color: #999;
|
25
|
-
border-bottom-color: #BBB;
|
26
|
-
border-top: #B00100 solid 4px;
|
27
|
-
border-top-left-radius: 9px;
|
28
|
-
border-top-right-radius: 9px;
|
29
|
-
background-color: white;
|
30
|
-
padding: 7px 12% 0;
|
31
|
-
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
32
|
-
}
|
33
|
-
|
34
|
-
h1 {
|
35
|
-
font-size: 100%;
|
36
|
-
color: #730E15;
|
37
|
-
line-height: 1.5em;
|
38
|
-
}
|
39
|
-
|
40
|
-
div.dialog > p {
|
41
|
-
margin: 0 0 1em;
|
42
|
-
padding: 1em;
|
43
|
-
background-color: #F7F7F7;
|
44
|
-
border: 1px solid #CCC;
|
45
|
-
border-right-color: #999;
|
46
|
-
border-left-color: #999;
|
47
|
-
border-bottom-color: #999;
|
48
|
-
border-bottom-left-radius: 4px;
|
49
|
-
border-bottom-right-radius: 4px;
|
50
|
-
border-top-color: #DADADA;
|
51
|
-
color: #666;
|
52
|
-
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
53
|
-
}
|
54
|
-
</style>
|
55
|
-
</head>
|
56
|
-
|
57
|
-
<body>
|
58
|
-
<!-- This file lives in public/404.html -->
|
59
|
-
<div class="dialog">
|
60
|
-
<div>
|
61
|
-
<h1>The page you were looking for doesn't exist.</h1>
|
62
|
-
<p>You may have mistyped the address or the page may have moved.</p>
|
63
|
-
</div>
|
64
|
-
<p>If you are the application owner check the logs for more information.</p>
|
65
|
-
</div>
|
66
|
-
</body>
|
67
|
-
</html>
|
@@ -1,67 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>The change you wanted was rejected (422)</title>
|
5
|
-
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
-
<style>
|
7
|
-
body {
|
8
|
-
background-color: #EFEFEF;
|
9
|
-
color: #2E2F30;
|
10
|
-
text-align: center;
|
11
|
-
font-family: arial, sans-serif;
|
12
|
-
margin: 0;
|
13
|
-
}
|
14
|
-
|
15
|
-
div.dialog {
|
16
|
-
width: 95%;
|
17
|
-
max-width: 33em;
|
18
|
-
margin: 4em auto 0;
|
19
|
-
}
|
20
|
-
|
21
|
-
div.dialog > div {
|
22
|
-
border: 1px solid #CCC;
|
23
|
-
border-right-color: #999;
|
24
|
-
border-left-color: #999;
|
25
|
-
border-bottom-color: #BBB;
|
26
|
-
border-top: #B00100 solid 4px;
|
27
|
-
border-top-left-radius: 9px;
|
28
|
-
border-top-right-radius: 9px;
|
29
|
-
background-color: white;
|
30
|
-
padding: 7px 12% 0;
|
31
|
-
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
32
|
-
}
|
33
|
-
|
34
|
-
h1 {
|
35
|
-
font-size: 100%;
|
36
|
-
color: #730E15;
|
37
|
-
line-height: 1.5em;
|
38
|
-
}
|
39
|
-
|
40
|
-
div.dialog > p {
|
41
|
-
margin: 0 0 1em;
|
42
|
-
padding: 1em;
|
43
|
-
background-color: #F7F7F7;
|
44
|
-
border: 1px solid #CCC;
|
45
|
-
border-right-color: #999;
|
46
|
-
border-left-color: #999;
|
47
|
-
border-bottom-color: #999;
|
48
|
-
border-bottom-left-radius: 4px;
|
49
|
-
border-bottom-right-radius: 4px;
|
50
|
-
border-top-color: #DADADA;
|
51
|
-
color: #666;
|
52
|
-
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
53
|
-
}
|
54
|
-
</style>
|
55
|
-
</head>
|
56
|
-
|
57
|
-
<body>
|
58
|
-
<!-- This file lives in public/422.html -->
|
59
|
-
<div class="dialog">
|
60
|
-
<div>
|
61
|
-
<h1>The change you wanted was rejected.</h1>
|
62
|
-
<p>Maybe you tried to change something you didn't have access to.</p>
|
63
|
-
</div>
|
64
|
-
<p>If you are the application owner check the logs for more information.</p>
|
65
|
-
</div>
|
66
|
-
</body>
|
67
|
-
</html>
|
@@ -1,66 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>We're sorry, but something went wrong (500)</title>
|
5
|
-
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
-
<style>
|
7
|
-
body {
|
8
|
-
background-color: #EFEFEF;
|
9
|
-
color: #2E2F30;
|
10
|
-
text-align: center;
|
11
|
-
font-family: arial, sans-serif;
|
12
|
-
margin: 0;
|
13
|
-
}
|
14
|
-
|
15
|
-
div.dialog {
|
16
|
-
width: 95%;
|
17
|
-
max-width: 33em;
|
18
|
-
margin: 4em auto 0;
|
19
|
-
}
|
20
|
-
|
21
|
-
div.dialog > div {
|
22
|
-
border: 1px solid #CCC;
|
23
|
-
border-right-color: #999;
|
24
|
-
border-left-color: #999;
|
25
|
-
border-bottom-color: #BBB;
|
26
|
-
border-top: #B00100 solid 4px;
|
27
|
-
border-top-left-radius: 9px;
|
28
|
-
border-top-right-radius: 9px;
|
29
|
-
background-color: white;
|
30
|
-
padding: 7px 12% 0;
|
31
|
-
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
32
|
-
}
|
33
|
-
|
34
|
-
h1 {
|
35
|
-
font-size: 100%;
|
36
|
-
color: #730E15;
|
37
|
-
line-height: 1.5em;
|
38
|
-
}
|
39
|
-
|
40
|
-
div.dialog > p {
|
41
|
-
margin: 0 0 1em;
|
42
|
-
padding: 1em;
|
43
|
-
background-color: #F7F7F7;
|
44
|
-
border: 1px solid #CCC;
|
45
|
-
border-right-color: #999;
|
46
|
-
border-left-color: #999;
|
47
|
-
border-bottom-color: #999;
|
48
|
-
border-bottom-left-radius: 4px;
|
49
|
-
border-bottom-right-radius: 4px;
|
50
|
-
border-top-color: #DADADA;
|
51
|
-
color: #666;
|
52
|
-
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
53
|
-
}
|
54
|
-
</style>
|
55
|
-
</head>
|
56
|
-
|
57
|
-
<body>
|
58
|
-
<!-- This file lives in public/500.html -->
|
59
|
-
<div class="dialog">
|
60
|
-
<div>
|
61
|
-
<h1>We're sorry, but something went wrong.</h1>
|
62
|
-
</div>
|
63
|
-
<p>If you are the application owner check the logs for more information.</p>
|
64
|
-
</div>
|
65
|
-
</body>
|
66
|
-
</html>
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,14 +0,0 @@
|
|
1
|
-
require "rails_helper"
|
2
|
-
require "fileutils"
|
3
|
-
|
4
|
-
describe Sapience, "rails integration", :integration do
|
5
|
-
context "with a sapience.yml present in config/" do
|
6
|
-
describe ".config" do
|
7
|
-
subject(:config) { Sapience.config }
|
8
|
-
its(:default_level) { is_expected.to eq(:fatal) }
|
9
|
-
its(:default_level_index) { is_expected.to eq(5) }
|
10
|
-
its(:backtrace_level) { is_expected.to eq(:fatal) }
|
11
|
-
its(:backtrace_level_index) { is_expected.to eq(5) }
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
@@ -1,36 +0,0 @@
|
|
1
|
-
require "rails_helper"
|
2
|
-
require "serverengine"
|
3
|
-
require "sneakers"
|
4
|
-
require "sneakers/runner"
|
5
|
-
require "external_sneaker"
|
6
|
-
|
7
|
-
describe TestJob do
|
8
|
-
include FileHelper
|
9
|
-
include ActiveJob::TestHelper
|
10
|
-
let(:metrics) { Sapience.add_appender(:datadog) }
|
11
|
-
let(:tags) do
|
12
|
-
%w(name:test queue:test_queue)
|
13
|
-
end
|
14
|
-
let(:message) do
|
15
|
-
{
|
16
|
-
title: "Cool",
|
17
|
-
body: "Hot",
|
18
|
-
}
|
19
|
-
end
|
20
|
-
let(:logger) { Sapience[described_class] }
|
21
|
-
|
22
|
-
after do
|
23
|
-
delete_file("config/sapience.yml")
|
24
|
-
delete_file(described_class::VERIFICATION_FILE)
|
25
|
-
end
|
26
|
-
|
27
|
-
# TODO: Possible make this less flaky or run it with retry (rspec-retry)
|
28
|
-
it "runs properly" do
|
29
|
-
expect(metrics).to receive(:increment).with("activejob.perform", tags: tags)
|
30
|
-
expect(metrics).to receive(:timing).with("activejob.perform.time", kind_of(Float), tags: tags)
|
31
|
-
|
32
|
-
perform_enqueued_jobs do
|
33
|
-
TestJob.perform_later
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
require "rails_helper"
|
2
|
-
|
3
|
-
RSpec.describe Post, type: :model do
|
4
|
-
let!(:metrics) { Sapience.add_appender(:datadog, app_name: "active_record") }
|
5
|
-
let(:tags) { %w(query:post.load) }
|
6
|
-
|
7
|
-
before(:each) { create :post }
|
8
|
-
|
9
|
-
it "records som sql metrics" do
|
10
|
-
expect(metrics).to receive(:increment).with("activerecord.sql", tags: tags)
|
11
|
-
expect(metrics).to receive(:timing).with("activerecord.sql.time", kind_of(Float), tags: tags)
|
12
|
-
Post.first
|
13
|
-
end
|
14
|
-
end
|
@@ -1,45 +0,0 @@
|
|
1
|
-
require "simplecov"
|
2
|
-
|
3
|
-
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
4
|
-
ENV["RAILS_ENV"] ||= "test"
|
5
|
-
require File.expand_path("../../config/environment", __FILE__)
|
6
|
-
# Prevent database truncation if the environment is production
|
7
|
-
abort("The Rails environment is running in production mode!") if Rails.env.production?
|
8
|
-
require "spec_helper"
|
9
|
-
require "sapience/rails"
|
10
|
-
require "rspec/rails"
|
11
|
-
require "rspec/its"
|
12
|
-
require_relative "../../../spec/support/file_helper"
|
13
|
-
|
14
|
-
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
|
15
|
-
|
16
|
-
# Checks for pending migration and applies them before tests are run.
|
17
|
-
# If you are not using ActiveRecord, you can remove this line.
|
18
|
-
Sapience.configure do |c|
|
19
|
-
c.app_name = "rails_app"
|
20
|
-
end
|
21
|
-
ActiveRecord::Migration.maintain_test_schema!
|
22
|
-
|
23
|
-
RSpec.configure do |config|
|
24
|
-
config.include FileHelper
|
25
|
-
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
26
|
-
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
27
|
-
|
28
|
-
config.use_transactional_fixtures = true
|
29
|
-
|
30
|
-
config.infer_spec_type_from_file_location!
|
31
|
-
config.filter_rails_from_backtrace!
|
32
|
-
config.before(:each) do
|
33
|
-
FileUtils.cp(
|
34
|
-
Rails.root.join("spec/fixtures/sapience.yml"),
|
35
|
-
Rails.root.join("config/sapience.yml"),
|
36
|
-
)
|
37
|
-
Sapience.reset!
|
38
|
-
end
|
39
|
-
|
40
|
-
config.after(:each) do
|
41
|
-
sapience_config = Rails.root.join("config/sapience.yml")
|
42
|
-
FileUtils.rm(sapience_config) if File.exist?(sapience_config)
|
43
|
-
end
|
44
|
-
config.include FactoryGirl::Syntax::Methods
|
45
|
-
end
|
@@ -1,44 +0,0 @@
|
|
1
|
-
require "rails_helper"
|
2
|
-
|
3
|
-
describe "Posts", type: :request do
|
4
|
-
describe "GET /posts" do
|
5
|
-
describe "ActiveSupport::Notification" do
|
6
|
-
context "when metrics is configured" do
|
7
|
-
before do
|
8
|
-
# ActiveRecord::Base.logger = Logger.new(STDOUT)
|
9
|
-
Rails.logger.level = :debug
|
10
|
-
Sapience.add_appender(:datadog)
|
11
|
-
FactoryGirl.create_list(:post, 10)
|
12
|
-
allow_any_instance_of(Sapience::Extensions::ActiveRecord::Notifications)
|
13
|
-
.to receive(:record).and_return(true)
|
14
|
-
end
|
15
|
-
|
16
|
-
it "records a batch of metrics" do
|
17
|
-
expect(Sapience.metrics).to receive(:increment) do |metric_name, options|
|
18
|
-
expect(metric_name).to eq("rails.request")
|
19
|
-
expect(options[:tags]).to match_array(%w(method:get status:200 action:index controller:posts format:html))
|
20
|
-
end
|
21
|
-
expect(Sapience.metrics).to receive(:timing) do |metric_name, duration, options|
|
22
|
-
expect(metric_name).to eq("rails.request.time")
|
23
|
-
expect(duration).to be_a(Float).and be > 0
|
24
|
-
expect(options[:tags]).to match_array(%w(method:get status:200 action:index controller:posts format:html))
|
25
|
-
end
|
26
|
-
|
27
|
-
expect(Sapience.metrics).to receive(:timing) do |metric_name, duration, options|
|
28
|
-
expect(metric_name).to eq("rails.request.time.db")
|
29
|
-
expect(duration).to be_a(Float).and be > 0
|
30
|
-
expect(options[:tags]).to match_array(%w(method:get status:200 action:index controller:posts format:html))
|
31
|
-
end
|
32
|
-
|
33
|
-
expect(Sapience.metrics).to receive(:timing) do |metric_name, duration, options|
|
34
|
-
expect(metric_name).to eq("rails.request.time.view")
|
35
|
-
expect(duration).to be_a(Float).and be > 0
|
36
|
-
expect(options[:tags]).to match_array(%w(method:get status:200 action:index controller:posts format:html))
|
37
|
-
end
|
38
|
-
|
39
|
-
get posts_path
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
require "rails_helper"
|
2
|
-
|
3
|
-
RSpec.describe PostsController, type: :routing do
|
4
|
-
describe "routing" do
|
5
|
-
it "routes to #index" do
|
6
|
-
expect(get: "/posts").to route_to("posts#index")
|
7
|
-
end
|
8
|
-
|
9
|
-
it "routes to #new" do
|
10
|
-
expect(get: "/posts/new").to route_to("posts#new")
|
11
|
-
end
|
12
|
-
|
13
|
-
it "routes to #show" do
|
14
|
-
expect(get: "/posts/1").to route_to("posts#show", id: "1")
|
15
|
-
end
|
16
|
-
|
17
|
-
it "routes to #edit" do
|
18
|
-
expect(get: "/posts/1/edit").to route_to("posts#edit", id: "1")
|
19
|
-
end
|
20
|
-
|
21
|
-
it "routes to #create" do
|
22
|
-
expect(post: "/posts").to route_to("posts#create")
|
23
|
-
end
|
24
|
-
|
25
|
-
it "routes to #update via PUT" do
|
26
|
-
expect(put: "/posts/1").to route_to("posts#update", id: "1")
|
27
|
-
end
|
28
|
-
|
29
|
-
it "routes to #update via PATCH" do
|
30
|
-
expect(patch: "/posts/1").to route_to("posts#update", id: "1")
|
31
|
-
end
|
32
|
-
|
33
|
-
it "routes to #destroy" do
|
34
|
-
expect(delete: "/posts/1").to route_to("posts#destroy", id: "1")
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|