summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/api.rb4
-rw-r--r--lib/api/groups.rb2
-rw-r--r--lib/api/system_hooks.rb140
-rw-r--r--lib/gitlab/auth.rb4
-rw-r--r--lib/gitlab/inline_diff.rb4
-rw-r--r--lib/gitlab/popen.rb2
-rw-r--r--lib/tasks/gitlab/backup.rake16
-rw-r--r--lib/tasks/gitlab/bulk_add_permission.rake8
-rw-r--r--lib/tasks/gitlab/cleanup.rake4
-rw-r--r--lib/tasks/gitlab/import.rake4
-rw-r--r--lib/tasks/gitlab/setup.rake2
-rw-r--r--lib/tasks/gitlab/test.rake2
-rw-r--r--lib/tasks/travis.rake2
13 files changed, 97 insertions, 97 deletions
diff --git a/lib/api.rb b/lib/api.rb
index d241f9b7479..082769da6d3 100644
--- a/lib/api.rb
+++ b/lib/api.rb
@@ -17,13 +17,13 @@ module Gitlab
message << exception.annoted_source_code.to_s if exception.respond_to?(:annoted_source_code)
message << " " << trace.join("\n ")
- API.logger.add Logger::FATAL, message
+ API.logger.add Logger::FATAL, message
rack_response({'message' => '500 Internal Server Error'}, 500)
end
format :json
helpers APIHelpers
-
+
mount Groups
mount Users
mount Projects
diff --git a/lib/api/groups.rb b/lib/api/groups.rb
index 52fa8eff33c..efdbeb176c6 100644
--- a/lib/api/groups.rb
+++ b/lib/api/groups.rb
@@ -70,7 +70,7 @@ module Gitlab
else
not_found!
end
- end
+ end
end
end
end
diff --git a/lib/api/system_hooks.rb b/lib/api/system_hooks.rb
index da0b005d69d..9e3574e3b99 100644
--- a/lib/api/system_hooks.rb
+++ b/lib/api/system_hooks.rb
@@ -1,70 +1,70 @@
-module Gitlab
- # Hooks API
- class SystemHooks < Grape::API
- before {
- authenticate!
- authenticated_as_admin!
- }
-
- resource :hooks do
- # Get the list of system hooks
- #
- # Example Request:
- # GET /hooks
- get do
- @hooks = SystemHook.all
- present @hooks, with: Entities::Hook
- end
-
- # Create new system hook
- #
- # Parameters:
- # url (required) - url for system hook
- # Example Request
- # POST /hooks
- post do
- attrs = attributes_for_keys [:url]
- required_attributes! [:url]
- @hook = SystemHook.new attrs
- if @hook.save
- present @hook, with: Entities::Hook
- else
- not_found!
- end
- end
-
- # Test a hook
- #
- # Example Request
- # GET /hooks/:id
- get ":id" do
- @hook = SystemHook.find(params[:id])
- data = {
- event_name: "project_create",
- name: "Ruby",
- path: "ruby",
- project_id: 1,
- owner_name: "Someone",
- owner_email: "example@gitlabhq.com"
- }
- @hook.execute(data)
- data
- end
-
- # Delete a hook. This is an idempotent function.
- #
- # Parameters:
- # id (required) - ID of the hook
- # Example Request:
- # DELETE /hooks/:id
- delete ":id" do
- begin
- @hook = SystemHook.find(params[:id])
- @hook.destroy
- rescue
- # SystemHook raises an Error if no hook with id found
- end
- end
- end
- end
-end \ No newline at end of file
+module Gitlab
+ # Hooks API
+ class SystemHooks < Grape::API
+ before {
+ authenticate!
+ authenticated_as_admin!
+ }
+
+ resource :hooks do
+ # Get the list of system hooks
+ #
+ # Example Request:
+ # GET /hooks
+ get do
+ @hooks = SystemHook.all
+ present @hooks, with: Entities::Hook
+ end
+
+ # Create new system hook
+ #
+ # Parameters:
+ # url (required) - url for system hook
+ # Example Request
+ # POST /hooks
+ post do
+ attrs = attributes_for_keys [:url]
+ required_attributes! [:url]
+ @hook = SystemHook.new attrs
+ if @hook.save
+ present @hook, with: Entities::Hook
+ else
+ not_found!
+ end
+ end
+
+ # Test a hook
+ #
+ # Example Request
+ # GET /hooks/:id
+ get ":id" do
+ @hook = SystemHook.find(params[:id])
+ data = {
+ event_name: "project_create",
+ name: "Ruby",
+ path: "ruby",
+ project_id: 1,
+ owner_name: "Someone",
+ owner_email: "example@gitlabhq.com"
+ }
+ @hook.execute(data)
+ data
+ end
+
+ # Delete a hook. This is an idempotent function.
+ #
+ # Parameters:
+ # id (required) - ID of the hook
+ # Example Request:
+ # DELETE /hooks/:id
+ delete ":id" do
+ begin
+ @hook = SystemHook.find(params[:id])
+ @hook.destroy
+ rescue
+ # SystemHook raises an Error if no hook with id found
+ end
+ end
+ end
+ end
+end
diff --git a/lib/gitlab/auth.rb b/lib/gitlab/auth.rb
index 0fee33dbeb0..78d2196fbbe 100644
--- a/lib/gitlab/auth.rb
+++ b/lib/gitlab/auth.rb
@@ -10,7 +10,7 @@ module Gitlab
@user
elsif @user = User.find_by_email(email)
log.info "Updating legacy LDAP user #{email} with extern_uid => #{uid}"
- @user.update_attributes(:extern_uid => uid, :provider => provider)
+ @user.update_attributes(extern_uid: uid, provider: provider)
@user
else
create_from_omniauth(auth, true)
@@ -57,7 +57,7 @@ module Gitlab
if @user = User.find_by_provider_and_extern_uid(provider, uid)
@user
elsif @user = User.find_by_email(email)
- @user.update_attributes(:extern_uid => uid, :provider => provider)
+ @user.update_attributes(extern_uid: uid, provider: provider)
@user
else
if Gitlab.config.omniauth['allow_single_sign_on']
diff --git a/lib/gitlab/inline_diff.rb b/lib/gitlab/inline_diff.rb
index 7a0a3214aa1..b39fd0d552d 100644
--- a/lib/gitlab/inline_diff.rb
+++ b/lib/gitlab/inline_diff.rb
@@ -4,7 +4,7 @@ module Gitlab
START = "#!idiff-start!#"
FINISH = "#!idiff-finish!#"
-
+
def processing diff_arr
indexes = _indexes_of_changed_lines diff_arr
@@ -60,7 +60,7 @@ module Gitlab
line.gsub!(FINISH, "</span>")
line
end
-
+
end
end
diff --git a/lib/gitlab/popen.rb b/lib/gitlab/popen.rb
index f2cfd8073e3..2f30fde2078 100644
--- a/lib/gitlab/popen.rb
+++ b/lib/gitlab/popen.rb
@@ -2,7 +2,7 @@ module Gitlab
module Popen
def popen(cmd, path)
vars = { "PWD" => path }
- options = { :chdir => path }
+ options = { chdir: path }
@cmd_output = ""
@cmd_status = 0
diff --git a/lib/tasks/gitlab/backup.rake b/lib/tasks/gitlab/backup.rake
index 9f28de593e9..0c791926c41 100644
--- a/lib/tasks/gitlab/backup.rake
+++ b/lib/tasks/gitlab/backup.rake
@@ -4,7 +4,7 @@ namespace :gitlab do
namespace :backup do
# Create backup of GitLab system
desc "GITLAB | Create a backup of the GitLab system"
- task :create => :environment do
+ task create: :environment do
warn_user_is_not_gitlab
Rake::Task["gitlab:backup:db:create"].invoke
@@ -57,7 +57,7 @@ namespace :gitlab do
# Restore backup of GitLab system
desc "GITLAB | Restore a previously created backup"
- task :restore => :environment do
+ task restore: :environment do
warn_user_is_not_gitlab
Dir.chdir(Gitlab.config.backup.path)
@@ -113,13 +113,13 @@ namespace :gitlab do
end
namespace :repo do
- task :create => :environment do
+ task create: :environment do
puts "Dumping repositories ...".blue
Backup::Repository.new.dump
puts "done".green
end
- task :restore => :environment do
+ task restore: :environment do
puts "Restoring repositories ...".blue
Backup::Repository.new.restore
puts "done".green
@@ -127,13 +127,13 @@ namespace :gitlab do
end
namespace :db do
- task :create => :environment do
+ task create: :environment do
puts "Dumping database ... ".blue
Backup::Database.new.dump
puts "done".green
end
- task :restore => :environment do
+ task restore: :environment do
puts "Restoring database ... ".blue
Backup::Database.new.restore
puts "done".green
@@ -141,13 +141,13 @@ namespace :gitlab do
end
namespace :uploads do
- task :create => :environment do
+ task create: :environment do
puts "Dumping uploads ... ".blue
Backup::Uploads.new.dump
puts "done".green
end
- task :restore => :environment do
+ task restore: :environment do
puts "Restoring uploads ... ".blue
Backup::Uploads.new.restore
puts "done".green
diff --git a/lib/tasks/gitlab/bulk_add_permission.rake b/lib/tasks/gitlab/bulk_add_permission.rake
index eb1a7559dbd..c270232edba 100644
--- a/lib/tasks/gitlab/bulk_add_permission.rake
+++ b/lib/tasks/gitlab/bulk_add_permission.rake
@@ -1,9 +1,9 @@
namespace :gitlab do
namespace :import do
desc "GITLAB | Add all users to all projects (admin users are added as masters)"
- task :all_users_to_all_projects => :environment do |t, args|
- user_ids = User.where(:admin => false).pluck(:id)
- admin_ids = User.where(:admin => true).pluck(:id)
+ task all_users_to_all_projects: :environment do |t, args|
+ user_ids = User.where(admin: false).pluck(:id)
+ admin_ids = User.where(admin: true).pluck(:id)
projects_ids = Project.pluck(:id)
puts "Importing #{user_ids.size} users into #{projects_ids.size} projects"
@@ -21,4 +21,4 @@ namespace :gitlab do
UsersProject.add_users_into_projects(project_ids, Array.wrap(user.id), UsersProject::DEVELOPER)
end
end
-end \ No newline at end of file
+end
diff --git a/lib/tasks/gitlab/cleanup.rake b/lib/tasks/gitlab/cleanup.rake
index d8ee56e5523..186abc65563 100644
--- a/lib/tasks/gitlab/cleanup.rake
+++ b/lib/tasks/gitlab/cleanup.rake
@@ -1,7 +1,7 @@
namespace :gitlab do
namespace :cleanup do
desc "GITLAB | Cleanup | Clean namespaces"
- task :dirs => :environment do
+ task dirs: :environment do
warn_user_is_not_gitlab
remove_flag = ENV['REMOVE']
@@ -44,7 +44,7 @@ namespace :gitlab do
end
desc "GITLAB | Cleanup | Clean respositories"
- task :repos => :environment do
+ task repos: :environment do
warn_user_is_not_gitlab
remove_flag = ENV['REMOVE']
diff --git a/lib/tasks/gitlab/import.rake b/lib/tasks/gitlab/import.rake
index bddbd7ef855..acf6abedd19 100644
--- a/lib/tasks/gitlab/import.rake
+++ b/lib/tasks/gitlab/import.rake
@@ -10,7 +10,7 @@ namespace :gitlab do
# * existing projects will be skipped
#
desc "GITLAB | Import bare repositories from git_host -> base_path into GitLab project instance"
- task :repos => :environment do
+ task repos: :environment do
git_base_path = Gitlab.config.gitlab_shell.repos_path
repos_to_import = Dir.glob(git_base_path + '/*')
@@ -40,7 +40,7 @@ namespace :gitlab do
user = User.admins.first
project_params = {
- :name => path,
+ name: path,
}
project = Projects::CreateContext.new(user, project_params).execute
diff --git a/lib/tasks/gitlab/setup.rake b/lib/tasks/gitlab/setup.rake
index 5b74daf956e..2b730774e06 100644
--- a/lib/tasks/gitlab/setup.rake
+++ b/lib/tasks/gitlab/setup.rake
@@ -1,6 +1,6 @@
namespace :gitlab do
desc "GITLAB | Setup production application"
- task :setup => :environment do
+ task setup: :environment do
setup_db
end
diff --git a/lib/tasks/gitlab/test.rake b/lib/tasks/gitlab/test.rake
index ad1bfb2e4b3..03b3fc5ea20 100644
--- a/lib/tasks/gitlab/test.rake
+++ b/lib/tasks/gitlab/test.rake
@@ -1,4 +1,4 @@
namespace :gitlab do
desc "GITLAB | Run both spinach and rspec"
- task :test => ['spinach', 'spec']
+ task test: ['spinach', 'spec']
end
diff --git a/lib/tasks/travis.rake b/lib/tasks/travis.rake
index 6b434830803..bc1b8aadbc5 100644
--- a/lib/tasks/travis.rake
+++ b/lib/tasks/travis.rake
@@ -1,5 +1,5 @@
desc "Travis run tests"
-task :travis => [
+task travis: [
:spinach,
:spec
]