meerstats_rails 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +52 -0
- data/Rakefile +32 -0
- data/app/controllers/meerstats/api/health_check_controller.rb +7 -0
- data/app/controllers/meerstats/api/metrics_controller.rb +7 -0
- data/app/controllers/meerstats/api/statistics_controller.rb +7 -0
- data/app/controllers/meerstats/api_controller.rb +12 -0
- data/bin/meerstats +5 -0
- data/config/routes.rb +7 -0
- data/lib/meerstats/configuration.rb +5 -0
- data/lib/meerstats/engine.rb +18 -0
- data/lib/meerstats/installer.rb +24 -0
- data/lib/meerstats/lazy_metric.rb +27 -0
- data/lib/meerstats/runner.rb +12 -0
- data/lib/meerstats/version.rb +3 -0
- data/lib/meerstats.rb +45 -0
- data/spec/configuration_spec.rb +26 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/javascripts/application.js +13 -0
- data/spec/dummy/app/assets/javascripts/cable.js +13 -0
- data/spec/dummy/app/assets/stylesheets/application.css +15 -0
- data/spec/dummy/app/channels/application_cable/channel.rb +4 -0
- data/spec/dummy/app/channels/application_cable/connection.rb +4 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/jobs/application_job.rb +2 -0
- data/spec/dummy/app/mailers/application_mailer.rb +4 -0
- data/spec/dummy/app/models/application_record.rb +3 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/app/views/layouts/mailer.html.erb +13 -0
- data/spec/dummy/app/views/layouts/mailer.text.erb +1 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +3 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/bin/setup +38 -0
- data/spec/dummy/bin/update +29 -0
- data/spec/dummy/bin/yarn +11 -0
- data/spec/dummy/config/application.rb +18 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/cable.yml +10 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +54 -0
- data/spec/dummy/config/environments/production.rb +91 -0
- data/spec/dummy/config/environments/test.rb +42 -0
- data/spec/dummy/config/initializers/application_controller_renderer.rb +6 -0
- data/spec/dummy/config/initializers/assets.rb +14 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +5 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +4 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +33 -0
- data/spec/dummy/config/puma.rb +56 -0
- data/spec/dummy/config/routes.rb +2 -0
- data/spec/dummy/config/secrets.yml +32 -0
- data/spec/dummy/config/spring.rb +6 -0
- data/spec/dummy/config.ru +5 -0
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/schema.rb +15 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/development.log +8 -0
- data/spec/dummy/log/test.log +2483 -0
- data/spec/dummy/package.json +5 -0
- data/spec/dummy/public/404.html +67 -0
- data/spec/dummy/public/422.html +67 -0
- data/spec/dummy/public/500.html +66 -0
- data/spec/dummy/public/apple-touch-icon-precomposed.png +0 -0
- data/spec/dummy/public/apple-touch-icon.png +0 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/installer_spec.rb +19 -0
- data/spec/requests/api/health_check_spec.rb +27 -0
- data/spec/requests/api/metrics_spec.rb +39 -0
- data/spec/requests/api/statistics_spec.rb +52 -0
- data/spec/spec_helper.rb +23 -0
- data/spec/support/stub_access_token.rb +17 -0
- metadata +253 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 5f4cf94d377f9cbe7f57b695851b18a108478138
|
4
|
+
data.tar.gz: fd38dc89c9e1304ecef20837908bdf5685e13044
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: cbc2d599c7321955d46449b8a46c45221dc5de32af2510a3c135a6ba1fa6944fa46e8bc6b753b1010fcff824352e138b069990e35c1f1246bbc4d5d40acd683f
|
7
|
+
data.tar.gz: fbfc5feb0980bafca7435b7479fbb1855c4cd49ef3719c45f083c08e696bbfdfed717ea70bba430cfaf3ba7caea8d494371ae0cc5d711916f5e34a6dd15d4cbd
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2017 Chuck Callebs
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
# meerstats for Rails
|
2
|
+
|
3
|
+
[meerstats](https://www.meerstats.io) helps you stop bugs in their tracks. We provide an easy way to gain insight into your data and notify you if we see problems.
|
4
|
+
|
5
|
+
This gem allows your Rails application to freely provide pre-configured daily data to meerstats. It does this by mounting a set of protected API endpoints in your app. Only meerstats can access these endpoints.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
gem 'meerstats_rails', require: 'meerstats'
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
You can then install the necessary configuration by executing:
|
18
|
+
|
19
|
+
$ meerstats install
|
20
|
+
|
21
|
+
This will create a configuration file:
|
22
|
+
|
23
|
+
# config/initializers/meerstats.rb
|
24
|
+
Meerstats.configure do |config|
|
25
|
+
config.access_token = ENV['MEERSTATS_TOKEN']
|
26
|
+
end
|
27
|
+
|
28
|
+
# Sample usage:
|
29
|
+
# Meerstats.add_daily :confirmed_users, -> { User.confirmed }
|
30
|
+
# Meerstats.add_daily :unpaid_orders, -> { Order.unpaid }
|
31
|
+
# Meerstats.add_cumulative :total_users, -> { User }
|
32
|
+
|
33
|
+
You will need to check your application dashboard for your access token. By default, we advise storing it in an environment variable in your production environment.
|
34
|
+
|
35
|
+
## Usage
|
36
|
+
|
37
|
+
For an example of how to set up various metrics to track, check out the configuration file. The `add_daily` and `add_cumulative` methods will expose additional metrics to the meerstats service. The metrics will automatically be picked up by our servers.
|
38
|
+
|
39
|
+
These method take two parameters -- a descriptive symbol and a lambda containing an ActiveRecord scope. Be aware that if you change the symbol name, it will track it as a separate metric.
|
40
|
+
|
41
|
+
|
42
|
+
## Contributing
|
43
|
+
|
44
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/meerstats/meerstats_rails. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.
|
45
|
+
|
46
|
+
## License
|
47
|
+
|
48
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
49
|
+
|
50
|
+
## Code of Conduct
|
51
|
+
|
52
|
+
Everyone interacting in the meerstats project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/meerstats/meerstats_rails/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'meerstats'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.md')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
|
18
|
+
load 'rails/tasks/engine.rake'
|
19
|
+
|
20
|
+
|
21
|
+
load 'rails/tasks/statistics.rake'
|
22
|
+
|
23
|
+
|
24
|
+
require 'bundler/gem_tasks'
|
25
|
+
|
26
|
+
require 'rspec/core'
|
27
|
+
require 'rspec/core/rake_task'
|
28
|
+
|
29
|
+
desc "Run all specs in spec directory (excluding plugin specs)"
|
30
|
+
RSpec::Core::RakeTask.new(:spec => 'app:db:test:prepare')
|
31
|
+
|
32
|
+
task :default => :spec
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module Meerstats
|
2
|
+
class ApiController < ActionController::Base
|
3
|
+
before_action :verify_access_token
|
4
|
+
|
5
|
+
def verify_access_token
|
6
|
+
if params[:access_token] != Meerstats.configuration.access_token
|
7
|
+
render json: { error: 'not authorized' }, status: 401
|
8
|
+
return
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
data/bin/meerstats
ADDED
data/config/routes.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
module Meerstats
|
2
|
+
class Engine < ::Rails::Engine
|
3
|
+
isolate_namespace Meerstats
|
4
|
+
|
5
|
+
initializer 'meerstats.mount' do |app|
|
6
|
+
app.routes.append do
|
7
|
+
mount Meerstats::Engine => '/meerstats'
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
config.generators do |g|
|
12
|
+
g.test_framework :rspec, :fixture => false
|
13
|
+
g.fixture_replacement :factory_girl, :dir => 'spec/factories'
|
14
|
+
g.assets false
|
15
|
+
g.helper false
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Meerstats
|
2
|
+
class Installer
|
3
|
+
def self.perform
|
4
|
+
if defined?(Rails)
|
5
|
+
file_path = Rails.root.join('config', 'initializers', 'meerstats.rb')
|
6
|
+
else
|
7
|
+
file_path = Dir.pwd + '/config/initializers/meerstats.rb'
|
8
|
+
end
|
9
|
+
|
10
|
+
file_contents = <<-FILE
|
11
|
+
Meerstats.configure do |config|
|
12
|
+
config.access_token = ENV['MEERSTATS_TOKEN']
|
13
|
+
end
|
14
|
+
|
15
|
+
# Sample usage:
|
16
|
+
# Meerstats.add_daily :confirmed_users, -> { User.confirmed }
|
17
|
+
# Meerstats.add_daily :unpaid_orders, -> { Order.unpaid }
|
18
|
+
# Meerstats.add_cumulative :total_users, -> { User }
|
19
|
+
FILE
|
20
|
+
|
21
|
+
File.write(file_path, file_contents)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Meerstats
|
2
|
+
class LazyMetric
|
3
|
+
class InvalidMetricTypeException < StandardError; end
|
4
|
+
|
5
|
+
attr_accessor :name, :scope, :type
|
6
|
+
|
7
|
+
def initialize(name, scope:, type:)
|
8
|
+
raise InvalidMetricTypeException unless ['daily', 'cumulative'].include?(type)
|
9
|
+
|
10
|
+
self.name = name
|
11
|
+
self.scope = scope
|
12
|
+
self.type = type
|
13
|
+
end
|
14
|
+
|
15
|
+
def compute(days_ago: 1)
|
16
|
+
computed_scope = scope.call
|
17
|
+
|
18
|
+
if type == 'daily'
|
19
|
+
computed_scope = computed_scope.where("date(created_at) = date(?)", days_ago.to_i.days.ago)
|
20
|
+
elsif type == 'cumulative'
|
21
|
+
computed_scope = computed_scope.where("date(created_at) <= date(?)", days_ago.to_i.days.ago)
|
22
|
+
end
|
23
|
+
|
24
|
+
computed_scope.count
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/lib/meerstats.rb
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
require "meerstats/engine"
|
2
|
+
require "meerstats/configuration"
|
3
|
+
require "meerstats/installer"
|
4
|
+
require "meerstats/lazy_metric"
|
5
|
+
|
6
|
+
module Meerstats
|
7
|
+
class << self
|
8
|
+
attr_writer :configuration
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.configuration
|
12
|
+
@configuration ||= Configuration.new
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.configure
|
16
|
+
yield(configuration)
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.metrics
|
20
|
+
@metrics ||= []
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.add_daily(name, scope)
|
24
|
+
add(name, scope: scope, type: 'daily')
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.add_cumulative(name, scope)
|
28
|
+
add(name, scope: scope, type: 'cumulative')
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.add(name, scope:, type: 'daily')
|
32
|
+
if metric = metrics.find { |m| m.name == name }
|
33
|
+
metric.scope = scope
|
34
|
+
else
|
35
|
+
metrics << LazyMetric.new(name, scope: scope, type: type)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.statistics_for(name, days_ago: 1)
|
40
|
+
metric = metrics.find { |m| m.name == name.to_sym }
|
41
|
+
metric.compute(days_ago: days_ago)
|
42
|
+
rescue
|
43
|
+
nil
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
module Meerstats
|
4
|
+
describe Configuration do
|
5
|
+
subject { Meerstats.configuration }
|
6
|
+
|
7
|
+
describe '#access_token' do
|
8
|
+
it 'sets value' do
|
9
|
+
subject.access_token = '1234'
|
10
|
+
expect(subject.access_token).to eq('1234')
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe '.configure' do
|
15
|
+
before do
|
16
|
+
Meerstats.configure do |config|
|
17
|
+
config.access_token = '4321'
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'sets values' do
|
22
|
+
expect(subject.access_token).to eq('4321')
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/spec/dummy/Rakefile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// compiled file. JavaScript code in this file should be added after the last require_* statement.
|
9
|
+
//
|
10
|
+
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= require_tree .
|
@@ -0,0 +1,13 @@
|
|
1
|
+
// Action Cable provides the framework to deal with WebSockets in Rails.
|
2
|
+
// You can generate new channels where WebSocket features live using the `rails generate channel` command.
|
3
|
+
//
|
4
|
+
//= require action_cable
|
5
|
+
//= require_self
|
6
|
+
//= require_tree ./channels
|
7
|
+
|
8
|
+
(function() {
|
9
|
+
this.App || (this.App = {});
|
10
|
+
|
11
|
+
App.cable = ActionCable.createConsumer();
|
12
|
+
|
13
|
+
}).call(this);
|
@@ -0,0 +1,15 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
|
10
|
+
* files in this directory. Styles in this file should be added after the last require_* statement.
|
11
|
+
* It is generally better to create a new file per style scope.
|
12
|
+
*
|
13
|
+
*= require_tree .
|
14
|
+
*= require_self
|
15
|
+
*/
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= yield %>
|
data/spec/dummy/bin/rake
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'pathname'
|
3
|
+
require 'fileutils'
|
4
|
+
include FileUtils
|
5
|
+
|
6
|
+
# path to your application root.
|
7
|
+
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
8
|
+
|
9
|
+
def system!(*args)
|
10
|
+
system(*args) || abort("\n== Command #{args} failed ==")
|
11
|
+
end
|
12
|
+
|
13
|
+
chdir APP_ROOT do
|
14
|
+
# This script is a starting point to setup your application.
|
15
|
+
# Add necessary setup steps to this file.
|
16
|
+
|
17
|
+
puts '== Installing dependencies =='
|
18
|
+
system! 'gem install bundler --conservative'
|
19
|
+
system('bundle check') || system!('bundle install')
|
20
|
+
|
21
|
+
# Install JavaScript dependencies if using Yarn
|
22
|
+
# system('bin/yarn')
|
23
|
+
|
24
|
+
|
25
|
+
# puts "\n== Copying sample files =="
|
26
|
+
# unless File.exist?('config/database.yml')
|
27
|
+
# cp 'config/database.yml.sample', 'config/database.yml'
|
28
|
+
# end
|
29
|
+
|
30
|
+
puts "\n== Preparing database =="
|
31
|
+
system! 'bin/rails db:setup'
|
32
|
+
|
33
|
+
puts "\n== Removing old logs and tempfiles =="
|
34
|
+
system! 'bin/rails log:clear tmp:clear'
|
35
|
+
|
36
|
+
puts "\n== Restarting application server =="
|
37
|
+
system! 'bin/rails restart'
|
38
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'pathname'
|
3
|
+
require 'fileutils'
|
4
|
+
include FileUtils
|
5
|
+
|
6
|
+
# path to your application root.
|
7
|
+
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
8
|
+
|
9
|
+
def system!(*args)
|
10
|
+
system(*args) || abort("\n== Command #{args} failed ==")
|
11
|
+
end
|
12
|
+
|
13
|
+
chdir APP_ROOT do
|
14
|
+
# This script is a way to update your development environment automatically.
|
15
|
+
# Add necessary update steps to this file.
|
16
|
+
|
17
|
+
puts '== Installing dependencies =='
|
18
|
+
system! 'gem install bundler --conservative'
|
19
|
+
system('bundle check') || system!('bundle install')
|
20
|
+
|
21
|
+
puts "\n== Updating database =="
|
22
|
+
system! 'bin/rails db:migrate'
|
23
|
+
|
24
|
+
puts "\n== Removing old logs and tempfiles =="
|
25
|
+
system! 'bin/rails log:clear tmp:clear'
|
26
|
+
|
27
|
+
puts "\n== Restarting application server =="
|
28
|
+
system! 'bin/rails restart'
|
29
|
+
end
|
data/spec/dummy/bin/yarn
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
VENDOR_PATH = File.expand_path('..', __dir__)
|
3
|
+
Dir.chdir(VENDOR_PATH) do
|
4
|
+
begin
|
5
|
+
exec "yarnpkg #{ARGV.join(" ")}"
|
6
|
+
rescue Errno::ENOENT
|
7
|
+
$stderr.puts "Yarn executable was not detected in the system."
|
8
|
+
$stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
|
9
|
+
exit 1
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require_relative 'boot'
|
2
|
+
|
3
|
+
require 'rails/all'
|
4
|
+
|
5
|
+
Bundler.require(*Rails.groups)
|
6
|
+
require "meerstats"
|
7
|
+
|
8
|
+
module Dummy
|
9
|
+
class Application < Rails::Application
|
10
|
+
# Initialize configuration defaults for originally generated Rails version.
|
11
|
+
config.load_defaults 5.1
|
12
|
+
|
13
|
+
# Settings in config/environments/* take precedence over those specified here.
|
14
|
+
# Application configuration should go into files in config/initializers
|
15
|
+
# -- all .rb files in that directory are automatically loaded.
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# SQLite version 3.x
|
2
|
+
# gem install sqlite3
|
3
|
+
#
|
4
|
+
# Ensure the SQLite 3 gem is defined in your Gemfile
|
5
|
+
# gem 'sqlite3'
|
6
|
+
#
|
7
|
+
default: &default
|
8
|
+
adapter: sqlite3
|
9
|
+
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
|
10
|
+
timeout: 5000
|
11
|
+
|
12
|
+
development:
|
13
|
+
<<: *default
|
14
|
+
database: db/development.sqlite3
|
15
|
+
|
16
|
+
# Warning: The database defined as "test" will be erased and
|
17
|
+
# re-generated from your development database when you run "rake".
|
18
|
+
# Do not set this db to the same as development or production.
|
19
|
+
test:
|
20
|
+
<<: *default
|
21
|
+
database: db/test.sqlite3
|
22
|
+
|
23
|
+
production:
|
24
|
+
<<: *default
|
25
|
+
database: db/production.sqlite3
|