Commit d6b0ac96f7b2952edb8aad0efcd48e0bccd23fe0
1 parent
b30b9c9c
Exists in
spb-stable
and in
3 other branches
Invoke Kernel#system with separate arguments
Showing
5 changed files
with
31 additions
and
26 deletions
Show diff stats
lib/gitlab/upgrader.rb
| ... | ... | @@ -50,21 +50,25 @@ module Gitlab |
| 50 | 50 | |
| 51 | 51 | def update_commands |
| 52 | 52 | { |
| 53 | - "Stash changed files" => "git stash", | |
| 54 | - "Get latest code" => "git fetch", | |
| 55 | - "Switch to new version" => "git checkout v#{latest_version}", | |
| 56 | - "Install gems" => "bundle", | |
| 57 | - "Migrate DB" => "bundle exec rake db:migrate RAILS_ENV=production", | |
| 58 | - "Recompile assets" => "bundle exec rake assets:clean assets:precompile RAILS_ENV=production", | |
| 59 | - "Clear cache" => "bundle exec rake cache:clear RAILS_ENV=production" | |
| 53 | + "Stash changed files" => %W(git stash), | |
| 54 | + "Get latest code" => %W(git fetch), | |
| 55 | + "Switch to new version" => %W(git checkout v#{latest_version}), | |
| 56 | + "Install gems" => %W(bundle), | |
| 57 | + "Migrate DB" => %W(bundle exec rake db:migrate), | |
| 58 | + "Recompile assets" => %W(bundle exec rake assets:clean assets:precompile), | |
| 59 | + "Clear cache" => %W(bundle exec rake cache:clear) | |
| 60 | 60 | } |
| 61 | 61 | end |
| 62 | 62 | |
| 63 | + def env | |
| 64 | + {'RAILS_ENV' => 'production'} | |
| 65 | + end | |
| 66 | + | |
| 63 | 67 | def upgrade |
| 64 | 68 | update_commands.each do |title, cmd| |
| 65 | 69 | puts title |
| 66 | - puts " -> #{cmd}" | |
| 67 | - if system(cmd) | |
| 70 | + puts " -> #{cmd.join(' ')}" | |
| 71 | + if system(env, *cmd) | |
| 68 | 72 | puts " -> OK" |
| 69 | 73 | else |
| 70 | 74 | puts " -> FAILED" | ... | ... |
lib/tasks/gitlab/generate_docs.rake
lib/tasks/gitlab/test.rake
| ... | ... | @@ -2,15 +2,15 @@ namespace :gitlab do |
| 2 | 2 | desc "GITLAB | Run all tests" |
| 3 | 3 | task :test do |
| 4 | 4 | cmds = [ |
| 5 | - "rake db:setup", | |
| 6 | - "rake db:seed_fu", | |
| 7 | - "rake spinach", | |
| 8 | - "rake spec", | |
| 9 | - "rake jasmine:ci" | |
| 5 | + %W(rake db:setup), | |
| 6 | + %W(rake db:seed_fu), | |
| 7 | + %W(rake spinach), | |
| 8 | + %W(rake spec), | |
| 9 | + %W(rake jasmine:ci) | |
| 10 | 10 | ] |
| 11 | 11 | |
| 12 | 12 | cmds.each do |cmd| |
| 13 | - system(cmd + " RAILS_ENV=test") | |
| 13 | + system({'RAILS_ENV' => 'test'}, *cmd) | |
| 14 | 14 | |
| 15 | 15 | raise "#{cmd} failed!" unless $?.exitstatus.zero? |
| 16 | 16 | end | ... | ... |
lib/tasks/sidekiq.rake
| 1 | 1 | namespace :sidekiq do |
| 2 | 2 | desc "GITLAB | Stop sidekiq" |
| 3 | 3 | task :stop do |
| 4 | - system "script/background_jobs stop" | |
| 4 | + system *%W(script/background_jobs stop) | |
| 5 | 5 | end |
| 6 | 6 | |
| 7 | 7 | desc "GITLAB | Start sidekiq" |
| 8 | 8 | task :start do |
| 9 | - system "script/background_jobs start" | |
| 9 | + system *%W(script/background_jobs start) | |
| 10 | 10 | end |
| 11 | 11 | |
| 12 | 12 | desc 'GitLab | Restart sidekiq' |
| 13 | 13 | task :restart do |
| 14 | - system "script/background_jobs restart" | |
| 14 | + system *%W(script/background_jobs restart) | |
| 15 | 15 | end |
| 16 | 16 | |
| 17 | 17 | desc "GITLAB | Start sidekiq with launchd on Mac OS X" |
| 18 | 18 | task :launchd do |
| 19 | - system "script/background_jobs start_no_deamonize" | |
| 19 | + system *%W(script/background_jobs start_no_deamonize) | |
| 20 | 20 | end |
| 21 | 21 | end | ... | ... |
spec/support/test_env.rb
| ... | ... | @@ -104,10 +104,12 @@ module TestEnv |
| 104 | 104 | |
| 105 | 105 | def reset_satellite_dir |
| 106 | 106 | setup_stubs |
| 107 | - FileUtils.cd(seed_satellite_path) do | |
| 108 | - `git reset --hard --quiet` | |
| 109 | - `git clean -fx` | |
| 110 | - `git checkout --quiet origin/master` | |
| 107 | + [ | |
| 108 | + %W(git reset --hard --quiet), | |
| 109 | + %W(git clean -fx), | |
| 110 | + %W(git checkout --quiet origin/master) | |
| 111 | + ].each do |git_cmd| | |
| 112 | + system(*git_cmd, chdir: seed_satellite_path) | |
| 111 | 113 | end |
| 112 | 114 | end |
| 113 | 115 | |
| ... | ... | @@ -186,7 +188,6 @@ module TestEnv |
| 186 | 188 | |
| 187 | 189 | def create_temp_repo(path) |
| 188 | 190 | FileUtils.mkdir_p path |
| 189 | - command = "git init --quiet --bare #{path};" | |
| 190 | - system(command) | |
| 191 | + system(*%W(git init --quiet --bare -- #{path})) | |
| 191 | 192 | end |
| 192 | 193 | end | ... | ... |