summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorHeinrich Lee Yu <heinrich@gitlab.com>2019-06-26 01:54:42 +0800
committerHeinrich Lee Yu <heinrich@gitlab.com>2019-07-12 10:15:31 +0800
commitaeb67dd489b1ccc7f0ab1d702725729ab9cc3e27 (patch)
treec508ba9459274be6a8a0488a838d31f03f45faba /bin
parentecffca5d92353d55aaf8f984737fa617782310e0 (diff)
downloadgitlab-ce-aeb67dd489b1ccc7f0ab1d702725729ab9cc3e27.tar.gz
Upgrade to Rails 5.2upgrade-rails-5-2-ce
Updates changed method names and fixes spec failures
Diffstat (limited to 'bin')
-rwxr-xr-xbin/bundle2
-rwxr-xr-xbin/setup31
-rwxr-xr-xbin/update6
-rwxr-xr-xbin/yarn11
4 files changed, 33 insertions, 17 deletions
diff --git a/bin/bundle b/bin/bundle
index 66e9889e8b4..f19acf5b5cc 100755
--- a/bin/bundle
+++ b/bin/bundle
@@ -1,3 +1,3 @@
#!/usr/bin/env ruby
-ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
load Gem.bin_path('bundler', 'bundle')
diff --git a/bin/setup b/bin/setup
index 883825bc0a2..94fd4d79775 100755
--- a/bin/setup
+++ b/bin/setup
@@ -1,33 +1,36 @@
#!/usr/bin/env ruby
-
-require "pathname"
+require 'fileutils'
+include FileUtils
# path to your application root.
-APP_ROOT = Pathname.new File.expand_path("../../", __FILE__)
+APP_ROOT = File.expand_path('..', __dir__)
def system!(*args)
system(*args) || abort("\n== Command #{args} failed ==")
end
-Dir.chdir APP_ROOT do
- # This script is a starting point to set up your application.
- # Add necessary setup steps to this file:
+chdir APP_ROOT do
+ # This script is a starting point to setup your application.
+ # Add necessary setup steps to this file.
+
+ puts '== Installing dependencies =='
+ system! 'gem install bundler --conservative'
+ system('bundle check') || system!('bundle install')
- puts "== Installing dependencies =="
- system! "gem install bundler --conservative"
- system("bundle check") || system!("bundle install")
+ # Install JavaScript dependencies if using Yarn
+ # system('bin/yarn')
# puts "\n== Copying sample files =="
- # unless File.exist?("config/database.yml")
- # cp "config/database.yml.sample", "config/database.yml"
+ # unless File.exist?('config/database.yml')
+ # cp 'config/database.yml.sample', 'config/database.yml'
# end
puts "\n== Preparing database =="
- system! "bin/rails db:setup"
+ system! 'bin/rails db:setup'
puts "\n== Removing old logs and tempfiles =="
- system! "bin/rails log:clear tmp:clear"
+ system! 'bin/rails log:clear tmp:clear'
puts "\n== Restarting application server =="
- system! "bin/rails restart"
+ system! 'bin/rails restart'
end
diff --git a/bin/update b/bin/update
index a8e4462f203..58bfaed518c 100755
--- a/bin/update
+++ b/bin/update
@@ -1,10 +1,9 @@
#!/usr/bin/env ruby
-require 'pathname'
require 'fileutils'
include FileUtils
# path to your application root.
-APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
+APP_ROOT = File.expand_path('..', __dir__)
def system!(*args)
system(*args) || abort("\n== Command #{args} failed ==")
@@ -18,6 +17,9 @@ chdir APP_ROOT do
system! 'gem install bundler --conservative'
system('bundle check') || system!('bundle install')
+ # Install JavaScript dependencies if using Yarn
+ # system('bin/yarn')
+
puts "\n== Updating database =="
system! 'bin/rails db:migrate'
diff --git a/bin/yarn b/bin/yarn
new file mode 100755
index 00000000000..460dd565b4a
--- /dev/null
+++ b/bin/yarn
@@ -0,0 +1,11 @@
+#!/usr/bin/env ruby
+APP_ROOT = File.expand_path('..', __dir__)
+Dir.chdir(APP_ROOT) do
+ begin
+ exec "yarnpkg", *ARGV
+ rescue Errno::ENOENT
+ $stderr.puts "Yarn executable was not detected in the system."
+ $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
+ exit 1
+ end
+end