Skip to content

Instantly share code, notes, and snippets.

@sonalkr132
Created May 30, 2018 06:17
Show Gist options
  • Save sonalkr132/2463e8f638be551a1787dcf83f196e61 to your computer and use it in GitHub Desktop.
Save sonalkr132/2463e8f638be551a1787dcf83f196e61 to your computer and use it in GitHub Desktop.
$ git s
On branch 5-1-upgrade
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
(commit or discard the untracked or modified content in submodules)
modified: Gemfile
modified: Gemfile.lock
modified: config/application.rb
modified: config/boot.rb
modified: config/environments/development.rb
modified: config/environments/production.rb
modified: config/environments/test.rb
modified: config/initializers/application_controller_renderer.rb
modified: config/initializers/assets.rb
modified: config/initializers/backtrace_silencers.rb
modified: config/initializers/cookies_serializer.rb
modified: config/initializers/mime_types.rb
modified: config/locales/en.yml
modified: config/routes.rb
modified: config/secrets.yml
modified: vendor/cache (modified content, untracked content)
Untracked files:
(use "git add <file>..." to include in what will be committed)
config/cable.yml
config/initializers/new_framework_defaults_5_1.rb
config/puma.rb
config/spring.rb
no changes added to commit (use "git add" and/or "git commit -a")
aditya@ ~/rubygems.org (5-1-upgrade) $ git diff
diff --git a/Gemfile b/Gemfile
index ef19ba3..5f4d066 100644
--- a/Gemfile
+++ b/Gemfile
@@ -4,7 +4,7 @@ source 'https://rubygems.org'
# This can be removed once all gems depend on > 3.0
gem 'mime-types', '~> 2.99', require: 'mime/types/columnar'
-gem 'rails', '~> 5.0.0'
+gem 'rails', '~> 5.1.0'
gem 'rails-i18n'
gem 'autoprefixer-rails'
diff --git a/Gemfile.lock b/Gemfile.lock
index cc1a2fd..934d529 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -1,48 +1,48 @@
GEM
remote: https://rubygems.org/
specs:
- actioncable (5.0.3)
- actionpack (= 5.0.3)
- nio4r (>= 1.2, < 3.0)
+ actioncable (5.1.6)
+ actionpack (= 5.1.6)
+ nio4r (~> 2.0)
websocket-driver (~> 0.6.1)
- actionmailer (5.0.3)
- actionpack (= 5.0.3)
- actionview (= 5.0.3)
- activejob (= 5.0.3)
+ actionmailer (5.1.6)
+ actionpack (= 5.1.6)
+ actionview (= 5.1.6)
+ activejob (= 5.1.6)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
- actionpack (5.0.3)
- actionview (= 5.0.3)
- activesupport (= 5.0.3)
+ actionpack (5.1.6)
+ actionview (= 5.1.6)
+ activesupport (= 5.1.6)
rack (~> 2.0)
- rack-test (~> 0.6.3)
+ rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
- actionview (5.0.3)
- activesupport (= 5.0.3)
+ actionview (5.1.6)
+ activesupport (= 5.1.6)
builder (~> 3.1)
- erubis (~> 2.7.0)
+ erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
- activejob (5.0.3)
- activesupport (= 5.0.3)
+ activejob (5.1.6)
+ activesupport (= 5.1.6)
globalid (>= 0.3.6)
- activemodel (5.0.3)
- activesupport (= 5.0.3)
- activerecord (5.0.3)
- activemodel (= 5.0.3)
- activesupport (= 5.0.3)
- arel (~> 7.0)
- activesupport (5.0.3)
+ activemodel (5.1.6)
+ activesupport (= 5.1.6)
+ activerecord (5.1.6)
+ activemodel (= 5.1.6)
+ activesupport (= 5.1.6)
+ arel (~> 8.0)
+ activesupport (5.1.6)
concurrent-ruby (~> 1.0, >= 1.0.2)
- i18n (~> 0.7)
+ i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
addressable (2.5.1)
public_suffix (~> 2.0, >= 2.0.2)
airbrussh (1.2.0)
sshkit (>= 1.6.1, != 1.7.0)
- arel (7.1.4)
+ arel (8.0.0)
ast (2.3.0)
autoprefixer-rails (7.1.2.3)
execjs
@@ -132,7 +132,7 @@ GEM
multi_json
email_validator (1.6.0)
activemodel
- erubis (2.7.0)
+ erubi (1.7.1)
execjs (2.7.0)
factory_bot (4.8.2)
activesupport (>= 3.0.0)
@@ -204,21 +204,21 @@ GEM
rack (2.0.5)
rack-attack (5.2.0)
rack
- rack-test (0.6.3)
- rack (>= 1.0)
+ rack-test (1.0.0)
+ rack (>= 1.0, < 3)
rack-utf8_sanitizer (1.3.2)
rack (>= 1.0, < 3.0)
- rails (5.0.3)
- actioncable (= 5.0.3)
- actionmailer (= 5.0.3)
- actionpack (= 5.0.3)
- actionview (= 5.0.3)
- activejob (= 5.0.3)
- activemodel (= 5.0.3)
- activerecord (= 5.0.3)
- activesupport (= 5.0.3)
- bundler (>= 1.3.0, < 2.0)
- railties (= 5.0.3)
+ rails (5.1.6)
+ actioncable (= 5.1.6)
+ actionmailer (= 5.1.6)
+ actionpack (= 5.1.6)
+ actionview (= 5.1.6)
+ activejob (= 5.1.6)
+ activemodel (= 5.1.6)
+ activerecord (= 5.1.6)
+ activesupport (= 5.1.6)
+ bundler (>= 1.3.0)
+ railties (= 5.1.6)
sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
@@ -233,9 +233,9 @@ GEM
rails-i18n (5.0.4)
i18n (~> 0.7)
railties (~> 5.0)
- railties (5.0.3)
- actionpack (= 5.0.3)
- activesupport (= 5.0.3)
+ railties (5.1.6)
+ actionpack (= 5.1.6)
+ activesupport (= 5.1.6)
method_source
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
@@ -355,7 +355,7 @@ DEPENDENCIES
rack-attack
rack-test
rack-utf8_sanitizer
- rails (~> 5.0.0)
+ rails (~> 5.1.0)
rails-erd
rails-i18n
rbtrace (~> 0.4.8)
diff --git a/config/application.rb b/config/application.rb
index fc9c5f3..38f449b 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -1,7 +1,6 @@
require_relative 'boot'
require 'rails/all'
-require 'elasticsearch/rails/instrumentation'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
@@ -9,34 +8,11 @@ Bundler.require(*Rails.groups)
module Gemcutter
class Application < Rails::Application
- config.rubygems = Application.config_for :rubygems
+ # Initialize configuration defaults for originally generated Rails version.
+ config.load_defaults 5.1
- config.time_zone = "UTC"
- config.encoding = "utf-8"
- config.i18n.available_locales = [:en, :nl, 'zh-CN', 'zh-TW', 'pt-BR', :fr, :es, :de]
- config.i18n.fallbacks = true
-
- config.middleware.insert 0, Rack::UTF8Sanitizer
- config.middleware.use Rack::Attack
- config.middleware.use Rack::Deflater
-
- config.active_record.include_root_in_json = false
-
- config.after_initialize do
- RubygemFs.s3! ENV['S3_PROXY'] if ENV['S3_PROXY']
- end
-
- config.plugins = [:dynamic_form]
-
- config.eager_load_paths << Rails.root.join('lib')
- end
-
- def self.config
- Rails.application.config.rubygems
+ # Settings in config/environments/* take precedence over those specified here.
+ # Application configuration should go into files in config/initializers
+ # -- all .rb files in that directory are automatically loaded.
end
-
- PROTOCOL = config['protocol']
- HOST = config['host']
- DEFAULT_PAGINATION = 20
- REMEMBER_FOR = 2.weeks
end
diff --git a/config/boot.rb b/config/boot.rb
index cc790c5..30f5120 100644
--- a/config/boot.rb
+++ b/config/boot.rb
@@ -1,8 +1,3 @@
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
require 'bundler/setup' # Set up gems listed in the Gemfile.
-
-env = ENV['RAILS_ENV'] || ENV['RACK_ENV'] || ENV['ENV']
-dev_mode = ['', nil, 'development'].include? env
-
-require 'bootsnap/setup' if dev_mode && !ENV['NO_BOOTSNAP']
diff --git a/config/environments/development.rb b/config/environments/development.rb
index a2545a6..5187e22 100644
--- a/config/environments/development.rb
+++ b/config/environments/development.rb
@@ -9,19 +9,28 @@ Rails.application.configure do
# Do not eager load code on boot.
# Do not eager load code on boot.
config.eager_load = false
- # Show full error reports and disable caching.
- config.consider_all_requests_local = true
- config.action_controller.perform_caching = false
+ # Show full error reports.
+ config.consider_all_requests_local = true
+
+ # Enable/disable caching. By default caching is disabled.
+ if Rails.root.join('tmp/caching-dev.txt').exist?
+ config.action_controller.perform_caching = true
+
+ config.cache_store = :memory_store
+ config.public_file_server.headers = {
+ 'Cache-Control' => "public, max-age=#{2.days.seconds.to_i}"
+ }
+ else
+ config.action_controller.perform_caching = false
+
+ config.cache_store = :null_store
+ end
# Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = false
config.action_mailer.perform_caching = false
- config.action_mailer.default_url_options = { host: Gemcutter::HOST,
- protocol: Gemcutter::PROTOCOL }
- config.action_mailer.preview_path = Rails.root.join("lib")
-
# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log
@@ -33,24 +42,13 @@ Rails.application.configure do
# number of complex assets.
config.assets.debug = true
- # Adds additional error checking when serving assets at runtime.
- # Checks for improperly declared sprockets dependencies.
- # Raises helpful error messages.
- config.assets.raise_runtime_errors = true
-
# Suppress logger output for asset requests.
config.assets.quiet = true
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
- config.middleware.use Hostess
-
- config.cache_store = :dalli_store,
- 'localhost:11211',
- { compress: true, compression_min_size: 524_288 }
-
# Use an evented file watcher to asynchronously detect changes in source code,
# routes, locales, etc. This feature depends on the listen gem.
- # config.file_watcher = ActiveSupport::EventedFileUpdateChecker
+ config.file_watcher = ActiveSupport::EventedFileUpdateChecker
end
diff --git a/config/environments/production.rb b/config/environments/production.rb
index a5e2b65..a377895 100644
--- a/config/environments/production.rb
+++ b/config/environments/production.rb
@@ -1,5 +1,3 @@
-require Rails.root.join("config", "secret") if Rails.root.join("config", "secret.rb").file?
-
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
@@ -16,47 +14,49 @@ Rails.application.configure do
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
+ # Attempt to read encrypted secrets from `config/secrets.yml.enc`.
+ # Requires an encryption key in `ENV["RAILS_MASTER_KEY"]` or
+ # `config/secrets.yml.key`.
+ config.read_encrypted_secrets = true
+
# Disable serving static files from the `/public` folder by default since
# Apache or NGINX already handles this.
- config.public_file_server.enabled = false
+ config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
# Compress JavaScripts and CSS.
config.assets.js_compressor = :uglifier
- config.assets.css_compressor = :sass
+ # config.assets.css_compressor = :sass
# Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = false
- # Generate digests for assets URLs.
- config.assets.digest = true
+ # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
- # `config.assets.precompile` and `config.assets.version` have moved to
- # config/initializers/assets.rb
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server.
+ # config.action_controller.asset_host = 'http://assets.example.com'
# Specifies the header that your server uses for sending files.
- config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
-
- # Force all access to the app over SSL and use secure cookies.
- config.force_ssl = true
- config.ssl_options = { hsts: false }
+ # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
# Mount Action Cable outside main process or domain
# config.action_cable.mount_path = nil
# config.action_cable.url = 'wss://example.com/cable'
# config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
- # Set to :debug to see everything in the log.
- config.log_level = :info
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
+ # config.force_ssl = true
+
+ # Use the lowest log level to ensure availability of diagnostic information
+ # when problems arise.
+ config.log_level = :debug
# Prepend all log lines with the following tags.
- # config.log_tags = [ :subdomain, :uuid ]
+ config.log_tags = [ :request_id ]
# Use a different cache store in production.
# config.cache_store = :mem_cache_store
- # Enable serving of images, stylesheets, and JavaScripts from an asset server.
- # config.action_controller.asset_host = "http://assets.example.com"
# Use a real queuing backend for Active Job (and separate queues per environment)
# config.active_job.queue_adapter = :resque
# config.active_job.queue_name_prefix = "gemcutter_#{Rails.env}"
@@ -65,8 +65,6 @@ Rails.application.configure do
# Ignore bad email addresses and do not raise email delivery errors.
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
# config.action_mailer.raise_delivery_errors = false
- config.action_mailer.default_url_options = { host: Gemcutter::HOST,
- protocol: Gemcutter::PROTOCOL }
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation cannot be found).
@@ -85,19 +83,9 @@ Rails.application.configure do
if ENV["RAILS_LOG_TO_STDOUT"].present?
logger = ActiveSupport::Logger.new(STDOUT)
logger.formatter = config.log_formatter
- config.logger = ActiveSupport::TaggedLogging.new(logger)
+ config.logger = ActiveSupport::TaggedLogging.new(logger)
end
# Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false
-
- config.cache_store = :dalli_store, ENV['MEMCACHED_ENDPOINT'], {
- failover: true,
- socket_timeout: 1.5,
- socket_failure_delay: 0.2,
- compress: true,
- compression_min_size: 524_288
- }
-
- config.middleware.use Redirector
end
diff --git a/config/environments/test.rb b/config/environments/test.rb
index 9d387f6..8e5cbde 100644
--- a/config/environments/test.rb
+++ b/config/environments/test.rb
@@ -15,7 +15,7 @@ Rails.application.configure do
# Configure public file server for tests with Cache-Control for performance.
config.public_file_server.enabled = true
config.public_file_server.headers = {
- 'Cache-Control' => 'public, max-age=3600'
+ 'Cache-Control' => "public, max-age=#{1.hour.seconds.to_i}"
}
}
# Show full error reports and disable caching.
@@ -33,21 +33,10 @@ Rails.application.configure do
# The :test delivery method accumulates sent emails in the
# ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :test
- config.action_mailer.default_url_options = { host: Gemcutter::HOST,
- protocol: Gemcutter::PROTOCOL }
# Print deprecation notices to the stderr.
config.active_support.deprecation = :stderr
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
-
- require 'clearance_backdoor'
- config.middleware.use ClearanceBackdoor
-
- config.active_support.test_order = :random
-
- config.cache_store = :dalli_store
-
- config.active_job.queue_adapter = :test
end
diff --git a/config/initializers/application_controller_renderer.rb b/config/initializers/application_controller_renderer.rb
index 51639b6..89d2efa 100644
--- a/config/initializers/application_controller_renderer.rb
+++ b/config/initializers/application_controller_renderer.rb
@@ -1,6 +1,8 @@
# Be sure to restart your server when you modify this file.
-# ApplicationController.renderer.defaults.merge!(
-# http_host: 'example.org',
-# https: false
-# )
+# ActiveSupport::Reloader.to_prepare do
+# ApplicationController.renderer.defaults.merge!(
+# http_host: 'example.org',
+# https: false
+# )
+# end
diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb
index 01ef3e6..4b828e8 100644
--- a/config/initializers/assets.rb
@@ -3,9 +3,12 @@
# Version of your assets, change this if you want to expire all your assets.
Rails.application.config.assets.version = '1.0'
-# Add additional assets to the asset load path
+# Add additional assets to the asset load path.
# Rails.application.config.assets.paths << Emoji.images_path
+# Add Yarn node_modules folder to the asset load path.
+Rails.application.config.assets.paths << Rails.root.join('node_modules')
# Precompile additional assets.
-# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
-# Rails.application.config.assets.precompile += %w( search.js )
+# application.js, application.css, and all non-JS/CSS in the app/assets
+# folder are already added.
+# Rails.application.config.assets.precompile += %w( admin.js admin.css )
diff --git a/config/initializers/backtrace_silencers.rb b/config/initializers/backtrace_silencers.rb
index cf74fe3..59385cd 100644
--- a/config/initializers/backtrace_silencers.rb
+++ b/config/initializers/backtrace_silencers.rb
@@ -1,9 +1,7 @@
# Be sure to restart your server when you modify this file.
-# You can add backtrace silencers for libraries that you're using but don't
-# wish to see in your backtraces.
+# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
-# You can also remove all the silencers if you're trying to debug a problem
-# that might stem from framework code.
+# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
# Rails.backtrace_cleaner.remove_silencers!
diff --git a/config/initializers/cookies_serializer.rb b/config/initializers/cookies_serializer.rb
index 54516e3..5a6a32d 100644
--- a/config/initializers/cookies_serializer.rb
+++ b/config/initializers/cookies_serializer.rb
@@ -1,3 +1,5 @@
# Be sure to restart your server when you modify this file.
-Rails.application.config.action_dispatch.cookies_serializer = :hybrid
+# Specify a serializer for the signed and encrypted cookie jars.
+# Valid options are :json, :marshal, and :hybrid.
+Rails.application.config.action_dispatch.cookies_serializer = :json
diff --git a/config/initializers/mime_types.rb b/config/initializers/mime_types.rb
index 3411534..dc18996 100644
--- a/config/initializers/mime_types.rb
+++ b/config/initializers/mime_types.rb
@@ -2,5 +2,3 @@
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
-
-Mime::Type.register "application/octet-stream", :marshal
diff --git a/config/locales/en.yml b/config/locales/en.yml
index d1f8c41..decc5a8 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -1,277 +1,33 @@
+# Files in the config/locales directory are used for internationalization
+# and are automatically loaded by Rails. If you want to use locales other
+# than English, add the necessary files in this directory.
+#
+# To use the locales, use `I18n.t`:
+#
+# I18n.t 'hello'
+#
+# In views, this is aliased to just `t`:
+#
+# <%= t('hello') %>
+#
+# To use a different locale, set it with `I18n.locale`:
+#
+# I18n.locale = :es
+#
+# This would use the information in config/locales/es.yml.
+#
+# The following keys must be escaped otherwise they will not be retrieved by
+# the default I18n backend:
+#
+# true, false, on, off, yes, no
+#
+# Instead, surround them with single quotes.
+#
+# en:
+# 'true': 'foo'
+#
+# To learn more, please read the Rails Internationalization guide
+# available at http://guides.rubyonrails.org/i18n.html.
+
en:
- edit: Edit
- failure_when_forbidden: Please double check the URL or try submitting it again.
- feed_latest: RubyGems.org | Latest Gems
- feed_subscribed: RubyGems.org | Subscribed Gems
- footer_about: RubyGems.org is the Ruby community&rsquo;s gem hosting service. Instantly <a href="%{publish_docs}">publish your gems</a> and then <a href="%{install_
docs}">install them</a>. Use <a href="%{api_docs}">the API</a> to find out more about <a href="%{gem_list}">available gems</a>. <a href="%{contributing_docs}">Become a
contributor</a> and improve the site yourself.
- form_disable_with: Please wait...
- help_url: http://help.rubygems.org
- locale_name: English
- none: None
- not_found: Not Found
- please_sign_up: Access Denied. Please sign up for an account at https://rubygems.org
- sign_in: Sign in
- sign_up: Sign up
- subtitle: your community gem host
- this_rubygem_could_not_be_found: Th
############## skipped
diff --git a/config/routes.rb b/config/routes.rb
index 19cdea3..787824f 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,183 +1,3 @@
Rails.application.routes.draw do
- ################################################################################
- # Root
-
- root to: 'home#index'
-
- ################################################################################
- # API
-
- namespace :api do
- namespace :v2 do
- resources :rubygems, param: :name, only: [], constraints: { name: Patterns::ROUTE_PATTERN } do
- resources :versions, param: :number, only: :show, constraints: {
- number: /#{Gem::Version::VERSION_PATTERN}(?=\.json\z)|#{Gem::Version::VERSION_PATTERN}/
- }
- end
- end
-
- namespace :v1 do
- resource :api_key, only: :show do
- put :reset
- end
- resources :profiles, only: :show
- resources :downloads, only: :index do
- get :top, on: :collection
############### skipped
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment