rails_stats 1.0.1 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/test.yml +42 -0
  3. data/.gitignore +2 -0
  4. data/CHANGELOG.md +21 -0
  5. data/CODE_OF_CONDUCT.md +76 -0
  6. data/Gemfile +12 -2
  7. data/README.md +48 -5
  8. data/Rakefile +12 -0
  9. data/codecov.yml +2 -0
  10. data/lib/rails_stats/all.rb +4 -0
  11. data/lib/rails_stats/app_statistics.rb +9 -8
  12. data/lib/rails_stats/code_statistics.rb +9 -148
  13. data/lib/rails_stats/code_statistics_calculator.rb +5 -1
  14. data/lib/rails_stats/console_formatter.rb +59 -0
  15. data/lib/rails_stats/json_formatter.rb +46 -0
  16. data/lib/rails_stats/spec_statistics.rb +1 -1
  17. data/lib/rails_stats/stats_calculator.rb +137 -0
  18. data/lib/rails_stats/stats_formatter.rb +13 -0
  19. data/lib/rails_stats/tasks.rb +4 -3
  20. data/lib/rails_stats/test_statistics.rb +1 -1
  21. data/lib/rails_stats/util.rb +3 -3
  22. data/lib/rails_stats/version.rb +3 -1
  23. data/pull_request_template.md +9 -0
  24. data/rails_stats.gemspec +2 -2
  25. data/test/dummy/Gemfile +43 -0
  26. data/test/dummy/Rakefile +6 -0
  27. data/test/dummy/app/assets/config/manifest.js +2 -0
  28. data/test/dummy/app/assets/images/.keep +0 -0
  29. data/test/dummy/app/assets/stylesheets/application.css +15 -0
  30. data/test/dummy/app/channels/application_cable/channel.rb +4 -0
  31. data/test/dummy/app/channels/application_cable/connection.rb +4 -0
  32. data/test/dummy/app/controllers/application_controller.rb +7 -0
  33. data/test/dummy/app/controllers/concerns/.keep +0 -0
  34. data/test/dummy/app/helpers/application_helper.rb +3 -0
  35. data/test/dummy/app/javascript/channels/consumer.js +6 -0
  36. data/test/dummy/app/javascript/channels/index.js +5 -0
  37. data/test/dummy/app/javascript/packs/application.js +16 -0
  38. data/test/dummy/app/jobs/application_job.rb +7 -0
  39. data/test/dummy/app/mailers/application_mailer.rb +4 -0
  40. data/test/dummy/app/models/application_record.rb +3 -0
  41. data/test/dummy/app/models/concerns/.keep +0 -0
  42. data/test/dummy/app/views/layouts/application.html.erb +15 -0
  43. data/test/dummy/app/views/layouts/mailer.html.erb +13 -0
  44. data/test/dummy/app/views/layouts/mailer.text.erb +1 -0
  45. data/test/dummy/bin/rails +4 -0
  46. data/test/dummy/bin/rake +4 -0
  47. data/test/dummy/bin/setup +36 -0
  48. data/test/dummy/bin/yarn +11 -0
  49. data/test/dummy/config/application.rb +35 -0
  50. data/test/dummy/config/boot.rb +4 -0
  51. data/test/dummy/config/cable.yml +10 -0
  52. data/test/dummy/config/credentials.yml.enc +1 -0
  53. data/test/dummy/config/database.yml +85 -0
  54. data/test/dummy/config/environment.rb +5 -0
  55. data/test/dummy/config/environments/development.rb +62 -0
  56. data/test/dummy/config/environments/production.rb +112 -0
  57. data/test/dummy/config/environments/test.rb +49 -0
  58. data/test/dummy/config/initializers/application_controller_renderer.rb +8 -0
  59. data/test/dummy/config/initializers/assets.rb +14 -0
  60. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  61. data/test/dummy/config/initializers/content_security_policy.rb +30 -0
  62. data/test/dummy/config/initializers/cookies_serializer.rb +5 -0
  63. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  64. data/test/dummy/config/initializers/inflections.rb +16 -0
  65. data/test/dummy/config/initializers/mime_types.rb +4 -0
  66. data/test/dummy/config/initializers/pagy.rb +1 -0
  67. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  68. data/test/dummy/config/locales/en.yml +33 -0
  69. data/test/dummy/config/master.key +1 -0
  70. data/test/dummy/config/puma.rb +38 -0
  71. data/test/dummy/config/routes.rb +3 -0
  72. data/test/dummy/config/spring.rb +6 -0
  73. data/test/dummy/config/storage.yml +34 -0
  74. data/test/dummy/config.ru +5 -0
  75. data/test/dummy/lib/monkeypatches.rb +1 -0
  76. data/test/dummy/package.json +10 -0
  77. data/test/dummy/spec/models/user_spec.rb +3 -0
  78. data/test/dummy/spec/support/support_file.rb +1 -0
  79. data/test/dummy/test/models/user_test.rb +2 -0
  80. data/test/dummy/test/support/test_helper.rb +1 -0
  81. data/test/fixtures/console-output.txt +40 -0
  82. data/test/lib/rails_stats/code_statistics_test.rb +20 -0
  83. data/test/lib/rails_stats/json_formatter_test.rb +144 -0
  84. data/test/test_helper.rb +27 -0
  85. metadata +143 -15
