summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJacob Vosmaer <contact@jacobvosmaer.nl>2014-02-25 12:15:18 +0100
committerJacob Vosmaer <contact@jacobvosmaer.nl>2014-03-03 08:40:30 +0100
commitd6b0ac96f7b2952edb8aad0efcd48e0bccd23fe0 (patch)
tree430c28c845eea9ca53103b7e5098cefd230dadc8 /lib
parentb30b9c9c464e3b6611c80b6436c8346eb2bbcccf (diff)
downloadgitlab-ce-d6b0ac96f7b2952edb8aad0efcd48e0bccd23fe0.tar.gz
Invoke Kernel#system with separate arguments
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/upgrader.rb22
-rw-r--r--lib/tasks/gitlab/generate_docs.rake2
-rw-r--r--lib/tasks/gitlab/test.rake12
-rw-r--r--lib/tasks/sidekiq.rake8
4 files changed, 24 insertions, 20 deletions
diff --git a/lib/gitlab/upgrader.rb b/lib/gitlab/upgrader.rb
index f17ad0d79cc..0fe4888665d 100644
--- a/lib/gitlab/upgrader.rb
+++ b/lib/gitlab/upgrader.rb
@@ -50,21 +50,25 @@ module Gitlab
def update_commands
{
- "Stash changed files" => "git stash",
- "Get latest code" => "git fetch",
- "Switch to new version" => "git checkout v#{latest_version}",
- "Install gems" => "bundle",
- "Migrate DB" => "bundle exec rake db:migrate RAILS_ENV=production",
- "Recompile assets" => "bundle exec rake assets:clean assets:precompile RAILS_ENV=production",
- "Clear cache" => "bundle exec rake cache:clear RAILS_ENV=production"
+ "Stash changed files" => %W(git stash),
+ "Get latest code" => %W(git fetch),
+ "Switch to new version" => %W(git checkout v#{latest_version}),
+ "Install gems" => %W(bundle),
+ "Migrate DB" => %W(bundle exec rake db:migrate),
+ "Recompile assets" => %W(bundle exec rake assets:clean assets:precompile),
+ "Clear cache" => %W(bundle exec rake cache:clear)
}
end
+ def env
+ {'RAILS_ENV' => 'production'}
+ end
+
def upgrade
update_commands.each do |title, cmd|
puts title
- puts " -> #{cmd}"
- if system(cmd)
+ puts " -> #{cmd.join(' ')}"
+ if system(env, *cmd)
puts " -> OK"
else
puts " -> FAILED"
diff --git a/lib/tasks/gitlab/generate_docs.rake b/lib/tasks/gitlab/generate_docs.rake
index 58795fac4af..332cd61f84c 100644
--- a/lib/tasks/gitlab/generate_docs.rake
+++ b/lib/tasks/gitlab/generate_docs.rake
@@ -1,7 +1,7 @@
namespace :gitlab do
desc "GITLAB | Generate sdocs for project"
task generate_docs: :environment do
- system("bundle exec sdoc -o doc/code app lib")
+ system(*%W(bundle exec sdoc -o doc/code app lib))
end
end
diff --git a/lib/tasks/gitlab/test.rake b/lib/tasks/gitlab/test.rake
index 011748c9711..f52af0c3ded 100644
--- a/lib/tasks/gitlab/test.rake
+++ b/lib/tasks/gitlab/test.rake
@@ -2,15 +2,15 @@ namespace :gitlab do
desc "GITLAB | Run all tests"
task :test do
cmds = [
- "rake db:setup",
- "rake db:seed_fu",
- "rake spinach",
- "rake spec",
- "rake jasmine:ci"
+ %W(rake db:setup),
+ %W(rake db:seed_fu),
+ %W(rake spinach),
+ %W(rake spec),
+ %W(rake jasmine:ci)
]
cmds.each do |cmd|
- system(cmd + " RAILS_ENV=test")
+ system({'RAILS_ENV' => 'test'}, *cmd)
raise "#{cmd} failed!" unless $?.exitstatus.zero?
end
diff --git a/lib/tasks/sidekiq.rake b/lib/tasks/sidekiq.rake
index e91678473a8..ba806e53ccf 100644
--- a/lib/tasks/sidekiq.rake
+++ b/lib/tasks/sidekiq.rake
@@ -1,21 +1,21 @@
namespace :sidekiq do
desc "GITLAB | Stop sidekiq"
task :stop do
- system "script/background_jobs stop"
+ system *%W(script/background_jobs stop)
end
desc "GITLAB | Start sidekiq"
task :start do
- system "script/background_jobs start"
+ system *%W(script/background_jobs start)
end
desc 'GitLab | Restart sidekiq'
task :restart do
- system "script/background_jobs restart"
+ system *%W(script/background_jobs restart)
end
desc "GITLAB | Start sidekiq with launchd on Mac OS X"
task :launchd do
- system "script/background_jobs start_no_deamonize"
+ system *%W(script/background_jobs start_no_deamonize)
end
end