Commit af5d0e9e92f3fb818c73f1b8b991ea61ddc35dd4

Authored by Dmitriy Zaporozhets
2 parents dc41ffa3 a50d96a8

Merge pull request #3275 from Undev/feature/code_cleanup_remove_old_hashes

Code cleanup: Replace old hashes and remove trailing spaces
Showing 46 changed files with 302 additions and 303 deletions   Show diff stats
app/contexts/issues_bulk_update_context.rb
@@ -7,7 +7,7 @@ class IssuesBulkUpdateContext < BaseContext @@ -7,7 +7,7 @@ class IssuesBulkUpdateContext < BaseContext
7 assignee_id = update_data[:assignee_id] 7 assignee_id = update_data[:assignee_id]
8 status = update_data[:status] 8 status = update_data[:status]
9 9
10 - opts = {} 10 + opts = {}
11 opts[:milestone_id] = milestone_id if milestone_id.present? 11 opts[:milestone_id] = milestone_id if milestone_id.present?
12 opts[:assignee_id] = assignee_id if assignee_id.present? 12 opts[:assignee_id] = assignee_id if assignee_id.present?
13 opts[:closed] = (status == "closed") if status.present? 13 opts[:closed] = (status == "closed") if status.present?
@@ -15,7 +15,7 @@ class IssuesBulkUpdateContext < BaseContext @@ -15,7 +15,7 @@ class IssuesBulkUpdateContext < BaseContext
15 issues = Issue.where(id: issues_ids).all 15 issues = Issue.where(id: issues_ids).all
16 issues = issues.select { |issue| can?(current_user, :modify_issue, issue) } 16 issues = issues.select { |issue| can?(current_user, :modify_issue, issue) }
17 issues.each { |issue| issue.update_attributes(opts) } 17 issues.each { |issue| issue.update_attributes(opts) }
18 - { 18 + {
19 count: issues.count, 19 count: issues.count,
20 success: !issues.count.zero? 20 success: !issues.count.zero?
21 } 21 }
app/models/milestone.rb
@@ -72,9 +72,9 @@ class Milestone < ActiveRecord::Base @@ -72,9 +72,9 @@ class Milestone < ActiveRecord::Base
72 if due_date.past? 72 if due_date.past?
73 "expired at #{due_date.stamp("Aug 21, 2011")}" 73 "expired at #{due_date.stamp("Aug 21, 2011")}"
74 else 74 else
75 - "expires at #{due_date.stamp("Aug 21, 2011")}" 75 + "expires at #{due_date.stamp("Aug 21, 2011")}"
76 end 76 end
77 - end 77 + end
78 end 78 end
79 79
80 def can_be_closed? 80 def can_be_closed?
app/views/devise/confirmations/new.html.erb
1 <h2>Resend confirmation instructions</h2> 1 <h2>Resend confirmation instructions</h2>
2 2
3 -<%= form_for(resource, :as => resource_name, :url => confirmation_path(resource_name), :html => { :method => :post }) do |f| %> 3 +<%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %>
4 <%= devise_error_messages! %> 4 <%= devise_error_messages! %>
5 5
6 <div><%= f.label :email %><br /> 6 <div><%= f.label :email %><br />
@@ -9,4 +9,4 @@ @@ -9,4 +9,4 @@
9 <div><%= f.submit "Resend confirmation instructions" %></div> 9 <div><%= f.submit "Resend confirmation instructions" %></div>
10 <% end %> 10 <% end %>
11 11
12 -<%= render :partial => "devise/shared/links" %> 12 +<%= render partial: "devise/shared/links" %>
app/views/devise/mailer/confirmation_instructions.html.erb
@@ -2,4 +2,4 @@ @@ -2,4 +2,4 @@
2 2
3 <p>You can confirm your account through the link below:</p> 3 <p>You can confirm your account through the link below:</p>
4 4
5 -<p><%= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @resource.confirmation_token) %></p> 5 +<p><%= link_to 'Confirm my account', confirmation_url(@resource, confirmation_token: @resource.confirmation_token) %></p>
app/views/devise/mailer/reset_password_instructions.html.erb
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 2
3 <p>Someone has requested a link to change your password, and you can do this through the link below.</p> 3 <p>Someone has requested a link to change your password, and you can do this through the link below.</p>
4 4
5 -<p><%= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @resource.reset_password_token) %></p> 5 +<p><%= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @resource.reset_password_token) %></p>
6 6
7 <p>If you didn't request this, please ignore this email.</p> 7 <p>If you didn't request this, please ignore this email.</p>
8 <p>Your password won't change until you access the link above and create a new one.</p> 8 <p>Your password won't change until you access the link above and create a new one.</p>
app/views/devise/mailer/unlock_instructions.html.erb
@@ -4,4 +4,4 @@ @@ -4,4 +4,4 @@
4 4
5 <p>Click the link below to unlock your account:</p> 5 <p>Click the link below to unlock your account:</p>
6 6
7 -<p><%= link_to 'Unlock my account', unlock_url(@resource, :unlock_token => @resource.unlock_token) %></p> 7 +<p><%= link_to 'Unlock my account', unlock_url(@resource, unlock_token: @resource.unlock_token) %></p>
app/views/devise/registrations/edit.html.erb
1 <h2>Edit <%= resource_name.to_s.humanize %></h2> 1 <h2>Edit <%= resource_name.to_s.humanize %></h2>
2 2
3 -<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) do |f| %> 3 +<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
4 <%= devise_error_messages! %> 4 <%= devise_error_messages! %>
5 5
6 <div><%= f.label :email %><br /> 6 <div><%= f.label :email %><br />
@@ -18,11 +18,11 @@ @@ -18,11 +18,11 @@
18 <div><%= f.label :current_password %> <i>(we need your current password to confirm your changes)</i><br /> 18 <div><%= f.label :current_password %> <i>(we need your current password to confirm your changes)</i><br />
19 <%= f.password_field :current_password %></div> 19 <%= f.password_field :current_password %></div>
20 20
21 -<div><%= f.submit "Update", :class => "input_button" %></div> 21 +<div><%= f.submit "Update", class: "input_button" %></div>
22 <% end %> 22 <% end %>
23 23
24 <h3>Cancel my account</h3> 24 <h3>Cancel my account</h3>
25 25
26 -<p>Unhappy? <%= link_to "Cancel my account", registration_path(resource_name), :confirm => "Are you sure?", :method => :delete %>.</p> 26 +<p>Unhappy? <%= link_to "Cancel my account", registration_path(resource_name), confirm: "Are you sure?", method: :delete %>.</p>
27 27
28 <%= link_to "Back", :back %> 28 <%= link_to "Back", :back %>
app/views/devise/shared/_links.erb
1 <%- if controller_name != 'sessions' %> 1 <%- if controller_name != 'sessions' %>
2 - <%= link_to "Sign in", new_session_path(resource_name), :class => "btn" %><br /> 2 + <%= link_to "Sign in", new_session_path(resource_name), class: "btn" %><br />
3 <% end -%> 3 <% end -%>
4 4
5 <%- if devise_mapping.registerable? && controller_name != 'registrations' %> 5 <%- if devise_mapping.registerable? && controller_name != 'registrations' %>
@@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
7 <% end -%> 7 <% end -%>
8 8
9 <%- if devise_mapping.recoverable? && controller_name != 'passwords' %> 9 <%- if devise_mapping.recoverable? && controller_name != 'passwords' %>
10 -<%= link_to "Forgot your password?", new_password_path(resource_name), :class => "btn" %><br /> 10 +<%= link_to "Forgot your password?", new_password_path(resource_name), class: "btn" %><br />
11 <% end -%> 11 <% end -%>
12 12
13 <%- if devise_mapping.confirmable? && controller_name != 'confirmations' %> 13 <%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
app/views/devise/unlocks/new.html.erb
1 <h2>Resend unlock instructions</h2> 1 <h2>Resend unlock instructions</h2>
2 2
3 -<%= form_for(resource, :as => resource_name, :url => unlock_path(resource_name), :html => { :method => :post }) do |f| %> 3 +<%= form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| %>
4 <%= devise_error_messages! %> 4 <%= devise_error_messages! %>
5 5
6 <div><%= f.label :email %><br /> 6 <div><%= f.label :email %><br />
@@ -9,4 +9,4 @@ @@ -9,4 +9,4 @@
9 <div><%= f.submit "Resend unlock instructions" %></div> 9 <div><%= f.submit "Resend unlock instructions" %></div>
10 <% end %> 10 <% end %>
11 11
12 -<%= render :partial => "devise/shared/links" %> 12 +<%= render partial: "devise/shared/links" %>
config/application.rb
@@ -4,7 +4,7 @@ require &#39;rails/all&#39; @@ -4,7 +4,7 @@ require &#39;rails/all&#39;
4 4
5 if defined?(Bundler) 5 if defined?(Bundler)
6 # If you precompile assets before deploying to production, use this line 6 # If you precompile assets before deploying to production, use this line
7 - # Bundler.require(*Rails.groups(:assets => %w(development test))) 7 + # Bundler.require(*Rails.groups(assets: %w(development test)))
8 # If you want your assets lazily compiled in production, use this line 8 # If you want your assets lazily compiled in production, use this line
9 Bundler.require(:default, :assets, Rails.env) 9 Bundler.require(:default, :assets, Rails.env)
10 end 10 end
config/environments/production.rb
@@ -68,8 +68,8 @@ Gitlab::Application.configure do @@ -68,8 +68,8 @@ Gitlab::Application.configure do
68 config.action_mailer.delivery_method = :sendmail 68 config.action_mailer.delivery_method = :sendmail
69 # Defaults to: 69 # Defaults to:
70 # # config.action_mailer.sendmail_settings = { 70 # # config.action_mailer.sendmail_settings = {
71 - # # :location => '/usr/sbin/sendmail',  
72 - # # :arguments => '-i -t' 71 + # # location: '/usr/sbin/sendmail',
  72 + # # arguments: '-i -t'