@@ -0,0 +1,137 @@
1
+ module RailsStats
2
+ class StatsCalculator
3
+ RAILS_APP_FOLDERS = ['models',
4
+ 'controllers',
5
+ 'helpers',
6
+ 'mailers',
7
+ 'views',
8
+ 'assets']
9
+
10
+ def initialize(root_directory)
11
+ @root_directory = root_directory
12
+ @key_concepts = calculate_key_concepts
13
+ @projects = calculate_projects
14
+ @statistics = calculate_statistics
15
+ @code_loc = calculate_code
16
+ @test_loc = calculate_tests
17
+ @files_total, @code_total, @tests_total, @grand_total = calculate_totals
18
+ end
19
+
20
+ attr_reader :code_loc, :code_total, :files_total, :grand_total, :statistics, :test_loc, :tests_total
21
+
22
+ private
23
+
24
+ def calculate_key_concepts
25
+ # returns names of main things like models, controllers, services, etc
26
+ concepts = {}
27
+ app_projects.each do |project|
28
+ project.key_concepts.each do |key|
29
+ concepts[key] = true
30
+ end
31
+ end
32
+
33
+ # TODO: maybe gem names?
34
+
35
+ concepts.keys
36
+ end
37
+
38
+ def calculate_projects
39
+ out = []
40
+ out += app_projects
41
+ out += calculate_root_projects
42
+ out += calculate_gem_projects
43
+ out += calculate_spec_projects
44
+ out += calculate_test_projects
45
+ out += calculate_cucumber_projects
46
+ out
47
+ end
48
+
49
+
50
+ def app_projects
51
+ @app_projects ||= calculate_app_projects
52
+ end
53
+
54
+ def calculate_app_projects
55
+ apps = Util.calculate_projects(@root_directory, "**", "app", RAILS_APP_FOLDERS)
56
+ apps.collect do |root_path|
57
+ AppStatistics.new(root_path)
58
+ end
59
+ end
60
+
61
+ def calculate_gem_projects
62
+ gems = Util.calculate_projects(@root_directory, "*", "**", "*.gemspec")
63
+ gems.collect do |root_path|
64
+ GemStatistics.new(root_path)
65
+ end
66
+ end
67
+
68
+ def calculate_spec_projects
69
+ specs = Util.calculate_shared_projects("spec", @root_directory, "**", "spec", "**", "*_spec.rb")
70
+ specs.collect do |root_path|
71
+ SpecStatistics.new(root_path, @key_concepts)
72
+ end
73
+ end
74
+
75
+ def calculate_test_projects
76
+ tests = Util.calculate_shared_projects("test", @root_directory, "**", "test", "**", "*_test.rb")
77
+ tests.collect do |root_path|
78
+ TestStatistics.new(root_path, @key_concepts)
79
+ end
80
+ end
81
+
82
+
83
+ def calculate_root_projects
84
+ [RootStatistics.new(@root_directory)]
85
+ end
86
+
87
+ def calculate_cucumber_projects
88
+ cukes = Util.calculate_projects(@root_directory, "**", "*.feature")
89
+ cukes.collect do |root_path|
90
+ CucumberStatistics.new(root_path)
91
+ end
92
+ end
93
+
94
+ def calculate_statistics
95
+ out = {}
96
+ @projects.each do |project|
97
+ project.statistics.each do |key, stats|
98
+ out[key] ||= CodeStatisticsCalculator.new(project.test)
99
+ out[key].add(stats)
100
+ end
101
+ end
102
+ out
103
+ end
104
+
105
+ def calculate_totals
106
+ files_total = @statistics.sum do |k,value|
107
+ value.files_total
108
+ end
109
+
110
+ code_total = @statistics.each_with_object(CodeStatisticsCalculator.new) do |pair, code_total|
111
+ code_total.add(pair.last) unless pair.last.test
112
+ end
113
+
114
+ tests_total = @statistics.each_with_object(CodeStatisticsCalculator.new) do |pair, tests_total|
115
+ tests_total.add(pair.last) if pair.last.test
116
+ end
117
+
118
+ grand_total = @statistics.each_with_object(CodeStatisticsCalculator.new) do |pair, total|
119
+ total.add(pair.last)
120
+ end
121
+
122
+ [files_total, code_total, tests_total, grand_total]
123
+ end
124
+
125
+ def calculate_code
126
+ @code_loc = 0
127
+ @statistics.each { |k, v| @code_loc += v.code_lines unless v.test }
128
+ @code_loc
129
+ end
130
+
131
+ def calculate_tests
132
+ @test_loc = 0
133
+ @statistics.each { |k, v| @test_loc += v.code_lines if v.test }
134
+ @test_loc
135
+ end
136
+ end
137
+ end
@@ -0,0 +1,13 @@
1
+ module RailsStats
2
+ class StatsFormatter
3
+ def initialize(calculator, opts = {})
4
+ @calculator = calculator
5
+ @statistics = calculator.statistics
6
+ @code_total = calculator.code_total
7
+ @tests_total = calculator.tests_total
8
+ @grand_total = calculator.grand_total
9
+ end
10
+
11
+ attr_reader :calculator
12
+ end
13
+ end
@@ -1,13 +1,14 @@
1
1
  desc "Report code statistics (KLOCs, etc) from the current (or given) application"
2
- task :stats, [:path] do |t, args|
2
+ task :stats, [:path, :format] do |t, args|
3
3
  Rake::Task["stats"].clear # clear out normal one if there
4
4
  require 'rails_stats/all'
5
5
 
6
6
  path = args[:path]
7
7
  path = Rails.root.to_s if defined?(Rails)
8
+ fmt = args[:format] || ""
8
9
  raise "no path given for stats" unless path
9
10
 
10
11
  root_directory = File.absolute_path(path)
11
12
  puts "\nDirectory: #{root_directory}\n\n" if args[:path]
12
- RailsStats::CodeStatistics.new(root_directory).to_s
13
- end
13
+ RailsStats::CodeStatistics.new(root_directory, format: fmt).to_s
14
+ end
@@ -35,7 +35,7 @@ module RailsStats
35
35
  out = {}
36
36
  categorize_files.each do |key, list|
37
37
  out[key] = Util.calculate_file_statistics(list)
38
- end
38
+ end
39
39
  out
40
40
  end
41
41
 
@@ -29,7 +29,7 @@ module RailsStats
29
29
  projects[$1] = true
30
30
  end
31
31
  end
32
-
32
+
33
33
  out = projects.keys
34
34
 
35
35
  # TODO: make sure none are children of other ones in there
@@ -56,14 +56,14 @@ module RailsStats
56
56
 
57
57
  directories.each do |dir_path|
58
58
  next unless File.directory?(dir_path)
59
-
59
+
60
60
  key = nil
61
61
  if block_given?
62
62
  key = yield(dir_path)
63
63
  end
64
64
 
65
65
  key = path_to_name(dir_path, is_test) if !key || key.length == 0
66
-
66
+
67
67
  out[key] ||= CodeStatisticsCalculator.new(is_test)
68
68
  out[key].add(calculate_directory_statistics(dir_path))
69
69
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module RailsStats
2
- VERSION = "1.0.1"
4
+ VERSION = "2.0.0"
3
5
  end
@@ -0,0 +1,9 @@
1
+ **IMPORTANT**: Please read the README before submitting pull requests for this project. Additionally, if your PR closes any open GitHub issues, make sure you include _Closes #XXXX_ in your comment or use the option on the PR's sidebar to add related issues to auto-close the issue that your PR fixes.
2
+
3
+ - [ ] Add an entry to `CHANGELOG.md` that links to this PR under the "main (unreleased)" heading.
4
+
5
+ **Description:**
6
+
7
+ Please include a summary of the change and which issue is fixed or which feature is introduced. If changes to the behavior are made, clearly describe what changes.
8
+
9
+ I will abide by the [code of conduct](CODE_OF_CONDUCT.md).
data/rails_stats.gemspec CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.email = ["brian@bleonard.com"]
11
11
  spec.summary = %q{Analyze a Rails project}
12
12
  spec.description = %q{Point it to a directory and see stuff about the app}
13
- spec.homepage = "https://github.com/bleonard/rails_stats"
13
+ spec.homepage = "https://github.com/fastruby/rails_stats"
14
14
  spec.license = "MIT"
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0")
@@ -19,5 +19,5 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ["lib"]
20
20
 
21
21
  spec.add_dependency "rake"
22
- spec.add_development_dependency "bundler", "~> 1.6"
22
+ spec.add_dependency "bundler-stats", ">= 2.1"
23
23
  end
