Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
36bedfb7
Commit
36bedfb7
authored
Mar 22, 2018
by
blackst0ne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Rails5] Update files by `rails app:update`
parent
5ae91f32
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
163 additions
and
24 deletions
+163
-24
bin/rails
bin/rails
+10
-5
bin/rake
bin/rake
+9
-4
bin/setup
bin/setup
+41
-9
bin/update
bin/update
+29
-0
config/boot.rb
config/boot.rb
+8
-3
config/environment.rb
config/environment.rb
+7
-1
config/environments/production.rb
config/environments/production.rb
+5
-1
config/environments/test.rb
config/environments/test.rb
+7
-1
config/initializers/application_controller_renderer.rb
config/initializers/application_controller_renderer.rb
+12
-0
config/initializers/new_framework_defaults.rb
config/initializers/new_framework_defaults.rb
+29
-0
config/spring.rb
config/spring.rb
+6
-0
No files found.
bin/rails
View file @
36bedfb7
#!/usr/bin/env ruby
begin
# Remove this block when upgraded to rails 5.0.
unless
%w[1 true]
.
include?
(
ENV
[
"RAILS5"
])
begin
load
File
.
expand_path
(
'../spring'
,
__FILE__
)
rescue
LoadError
=>
e
rescue
LoadError
=>
e
raise
unless
e
.
message
.
include?
(
'spring'
)
end
end
APP_PATH
=
File
.
expand_path
(
'../../config/application'
,
__FILE__
)
APP_PATH
=
File
.
expand_path
(
'../config/application'
,
__dir__
)
require_relative
'../config/boot'
require
'rails/commands'
bin/rake
View file @
36bedfb7
#!/usr/bin/env ruby
begin
# Remove this block when upgraded to rails 5.0.
unless
%w[1 true]
.
include?
(
ENV
[
"RAILS5"
])
begin
load
File
.
expand_path
(
'../spring'
,
__FILE__
)
rescue
LoadError
=>
e
rescue
LoadError
=>
e
raise
unless
e
.
message
.
include?
(
'spring'
)
end
end
require_relative
'../config/boot'
require
'rake'
Rake
.
application
.
run
bin/setup
View file @
36bedfb7
#!/usr/bin/env ruby
require
'pathname'
def
rails5?
%w[1 true]
.
include?
(
ENV
[
"RAILS5"
])
end
require
"pathname"
# path to your application root.
APP_ROOT
=
Pathname
.
new
File
.
expand_path
(
'../../'
,
__FILE__
)
APP_ROOT
=
Pathname
.
new
File
.
expand_path
(
"../../"
,
__FILE__
)
if
rails5?
def
system!
(
*
args
)
system
(
*
args
)
||
abort
(
"
\n
== Command
#{
args
}
failed =="
)
end
end
Dir
.
chdir
APP_ROOT
do
# This script is a starting point to setup your application.
# Add necessary setup steps to this file:
puts
"== Installing dependencies =="
if
rails5?
system
!
"gem install bundler --conservative"
system
(
"bundle check"
)
||
system
!
(
"bundle install"
)
else
system
"gem install bundler --conservative"
system
"bundle check || bundle install"
end
# puts "\n== Copying sample files =="
# unless File.exist?("config/database.yml")
#
system "cp config/database.yml.sample
config/database.yml"
#
cp "config/database.yml.sample", "
config/database.yml"
# end
puts
"
\n
== Preparing database =="
if
rails5?
system
!
"bin/rails db:setup"
else
system
"bin/rake db:reset"
end
puts
"
\n
== Removing old logs and tempfiles =="
if
rails5?
system
!
"bin/rails log:clear tmp:clear"
else
system
"rm -f log/*"
system
"rm -rf tmp/cache"
end
puts
"
\n
== Restarting application server =="
if
rails5?
system
!
"bin/rails restart"
else
system
"touch tmp/restart.txt"
end
end
bin/update
0 → 100755
View file @
36bedfb7
#!/usr/bin/env ruby
require
'pathname'
require
'fileutils'
include
FileUtils
# path to your application root.
APP_ROOT
=
Pathname
.
new
File
.
expand_path
(
'../../'
,
__FILE__
)
def
system!
(
*
args
)
system
(
*
args
)
||
abort
(
"
\n
== Command
#{
args
}
failed =="
)
end
chdir
APP_ROOT
do
# This script is a way to update your development environment automatically.
# Add necessary update steps to this file.
puts
'== Installing dependencies =='
system
!
'gem install bundler --conservative'
system
(
'bundle check'
)
||
system
!
(
'bundle install'
)
puts
"
\n
== Updating database =="
system
!
'bin/rails db:migrate'
puts
"
\n
== Removing old logs and tempfiles =="
system
!
'bin/rails log:clear tmp:clear'
puts
"
\n
== Restarting application server =="
system
!
'bin/rails restart'
end
config/boot.rb
View file @
36bedfb7
require
'rubygems'
def
rails5?
%w[1 true]
.
include?
(
ENV
[
"RAILS5"
])
end
# Set up gems listed in the Gemfile.
ENV
[
'BUNDLE_GEMFILE'
]
||=
File
.
expand_path
(
'../../Gemfile'
,
__FILE__
)
require
'rubygems'
unless
rails5?
gemfile
=
rails5?
?
"Gemfile.rails5"
:
"Gemfile"
ENV
[
'BUNDLE_GEMFILE'
]
||=
File
.
expand_path
(
"../
#{
gemfile
}
"
,
__dir__
)
# Set up gems listed in the Gemfile.
require
'bundler/setup'
if
File
.
exist?
(
ENV
[
'BUNDLE_GEMFILE'
])
config/environment.rb
View file @
36bedfb7
# Load the rails application
require
File
.
expand_path
(
'../application'
,
__FILE__
)
# Remove this condition when upgraded to rails 5.0.
if
%w[1 true]
.
include?
(
ENV
[
"RAILS5"
])
require_relative
'application'
else
require
File
.
expand_path
(
'../application'
,
__FILE__
)
end
# Initialize the rails application
Rails
.
application
.
initialize!
config/environments/production.rb
View file @
36bedfb7
...
...
@@ -9,7 +9,11 @@ Rails.application.configure do
config
.
action_controller
.
perform_caching
=
true
# Disable Rails's static asset server (Apache or nginx will already do this)
if
Gitlab
.
rails5?
config
.
public_file_server
.
enabled
=
false
else
config
.
serve_static_files
=
false
end
# Compress JavaScripts and CSS.
config
.
assets
.
js_compressor
=
:uglifier
...
...
config/environments/test.rb
View file @
36bedfb7
...
...
@@ -18,7 +18,13 @@ Rails.application.configure do
# Configure static asset server for tests with Cache-Control for performance
config
.
assets
.
compile
=
false
if
ENV
[
'CI'
]
if
Gitlab
.
rails5?
config
.
public_file_server
.
enabled
=
true
else
config
.
serve_static_files
=
true
end
config
.
static_cache_control
=
"public, max-age=3600"
# Show full error reports and disable caching
...
...
config/initializers/application_controller_renderer.rb
0 → 100644
View file @
36bedfb7
# Remove this `if` condition when upgraded to rails 5.0.
# The body must be kept.
if
Gitlab
.
rails5?
# Be sure to restart your server when you modify this file.
# ActiveSupport::Reloader.to_prepare do
# ApplicationController.renderer.defaults.merge!(
# http_host: 'example.org',
# https: false
# )
# end
end
config/initializers/new_framework_defaults.rb
0 → 100644
View file @
36bedfb7
# Remove this `if` condition when upgraded to rails 5.0.
# The body must be kept.
if
Gitlab
.
rails5?
# Be sure to restart your server when you modify this file.
#
# This file contains migration options to ease your Rails 5.0 upgrade.
#
# Once upgraded flip defaults one by one to migrate to the new default.
#
# Read the Guide for Upgrading Ruby on Rails for more info on each option.
Rails
.
application
.
config
.
action_controller
.
raise_on_unfiltered_parameters
=
true
# Enable per-form CSRF tokens. Previous versions had false.
Rails
.
application
.
config
.
action_controller
.
per_form_csrf_tokens
=
false
# Enable origin-checking CSRF mitigation. Previous versions had false.
Rails
.
application
.
config
.
action_controller
.
forgery_protection_origin_check
=
false
# Make Ruby 2.4 preserve the timezone of the receiver when calling `to_time`.
# Previous versions had false.
ActiveSupport
.
to_time_preserves_timezone
=
false
# Require `belongs_to` associations by default. Previous versions had false.
Rails
.
application
.
config
.
active_record
.
belongs_to_required_by_default
=
false
# Do not halt callback chains when a callback returns false. Previous versions had true.
ActiveSupport
.
halt_callback_chains_on_return_false
=
true
end
config/spring.rb
0 → 100644
View file @
36bedfb7
%w(
.ruby-version
.rbenv-vars
tmp/restart.txt
tmp/caching-dev.txt
)
.
each
{
|
path
|
Spring
.
watch
(
path
)
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment