sorbet-rails 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +77 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +176 -0
- data/README.md +68 -45
- data/Rakefile +6 -0
- data/SECURITY.md +5 -0
- data/lib/sorbet-rails/model_rbi_formatter.rb +1 -1
- data/lib/sorbet-rails/tasks/rails_rbi.rake +60 -0
- data/rbis/activerecord.rbi +133 -0
- data/sorbet-rails.gemspec +31 -0
- data/spec/model_rbi_formatter_spec.rb +54 -0
- data/spec/rails_helper.rb +14 -0
- data/spec/routes_rbi_formatter_spec.rb +21 -0
- data/spec/spec_helper.rb +8 -0
- data/spec/support/rails_app/.ruby-version +1 -0
- data/spec/support/rails_app/Gemfile +45 -0
- data/spec/support/rails_app/Gemfile.lock +139 -0
- data/spec/support/rails_app/README.md +24 -0
- data/spec/support/rails_app/Rakefile +6 -0
- data/spec/support/rails_app/app/channels/application_cable/channel.rb +4 -0
- data/spec/support/rails_app/app/channels/application_cable/connection.rb +4 -0
- data/spec/support/rails_app/app/controllers/application_controller.rb +2 -0
- data/spec/support/rails_app/app/controllers/concerns/.keep +0 -0
- data/spec/support/rails_app/app/controllers/test_controller.rb +5 -0
- data/spec/support/rails_app/app/jobs/application_job.rb +2 -0
- data/spec/support/rails_app/app/mailers/application_mailer.rb +4 -0
- data/spec/support/rails_app/app/models/application_record.rb +3 -0
- data/spec/support/rails_app/app/models/concerns/.keep +0 -0
- data/spec/support/rails_app/app/models/spell_book.rb +6 -0
- data/spec/support/rails_app/app/models/wand.rb +15 -0
- data/spec/support/rails_app/app/models/wizard.rb +14 -0
- data/spec/support/rails_app/app/views/layouts/mailer.html.erb +13 -0
- data/spec/support/rails_app/app/views/layouts/mailer.text.erb +1 -0
- data/spec/support/rails_app/bin/bundle +3 -0
- data/spec/support/rails_app/bin/rails +9 -0
- data/spec/support/rails_app/bin/rake +9 -0
- data/spec/support/rails_app/bin/setup +33 -0
- data/spec/support/rails_app/bin/spring +17 -0
- data/spec/support/rails_app/bin/update +28 -0
- data/spec/support/rails_app/config.ru +5 -0
- data/spec/support/rails_app/config/application.rb +35 -0
- data/spec/support/rails_app/config/boot.rb +3 -0
- data/spec/support/rails_app/config/cable.yml +10 -0
- data/spec/support/rails_app/config/credentials.yml.enc +1 -0
- data/spec/support/rails_app/config/database.yml +25 -0
- data/spec/support/rails_app/config/environment.rb +5 -0
- data/spec/support/rails_app/config/environments/development.rb +54 -0
- data/spec/support/rails_app/config/environments/production.rb +85 -0
- data/spec/support/rails_app/config/environments/test.rb +46 -0
- data/spec/support/rails_app/config/initializers/application_controller_renderer.rb +8 -0
- data/spec/support/rails_app/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/support/rails_app/config/initializers/cors.rb +16 -0
- data/spec/support/rails_app/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/support/rails_app/config/initializers/inflections.rb +16 -0
- data/spec/support/rails_app/config/initializers/mime_types.rb +4 -0
- data/spec/support/rails_app/config/initializers/wrap_parameters.rb +14 -0
- data/spec/support/rails_app/config/locales/en.yml +33 -0
- data/spec/support/rails_app/config/puma.rb +34 -0
- data/spec/support/rails_app/config/routes.rb +5 -0
- data/spec/support/rails_app/config/spring.rb +6 -0
- data/spec/support/rails_app/config/storage.yml +34 -0
- data/spec/support/rails_app/db/migrate/20190620001234_create_wizards.rb +12 -0
- data/spec/support/rails_app/db/migrate/20190620003037_create_wands.rb +11 -0
- data/spec/support/rails_app/db/migrate/20190620003739_create_spell_books.rb +8 -0
- data/spec/support/rails_app/db/schema.rb +39 -0
- data/spec/support/rails_app/db/seeds.rb +7 -0
- data/spec/support/rails_app/lib/tasks/.keep +0 -0
- data/spec/support/rails_app/log/.keep +0 -0
- data/spec/support/rails_app/public/robots.txt +1 -0
- data/spec/support/rails_app/storage/.keep +0 -0
- data/spec/support/rails_app/test/controllers/.keep +0 -0
- data/spec/support/rails_app/test/fixtures/.keep +0 -0
- data/spec/support/rails_app/test/fixtures/files/.keep +0 -0
- data/spec/support/rails_app/test/integration/.keep +0 -0
- data/spec/support/rails_app/test/mailers/.keep +0 -0
- data/spec/support/rails_app/test/models/.keep +0 -0
- data/spec/support/rails_app/test/test_helper.rb +10 -0
- data/spec/support/rails_app/tmp/.keep +0 -0
- data/spec/support/rails_app/vendor/.keep +0 -0
- data/spec/test_data/expected_routes.rbi +43 -0
- data/spec/test_data/expected_wizard_no_book.rbi +0 -0
- data/spec/test_data/models/expected_wand.rbi +174 -0
- data/spec/test_data/models/expected_wizard.rbi +189 -0
- data/spec/test_data/models/expected_wizard_wo_spellbook.rbi +189 -0
- metadata +338 -3
@@ -0,0 +1,24 @@
|
|
1
|
+
# README
|
2
|
+
|
3
|
+
This README would normally document whatever steps are necessary to get the
|
4
|
+
application up and running.
|
5
|
+
|
6
|
+
Things you may want to cover:
|
7
|
+
|
8
|
+
* Ruby version
|
9
|
+
|
10
|
+
* System dependencies
|
11
|
+
|
12
|
+
* Configuration
|
13
|
+
|
14
|
+
* Database creation
|
15
|
+
|
16
|
+
* Database initialization
|
17
|
+
|
18
|
+
* How to run the test suite
|
19
|
+
|
20
|
+
* Services (job queues, cache servers, search engines, etc.)
|
21
|
+
|
22
|
+
* Deployment instructions
|
23
|
+
|
24
|
+
* ...
|
File without changes
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= yield %>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
begin
|
3
|
+
load File.expand_path('../spring', __FILE__)
|
4
|
+
rescue LoadError => e
|
5
|
+
raise unless e.message.include?('spring')
|
6
|
+
end
|
7
|
+
APP_PATH = File.expand_path('../config/application', __dir__)
|
8
|
+
require_relative '../config/boot'
|
9
|
+
require 'rails/commands'
|
@@ -0,0 +1,33 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'fileutils'
|
3
|
+
include FileUtils
|
4
|
+
|
5
|
+
# path to your application root.
|
6
|
+
APP_ROOT = File.expand_path('..', __dir__)
|
7
|
+
|
8
|
+
def system!(*args)
|
9
|
+
system(*args) || abort("\n== Command #{args} failed ==")
|
10
|
+
end
|
11
|
+
|
12
|
+
chdir APP_ROOT do
|
13
|
+
# This script is a starting point to setup your application.
|
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
|
+
# puts "\n== Copying sample files =="
|
21
|
+
# unless File.exist?('config/database.yml')
|
22
|
+
# cp 'config/database.yml.sample', 'config/database.yml'
|
23
|
+
# end
|
24
|
+
|
25
|
+
puts "\n== Preparing database =="
|
26
|
+
system! 'bin/rails db:setup'
|
27
|
+
|
28
|
+
puts "\n== Removing old logs and tempfiles =="
|
29
|
+
system! 'bin/rails log:clear tmp:clear'
|
30
|
+
|
31
|
+
puts "\n== Restarting application server =="
|
32
|
+
system! 'bin/rails restart'
|
33
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# This file loads Spring without using Bundler, in order to be fast.
|
4
|
+
# It gets overwritten when you run the `spring binstub` command.
|
5
|
+
|
6
|
+
unless defined?(Spring)
|
7
|
+
require 'rubygems'
|
8
|
+
require 'bundler'
|
9
|
+
|
10
|
+
lockfile = Bundler::LockfileParser.new(Bundler.default_lockfile.read)
|
11
|
+
spring = lockfile.specs.detect { |spec| spec.name == 'spring' }
|
12
|
+
if spring
|
13
|
+
Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path
|
14
|
+
gem 'spring', spring.version
|
15
|
+
require 'spring/binstub'
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'fileutils'
|
3
|
+
include FileUtils
|
4
|
+
|
5
|
+
# path to your application root.
|
6
|
+
APP_ROOT = File.expand_path('..', __dir__)
|
7
|
+
|
8
|
+
def system!(*args)
|
9
|
+
system(*args) || abort("\n== Command #{args} failed ==")
|
10
|
+
end
|
11
|
+
|
12
|
+
chdir APP_ROOT do
|
13
|
+
# This script is a way to update your development environment automatically.
|
14
|
+
# Add necessary update steps to this file.
|
15
|
+
|
16
|
+
puts '== Installing dependencies =='
|
17
|
+
system! 'gem install bundler --conservative'
|
18
|
+
system('bundle check') || system!('bundle install')
|
19
|
+
|
20
|
+
puts "\n== Updating database =="
|
21
|
+
system! 'bin/rails db:migrate'
|
22
|
+
|
23
|
+
puts "\n== Removing old logs and tempfiles =="
|
24
|
+
system! 'bin/rails log:clear tmp:clear'
|
25
|
+
|
26
|
+
puts "\n== Restarting application server =="
|
27
|
+
system! 'bin/rails restart'
|
28
|
+
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_view/railtie"
|
12
|
+
require "action_cable/engine"
|
13
|
+
# require "sprockets/railtie"
|
14
|
+
require "rails/test_unit/railtie"
|
15
|
+
|
16
|
+
# Require the gems listed in Gemfile, including any gems
|
17
|
+
# you've limited to :test, :development, or :production.
|
18
|
+
Bundler.require(*Rails.groups)
|
19
|
+
|
20
|
+
module RailsApp
|
21
|
+
class Application < Rails::Application
|
22
|
+
# Initialize configuration defaults for originally generated Rails version.
|
23
|
+
config.load_defaults 5.2
|
24
|
+
|
25
|
+
# Settings in config/environments/* take precedence over those specified here.
|
26
|
+
# Application configuration can go into files in config/initializers
|
27
|
+
# -- all .rb files in that directory are automatically loaded after loading
|
28
|
+
# the framework and any gems in your application.
|
29
|
+
|
30
|
+
# Only loads a smaller set of middleware suitable for API only apps.
|
31
|
+
# Middleware like session, flash, cookies can be added back manually.
|
32
|
+
# Skip views, helpers and assets when generating a new resource.
|
33
|
+
config.api_only = true
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
Y1Wmg1d8/GcG/5uOckL5oi7hYMNCXjwKjzk8GZQJ5cfX4xbFcJNPxsYhb/WpiVpT8z3/84aGMxdhQMfSfS/7iV9AkLReRYlyzKowIcvfDzPk1MRPPsLMRt+BeyGYtnYsi3MwtbR54e+eGUYjOIsKKu48qjNBHFB+HGFXxp9yqwDOAQ1IZdtyS30BTlIDHcogmn37bBz00Ft5NZjjbND3r9en7F42YJFqVDMwspskfjbbEpraEa+V4jFHFF4VXGEj+6D/lY9MThPYWIsNd+UK9uY37QyzEj9mTQMc7Ot6CaojhlbtjaG2JXCcpaFc9bFx8LEC/tB9HUGVaq89IqyELMCsnqKvHJ8gEi0MuRgAzIvbIv/abQzwfdFFWwEiNNJbNbDQ5iyDlUfLmzB0nPaK3ng70/ZMo4Jw2anh--lRgFoT/AEiTPa1Ed--l71FGlZ5jnultCNWmNH1/A==
|
@@ -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
|
@@ -0,0 +1,54 @@
|
|
1
|
+
Rails.application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
3
|
+
|
4
|
+
# In the development environment your application's code is reloaded on
|
5
|
+
# every request. This slows down response time but is perfect for development
|
6
|
+
# since you don't have to restart the web server when you make code changes.
|
7
|
+
config.cache_classes = false
|
8
|
+
|
9
|
+
# Do not eager load code on boot.
|
10
|
+
config.eager_load = false
|
11
|
+
|
12
|
+
# Show full error reports.
|
13
|
+
config.consider_all_requests_local = true
|
14
|
+
|
15
|
+
# Enable/disable caching. By default caching is disabled.
|
16
|
+
# Run rails dev:cache to toggle caching.
|
17
|
+
if Rails.root.join('tmp', 'caching-dev.txt').exist?
|
18
|
+
config.action_controller.perform_caching = true
|
19
|
+
|
20
|
+
config.cache_store = :memory_store
|
21
|
+
config.public_file_server.headers = {
|
22
|
+
'Cache-Control' => "public, max-age=#{2.days.to_i}"
|
23
|
+
}
|
24
|
+
else
|
25
|
+
config.action_controller.perform_caching = false
|
26
|
+
|
27
|
+
config.cache_store = :null_store
|
28
|
+
end
|
29
|
+
|
30
|
+
# Store uploaded files on the local file system (see config/storage.yml for options)
|
31
|
+
config.active_storage.service = :local
|
32
|
+
|
33
|
+
# Don't care if the mailer can't send.
|
34
|
+
config.action_mailer.raise_delivery_errors = false
|
35
|
+
|
36
|
+
config.action_mailer.perform_caching = false
|
37
|
+
|
38
|
+
# Print deprecation notices to the Rails logger.
|
39
|
+
config.active_support.deprecation = :log
|
40
|
+
|
41
|
+
# Raise an error on page load if there are pending migrations.
|
42
|
+
config.active_record.migration_error = :page_load
|
43
|
+
|
44
|
+
# Highlight code that triggered database queries in logs.
|
45
|
+
config.active_record.verbose_query_logs = true
|
46
|
+
|
47
|
+
|
48
|
+
# Raises error for missing translations
|
49
|
+
# config.action_view.raise_on_missing_translations = true
|
50
|
+
|
51
|
+
# Use an evented file watcher to asynchronously detect changes in source code,
|
52
|
+
# routes, locales, etc. This feature depends on the listen gem.
|
53
|
+
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
|
54
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
Rails.application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
3
|
+
|
4
|
+
# Code is not reloaded between requests.
|
5
|
+
config.cache_classes = true
|
6
|
+
|
7
|
+
# Eager load code on boot. This eager loads most of Rails and
|
8
|
+
# your application in memory, allowing both threaded web servers
|
9
|
+
# and those relying on copy on write to perform better.
|
10
|
+
# Rake tasks automatically ignore this option for performance.
|
11
|
+
config.eager_load = true
|
12
|
+
|
13
|
+
# Full error reports are disabled and caching is turned on.
|
14
|
+
config.consider_all_requests_local = false
|
15
|
+
config.action_controller.perform_caching = true
|
16
|
+
|
17
|
+
# Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
|
18
|
+
# or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
|
19
|
+
# config.require_master_key = true
|
20
|
+
|
21
|
+
# Disable serving static files from the `/public` folder by default since
|
22
|
+
# Apache or NGINX already handles this.
|
23
|
+
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
|
24
|
+
|
25
|
+
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
26
|
+
# config.action_controller.asset_host = 'http://assets.example.com'
|
27
|
+
|
28
|
+
# Specifies the header that your server uses for sending files.
|
29
|
+
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
|
30
|
+
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
|
31
|
+
|
32
|
+
# Store uploaded files on the local file system (see config/storage.yml for options)
|
33
|
+
config.active_storage.service = :local
|
34
|
+
|
35
|
+
# Mount Action Cable outside main process or domain
|
36
|
+
# config.action_cable.mount_path = nil
|
37
|
+
# config.action_cable.url = 'wss://example.com/cable'
|
38
|
+
# config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
|
39
|
+
|
40
|
+
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
41
|
+
# config.force_ssl = true
|
42
|
+
|
43
|
+
# Use the lowest log level to ensure availability of diagnostic information
|
44
|
+
# when problems arise.
|
45
|
+
config.log_level = :debug
|
46
|
+
|
47
|
+
# Prepend all log lines with the following tags.
|
48
|
+
config.log_tags = [ :request_id ]
|
49
|
+
|
50
|
+
# Use a different cache store in production.
|
51
|
+
# config.cache_store = :mem_cache_store
|
52
|
+
|
53
|
+
# Use a real queuing backend for Active Job (and separate queues per environment)
|
54
|
+
# config.active_job.queue_adapter = :resque
|
55
|
+
# config.active_job.queue_name_prefix = "rails_app_#{Rails.env}"
|
56
|
+
|
57
|
+
config.action_mailer.perform_caching = false
|
58
|
+
|
59
|
+
# Ignore bad email addresses and do not raise email delivery errors.
|
60
|
+
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
61
|
+
# config.action_mailer.raise_delivery_errors = false
|
62
|
+
|
63
|
+
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
64
|
+
# the I18n.default_locale when a translation cannot be found).
|
65
|
+
config.i18n.fallbacks = true
|
66
|
+
|
67
|
+
# Send deprecation notices to registered listeners.
|
68
|
+
config.active_support.deprecation = :notify
|
69
|
+
|
70
|
+
# Use default logging formatter so that PID and timestamp are not suppressed.
|
71
|
+
config.log_formatter = ::Logger::Formatter.new
|
72
|
+
|
73
|
+
# Use a different logger for distributed setups.
|
74
|
+
# require 'syslog/logger'
|
75
|
+
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
|
76
|
+
|
77
|
+
if ENV["RAILS_LOG_TO_STDOUT"].present?
|
78
|
+
logger = ActiveSupport::Logger.new(STDOUT)
|
79
|
+
logger.formatter = config.log_formatter
|
80
|
+
config.logger = ActiveSupport::TaggedLogging.new(logger)
|
81
|
+
end
|
82
|
+
|
83
|
+
# Do not dump schema after migrations.
|
84
|
+
config.active_record.dump_schema_after_migration = false
|
85
|
+
end
|