shrek 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +5 -1
  3. data/examples/tree_pruning/.gitignore +30 -0
  4. data/examples/tree_pruning/.rspec +3 -0
  5. data/examples/tree_pruning/.rubocop.yml +10 -0
  6. data/examples/tree_pruning/.ruby-version +1 -0
  7. data/examples/tree_pruning/Gemfile +70 -0
  8. data/examples/tree_pruning/README.md +83 -0
  9. data/examples/tree_pruning/Rakefile +8 -0
  10. data/examples/tree_pruning/app/assets/config/manifest.js +3 -0
  11. data/examples/tree_pruning/app/assets/images/.keep +0 -0
  12. data/examples/tree_pruning/app/assets/javascripts/application.js +16 -0
  13. data/examples/tree_pruning/app/assets/javascripts/cable.js +13 -0
  14. data/examples/tree_pruning/app/assets/javascripts/channels/.keep +0 -0
  15. data/examples/tree_pruning/app/assets/stylesheets/application.css +15 -0
  16. data/examples/tree_pruning/app/channels/application_cable/channel.rb +6 -0
  17. data/examples/tree_pruning/app/channels/application_cable/connection.rb +6 -0
  18. data/examples/tree_pruning/app/controllers/application_controller.rb +4 -0
  19. data/examples/tree_pruning/app/controllers/concerns/.keep +0 -0
  20. data/examples/tree_pruning/app/controllers/tree_controller.rb +13 -0
  21. data/examples/tree_pruning/app/helpers/application_helper.rb +4 -0
  22. data/examples/tree_pruning/app/jobs/application_job.rb +4 -0
  23. data/examples/tree_pruning/app/lib/layers/external_fetcher.rb +21 -0
  24. data/examples/tree_pruning/app/lib/layers/parser.rb +11 -0
  25. data/examples/tree_pruning/app/lib/layers/selector.rb +46 -0
  26. data/examples/tree_pruning/app/lib/statistics_processor.rb +9 -0
  27. data/examples/tree_pruning/app/mailers/application_mailer.rb +6 -0
  28. data/examples/tree_pruning/app/models/application_record.rb +5 -0
  29. data/examples/tree_pruning/app/models/concerns/.keep +0 -0
  30. data/examples/tree_pruning/app/views/layouts/application.html.erb +15 -0
  31. data/examples/tree_pruning/app/views/layouts/mailer.html.erb +13 -0
  32. data/examples/tree_pruning/app/views/layouts/mailer.text.erb +1 -0
  33. data/examples/tree_pruning/bin/bundle +5 -0
  34. data/examples/tree_pruning/bin/rails +11 -0
  35. data/examples/tree_pruning/bin/rake +11 -0
  36. data/examples/tree_pruning/bin/setup +38 -0
  37. data/examples/tree_pruning/bin/spring +18 -0
  38. data/examples/tree_pruning/bin/update +33 -0
  39. data/examples/tree_pruning/bin/yarn +11 -0
  40. data/examples/tree_pruning/config.ru +7 -0
  41. data/examples/tree_pruning/config/application.rb +21 -0
  42. data/examples/tree_pruning/config/boot.rb +6 -0
  43. data/examples/tree_pruning/config/cable.yml +10 -0
  44. data/examples/tree_pruning/config/credentials.yml.enc +1 -0
  45. data/examples/tree_pruning/config/database.yml +25 -0
  46. data/examples/tree_pruning/config/environment.rb +7 -0
  47. data/examples/tree_pruning/config/environments/development.rb +63 -0
  48. data/examples/tree_pruning/config/environments/production.rb +96 -0
  49. data/examples/tree_pruning/config/environments/test.rb +48 -0
  50. data/examples/tree_pruning/config/initializers/application_controller_renderer.rb +9 -0
  51. data/examples/tree_pruning/config/initializers/assets.rb +16 -0
  52. data/examples/tree_pruning/config/initializers/backtrace_silencers.rb +8 -0
  53. data/examples/tree_pruning/config/initializers/content_security_policy.rb +26 -0
  54. data/examples/tree_pruning/config/initializers/cookies_serializer.rb +7 -0
  55. data/examples/tree_pruning/config/initializers/filter_parameter_logging.rb +6 -0
  56. data/examples/tree_pruning/config/initializers/inflections.rb +17 -0
  57. data/examples/tree_pruning/config/initializers/mime_types.rb +5 -0
  58. data/examples/tree_pruning/config/initializers/wrap_parameters.rb +16 -0
  59. data/examples/tree_pruning/config/locales/en.yml +33 -0
  60. data/examples/tree_pruning/config/puma.rb +36 -0
  61. data/examples/tree_pruning/config/routes.rb +6 -0
  62. data/examples/tree_pruning/config/spring.rb +8 -0
  63. data/examples/tree_pruning/config/storage.yml +34 -0
  64. data/examples/tree_pruning/db/seeds.rb +8 -0
  65. data/examples/tree_pruning/lib/assets/.keep +0 -0
  66. data/examples/tree_pruning/lib/tasks/.keep +0 -0
  67. data/examples/tree_pruning/log/.keep +0 -0
  68. data/examples/tree_pruning/package.json +5 -0
  69. data/examples/tree_pruning/public/404.html +67 -0
  70. data/examples/tree_pruning/public/422.html +67 -0
  71. data/examples/tree_pruning/public/500.html +66 -0
  72. data/examples/tree_pruning/public/apple-touch-icon-precomposed.png +0 -0
  73. data/examples/tree_pruning/public/apple-touch-icon.png +0 -0
  74. data/examples/tree_pruning/public/favicon.ico +0 -0
  75. data/examples/tree_pruning/public/robots.txt +1 -0
  76. data/examples/tree_pruning/spec/fixtures/.keep +0 -0
  77. data/examples/tree_pruning/spec/fixtures/files/.keep +0 -0
  78. data/examples/tree_pruning/spec/fixtures/files/people_stats.json +2682 -0
  79. data/examples/tree_pruning/spec/lib/layers/external_fetcher_spec.rb +32 -0
  80. data/examples/tree_pruning/spec/lib/layers/parser_spec.rb +17 -0
  81. data/examples/tree_pruning/spec/lib/layers/selector_spec.rb +40 -0
  82. data/examples/tree_pruning/spec/lib/statistics_processor_spec.rb +24 -0
  83. data/examples/tree_pruning/spec/rails_helper.rb +59 -0
  84. data/examples/tree_pruning/spec/spec_helper.rb +96 -0
  85. data/examples/tree_pruning/spec/support/people_stats.rb +15 -0
  86. data/examples/tree_pruning/spec/system/root_spec.rb +30 -0
  87. data/examples/tree_pruning/tmp/.keep +0 -0
  88. data/examples/tree_pruning/vendor/.keep +0 -0
  89. data/lib/shrek/runner.rb +5 -1
  90. data/lib/shrek/version.rb +1 -1
  91. metadata +88 -2
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ApplicationMailer < ActionMailer::Base
4
+ default from: 'from@example.com'
5
+ layout 'mailer'
6
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ApplicationRecord < ActiveRecord::Base
4
+ self.abstract_class = true
5
+ end
File without changes
@@ -0,0 +1,15 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>TreePruning</title>
5
+ <%= csrf_meta_tags %>
6
+ <%= csp_meta_tag %>
7
+
8
+ <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
9
+ <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
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,5 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
5
+ load Gem.bin_path('bundler', 'bundle')
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ begin
5
+ load File.expand_path('spring', __dir__)
6
+ rescue LoadError => e
7
+ raise unless e.message.include?('spring')
8
+ end
9
+ APP_PATH = File.expand_path('../config/application', __dir__)
10
+ require_relative '../config/boot'
11
+ require 'rails/commands'
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ begin
5
+ load File.expand_path('spring', __dir__)
6
+ rescue LoadError => e
7
+ raise unless e.message.include?('spring')
8
+ end
9
+ require_relative '../config/boot'
10
+ require 'rake'
11
+ Rake.application.run
@@ -0,0 +1,38 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'fileutils'
5
+ include FileUtils
6
+
7
+ # path to your application root.
8
+ APP_ROOT = File.expand_path('..', __dir__)
9
+
10
+ def system!(*args)
11
+ system(*args) || abort("\n== Command #{args} failed ==")
12
+ end
13
+
14
+ chdir APP_ROOT do
15
+ # This script is a starting point to setup your application.
16
+ # Add necessary setup steps to this file.
17
+
18
+ puts '== Installing dependencies =='
19
+ system! 'gem install bundler --conservative'
20
+ system('bundle check') || system!('bundle install')
21
+
22
+ # Install JavaScript dependencies if using Yarn
23
+ # system('bin/yarn')
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,18 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ # This file loads spring without using Bundler, in order to be fast.
5
+ # It gets overwritten when you run the `spring binstub` command.
6
+
7
+ unless defined?(Spring)
8
+ require 'rubygems'
9
+ require 'bundler'
10
+
11
+ lockfile = Bundler::LockfileParser.new(Bundler.default_lockfile.read)
12
+ spring = lockfile.specs.detect { |spec| spec.name == 'spring' }
13
+ if spring
14
+ Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path
15
+ gem 'spring', spring.version
16
+ require 'spring/binstub'
17
+ end
18
+ end
@@ -0,0 +1,33 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'fileutils'
5
+ include FileUtils
6
+
7
+ # path to your application root.
8
+ APP_ROOT = File.expand_path('..', __dir__)
9
+
10
+ def system!(*args)
11
+ system(*args) || abort("\n== Command #{args} failed ==")
12
+ end
13
+
14
+ chdir APP_ROOT do
15
+ # This script is a way to update your development environment automatically.
16
+ # Add necessary update steps to this file.
17
+
18
+ puts '== Installing dependencies =='
19
+ system! 'gem install bundler --conservative'
20
+ system('bundle check') || system!('bundle install')
21
+
22
+ # Install JavaScript dependencies if using Yarn
23
+ # system('bin/yarn')
24
+
25
+ puts "\n== Updating database =="
26
+ system! 'bin/rails db:migrate'
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,11 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ APP_ROOT = File.expand_path('..', __dir__)
5
+ Dir.chdir(APP_ROOT) do
6
+ exec 'yarnpkg', *ARGV
7
+ rescue Errno::ENOENT
8
+ warn 'Yarn executable was not detected in the system.'
9
+ warn 'Download Yarn at https://yarnpkg.com/en/docs/install'
10
+ exit 1
11
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file is used by Rack-based servers to start the application.
4
+
5
+ require_relative 'config/environment'
6
+
7
+ run Rails.application
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'boot'
4
+
5
+ require 'rails/all'
6
+
7
+ # Require the gems listed in Gemfile, including any gems
8
+ # you've limited to :test, :development, or :production.
9
+ Bundler.require(*Rails.groups)
10
+
11
+ module TreePruning
12
+ class Application < Rails::Application
13
+ # Initialize configuration defaults for originally generated Rails version.
14
+ config.load_defaults 5.2
15
+
16
+ # Settings in config/environments/* take precedence over those specified here.
17
+ # Application configuration can go into files in config/initializers
18
+ # -- all .rb files in that directory are automatically loaded after loading
19
+ # the framework and any gems in your application.
20
+ end
21
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
4
+
5
+ require 'bundler/setup' # Set up gems listed in the Gemfile.
6
+ 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: async
6
+
7
+ production:
8
+ adapter: redis
9
+ url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
10
+ channel_prefix: tree_pruning_production
@@ -0,0 +1 @@
1
+ WIWxThRh2DlvGzBHXTrLsSb5zMe/8Y1wzPFEVCr2dYL9nvG3cZe7v0Pt+s+L+wY89O9pVaDpguVW58airYL9KFb6o3XN+AxPpj/KC7prFREI6TXayAsFxgc2p03wBevhWa2nSnszvtUzaTrXd4VovfYnqiZyzLeXWhCbzxwl1n6gRUbEZGhrpeqybDO4K/aDN1wMGH+BAvnN1G+y2L1O/DC9QHhrDSHnLnsb/4tPhcZvIVAxMB2FQNuKWrMW/GjwbyH9FzjuG5tF1uo8Kau6DSeVpMDk4/t53bNSu60/XT89kBqCNLoqqNukPU2zRbu5CBMcGBnOk7x6tlz8zpKsC3sggLvmP9BpJT6unNtnNvKusCReftsydkFjz21gg/oMyUuY3OgknyPLeNuc6l5oEW4aX7R42TDw1axK--28a5l3A0zxi+BVy6--RjRRy7Y0MZP5oNNNgpGHUg==
@@ -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,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Load the Rails application.
4
+ require_relative 'application'
5
+
6
+ # Initialize the Rails application.
7
+ Rails.application.initialize!
@@ -0,0 +1,63 @@
1
+ # frozen_string_literal: true
2
+
3
+ Rails.application.configure do
4
+ # Settings specified here will take precedence over those in config/application.rb.
5
+
6
+ # In the development environment your application's code is reloaded on
7
+ # every request. This slows down response time but is perfect for development
8
+ # since you don't have to restart the web server when you make code changes.
9
+ config.cache_classes = false
10
+
11
+ # Do not eager load code on boot.
12
+ config.eager_load = false
13
+
14
+ # Show full error reports.
15
+ config.consider_all_requests_local = true
16
+
17
+ # Enable/disable caching. By default caching is disabled.
18
+ # Run rails dev:cache to toggle caching.
19
+ if Rails.root.join('tmp', 'caching-dev.txt').exist?
20
+ config.action_controller.perform_caching = true
21
+
22
+ config.cache_store = :memory_store
23
+ config.public_file_server.headers = {
24
+ 'Cache-Control' => "public, max-age=#{2.days.to_i}"
25
+ }
26
+ else
27
+ config.action_controller.perform_caching = false
28
+
29
+ config.cache_store = :null_store
30
+ end
31
+
32
+ # Store uploaded files on the local file system (see config/storage.yml for options)
33
+ config.active_storage.service = :local
34
+
35
+ # Don't care if the mailer can't send.
36
+ config.action_mailer.raise_delivery_errors = false
37
+
38
+ config.action_mailer.perform_caching = false
39
+
40
+ # Print deprecation notices to the Rails logger.
41
+ config.active_support.deprecation = :log
42
+
43
+ # Raise an error on page load if there are pending migrations.
44
+ config.active_record.migration_error = :page_load
45
+
46
+ # Highlight code that triggered database queries in logs.
47
+ config.active_record.verbose_query_logs = true
48
+
49
+ # Debug mode disables concatenation and preprocessing of assets.
50
+ # This option may cause significant delays in view rendering with a large
51
+ # number of complex assets.
52
+ config.assets.debug = true
53
+
54
+ # Suppress logger output for asset requests.
55
+ config.assets.quiet = true
56
+
57
+ # Raises error for missing translations
58
+ # config.action_view.raise_on_missing_translations = true
59
+
60
+ # Use an evented file watcher to asynchronously detect changes in source code,
61
+ # routes, locales, etc. This feature depends on the listen gem.
62
+ config.file_watcher = ActiveSupport::EventedFileUpdateChecker
63
+ end
@@ -0,0 +1,96 @@
1
+ # frozen_string_literal: true
2
+
3
+ Rails.application.configure do
4
+ # Settings specified here will take precedence over those in config/application.rb.
5
+
6
+ # Code is not reloaded between requests.
7
+ config.cache_classes = true
8
+
9
+ # Eager load code on boot. This eager loads most of Rails and
10
+ # your application in memory, allowing both threaded web servers
11
+ # and those relying on copy on write to perform better.
12
+ # Rake tasks automatically ignore this option for performance.
13
+ config.eager_load = true
14
+
15
+ # Full error reports are disabled and caching is turned on.
16
+ config.consider_all_requests_local = false
17
+ config.action_controller.perform_caching = true
18
+
19
+ # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
20
+ # or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
21
+ # config.require_master_key = true
22
+
23
+ # Disable serving static files from the `/public` folder by default since
24
+ # Apache or NGINX already handles this.
25
+ config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
26
+
27
+ # Compress JavaScripts and CSS.
28
+ config.assets.js_compressor = :uglifier
29
+ # config.assets.css_compressor = :sass
30
+
31
+ # Do not fallback to assets pipeline if a precompiled asset is missed.
32
+ config.assets.compile = false
33
+
34
+ # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
35
+
36
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server.
37
+ # config.action_controller.asset_host = 'http://assets.example.com'
38
+
39
+ # Specifies the header that your server uses for sending files.
40
+ # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
41
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
42
+
43
+ # Store uploaded files on the local file system (see config/storage.yml for options)
44
+ config.active_storage.service = :local
45
+
46
+ # Mount Action Cable outside main process or domain
47
+ # config.action_cable.mount_path = nil
48
+ # config.action_cable.url = 'wss://example.com/cable'
49
+ # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
50
+
51
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
52
+ # config.force_ssl = true
53
+
54
+ # Use the lowest log level to ensure availability of diagnostic information
55
+ # when problems arise.
56
+ config.log_level = :debug
57
+
58
+ # Prepend all log lines with the following tags.
59
+ config.log_tags = [:request_id]
60
+
61
+ # Use a different cache store in production.
62
+ # config.cache_store = :mem_cache_store
63
+
64
+ # Use a real queuing backend for Active Job (and separate queues per environment)
65
+ # config.active_job.queue_adapter = :resque
66
+ # config.active_job.queue_name_prefix = "tree_pruning_#{Rails.env}"
67
+
68
+ config.action_mailer.perform_caching = false
69
+
70
+ # Ignore bad email addresses and do not raise email delivery errors.
71
+ # Set this to true and configure the email server for immediate delivery to raise delivery errors.
72
+ # config.action_mailer.raise_delivery_errors = false
73
+
74
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
75
+ # the I18n.default_locale when a translation cannot be found).
76
+ config.i18n.fallbacks = true
77
+
78
+ # Send deprecation notices to registered listeners.
79
+ config.active_support.deprecation = :notify
80
+
81
+ # Use default logging formatter so that PID and timestamp are not suppressed.
82
+ config.log_formatter = ::Logger::Formatter.new
83
+
84
+ # Use a different logger for distributed setups.
85
+ # require 'syslog/logger'
86
+ # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
87
+
88
+ if ENV['RAILS_LOG_TO_STDOUT'].present?
89
+ logger = ActiveSupport::Logger.new(STDOUT)
90
+ logger.formatter = config.log_formatter
91
+ config.logger = ActiveSupport::TaggedLogging.new(logger)
92
+ end
93
+
94
+ # Do not dump schema after migrations.
95
+ config.active_record.dump_schema_after_migration = false
96
+ end