@@ -0,0 +1,43 @@
1
+ source 'https://rubygems.org'
2
+ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
3
+
4
+ ruby '2.6.8'
5
+
6
+ # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
7
+ gem 'rails', '~> 6.0.3', '>= 6.0.3.3'
8
+ # Use Puma as the app server
9
+ gem 'puma', '~> 4.1'
10
+ # Use SCSS for stylesheets
11
+ gem "sass-rails"
12
+ # Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker
13
+ gem 'webpacker', '~> 4.0'
14
+ # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
15
+ gem 'jbuilder', '~> 2.7'
16
+ # Use Redis adapter to run Action Cable in production
17
+ # gem 'redis', '~> 4.0'
18
+ # Use Active Model has_secure_password
19
+ # gem 'bcrypt', '~> 3.1.7'
20
+
21
+ # Use Active Storage variant
22
+ # gem 'image_processing', '~> 1.2'
23
+ gem 'rails_stats', path: '../../../rails_stats'
24
+
25
+ # Reduces boot times through caching; required in config/boot.rb
26
+ gem 'bootsnap', '>= 1.4.2', require: false
27
+
28
+ group :development, :test do
29
+ # Call 'byebug' anywhere in the code to stop execution and get a debugger console
30
+ gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
31
+ end
32
+
33
+ group :development do
34
+ # Access an interactive console on exception pages or by calling 'console' anywhere in the code.
35
+ gem 'web-console', '>= 3.3.0'
36
+ gem 'listen', '~> 3.2'
37
+ # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
38
+ gem 'spring'
39
+ gem 'spring-watcher-listen', '~> 2.0.0'
40
+ end
41
+
42
+ # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
43
+ gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
@@ -0,0 +1,6 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require_relative 'config/application'
5
+
6
+ Rails.application.load_tasks
@@ -0,0 +1,2 @@
1
+ //= link_tree ../images
2
+ //= link_directory ../stylesheets .css
File without changes
@@ -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, or any plugin's
6
+ * 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,4 @@
1
+ module ApplicationCable
2
+ class Channel < ActionCable::Channel::Base
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module ApplicationCable
2
+ class Connection < ActionCable::Connection::Base
3
+ end
4
+ end
@@ -0,0 +1,7 @@
1
+ class ApplicationController < ActionController::Base
2
+ include Pagy::Backend
3
+
4
+ def hello
5
+ p hello
6
+ end
7
+ end
File without changes
@@ -0,0 +1,3 @@
1
+ module ApplicationHelper
2
+ include Pagy::Frontend
3
+ end
@@ -0,0 +1,6 @@
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
+ import { createConsumer } from "@rails/actioncable"
5
+
6
+ export default createConsumer()
@@ -0,0 +1,5 @@
1
+ // Load all the channels within this directory and all subdirectories.
2
+ // Channel files must be named *_channel.js.
3
+
4
+ const channels = require.context('.', true, /_channel\.js$/)
5
+ channels.keys().forEach(channels)
@@ -0,0 +1,16 @@
1
+ // This file is automatically compiled by Webpack, along with any other files
2
+ // present in this directory. You're encouraged to place your actual application logic in
3
+ // a relevant structure within app/javascript and only use these pack files to reference
4
+ // that code so it'll be compiled.
5
+
6
+ require("@rails/ujs").start()
7
+ require("@rails/activestorage").start()
8
+ require("channels")
9
+
10
+
11
+ // Uncomment to copy all static images under ../images to the output folder and reference
12
+ // them with the image_pack_tag helper in views (e.g <%= image_pack_tag 'rails.png' %>)
13
+ // or the `imagePath` JavaScript helper below.
14
+ //
15
+ // const images = require.context('../images', true)
16
+ // const imagePath = (name) => images(name, true)
@@ -0,0 +1,7 @@
1
+ class ApplicationJob < ActiveJob::Base
2
+ # Automatically retry jobs that encountered a deadlock
3
+ # retry_on ActiveRecord::Deadlocked
4
+
5
+ # Most jobs are safe to ignore if the underlying records are no longer available
6
+ # discard_on ActiveJob::DeserializationError
7
+ end
@@ -0,0 +1,4 @@
1
+ class ApplicationMailer < ActionMailer::Base
2
+ default from: 'from@example.com'
3
+ layout 'mailer'
4
+ end
@@ -0,0 +1,3 @@
1
+ class ApplicationRecord < ActiveRecord::Base
2
+ self.abstract_class = true
3
+ end
File without changes
@@ -0,0 +1,15 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <%= csrf_meta_tags %>
6
+ <%= csp_meta_tag %>
7
+
8
+ <%= stylesheet_link_tag 'application', media: 'all' %>
9
+ <%= javascript_pack_tag 'application' %>
10
+ </head>
11
+
12
+ <body>
13
+ <%= yield %>
14
+ </body>
15
+ </html>
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5
+ <style>
6
+ /* Email styles need to be inline */
7
+ </style>
8
+ </head>
9
+
10
+ <body>
11
+ <%= yield %>
12
+ </body>
13
+ </html>
@@ -0,0 +1 @@
1
+ <%= yield %>
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ APP_PATH = File.expand_path('../config/application', __dir__)
3
+ require_relative '../config/boot'
4
+ require 'rails/commands'
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative '../config/boot'
3
+ require 'rake'
4
+ Rake.application.run
@@ -0,0 +1,36 @@
1
+ #!/usr/bin/env ruby
2
+ require 'fileutils'
3
+
4
+ # path to your application root.
5
+ APP_ROOT = File.expand_path('..', __dir__)
6
+
7
+ def system!(*args)
8
+ system(*args) || abort("\n== Command #{args} failed ==")
9
+ end
10
+
11
+ FileUtils.chdir APP_ROOT do
12
+ # This script is a way to setup or update your development environment automatically.
13
+ # This script is idempotent, so that you can run it at anytime and get an expectable outcome.
14
+ # Add necessary setup steps to this file.
15
+
16
+ puts '== Installing dependencies =='
17
+ system! 'gem install bundler --conservative'
18
+ system('bundle check') || system!('bundle install')
19
+
20
+ # Install JavaScript dependencies
21
+ # system('bin/yarn')
22
+
23
+ # puts "\n== Copying sample files =="
24
+ # unless File.exist?('config/database.yml')
25
+ # FileUtils.cp 'config/database.yml.sample', 'config/database.yml'
26
+ # end
27
+
28
+ puts "\n== Preparing database =="
29
+ system! 'bin/rails db:prepare'
30
+
31
+ puts "\n== Removing old logs and tempfiles =="
32
+ system! 'bin/rails log:clear tmp:clear'
33
+
34
+ puts "\n== Restarting application server =="
35
+ system! 'bin/rails restart'
36
+ end
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+ APP_ROOT = File.expand_path('..', __dir__)
3
+ Dir.chdir(APP_ROOT) do
4
+ begin
5
+ exec "yarnpkg", *ARGV
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,35 @@
1
+ require_relative 'boot'
2
+
3
+ require "rails"
4
+ # Pick the frameworks you want:
5
+ require "active_model/railtie"
6
+ require "active_job/railtie"
7
+ require "active_record/railtie"
8
+ require "active_storage/engine"
9
+ require "action_controller/railtie"
10
+ require "action_mailer/railtie"
11
+ require "action_mailbox/engine"
12
+ require "action_text/engine"
13
+ require "action_view/railtie"
14
+ require "action_cable/engine"
15
+ require "sprockets/railtie"
16
+ # require "rails/test_unit/railtie"
17
+
18
+ # Require the gems listed in Gemfile, including any gems
19
+ # you've limited to :test, :development, or :production.
20
+ Bundler.require(*Rails.groups)
21
+
22
+ module Dummy
23
+ class Application < Rails::Application
24
+ # Initialize configuration defaults for originally generated Rails version.
25
+ config.load_defaults 6.0
26
+
27
+ # Settings in config/environments/* take precedence over those specified here.
28
+ # Application configuration can go into files in config/initializers
29
+ # -- all .rb files in that directory are automatically loaded after loading
30
+ # the framework and any gems in your application.
31
+
32
+ # Don't generate system test files.
33
+ config.generators.system_tests = nil
34
+ end
35
+ end
@@ -0,0 +1,4 @@
1
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
2
+
3
+ require 'bundler/setup' # Set up gems listed in the Gemfile.
4
+ require 'bootsnap/setup' # Speed up boot time by caching expensive operations.
@@ -0,0 +1,10 @@
1
+ development:
2
+ adapter: async
3
+
4
+ test:
5
+ adapter: test
6
+
7
+ production:
8
+ adapter: redis
9
+ url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
10
+ channel_prefix: dummy_production
@@ -0,0 +1 @@
1
+ kVQyiT2sFnPIwIVdzuBHvP1JZmyvV+vtZJ0KzfELfTDZln4s6lDaBbczomzzpgspU6/H3T0eGQk7vret3yy9Aghr9zD/moDfSvbUcniOKX/orcGlUo8cr04C5+POsIjETLI3IpE0uSvuZRiWs6bGH92AYAH+kQJar7pGyoMJLStb0WZgqFhXUGhv4d5C7ko7oXu5JojXtFpybvTUSu5SUxUsRgwobgHxVwItFzkLdxuBHgS5crUszCLnLJtjzzQw+svFUAYyRpSGgKO4v6ikHgf1coBZXCnSVmAy/7KiXD+pYj/cQG7mprblx6eryuTRN7M41lFe+54sCKLqVsosnON+cMAWY4OgXnsK4cQ9YZtSP2P6kLGWgK89dttkzPyzkICBBAihtUTDNtzE4dFoSLKtBL/0+XfW/Kja--IZq8NitCVQ3OGILn--phUrzOOviX2c97WDp14Htg==
@@ -0,0 +1,85 @@
1
+ # PostgreSQL. Versions 9.3 and up are supported.
2
+ #
3
+ # Install the pg driver:
4
+ # gem install pg
5
+ # On macOS with Homebrew:
6
+ # gem install pg -- --with-pg-config=/usr/local/bin/pg_config
7
+ # On macOS with MacPorts:
8
+ # gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config
9
+ # On Windows:
10
+ # gem install pg
11
+ # Choose the win32 build.
12
+ # Install PostgreSQL and put its /bin directory on your path.
13
+ #
14
+ # Configure Using Gemfile
15
+ # gem 'pg'
16
+ #
17
+ default: &default
18
+ adapter: postgresql
19
+ encoding: unicode
20
+ # For details on connection pooling, see Rails configuration guide
21
+ # https://guides.rubyonrails.org/configuring.html#database-pooling
22
+ pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
23
+
24
+ development:
25
+ <<: *default
26
+ database: dummy_development
27
+
28
+ # The specified database role being used to connect to postgres.
29
+ # To create additional roles in postgres see `$ createuser --help`.
30
+ # When left blank, postgres will use the default role. This is
31
+ # the same name as the operating system user that initialized the database.
32
+ #username: dummy
33
+
34
+ # The password associated with the postgres role (username).
35
+ #password:
36
+
37
+ # Connect on a TCP socket. Omitted by default since the client uses a
38
+ # domain socket that doesn't need configuration. Windows does not have
39
+ # domain sockets, so uncomment these lines.
40
+ #host: localhost
41
+
42
+ # The TCP port the server listens on. Defaults to 5432.
43
+ # If your server runs on a different port number, change accordingly.
44
+ #port: 5432
45
+
46
+ # Schema search path. The server defaults to $user,public
47
+ #schema_search_path: myapp,sharedapp,public
48
+
49
+ # Minimum log levels, in increasing order:
50
+ # debug5, debug4, debug3, debug2, debug1,
51
+ # log, notice, warning, error, fatal, and panic
52
+ # Defaults to warning.
53
+ #min_messages: notice
54
+
55
+ # Warning: The database defined as "test" will be erased and
56
+ # re-generated from your development database when you run "rake".
57
+ # Do not set this db to the same as development or production.
58
+ test:
59
+ <<: *default
60
+ database: dummy_test
61
+
62
+ # As with config/credentials.yml, you never want to store sensitive information,
63
+ # like your database password, in your source code. If your source code is
64
+ # ever seen by anyone, they now have access to your database.
65
+ #
66
+ # Instead, provide the password as a unix environment variable when you boot
67
+ # the app. Read https://guides.rubyonrails.org/configuring.html#configuring-a-database
68
+ # for a full rundown on how to provide these environment variables in a
69
+ # production deployment.
70
+ #
71
+ # On Heroku and other platform providers, you may have a full connection URL
72
+ # available as an environment variable. For example:
73
+ #
74
+ # DATABASE_URL="postgres://myuser:mypass@localhost/somedatabase"
75
+ #
76
+ # You can use this database configuration with:
77
+ #
78
+ # production:
79
+ # url: <%= ENV['DATABASE_URL'] %>
80
+ #
81
+ production:
82
+ <<: *default
83
+ database: dummy_production
84
+ username: dummy
85
+ password: <%= ENV['DUMMY_DATABASE_PASSWORD'] %>
@@ -0,0 +1,5 @@
1
+ # Load the Rails application.
2
+ require_relative 'application'
3
+
4
+ # Initialize the Rails application.
5
+ Rails.application.initialize!