73 # # } 73 # # }
74 config.action_mailer.perform_deliveries = true 74 config.action_mailer.perform_deliveries = true
75 config.action_mailer.raise_delivery_errors = true 75 config.action_mailer.raise_delivery_errors = true
config/initializers/devise.rb
@@ -94,7 +94,7 @@ Devise.setup do |config| @@ -94,7 +94,7 @@ Devise.setup do |config|
94 # config.extend_remember_period = false 94 # config.extend_remember_period = false
95 95
96 # Options to be passed to the created cookie. For instance, you can set 96 # Options to be passed to the created cookie. For instance, you can set
97 - # :secure => true in order to force SSL only cookies. 97 + # secure: true in order to force SSL only cookies.
98 # config.cookie_options = {} 98 # config.cookie_options = {}
99 99
100 # ==> Configuration for :validatable 100 # ==> Configuration for :validatable
@@ -202,18 +202,18 @@ Devise.setup do |config| @@ -202,18 +202,18 @@ Devise.setup do |config|
202 # config.warden do |manager| 202 # config.warden do |manager|
203 # manager.failure_app = AnotherApp 203 # manager.failure_app = AnotherApp
204 # manager.intercept_401 = false 204 # manager.intercept_401 = false
205 - # manager.default_strategies(:scope => :user).unshift :some_external_strategy 205 + # manager.default_strategies(scope: :user).unshift :some_external_strategy
206 # end 206 # end
207 207
208 if Gitlab.config.ldap.enabled 208 if Gitlab.config.ldap.enabled
209 config.omniauth :ldap, 209 config.omniauth :ldap,
210 - :host => Gitlab.config.ldap['host'],  
211 - :base => Gitlab.config.ldap['base'],  
212 - :uid => Gitlab.config.ldap['uid'],  
213 - :port => Gitlab.config.ldap['port'],  
214 - :method => Gitlab.config.ldap['method'],  
215 - :bind_dn => Gitlab.config.ldap['bind_dn'],  
216 - :password => Gitlab.config.ldap['password'] 210 + host: Gitlab.config.ldap['host'],
  211 + base: Gitlab.config.ldap['base'],
  212 + uid: Gitlab.config.ldap['uid'],
  213 + port: Gitlab.config.ldap['port'],
  214 + method: Gitlab.config.ldap['method'],
  215 + bind_dn: Gitlab.config.ldap['bind_dn'],
  216 + password: Gitlab.config.ldap['password']
217 end 217 end
218 218
219 Gitlab.config.omniauth.providers.each do |provider| 219 Gitlab.config.omniauth.providers.each do |provider|
config/routes.rb
@@ -179,8 +179,7 @@ Gitlab::Application.routes.draw do @@ -179,8 +179,7 @@ Gitlab::Application.routes.draw do
179 resources :compare, only: [:index, :create] 179 resources :compare, only: [:index, :create]
180 resources :blame, only: [:show], constraints: {id: /.+/} 180 resources :blame, only: [:show], constraints: {id: /.+/}
181 resources :graph, only: [:show], constraints: {id: /(?:[^.]|\.(?!json$))+/, format: /json/} 181 resources :graph, only: [:show], constraints: {id: /(?:[^.]|\.(?!json$))+/, format: /json/}
182 - match "/compare/:from...:to" => "compare#show", as: "compare",  
183 - :via => [:get, :post], constraints: {from: /.+/, to: /.+/} 182 + match "/compare/:from...:to" => "compare#show", as: "compare", via: [:get, :post], constraints: {from: /.+/, to: /.+/}
184 183
185 resources :wikis, only: [:show, :edit, :destroy, :create] do 184 resources :wikis, only: [:show, :edit, :destroy, :create] do
186 collection do 185 collection do
db/fixtures/development/07_milestones.rb
1 Milestone.seed(:id, [ 1 Milestone.seed(:id, [
2 - { :id => 1, :project_id => 1, :title => 'v' + Faker::Address.zip_code },  
3 - { :id => 2, :project_id => 1, :title => 'v' + Faker::Address.zip_code },  
4 - { :id => 3, :project_id => 1, :title => 'v' + Faker::Address.zip_code },  
5 - { :id => 4, :project_id => 2, :title => 'v' + Faker::Address.zip_code },  
6 - { :id => 5, :project_id => 2, :title => 'v' + Faker::Address.zip_code }, 2 + { id: 1, project_id: 1, title: 'v' + Faker::Address.zip_code },
  3 + { id: 2, project_id: 1, title: 'v' + Faker::Address.zip_code },
  4 + { id: 3, project_id: 1, title: 'v' + Faker::Address.zip_code },
  5 + { id: 4, project_id: 2, title: 'v' + Faker::Address.zip_code },
  6 + { id: 5, project_id: 2, title: 'v' + Faker::Address.zip_code },
7 7
8 - { :id => 6, :project_id => 2, :title => 'v' + Faker::Address.zip_code },  
9 - { :id => 7, :project_id => 2, :title => 'v' + Faker::Address.zip_code },  
10 - { :id => 8, :project_id => 3, :title => 'v' + Faker::Address.zip_code },  
11 - { :id => 9, :project_id => 3, :title => 'v' + Faker::Address.zip_code },  
12 - { :id => 11, :project_id => 3, :title => 'v' + Faker::Address.zip_code }, 8 + { id: 6, project_id: 2, title: 'v' + Faker::Address.zip_code },
  9 + { id: 7, project_id: 2, title: 'v' + Faker::Address.zip_code },
  10 + { id: 8, project_id: 3, title: 'v' + Faker::Address.zip_code },
  11 + { id: 9, project_id: 3, title: 'v' + Faker::Address.zip_code },
  12 + { id: 11, project_id: 3, title: 'v' + Faker::Address.zip_code },
13 ]) 13 ])
features/steps/admin/admin_groups.rb
@@ -20,12 +20,12 @@ class AdminGroups &lt; Spinach::FeatureSteps @@ -20,12 +20,12 @@ class AdminGroups &lt; Spinach::FeatureSteps
20 end 20 end
21 21
22 And 'Create gitlab user "John"' do 22 And 'Create gitlab user "John"' do
23 - create(:user, :name => "John") 23 + create(:user, name: "John")
24 end 24 end
25 25
26 And 'submit form with new group info' do 26 And 'submit form with new group info' do
27 - fill_in 'group_name', :with => 'gitlab'  
28 - fill_in 'group_description', :with => 'Group description' 27 + fill_in 'group_name', with: 'gitlab'
  28 + fill_in 'group_description', with: 'Group description'
29 click_button "Create group" 29 click_button "Create group"
30 end 30 end
31 31
@@ -41,8 +41,8 @@ class AdminGroups &lt; Spinach::FeatureSteps @@ -41,8 +41,8 @@ class AdminGroups &lt; Spinach::FeatureSteps
41 When 'I select user "John" from user list as "Reporter"' do 41 When 'I select user "John" from user list as "Reporter"' do
42 user = User.find_by_name("John") 42 user = User.find_by_name("John")
43 within "#new_team_member" do 43 within "#new_team_member" do
44 - select user.name, :from => "user_ids"  
45 - select "Reporter", :from => "project_access" 44 + select user.name, from: "user_ids"
  45 + select "Reporter", from: "project_access"
46 end 46 end
47 click_button "Add user to projects in group" 47 click_button "Add user to projects in group"
48 end 48 end
features/steps/group/group.rb
@@ -39,8 +39,8 @@ class Groups &lt; Spinach::FeatureSteps @@ -39,8 +39,8 @@ class Groups &lt; Spinach::FeatureSteps
39 And 'I select user "John" from list with role "Reporter"' do 39 And 'I select user "John" from list with role "Reporter"' do
40 user = User.find_by_name("John") 40 user = User.find_by_name("John")
41 within "#new_team_member" do 41 within "#new_team_member" do
42 - select user.name, :from => "user_ids"  
43 - select "Reporter", :from => "project_access" 42 + select user.name, from: "user_ids"
  43 + select "Reporter", from: "project_access"
44 end 44 end
45 click_button "Add" 45 click_button "Add"
46 end 46 end
@@ -85,7 +85,7 @@ class Groups &lt; Spinach::FeatureSteps @@ -85,7 +85,7 @@ class Groups &lt; Spinach::FeatureSteps
85 end 85 end
86 86
87 And 'I change group name' do 87 And 'I change group name' do
88 - fill_in 'group_name', :with => 'new-name' 88 + fill_in 'group_name', with: 'new-name'
89 click_button "Save group" 89 click_button "Save group"
90 end 90 end
91 91
features/steps/profile/profile.rb
@@ -9,9 +9,9 @@ class Profile &lt; Spinach::FeatureSteps @@ -9,9 +9,9 @@ class Profile &lt; Spinach::FeatureSteps
9 end 9 end
10 10
11 Then 'I change my contact info' do 11 Then 'I change my contact info' do
12 - fill_in "user_skype", :with => "testskype"  
13 - fill_in "user_linkedin", :with => "testlinkedin"  
14 - fill_in "user_twitter", :with => "testtwitter" 12 + fill_in "user_skype", with: "testskype"
  13 + fill_in "user_linkedin", with: "testlinkedin"
  14 + fill_in "user_twitter", with: "testtwitter"
15 click_button "Save" 15 click_button "Save"
16 @user.reload 16 @user.reload
17 end 17 end
@@ -24,8 +24,8 @@ class Profile &lt; Spinach::FeatureSteps @@ -24,8 +24,8 @@ class Profile &lt; Spinach::FeatureSteps
24 24
25 Then 'I change my password' do 25 Then 'I change my password' do
26 within '.update-password' do 26 within '.update-password' do
27 - fill_in "user_password", :with => "222333"  
28 - fill_in "user_password_confirmation", :with => "222333" 27 + fill_in "user_password", with: "222333"
  28 + fill_in "user_password_confirmation", with: "222333"
29 click_button "Save" 29 click_button "Save"
30 end 30 end
31 end 31 end
features/steps/profile/profile_ssh_keys.rb
@@ -12,8 +12,8 @@ class ProfileSshKeys &lt; Spinach::FeatureSteps @@ -12,8 +12,8 @@ class ProfileSshKeys &lt; Spinach::FeatureSteps
12 end 12 end
13 13
14 And 'I submit new ssh key "Laptop"' do 14 And 'I submit new ssh key "Laptop"' do
15 - fill_in "key_title", :with => "Laptop"  
16 - fill_in "key_key", :with => "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAzrEJUIR6Y03TCE9rIJ+GqTBvgb8t1jI9h5UBzCLuK4VawOmkLornPqLDrGbm6tcwM/wBrrLvVOqi2HwmkKEIecVO0a64A4rIYScVsXIniHRS6w5twyn1MD3sIbN+socBDcaldECQa2u1dI3tnNVcs8wi77fiRe7RSxePsJceGoheRQgC8AZ510UdIlO+9rjIHUdVN7LLyz512auAfYsgx1OfablkQ/XJcdEwDNgi9imI6nAXhmoKUm1IPLT2yKajTIC64AjLOnE0YyCh6+7RFMpiMyu1qiOCpdjYwTgBRiciNRZCH8xIedyCoAmiUgkUT40XYHwLuwiPJICpkAzp7Q== user@laptop" 15 + fill_in "key_title", with: "Laptop"
  16 + fill_in "key_key", with: "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAzrEJUIR6Y03TCE9rIJ+GqTBvgb8t1jI9h5UBzCLuK4VawOmkLornPqLDrGbm6tcwM/wBrrLvVOqi2HwmkKEIecVO0a64A4rIYScVsXIniHRS6w5twyn1MD3sIbN+socBDcaldECQa2u1dI3tnNVcs8wi77fiRe7RSxePsJceGoheRQgC8AZ510UdIlO+9rjIHUdVN7LLyz512auAfYsgx1OfablkQ/XJcdEwDNgi9imI6nAXhmoKUm1IPLT2yKajTIC64AjLOnE0YyCh6+7RFMpiMyu1qiOCpdjYwTgBRiciNRZCH8xIedyCoAmiUgkUT40XYHwLuwiPJICpkAzp7Q== user@laptop"
17 click_button "Save" 17 click_button "Save"
18 end 18 end
19 19
@@ -43,6 +43,6 @@ class ProfileSshKeys &lt; Spinach::FeatureSteps @@ -43,6 +43,6 @@ class ProfileSshKeys &lt; Spinach::FeatureSteps
43 end 43 end
44 44
45 And 'I have ssh key "ssh-rsa Work"' do 45 And 'I have ssh key "ssh-rsa Work"' do
46 - create(:key, :user => @user, :title => "ssh-rsa Work", :key => "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC+L3TbFegm3k8QjejSwemk4HhlRh+DuN679Pc5ckqE/MPhVtE/+kZQDYCTB284GiT2aIoGzmZ8ee9TkaoejAsBwlA+Wz2Q3vhz65X6sMgalRwpdJx8kSEUYV8ZPV3MZvPo8KdNg993o4jL6G36GDW4BPIyO6FPZhfsawdf6liVD0Xo5kibIK7B9VoE178cdLQtLpS2YolRwf5yy6XR6hbbBGQR+6xrGOdP16eGZDb1CE2bMvvJijjloFqPscGktWOqW+nfh5txwFfBzlfARDTBsS8WZtg3Yoj1kn33kPsWRlgHfNutFRAIynDuDdQzQq8tTtVwm+Yi75RfcPHW8y3P Work") 46 + create(:key, user: @user, title: "ssh-rsa Work", key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC+L3TbFegm3k8QjejSwemk4HhlRh+DuN679Pc5ckqE/MPhVtE/+kZQDYCTB284GiT2aIoGzmZ8ee9TkaoejAsBwlA+Wz2Q3vhz65X6sMgalRwpdJx8kSEUYV8ZPV3MZvPo8KdNg993o4jL6G36GDW4BPIyO6FPZhfsawdf6liVD0Xo5kibIK7B9VoE178cdLQtLpS2YolRwf5yy6XR6hbbBGQR+6xrGOdP16eGZDb1CE2bMvvJijjloFqPscGktWOqW+nfh5txwFfBzlfARDTBsS8WZtg3Yoj1kn33kPsWRlgHfNutFRAIynDuDdQzQq8tTtVwm+Yi75RfcPHW8y3P Work")
47 end 47 end
48 end 48 end
features/steps/project/project_browse_branches.rb
@@ -30,6 +30,6 @@ class ProjectBrowseBranches &lt; Spinach::FeatureSteps @@ -30,6 +30,6 @@ class ProjectBrowseBranches &lt; Spinach::FeatureSteps
30 30
31 And 'project "Shop" has protected branches' do 31 And 'project "Shop" has protected branches' do
32 project = Project.find_by_name("Shop") 32 project = Project.find_by_name("Shop")
33 - project.protected_branches.create(:name => "stable") 33 + project.protected_branches.create(name: "stable")
34 end 34 end
35 end 35 end
features/steps/project/project_browse_commits.rb
@@ -17,9 +17,9 @@ class ProjectBrowseCommits &lt; Spinach::FeatureSteps @@ -17,9 +17,9 @@ class ProjectBrowseCommits &lt; Spinach::FeatureSteps
17 Then 'I see commits atom feed' do 17 Then 'I see commits atom feed' do
18 commit = @project.repository.commit 18 commit = @project.repository.commit
19 page.response_headers['Content-Type'].should have_content("application/atom+xml") 19 page.response_headers['Content-Type'].should have_content("application/atom+xml")
20 - page.body.should have_selector("title", :text => "Recent commits to #{@project.name}")  
21 - page.body.should have_selector("author email", :text => commit.author_email)  
22 - page.body.should have_selector("entry summary", :text => commit.description) 20 + page.body.should have_selector("title", text: "Recent commits to #{@project.name}")
  21 + page.body.should have_selector("author email", text: commit.author_email)
  22 + page.body.should have_selector("entry summary", text: commit.description)
23 end 23 end
24 24
25 Given 'I click on commit link' do 25 Given 'I click on commit link' do
features/steps/project/project_issues.rb
@@ -41,7 +41,7 @@ class ProjectIssues &lt; Spinach::FeatureSteps @@ -41,7 +41,7 @@ class ProjectIssues &lt; Spinach::FeatureSteps
41 end 41 end
42 42
43 And 'I submit new issue "500 error on profile"' do 43 And 'I submit new issue "500 error on profile"' do
44 - fill_in "issue_title", :with => "500 error on profile" 44 + fill_in "issue_title", with: "500 error on profile"
45 click_button "Submit new issue" 45 click_button "Submit new issue"
46 end 46 end
47 47
@@ -78,16 +78,16 @@ class ProjectIssues &lt; Spinach::FeatureSteps @@ -78,16 +78,16 @@ class ProjectIssues &lt; Spinach::FeatureSteps
78 78
79 Given 'project "Shop" has milestone "v2.2"' do 79 Given 'project "Shop" has milestone "v2.2"' do
80 project = Project.find_by_name("Shop") 80 project = Project.find_by_name("Shop")
81 - milestone = create(:milestone, :title => "v2.2", :project => project) 81 + milestone = create(:milestone, title: "v2.2", project: project)
82 82
83 - 3.times { create(:issue, :project => project, :milestone => milestone) } 83 + 3.times { create(:issue, project: project, milestone: milestone) }
84 end 84 end
85 85
86 And 'project "Shop" has milestone "v3.0"' do 86 And 'project "Shop" has milestone "v3.0"' do
87 project = Project.find_by_name("Shop") 87 project = Project.find_by_name("Shop")
88 - milestone = create(:milestone, :title => "v3.0", :project => project) 88 + milestone = create(:milestone, title: "v3.0", project: project)
89 89
90 - 3.times { create(:issue, :project => project, :milestone => milestone) } 90 + 3.times { create(:issue, project: project, milestone: milestone) }
91 end 91 end
92 92
93 When 'I select milestone "v3.0"' do 93 When 'I select milestone "v3.0"' do
@@ -115,16 +115,16 @@ class ProjectIssues &lt; Spinach::FeatureSteps @@ -115,16 +115,16 @@ class ProjectIssues &lt; Spinach::FeatureSteps
115 And 'project "Shop" have "Release 0.4" open issue' do 115 And 'project "Shop" have "Release 0.4" open issue' do
116 project = Project.find_by_name("Shop") 116 project = Project.find_by_name("Shop")
117 create(:issue, 117 create(:issue,
118 - :title => "Release 0.4",  
119 - :project => project,  
120 - :author => project.users.first) 118 + title: "Release 0.4",
  119 + project: project,
  120 + author: project.users.first)
121 end 121 end
122 122
123 And 'project "Shop" have "Release 0.3" closed issue' do 123 And 'project "Shop" have "Release 0.3" closed issue' do
124 project = Project.find_by_name("Shop") 124 project = Project.find_by_name("Shop")
125 create(:closed_issue, 125 create(:closed_issue,
126 - :title => "Release 0.3",  
127 - :project => project,  
128 - :author => project.users.first) 126 + title: "Release 0.3",
  127 + project: project,
  128 + author: project.users.first)
129 end 129 end
130 end 130 end
features/steps/project/project_merge_requests.rb
@@ -56,9 +56,9 @@ class ProjectMergeRequests &lt; Spinach::FeatureSteps @@ -56,9 +56,9 @@ class ProjectMergeRequests &lt; Spinach::FeatureSteps
56 end 56 end
57 57
58 And 'I submit new merge request "Wiki Feature"' do 58 And 'I submit new merge request "Wiki Feature"' do
59 - fill_in "merge_request_title", :with => "Wiki Feature"  
60 - select "master", :from => "merge_request_source_branch"  
61 - select "stable", :from => "merge_request_target_branch" 59 + fill_in "merge_request_title", with: "Wiki Feature"
  60 + select "master", from: "merge_request_source_branch"
  61 + select "stable", from: "merge_request_target_branch"
62 click_button "Submit merge request" 62 click_button "Submit merge request"
63 end 63 end
64 64
features/steps/project/project_milestones.rb
@@ -19,7 +19,7 @@ class ProjectMilestones &lt; Spinach::FeatureSteps @@ -19,7 +19,7 @@ class ProjectMilestones &lt; Spinach::FeatureSteps
19 end 19 end
20 20
21 And 'I submit new milestone "v2.3"' do 21 And 'I submit new milestone "v2.3"' do
22 - fill_in "milestone_title", :with => "v2.3" 22 + fill_in "milestone_title", with: "v2.3"
23 click_button "Create milestone" 23 click_button "Create milestone"
24 end 24 end
25 25
@@ -32,9 +32,9 @@ class ProjectMilestones &lt; Spinach::FeatureSteps @@ -32,9 +32,9 @@ class ProjectMilestones &lt; Spinach::FeatureSteps
32 32
33 And 'project "Shop" has milestone "v2.2"' do 33 And 'project "Shop" has milestone "v2.2"' do
34 project = Project.find_by_name("Shop") 34 project = Project.find_by_name("Shop")
35 - milestone = create(:milestone, :title => "v2.2", :project => project) 35 + milestone = create(:milestone, title: "v2.2", project: project)
36 36
37 - 3.times { create(:issue, :project => project, :milestone => milestone) } 37 + 3.times { create(:issue, project: project, milestone: milestone) }
38 end 38 end
39 39
40 Given 'the milestone has open and closed issues' do 40 Given 'the milestone has open and closed issues' do
features/steps/project/project_network_graph.rb
@@ -16,7 +16,7 @@ class ProjectNetworkGraph &lt; Spinach::FeatureSteps @@ -16,7 +16,7 @@ class ProjectNetworkGraph &lt; Spinach::FeatureSteps
16 end 16 end
17 17
18 And 'page should select "master" in select box' do 18 And 'page should select "master" in select box' do
19 - page.should have_selector '#ref_chzn span', :text => "master" 19 + page.should have_selector '#ref_chzn span', text: "master"
20 end 20 end
21 21
22 And 'page should have "master" on graph' do 22 And 'page should have "master" on graph' do
@@ -26,21 +26,21 @@ class ProjectNetworkGraph &lt; Spinach::FeatureSteps @@ -26,21 +26,21 @@ class ProjectNetworkGraph &lt; Spinach::FeatureSteps
26 end 26 end
27 27
28 When 'I switch ref to "stable"' do 28 When 'I switch ref to "stable"' do
29 - page.select 'stable', :from => 'ref' 29 + page.select 'stable', from: 'ref'
30 sleep 2 30 sleep 2
31 end 31 end
32 32
33 When 'I switch ref to "v2.1.0"' do 33 When 'I switch ref to "v2.1.0"' do
34 - page.select 'v2.1.0', :from => 'ref' 34 + page.select 'v2.1.0', from: 'ref'
35 sleep 2 35 sleep 2
36 end 36 end
37 37
38 And 'page should select "stable" in select box' do 38 And 'page should select "stable" in select box' do
39 - page.should have_selector '#ref_chzn span', :text => "stable" 39 + page.should have_selector '#ref_chzn span', text: "stable"
40 end 40 end
41 41
42 And 'page should select "v2.1.0" in select box' do 42 And 'page should select "v2.1.0" in select box' do
43 - page.should have_selector '#ref_chzn span', :text => "v2.1.0" 43 + page.should have_selector '#ref_chzn span', text: "v2.1.0"
44 end 44 end
45 45
46 And 'page should have "stable" on graph' do 46 And 'page should have "stable" on graph' do
@@ -51,7 +51,7 @@ class ProjectNetworkGraph &lt; Spinach::FeatureSteps @@ -51,7 +51,7 @@ class ProjectNetworkGraph &lt; Spinach::FeatureSteps
51 51
52 When 'I looking for a commit by SHA of "v2.1.0"' do 52 When 'I looking for a commit by SHA of "v2.1.0"' do
53 within ".content .search" do 53 within ".content .search" do
54 - fill_in 'q', :with => '98d6492' 54 + fill_in 'q', with: '98d6492'
55 find('button').click 55 find('button').click
56 end 56 end
57 sleep 2 57 sleep 2
features/steps/project/project_wiki.rb
@@ -16,7 +16,7 @@ class ProjectWiki &lt; Spinach::FeatureSteps @@ -16,7 +16,7 @@ class ProjectWiki &lt; Spinach::FeatureSteps
16 end 16 end
17 17
18 Given 'I create the Wiki Home page' do 18 Given 'I create the Wiki Home page' do
19 - fill_in "Content", :with => '[link test](test)' 19 + fill_in "Content", with: '[link test](test)'
20 click_on "Save" 20 click_on "Save"
21 end 21 end
22 22
@@ -42,7 +42,7 @@ class ProjectWiki &lt; Spinach::FeatureSteps @@ -42,7 +42,7 @@ class ProjectWiki &lt; Spinach::FeatureSteps
42 end 42 end
43 43
44 And 'I change the content' do 44 And 'I change the content' do
45 - fill_in "Content", :with => 'Updated Wiki Content' 45 + fill_in "Content", with: 'Updated Wiki Content'
46 click_on "Save" 46 click_on "Save"
47 end 47 end
48 48
@@ -17,13 +17,13 @@ module Gitlab @@ -17,13 +17,13 @@ module Gitlab
17 message << exception.annoted_source_code.to_s if exception.respond_to?(:annoted_source_code) 17 message << exception.annoted_source_code.to_s if exception.respond_to?(:annoted_source_code)
18 message << " " << trace.join("\n ") 18 message << " " << trace.join("\n ")
19 19
20 - API.logger.add Logger::FATAL, message 20 + API.logger.add Logger::FATAL, message
21 rack_response({'message' => '500 Internal Server Error'}, 500) 21 rack_response({'message' => '500 Internal Server Error'}, 500)
22 end 22 end
23 23
24 format :json 24 format :json
25 helpers APIHelpers 25 helpers APIHelpers
26 - 26 +
27 mount Groups 27 mount Groups
28 mount Users 28 mount Users
29 mount Projects 29 mount Projects
lib/api/groups.rb
@@ -70,7 +70,7 @@ module Gitlab @@ -70,7 +70,7 @@ module Gitlab
70 else 70 else
71 not_found! 71 not_found!
72 end 72 end
73 - end 73 + end
74 end 74 end
75 end 75 end
76 end 76 end
lib/api/system_hooks.rb
1 -module Gitlab  
2 - # Hooks API  
3 - class SystemHooks < Grape::API  
4 - before {  
5 - authenticate!  
6 - authenticated_as_admin!  
7 - }  
8 -  
9 - resource :hooks do  
10 - # Get the list of system hooks  
11 - #  
12 - # Example Request:  
13 - # GET /hooks  
14 - get do  
15 - @hooks = SystemHook.all  
16 - present @hooks, with: Entities::Hook  
17 - end  
18 -  
19 - # Create new system hook  
20 - #  
21 - # Parameters:  
22 - # url (required) - url for system hook  
23 - # Example Request  
24 - # POST /hooks  
25 - post do  
26 - attrs = attributes_for_keys [:url]  
27 - required_attributes! [:url]  
28 - @hook = SystemHook.new attrs  
29 - if @hook.save  
30 - present @hook, with: Entities::Hook  
31 - else  
32 - not_found!  
33 - end  
34 - end  
35 -  
36 - # Test a hook  
37 - #  
38 - # Example Request  
39 - # GET /hooks/:id  
40 - get ":id" do  
41 - @hook = SystemHook.find(params[:id])  
42 - data = {  
43 - event_name: "project_create",  
44 - name: "Ruby",  
45 - path: "ruby",  
46 - project_id: 1,  
47 - owner_name: "Someone",  
48 - owner_email: "example@gitlabhq.com"  
49 - }  
50 - @hook.execute(data)  
51 - data  
52 - end  
53 -  
54 - # Delete a hook. This is an idempotent function.  
55 - #  
56 - # Parameters:  
57 - # id (required) - ID of the hook  
58 - # Example Request:  
59 - # DELETE /hooks/:id  
60 - delete ":id" do  
61 - begin  
62 - @hook = SystemHook.find(params[:id])  
63 - @hook.destroy  
64 - rescue  
65 - # SystemHook raises an Error if no hook with id found  
66 - end  
67 - end  
68 - end  
69 - end  
70 -end  
71 \ No newline at end of file 1 \ No newline at end of file
  2 +module Gitlab
  3 + # Hooks API
  4 + class SystemHooks < Grape::API
  5 + before {
  6 + authenticate!
  7 + authenticated_as_admin!
  8 + }
  9 +
  10 + resource :hooks do
  11 + # Get the list of system hooks
  12 + #
  13 + # Example Request:
  14 + # GET /hooks
  15 + get do
  16 + @hooks = SystemHook.all
  17 + present @hooks, with: Entities::Hook
  18 + end
  19 +
  20 + # Create new system hook
  21 + #
  22 + # Parameters:
  23 + # url (required) - url for system hook
  24 + # Example Request
  25 + # POST /hooks
  26 + post do
  27 + attrs = attributes_for_keys [:url]
  28 + required_attributes! [:url]
  29 + @hook = SystemHook.new attrs
  30 + if @hook.save
  31 + present @hook, with: Entities::Hook
  32 + else
  33 + not_found!
  34 + end
  35 + end
  36 +
  37 + # Test a hook
  38 + #
  39 + # Example Request
  40 + # GET /hooks/:id
  41 + get ":id" do
  42 + @hook = SystemHook.find(params[:id])
  43 + data = {
  44 + event_name: "project_create",
  45 + name: "Ruby",
  46 + path: "ruby",
  47 + project_id: 1,
  48 + owner_name: "Someone",
  49 + owner_email: "example@gitlabhq.com"
  50 + }
  51 + @hook.execute(data)
  52 + data
  53 + end
  54 +
  55 + # Delete a hook. This is an idempotent function.
  56 + #
  57 + # Parameters:
  58 + # id (required) - ID of the hook
  59 + # Example Request:
  60 + # DELETE /hooks/:id
  61 + delete ":id" do
  62 + begin
  63 + @hook = SystemHook.find(params[:id])
  64 + @hook.destroy
  65 + rescue
  66 + # SystemHook raises an Error if no hook with id found
  67 + end
  68 + end
  69 + end
  70 + end
  71 +end
lib/gitlab/auth.rb
@@ -10,7 +10,7 @@ module Gitlab @@ -10,7 +10,7 @@ module Gitlab
10 @user 10 @user
11 elsif @user = User.find_by_email(email) 11 elsif @user = User.find_by_email(email)
12 log.info "Updating legacy LDAP user #{email} with extern_uid => #{uid}" 12 log.info "Updating legacy LDAP user #{email} with extern_uid => #{uid}"
13 - @user.update_attributes(:extern_uid => uid, :provider => provider) 13 + @user.update_attributes(extern_uid: uid, provider: provider)
14 @user 14 @user
15 else 15 else
16 create_from_omniauth(auth, true) 16 create_from_omniauth(auth, true)
@@ -57,7 +57,7 @@ module Gitlab @@ -57,7 +57,7 @@ module Gitlab
57 if @user = User.find_by_provider_and_extern_uid(provider, uid) 57 if @user = User.find_by_provider_and_extern_uid(provider, uid)
58 @user 58 @user
59 elsif @user = User.find_by_email(email) 59 elsif @user = User.find_by_email(email)
60 - @user.update_attributes(:extern_uid => uid, :provider => provider) 60 + @user.update_attributes(extern_uid: uid, provider: provider)
61 @user 61 @user
62 else 62 else
63 if Gitlab.config.omniauth['allow_single_sign_on'] 63 if Gitlab.config.omniauth['allow_single_sign_on']
lib/gitlab/inline_diff.rb
@@ -4,7 +4,7 @@ module Gitlab @@ -4,7 +4,7 @@ module Gitlab
4 4
5 START = "" 5 START = ""
6 FINISH = "" 6 FINISH = ""
7 - 7 +
8 def processing diff_arr 8 def processing diff_arr
9 indexes = _indexes_of_changed_lines diff_arr 9 indexes = _indexes_of_changed_lines diff_arr
10 10
@@ -60,7 +60,7 @@ module Gitlab @@ -60,7 +60,7 @@ module Gitlab
60 line.gsub!(FINISH, "</span>") 60 line.gsub!(FINISH, "</span>")
61 line 61 line
62 end 62 end
63 - 63 +
64 end 64 end
65 65
66 end 66 end
lib/gitlab/popen.rb
@@ -2,7 +2,7 @@ module Gitlab @@ -2,7 +2,7 @@ module Gitlab
2 module Popen 2 module Popen
3 def popen(cmd, path) 3 def popen(cmd, path)
4 vars = { "PWD" => path } 4 vars = { "PWD" => path }
5 - options = { :chdir => path } 5 + options = { chdir: path }
6 6
7 @cmd_output = "" 7 @cmd_output = ""
8 @cmd_status = 0 8 @cmd_status = 0
lib/tasks/gitlab/backup.rake
@@ -4,7 +4,7 @@ namespace :gitlab do @@ -4,7 +4,7 @@ namespace :gitlab do
4 namespace :backup do 4 namespace :backup do
5 # Create backup of GitLab system 5 # Create backup of GitLab system
6 desc "GITLAB | Create a backup of the GitLab system" 6 desc "GITLAB | Create a backup of the GitLab system"
7 - task :create => :environment do 7 + task create: :environment do
8 warn_user_is_not_gitlab 8 warn_user_is_not_gitlab
9 9
10 Rake::Task["gitlab:backup:db:create"].invoke 10 Rake::Task["gitlab:backup:db:create"].invoke
@@ -57,7 +57,7 @@ namespace :gitlab do @@ -57,7 +57,7 @@ namespace :gitlab do
57 57
58 # Restore backup of GitLab system 58 # Restore backup of GitLab system
59 desc "GITLAB | Restore a previously created backup" 59 desc "GITLAB | Restore a previously created backup"
60 - task :restore => :environment do 60 + task restore: :environment do
61 warn_user_is_not_gitlab 61 warn_user_is_not_gitlab
62 62
63 Dir.chdir(Gitlab.config.backup.path) 63 Dir.chdir(Gitlab.config.backup.path)
@@ -113,13 +113,13 @@ namespace :gitlab do @@ -113,13 +113,13 @@ namespace :gitlab do
113 end 113 end
114 114
115 namespace :repo do 115 namespace :repo do
116 - task :create => :environment do 116 + task create: :environment do
117 puts "Dumping repositories ...".blue 117 puts "Dumping repositories ...".blue
118 Backup::Repository.new.dump 118 Backup::Repository.new.dump
119 puts "done".green 119 puts "done".green
120 end 120 end
121 121
122 - task :restore => :environment do 122 + task restore: :environment do
123 puts "Restoring repositories ...".blue 123 puts "Restoring repositories ...".blue
124 Backup::Repository.new.restore 124 Backup::Repository.new.restore
125 puts "done".green 125 puts "done".green
@@ -127,13 +127,13 @@ namespace :gitlab do @@ -127,13 +127,13 @@ namespace :gitlab do
127 end 127 end
128 128
129 namespace :db do 129 namespace :db do
130 - task :create => :environment do 130 + task create: :environment do
131 puts "Dumping database ... ".blue 131 puts "Dumping database ... ".blue
132 Backup::Database.new.dump 132 Backup::Database.new.dump
133 puts "done".green 133 puts "done".green
134 end 134 end
135 135
136 - task :restore => :environment do 136 + task restore: :environment do
137 puts "Restoring database ... ".blue 137 puts "Restoring database ... ".blue
138 Backup::Database.new.restore 138 Backup::Database.new.restore
139 puts "done".green 139 puts "done".green
@@ -141,13 +141,13 @@ namespace :gitlab do @@ -141,13 +141,13 @@ namespace :gitlab do
141 end 141 end
142 142
143 namespace :uploads do 143 namespace :uploads do
144 - task :create => :environment do 144 + task create: :environment do
145 puts "Dumping uploads ... ".blue 145 puts "Dumping uploads ... ".blue
146 Backup::Uploads.new.dump 146 Backup::Uploads.new.dump
147 puts "done".green 147 puts "done".green
148 end 148 end
149 149
150 - task :restore => :environment do 150 + task restore: :environment do
151 puts "Restoring uploads ... ".blue 151 puts "Restoring uploads ... ".blue
152 Backup::Uploads.new.restore 152 Backup::Uploads.new.restore
153 puts "done".green 153 puts "done".green
lib/tasks/gitlab/bulk_add_permission.rake
1 namespace :gitlab do 1 namespace :gitlab do
2 namespace :import do 2 namespace :import do
3 desc "GITLAB | Add all users to all projects (admin users are added as masters)" 3 desc "GITLAB | Add all users to all projects (admin users are added as masters)"
4 - task :all_users_to_all_projects => :environment do |t, args|  
5 - user_ids = User.where(:admin => false).pluck(:id)  
6 - admin_ids = User.where(:admin => true).pluck(:id) 4 + task all_users_to_all_projects: :environment do |t, args|
  5 + user_ids = User.where(admin: false).pluck(:id)
  6 + admin_ids = User.where(admin: true).pluck(:id)
7 projects_ids = Project.pluck(:id) 7 projects_ids = Project.pluck(:id)
8 8
9 puts "Importing #{user_ids.size} users into #{projects_ids.size} projects" 9 puts "Importing #{user_ids.size} users into #{projects_ids.size} projects"
@@ -21,4 +21,4 @@ namespace :gitlab do @@ -21,4 +21,4 @@ namespace :gitlab do
21 UsersProject.add_users_into_projects(project_ids, Array.wrap(user.id), UsersProject::DEVELOPER) 21 UsersProject.add_users_into_projects(project_ids, Array.wrap(user.id), UsersProject::DEVELOPER)
22 end 22 end
23 end 23 end
24 -end  
25 \ No newline at end of file 24 \ No newline at end of file
  25 +end
lib/tasks/gitlab/cleanup.rake
1 namespace :gitlab do 1 namespace :gitlab do
2 namespace :cleanup do 2 namespace :cleanup do
3 desc "GITLAB | Cleanup | Clean namespaces" 3 desc "GITLAB | Cleanup | Clean namespaces"
4 - task :dirs => :environment do 4 + task dirs: :environment do
5 warn_user_is_not_gitlab 5 warn_user_is_not_gitlab
6 remove_flag = ENV['REMOVE'] 6 remove_flag = ENV['REMOVE']
7 7
@@ -44,7 +44,7 @@ namespace :gitlab do @@ -44,7 +44,7 @@ namespace :gitlab do
44 end 44 end
45 45
46 desc "GITLAB | Cleanup | Clean respositories" 46 desc "GITLAB | Cleanup | Clean respositories"
47 - task :repos => :environment do 47 + task repos: :environment do
48 warn_user_is_not_gitlab 48 warn_user_is_not_gitlab
49 remove_flag = ENV['REMOVE'] 49 remove_flag = ENV['REMOVE']
50 50
lib/tasks/gitlab/import.rake
@@ -10,7 +10,7 @@ namespace :gitlab do @@ -10,7 +10,7 @@ namespace :gitlab do
10 # * existing projects will be skipped 10 # * existing projects will be skipped
11 # 11 #
12 desc "GITLAB | Import bare repositories from git_host -> base_path into GitLab project instance" 12 desc "GITLAB | Import bare repositories from git_host -> base_path into GitLab project instance"
13 - task :repos => :environment do 13 + task repos: :environment do
14 14
15 git_base_path = Gitlab.config.gitlab_shell.repos_path 15 git_base_path = Gitlab.config.gitlab_shell.repos_path
16 repos_to_import = Dir.glob(git_base_path + '/*') 16 repos_to_import = Dir.glob(git_base_path + '/*')
@@ -40,7 +40,7 @@ namespace :gitlab do @@ -40,7 +40,7 @@ namespace :gitlab do
40 user = User.admins.first 40 user = User.admins.first
41 41
42 project_params = { 42 project_params = {
43 - :name => path, 43 + name: path,
44 } 44 }
45 45
46 project = Projects::CreateContext.new(user, project_params).execute 46 project = Projects::CreateContext.new(user, project_params).execute
lib/tasks/gitlab/setup.rake
1 namespace :gitlab do 1 namespace :gitlab do
2 desc "GITLAB | Setup production application" 2 desc "GITLAB | Setup production application"
3 - task :setup => :environment do 3 + task setup: :environment do
4 setup_db 4 setup_db
5 end 5 end
6 6
lib/tasks/gitlab/test.rake
1 namespace :gitlab do 1 namespace :gitlab do
2 desc "GITLAB | Run both spinach and rspec" 2 desc "GITLAB | Run both spinach and rspec"
3 - task :test => ['spinach', 'spec'] 3 + task test: ['spinach', 'spec']
4 end 4 end
lib/tasks/travis.rake
1 desc "Travis run tests" 1 desc "Travis run tests"
2 -task :travis => [ 2 +task travis: [
3 :spinach, 3 :spinach,
4 :spec 4 :spec
5 ] 5 ]
spec/models/merge_request_spec.rb
@@ -36,7 +36,7 @@ describe MergeRequest do @@ -36,7 +36,7 @@ describe MergeRequest do
36 it { should respond_to(:can_be_merged?) } 36 it { should respond_to(:can_be_merged?) }
37 it { should respond_to(:cannot_be_merged?) } 37 it { should respond_to(:cannot_be_merged?) }
38 end 38 end
39 - 39 +
40 describe 'modules' do 40 describe 'modules' do
41 it { should include_module(Issuable) } 41 it { should include_module(Issuable) }
42 end 42 end
spec/models/milestone_spec.rb
@@ -134,7 +134,7 @@ describe Milestone do @@ -134,7 +134,7 @@ describe Milestone do
134 134
135 it 'should be false if milestone active and not all nestied issues closed' do 135 it 'should be false if milestone active and not all nestied issues closed' do
136 issue.milestone = milestone 136 issue.milestone = milestone
137 - issue.save 137 + issue.save
138 138
139 milestone.can_be_closed?.should be_false 139 milestone.can_be_closed?.should be_false
140 end 140 end
spec/observers/users_project_observer_spec.rb
@@ -16,7 +16,7 @@ describe UsersProjectObserver do @@ -16,7 +16,7 @@ describe UsersProjectObserver do
16 16
17 it "should send email to user" do 17 it "should send email to user" do
18 subject.should_receive(:notification) 18 subject.should_receive(:notification)
19 - Event.stub(:create => true) 19 + Event.stub(create: true)
20 20
21 create(:users_project) 21 create(:users_project)
22 end 22 end
spec/requests/api/groups_spec.rb
@@ -26,7 +26,7 @@ describe Gitlab::API do @@ -26,7 +26,7 @@ describe Gitlab::API do
26 json_response.first['name'].should == group1.name 26 json_response.first['name'].should == group1.name
27 end 27 end
28 end 28 end
29 - 29 +
30 context "when authenticated as admin" do 30 context "when authenticated as admin" do
31 it "admin: should return an array of all groups" do 31 it "admin: should return an array of all groups" do
32 get api("/groups", admin) 32 get api("/groups", admin)
@@ -36,7 +36,7 @@ describe Gitlab::API do @@ -36,7 +36,7 @@ describe Gitlab::API do
36 end 36 end
37 end 37 end
38 end 38 end
39 - 39 +
40 describe "GET /groups/:id" do 40 describe "GET /groups/:id" do
41 context "when authenticated as user" do 41 context "when authenticated as user" do
42 it "should return one of user1's groups" do 42 it "should return one of user1's groups" do
@@ -44,32 +44,32 @@ describe Gitlab::API do @@ -44,32 +44,32 @@ describe Gitlab::API do
44 response.status.should == 200 44 response.status.should == 200
45 json_response['name'] == group1.name 45 json_response['name'] == group1.name
46 end 46 end
47 - 47 +
48 it "should not return a non existing group" do 48 it "should not return a non existing group" do
49 get api("/groups/1328", user1) 49 get api("/groups/1328", user1)
50 response.status.should == 404 50 response.status.should == 404
51 end 51 end
52 - 52 +
53 it "should not return a group not attached to user1" do 53 it "should not return a group not attached to user1" do
54 get api("/groups/#{group2.id}", user1) 54 get api("/groups/#{group2.id}", user1)
55 response.status.should == 404 55 response.status.should == 404
56 end 56 end
57 end 57 end
58 - 58 +
59 context "when authenticated as admin" do 59 context "when authenticated as admin" do
60 it "should return any existing group" do 60 it "should return any existing group" do
61 get api("/groups/#{group2.id}", admin) 61 get api("/groups/#{group2.id}", admin)
62 response.status.should == 200 62 response.status.should == 200
63 json_response['name'] == group2.name 63 json_response['name'] == group2.name
64 end 64 end
65 - 65 +
66 it "should not return a non existing group" do 66 it "should not return a non existing group" do
67 get api("/groups/1328", admin) 67 get api("/groups/1328", admin)
68 response.status.should == 404 68 response.status.should == 404
69 end 69 end
70 end 70 end
71 end 71 end
72 - 72 +
73 describe "POST /groups" do 73 describe "POST /groups" do
74 context "when authenticated as user" do 74 context "when authenticated as user" do
75 it "should not create group" do 75 it "should not create group" do
@@ -77,7 +77,7 @@ describe Gitlab::API do @@ -77,7 +77,7 @@ describe Gitlab::API do
77 response.status.should == 403 77 response.status.should == 403
78 end 78 end
79 end 79 end
80 - 80 +
81 context "when authenticated as admin" do 81 context "when authenticated as admin" do
82 it "should create group" do 82 it "should create group" do
83 post api("/groups", admin), attributes_for(:group) 83 post api("/groups", admin), attributes_for(:group)
@@ -85,17 +85,17 @@ describe Gitlab::API do @@ -85,17 +85,17 @@ describe Gitlab::API do
85 end 85 end
86 86
87 it "should not create group, duplicate" do 87 it "should not create group, duplicate" do
88 - post api("/groups", admin), {:name => "Duplicate Test", :path => group2.path} 88 + post api("/groups", admin), {name: "Duplicate Test", path: group2.path}
89 response.status.should == 404 89 response.status.should == 404
90 end 90 end
91 91
92 it "should return 400 bad request error if name not given" do 92 it "should return 400 bad request error if name not given" do
93 - post api("/groups", admin), { :path => group2.path } 93 + post api("/groups", admin), { path: group2.path }
94 response.status.should == 400 94 response.status.should == 400
95 end 95 end
96 96
97 it "should return 400 bad request error if path not given" do 97 it "should return 400 bad request error if path not given" do
98 - post api("/groups", admin), { :name => 'test' } 98 + post api("/groups", admin), { name: 'test' }
99 response.status.should == 400 99 response.status.should == 400
100 end 100 end
101 end 101 end
@@ -104,8 +104,8 @@ describe Gitlab::API do @@ -104,8 +104,8 @@ describe Gitlab::API do
104 describe "POST /groups/:id/projects/:project_id" do 104 describe "POST /groups/:id/projects/:project_id" do
105 let(:project) { create(:project) } 105 let(:project) { create(:project) }
106 before(:each) do 106 before(:each) do
107 - project.stub!(:transfer).and_return(true)  
108 - Project.stub(:find).and_return(project) 107 + project.stub!(:transfer).and_return(true)
  108 + Project.stub(:find).and_return(project)
109 end 109 end
110 110
111 111
spec/requests/api/system_hooks_spec.rb
1 -require 'spec_helper'  
2 -  
3 -describe Gitlab::API do  
4 - include ApiHelpers  
5 -  
6 - let(:user) { create(:user) }  
7 - let(:admin) { create(:admin) }  
8 - let!(:hook) { create(:system_hook, url: "http://example.com") }  
9 -  
10 - before { stub_request(:post, hook.url) }  
11 -  
12 - describe "GET /hooks" do  
13 - context "when no user" do  
14 - it "should return authentication error" do  
15 - get api("/hooks")  
16 - response.status.should == 401  
17 - end  
18 - end  
19 -  
20 - context "when not an admin" do  
21 - it "should return forbidden error" do  
22 - get api("/hooks", user)  
23 - response.status.should == 403  
24 - end  
25 - end  
26 -  
27 - context "when authenticated as admin" do  
28 - it "should return an array of hooks" do  
29 - get api("/hooks", admin)  
30 - response.status.should == 200  
31 - json_response.should be_an Array  
32 - json_response.first['url'].should == hook.url  
33 - end  
34 - end  
35 - end  
36 -  
37 - describe "POST /hooks" do  
38 - it "should create new hook" do  
39 - expect {  
40 - post api("/hooks", admin), url: 'http://example.com'  
41 - }.to change { SystemHook.count }.by(1)  
42 - end  
43 -  
44 - it "should respond with 400 if url not given" do  
45 - post api("/hooks", admin)  
46 - response.status.should == 400  
47 - end  
48 -  
49 - it "should not create new hook without url" do  
50 - expect {  
51 - post api("/hooks", admin)  
52 - }.to_not change { SystemHook.count }  
53 - end  
54 - end  
55 -  
56 - describe "GET /hooks/:id" do  
57 - it "should return hook by id" do  
58 - get api("/hooks/#{hook.id}", admin)  
59 - response.status.should == 200  
60 - json_response['event_name'].should == 'project_create'  
61 - end  
62 -  
63 - it "should return 404 on failure" do  
64 - get api("/hooks/404", admin)  
65 - response.status.should == 404  
66 - end  
67 - end  
68 -  
69 - describe "DELETE /hooks/:id" do  
70 - it "should delete a hook" do  
71 - expect {  
72 - delete api("/hooks/#{hook.id}", admin)  
73 - }.to change { SystemHook.count }.by(-1)  
74 - end  
75 -  
76 - it "should return success if hook id not found" do  
77 - delete api("/hooks/12345", admin)  
78 - response.status.should == 200  
79 - end  
80 - end  
81 -end  
82 \ No newline at end of file 1 \ No newline at end of file
  2 +require 'spec_helper'
  3 +
  4 +describe Gitlab::API do
  5 + include ApiHelpers
  6 +
  7 + let(:user) { create(:user) }
  8 + let(:admin) { create(:admin) }
  9 + let!(:hook) { create(:system_hook, url: "http://example.com") }
  10 +
  11 + before { stub_request(:post, hook.url) }
  12 +
  13 + describe "GET /hooks" do
  14 + context "when no user" do
  15 + it "should return authentication error" do
  16 + get api("/hooks")
  17 + response.status.should == 401
  18 + end
  19 + end
  20 +
  21 + context "when not an admin" do
  22 + it "should return forbidden error" do
  23 + get api("/hooks", user)
  24 + response.status.should == 403
  25 + end
  26 + end
  27 +
  28 + context "when authenticated as admin" do
  29 + it "should return an array of hooks" do
  30 + get api("/hooks", admin)
  31 + response.status.should == 200
  32 + json_response.should be_an Array
  33 + json_response.first['url'].should == hook.url
  34 + end
  35 + end
  36 + end
  37 +
  38 + describe "POST /hooks" do
  39 + it "should create new hook" do
  40 + expect {
  41 + post api("/hooks", admin), url: 'http://example.com'
  42 + }.to change { SystemHook.count }.by(1)
  43 + end
  44 +
  45 + it "should respond with 400 if url not given" do
  46 + post api("/hooks", admin)
  47 + response.status.should == 400
  48 + end
  49 +
  50 + it "should not create new hook without url" do
  51 + expect {
  52 + post api("/hooks", admin)
  53 + }.to_not change { SystemHook.count }
  54 + end
  55 + end
  56 +
  57 + describe "GET /hooks/:id" do
  58 + it "should return hook by id" do
  59 + get api("/hooks/#{hook.id}", admin)
  60 + response.status.should == 200
  61 + json_response['event_name'].should == 'project_create'
  62 + end
  63 +
  64 + it "should return 404 on failure" do
  65 + get api("/hooks/404", admin)
  66 + response.status.should == 404
  67 + end
  68 + end
  69 +
  70 + describe "DELETE /hooks/:id" do
  71 + it "should delete a hook" do
  72 + expect {
  73 + delete api("/hooks/#{hook.id}", admin)
  74 + }.to change { SystemHook.count }.by(-1)
  75 + end
  76 +
  77 + it "should return success if hook id not found" do
  78 + delete api("/hooks/12345", admin)
  79 + response.status.should == 200
  80 + end
  81 + end
  82 +end
spec/routing/admin_routing_spec.rb
@@ -56,15 +56,15 @@ describe Admin::UsersController, &quot;routing&quot; do @@ -56,15 +56,15 @@ describe Admin::UsersController, &quot;routing&quot; do
56 end 56 end
57 end 57 end
58 58
59 -# team_admin_project GET /admin/projects/:id/team(.:format) admin/projects#team {:id=>/[^\/]+/}  
60 -# team_update_admin_project PUT /admin/projects/:id/team_update(.:format) admin/projects#team_update {:id=>/[^\/]+/}  
61 -# admin_projects GET /admin/projects(.:format) admin/projects#index {:id=>/[^\/]+/}  
62 -# POST /admin/projects(.:format) admin/projects#create {:id=>/[^\/]+/}  
63 -# new_admin_project GET /admin/projects/new(.:format) admin/projects#new {:id=>/[^\/]+/}  
64 -# edit_admin_project GET /admin/projects/:id/edit(.:format) admin/projects#edit {:id=>/[^\/]+/}  
65 -# admin_project GET /admin/projects/:id(.:format) admin/projects#show {:id=>/[^\/]+/}  
66 -# PUT /admin/projects/:id(.:format) admin/projects#update {:id=>/[^\/]+/}  
67 -# DELETE /admin/projects/:id(.:format) admin/projects#destroy {:id=>/[^\/]+/} 59 +# team_admin_project GET /admin/projects/:id/team(.:format) admin/projects#team {id: /[^\/]+/}
  60 +# team_update_admin_project PUT /admin/projects/:id/team_update(.:format) admin/projects#team_update {id: /[^\/]+/}
  61 +# admin_projects GET /admin/projects(.:format) admin/projects#index {id: /[^\/]+/}
  62 +# POST /admin/projects(.:format) admin/projects#create {id: /[^\/]+/}
  63 +# new_admin_project GET /admin/projects/new(.:format) admin/projects#new {id: /[^\/]+/}
  64 +# edit_admin_project GET /admin/projects/:id/edit(.:format) admin/projects#edit {id: /[^\/]+/}
  65 +# admin_project GET /admin/projects/:id(.:format) admin/projects#show {id: /[^\/]+/}
  66 +# PUT /admin/projects/:id(.:format) admin/projects#update {id: /[^\/]+/}
  67 +# DELETE /admin/projects/:id(.:format) admin/projects#destroy {id: /[^\/]+/}
68 describe Admin::ProjectsController, "routing" do 68 describe Admin::ProjectsController, "routing" do
69 it "to #index" do 69 it "to #index" do
70 get("/admin/projects").should route_to('admin/projects#index') 70 get("/admin/projects").should route_to('admin/projects#index')
@@ -75,9 +75,9 @@ describe Admin::ProjectsController, &quot;routing&quot; do @@ -75,9 +75,9 @@ describe Admin::ProjectsController, &quot;routing&quot; do
75 end 75 end
76 end 76 end
77 77
78 -# edit_admin_project_member GET /admin/projects/:project_id/members/:id/edit(.:format) admin/projects/members#edit {:id=>/[^\/]+/, :project_id=>/[^\/]+/}  
79 -# admin_project_member PUT /admin/projects/:project_id/members/:id(.:format) admin/projects/members#update {:id=>/[^\/]+/, :project_id=>/[^\/]+/}  
80 -# DELETE /admin/projects/:project_id/members/:id(.:format) admin/projects/members#destroy {:id=>/[^\/]+/, :project_id=>/[^\/]+/} 78 +# edit_admin_project_member GET /admin/projects/:project_id/members/:id/edit(.:format) admin/projects/members#edit {id: /[^\/]+/, project_id: /[^\/]+/}
  79 +# admin_project_member PUT /admin/projects/:project_id/members/:id(.:format) admin/projects/members#update {id: /[^\/]+/, project_id: /[^\/]+/}
  80 +# DELETE /admin/projects/:project_id/members/:id(.:format) admin/projects/members#destroy {id: /[^\/]+/, project_id: /[^\/]+/}
81 describe Admin::Projects::MembersController, "routing" do 81 describe Admin::Projects::MembersController, "routing" do
82 it "to #edit" do 82 it "to #edit" do
83 get("/admin/projects/test/members/1/edit").should route_to('admin/projects/members#edit', project_id: 'test', id: '1') 83 get("/admin/projects/test/members/1/edit").should route_to('admin/projects/members#edit', project_id: 'test', id: '1')
spec/routing/project_routing_spec.rb
@@ -279,7 +279,7 @@ describe HooksController, &quot;routing&quot; do @@ -279,7 +279,7 @@ describe HooksController, &quot;routing&quot; do
279 end 279 end
280 end 280 end
281 281
282 -# project_commit GET /:project_id/commit/:id(.:format) commit#show {:id=>/[[:alnum:]]{6,40}/, :project_id=>/[^\/]+/} 282 +# project_commit GET /:project_id/commit/:id(.:format) commit#show {id: /[[:alnum:]]{6,40}/, project_id: /[^\/]+/}
283 describe CommitController, "routing" do 283 describe CommitController, "routing" do
284 it "to #show" do 284 it "to #show" do
285 get("/gitlabhq/commit/4246fb").should route_to('commit#show', project_id: 'gitlabhq', id: '4246fb') 285 get("/gitlabhq/commit/4246fb").should route_to('commit#show', project_id: 'gitlabhq', id: '4246fb')
@@ -375,7 +375,7 @@ describe NotesController, &quot;routing&quot; do @@ -375,7 +375,7 @@ describe NotesController, &quot;routing&quot; do
375 end 375 end
376 end 376 end
377 377
378 -# project_blame GET /:project_id/blame/:id(.:format) blame#show {:id=>/.+/, :project_id=>/[^\/]+/} 378 +# project_blame GET /:project_id/blame/:id(.:format) blame#show {id: /.+/, project_id: /[^\/]+/}
379 describe BlameController, "routing" do 379 describe BlameController, "routing" do
380 it "to #show" do 380 it "to #show" do
381 get("/gitlabhq/blame/master/app/models/project.rb").should route_to('blame#show', project_id: 'gitlabhq', id: 'master/app/models/project.rb') 381 get("/gitlabhq/blame/master/app/models/project.rb").should route_to('blame#show', project_id: 'gitlabhq', id: 'master/app/models/project.rb')
@@ -383,7 +383,7 @@ describe BlameController, &quot;routing&quot; do @@ -383,7 +383,7 @@ describe BlameController, &quot;routing&quot; do
383 end 383 end
384 end 384 end
385 385
386 -# project_blob GET /:project_id/blob/:id(.:format) blob#show {:id=>/.+/, :project_id=>/[^\/]+/} 386 +# project_blob GET /:project_id/blob/:id(.:format) blob#show {id: /.+/, project_id: /[^\/]+/}
387 describe BlobController, "routing" do 387 describe BlobController, "routing" do
388 it "to #show" do 388 it "to #show" do
389 get("/gitlabhq/blob/master/app/models/project.rb").should route_to('blob#show', project_id: 'gitlabhq', id: 'master/app/models/project.rb') 389 get("/gitlabhq/blob/master/app/models/project.rb").should route_to('blob#show', project_id: 'gitlabhq', id: 'master/app/models/project.rb')
@@ -392,7 +392,7 @@ describe BlobController, &quot;routing&quot; do @@ -392,7 +392,7 @@ describe BlobController, &quot;routing&quot; do
392 end 392 end
393 end 393 end
394 394
395 -# project_tree GET /:project_id/tree/:id(.:format) tree#show {:id=>/.+/, :project_id=>/[^\/]+/} 395 +# project_tree GET /:project_id/tree/:id(.:format) tree#show {id: /.+/, project_id: /[^\/]+/}
396 describe TreeController, "routing" do 396 describe TreeController, "routing" do
397 it "to #show" do 397 it "to #show" do
398 get("/gitlabhq/tree/master/app/models/project.rb").should route_to('tree#show', project_id: 'gitlabhq', id: 'master/app/models/project.rb') 398 get("/gitlabhq/tree/master/app/models/project.rb").should route_to('tree#show', project_id: 'gitlabhq', id: 'master/app/models/project.rb')
@@ -400,9 +400,9 @@ describe TreeController, &quot;routing&quot; do @@ -400,9 +400,9 @@ describe TreeController, &quot;routing&quot; do
400 end 400 end
401 end 401 end
402 402
403 -# project_compare_index GET /:project_id/compare(.:format) compare#index {:id=>/[^\/]+/, :project_id=>/[^\/]+/}  
404 -# POST /:project_id/compare(.:format) compare#create {:id=>/[^\/]+/, :project_id=>/[^\/]+/}  
405 -# project_compare /:project_id/compare/:from...:to(.:format) compare#show {:from=>/.+/, :to=>/.+/, :id=>/[^\/]+/, :project_id=>/[^\/]+/} 403 +# project_compare_index GET /:project_id/compare(.:format) compare#index {id: /[^\/]+/, project_id: /[^\/]+/}
  404 +# POST /:project_id/compare(.:format) compare#create {id: /[^\/]+/, project_id: /[^\/]+/}
  405 +# project_compare /:project_id/compare/:from...:to(.:format) compare#show {from: /.+/, to: /.+/, id: /[^\/]+/, project_id: /[^\/]+/}
406 describe CompareController, "routing" do 406 describe CompareController, "routing" do
407 it "to #index" do 407 it "to #index" do
408 get("/gitlabhq/compare").should route_to('compare#index', project_id: 'gitlabhq') 408 get("/gitlabhq/compare").should route_to('compare#index', project_id: 'gitlabhq')
spec/tasks/gitlab/backup_rake_spec.rb
@@ -22,21 +22,21 @@ describe &#39;gitlab:app namespace rake task&#39; do @@ -22,21 +22,21 @@ describe &#39;gitlab:app namespace rake task&#39; do
22 22
23 context 'gitlab version' do 23 context 'gitlab version' do
24 before do 24 before do
25 - Dir.stub :glob => [] 25 + Dir.stub glob: []
26 Dir.stub :chdir 26 Dir.stub :chdir
27 - File.stub :exists? => true  
28 - Kernel.stub :system => true 27 + File.stub exists?: true
  28 + Kernel.stub system: true
29 end 29 end
30 30
31 let(:gitlab_version) { %x{git rev-parse HEAD}.gsub(/\n/,"") } 31 let(:gitlab_version) { %x{git rev-parse HEAD}.gsub(/\n/,"") }
32 32
33 it 'should fail on mismach' do 33 it 'should fail on mismach' do
34 - YAML.stub :load_file => {:gitlab_version => gitlab_version.reverse} 34 + YAML.stub load_file: {gitlab_version: gitlab_version.reverse}
35 expect { run_rake_task }.to raise_error SystemExit 35 expect { run_rake_task }.to raise_error SystemExit
36 end 36 end
37 37
38 it 'should invoke restoration on mach' do 38 it 'should invoke restoration on mach' do
39 - YAML.stub :load_file => {:gitlab_version => gitlab_version} 39 + YAML.stub load_file: {gitlab_version: gitlab_version}
40 Rake::Task["gitlab:backup:db:restore"].should_receive :invoke 40 Rake::Task["gitlab:backup:db:restore"].should_receive :invoke
41 Rake::Task["gitlab:backup:repo:restore"].should_receive :invoke 41 Rake::Task["gitlab:backup:repo:restore"].should_receive :invoke
42 expect { run_rake_task }.to_not raise_error SystemExit 42 expect { run_rake_task }.to_not raise_error SystemExit