Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kazuhiko Shiozaki
gitlab-ce
Commits
4f1d1fc5
Commit
4f1d1fc5
authored
Feb 02, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Convert hashes to ruby 1.9 style
parent
7dad2663
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
27 additions
and
31 deletions
+27
-31
.rubocop.yml
.rubocop.yml
+1
-5
app/controllers/github_imports_controller.rb
app/controllers/github_imports_controller.rb
+2
-2
app/helpers/emails_helper.rb
app/helpers/emails_helper.rb
+1
-1
app/helpers/merge_requests_helper.rb
app/helpers/merge_requests_helper.rb
+1
-1
app/models/merge_request.rb
app/models/merge_request.rb
+1
-1
app/models/project.rb
app/models/project.rb
+4
-4
config/initializers/carrierwave.rb
config/initializers/carrierwave.rb
+5
-5
config/initializers/doorkeeper.rb
config/initializers/doorkeeper.rb
+2
-2
config/routes.rb
config/routes.rb
+3
-3
lib/api/api_guard.rb
lib/api/api_guard.rb
+2
-2
lib/api/entities.rb
lib/api/entities.rb
+1
-1
lib/gitlab/github/importer.rb
lib/gitlab/github/importer.rb
+4
-4
No files found.
.rubocop.yml
View file @
4f1d1fc5
...
@@ -267,7 +267,7 @@ Style/HashSyntax:
...
@@ -267,7 +267,7 @@ Style/HashSyntax:
Prefer Ruby 1.9 hash syntax { a: 1, b: 2 } over 1.8 syntax
Prefer Ruby 1.9 hash syntax { a: 1, b: 2 } over 1.8 syntax
{ :a => 1, :b => 2 }.
{ :a => 1, :b => 2 }.
StyleGuide
:
'
https://github.com/bbatsov/ruby-style-guide#hash-literals'
StyleGuide
:
'
https://github.com/bbatsov/ruby-style-guide#hash-literals'
Enabled
:
fals
e
Enabled
:
tru
e
Style/IfUnlessModifier
:
Style/IfUnlessModifier
:
Description
:
>-
Description
:
>-
...
@@ -817,10 +817,6 @@ Lint/DeprecatedClassMethods:
...
@@ -817,10 +817,6 @@ Lint/DeprecatedClassMethods:
Description
:
'
Check
for
deprecated
class
method
calls.'
Description
:
'
Check
for
deprecated
class
method
calls.'
Enabled
:
false
Enabled
:
false
Lint/DuplicateMethods
:
Description
:
'
Check
for
duplicate
methods
calls.'
Enabled
:
false
Lint/ElseLayout
:
Lint/ElseLayout
:
Description
:
'
Check
for
odd
code
arrangement
in
an
else
block.'
Description
:
'
Check
for
odd
code
arrangement
in
an
else
block.'
Enabled
:
false
Enabled
:
false
...
...
app/controllers/github_imports_controller.rb
View file @
4f1d1fc5
...
@@ -23,7 +23,7 @@ class GithubImportsController < ApplicationController
...
@@ -23,7 +23,7 @@ class GithubImportsController < ApplicationController
end
end
def
jobs
def
jobs
jobs
=
current_user
.
created_projects
.
where
(
import_type:
"github"
).
to_json
(
:only
=>
[
:id
,
:import_status
])
jobs
=
current_user
.
created_projects
.
where
(
import_type:
"github"
).
to_json
(
only:
[
:id
,
:import_status
])
render
json:
jobs
render
json:
jobs
end
end
...
@@ -58,7 +58,7 @@ class GithubImportsController < ApplicationController
...
@@ -58,7 +58,7 @@ class GithubImportsController < ApplicationController
def
octo_client
def
octo_client
Octokit
.
auto_paginate
=
true
Octokit
.
auto_paginate
=
true
@octo_client
||=
Octokit
::
Client
.
new
(
:access_token
=>
current_user
.
github_access_token
)
@octo_client
||=
Octokit
::
Client
.
new
(
access_token:
current_user
.
github_access_token
)
end
end
def
github_auth
def
github_auth
...
...
app/helpers/emails_helper.rb
View file @
4f1d1fc5
...
@@ -31,7 +31,7 @@ module EmailsHelper
...
@@ -31,7 +31,7 @@ module EmailsHelper
end
end
def
add_email_highlight_css
def
add_email_highlight_css
Rugments
::
Themes
::
Github
.
render
(
:scope
=>
'.highlight'
)
Rugments
::
Themes
::
Github
.
render
(
scope:
'.highlight'
)
end
end
def
color_email_diff
(
diffcontent
)
def
color_email_diff
(
diffcontent
)
...
...
app/helpers/merge_requests_helper.rb
View file @
4f1d1fc5
...
@@ -15,7 +15,7 @@ module MergeRequestsHelper
...
@@ -15,7 +15,7 @@ module MergeRequestsHelper
end
end
def
new_mr_from_push_event
(
event
,
target_project
)
def
new_mr_from_push_event
(
event
,
target_project
)
return
:merge_request
=>
{
return
merge_request:
{
source_project_id:
event
.
project
.
id
,
source_project_id:
event
.
project
.
id
,
target_project_id:
target_project
.
id
,
target_project_id:
target_project
.
id
,
source_branch:
event
.
branch_name
,
source_branch:
event
.
branch_name
,
...
...
app/models/merge_request.rb
View file @
4f1d1fc5
...
@@ -76,7 +76,7 @@ class MergeRequest < ActiveRecord::Base
...
@@ -76,7 +76,7 @@ class MergeRequest < ActiveRecord::Base
merge_request
.
save
merge_request
.
save
end
end
after_transition
:locked
=>
(
any
-
:locked
)
do
|
merge_request
,
transition
|
after_transition
locked:
(
any
-
:locked
)
do
|
merge_request
,
transition
|
merge_request
.
locked_at
=
nil
merge_request
.
locked_at
=
nil
merge_request
.
save
merge_request
.
save
end
end
...
...
app/models/project.rb
View file @
4f1d1fc5
...
@@ -156,22 +156,22 @@ class Project < ActiveRecord::Base
...
@@ -156,22 +156,22 @@ class Project < ActiveRecord::Base
end
end
event
:import_finish
do
event
:import_finish
do
transition
:started
=>
:finished
transition
started:
:finished
end
end
event
:import_fail
do
event
:import_fail
do
transition
:started
=>
:failed
transition
started:
:failed
end
end
event
:import_retry
do
event
:import_retry
do
transition
:failed
=>
:started
transition
failed:
:started
end
end
state
:started
state
:started
state
:finished
state
:finished
state
:failed
state
:failed
after_transition
any
=>
:started
,
:do
=>
:add_import_job
after_transition
any
=>
:started
,
do:
:add_import_job
end
end
class
<<
self
class
<<
self
...
...
config/initializers/carrierwave.rb
View file @
4f1d1fc5
...
@@ -23,11 +23,11 @@ if File.exists?(aws_file)
...
@@ -23,11 +23,11 @@ if File.exists?(aws_file)
if
Rails
.
env
.
test?
if
Rails
.
env
.
test?
Fog
.
mock!
Fog
.
mock!
connection
=
::
Fog
::
Storage
.
new
(
connection
=
::
Fog
::
Storage
.
new
(
:aws_access_key_id
=>
AWS_CONFIG
[
'access_key_id'
],
aws_access_key_id:
AWS_CONFIG
[
'access_key_id'
],
:aws_secret_access_key
=>
AWS_CONFIG
[
'secret_access_key'
],
aws_secret_access_key:
AWS_CONFIG
[
'secret_access_key'
],
:provider
=>
'AWS'
,
provider:
'AWS'
,
:region
=>
AWS_CONFIG
[
'region'
]
region:
AWS_CONFIG
[
'region'
]
)
)
connection
.
directories
.
create
(
:key
=>
AWS_CONFIG
[
'bucket'
])
connection
.
directories
.
create
(
key:
AWS_CONFIG
[
'bucket'
])
end
end
end
end
config/initializers/doorkeeper.rb
View file @
4f1d1fc5
...
@@ -43,10 +43,10 @@ Doorkeeper.configure do
...
@@ -43,10 +43,10 @@ Doorkeeper.configure do
force_ssl_in_redirect_uri
false
force_ssl_in_redirect_uri
false
# Provide support for an owner to be assigned to each registered application (disabled by default)
# Provide support for an owner to be assigned to each registered application (disabled by default)
# Optional parameter
:confirmation =>
true (default false) if you want to enforce ownership of
# Optional parameter
confirmation:
true (default false) if you want to enforce ownership of
# a registered application
# a registered application
# Note: you must also run the rails g doorkeeper:application_owner generator to provide the necessary support
# Note: you must also run the rails g doorkeeper:application_owner generator to provide the necessary support
enable_application_owner
:confirmation
=>
false
enable_application_owner
confirmation:
false
# Define access token scopes for your provider
# Define access token scopes for your provider
# For more information go to
# For more information go to
...
...
config/routes.rb
View file @
4f1d1fc5
...
@@ -3,9 +3,9 @@ require 'api/api'
...
@@ -3,9 +3,9 @@ require 'api/api'
Gitlab
::
Application
.
routes
.
draw
do
Gitlab
::
Application
.
routes
.
draw
do
use_doorkeeper
do
use_doorkeeper
do
controllers
:applications
=>
'oauth/applications'
,
controllers
applications:
'oauth/applications'
,
:authorized_applications
=>
'oauth/authorized_applications'
,
authorized_applications:
'oauth/authorized_applications'
,
:authorizations
=>
'oauth/authorizations'
authorizations:
'oauth/authorizations'
end
end
#
#
# Search
# Search
...
...
lib/api/api_guard.rb
View file @
4f1d1fc5
...
@@ -146,7 +146,7 @@ module APIGuard
...
@@ -146,7 +146,7 @@ module APIGuard
Rack
::
OAuth2
::
Server
::
Resource
::
Bearer
::
Forbidden
.
new
(
Rack
::
OAuth2
::
Server
::
Resource
::
Bearer
::
Forbidden
.
new
(
:insufficient_scope
,
:insufficient_scope
,
Rack
::
OAuth2
::
Server
::
Resource
::
ErrorMethods
::
DEFAULT_DESCRIPTION
[
:insufficient_scope
],
Rack
::
OAuth2
::
Server
::
Resource
::
ErrorMethods
::
DEFAULT_DESCRIPTION
[
:insufficient_scope
],
{
:scope
=>
e
.
scopes
})
{
scope:
e
.
scopes
})
end
end
response
.
finish
response
.
finish
...
@@ -172,4 +172,4 @@ module APIGuard
...
@@ -172,4 +172,4 @@ module APIGuard
@scopes
=
scopes
@scopes
=
scopes
end
end
end
end
end
end
\ No newline at end of file
lib/api/entities.rb
View file @
4f1d1fc5
...
@@ -55,7 +55,7 @@ module API
...
@@ -55,7 +55,7 @@ module API
expose
:path
,
:path_with_namespace
expose
:path
,
:path_with_namespace
expose
:issues_enabled
,
:merge_requests_enabled
,
:wiki_enabled
,
:snippets_enabled
,
:created_at
,
:last_activity_at
expose
:issues_enabled
,
:merge_requests_enabled
,
:wiki_enabled
,
:snippets_enabled
,
:created_at
,
:last_activity_at
expose
:namespace
expose
:namespace
expose
:forked_from_project
,
using:
Entities
::
ForkedFromProject
,
:if
=>
lambda
{
|
project
,
options
|
project
.
forked?
}
expose
:forked_from_project
,
using:
Entities
::
ForkedFromProject
,
if:
lambda
{
|
project
,
options
|
project
.
forked?
}
end
end
class
ProjectMember
<
UserBasic
class
ProjectMember
<
UserBasic
...
...
lib/gitlab/github/importer.rb
View file @
4f1d1fc5
...
@@ -9,12 +9,12 @@ module Gitlab
...
@@ -9,12 +9,12 @@ module Gitlab
def
execute
def
execute
client
=
octo_client
(
project
.
creator
.
github_access_token
)
client
=
octo_client
(
project
.
creator
.
github_access_token
)
#Issues && Comments
#Issues && Comments
client
.
list_issues
(
project
.
import_source
,
state: :all
).
each
do
|
issue
|
client
.
list_issues
(
project
.
import_source
,
state: :all
).
each
do
|
issue
|
if
issue
.
pull_request
.
nil?
if
issue
.
pull_request
.
nil?
body
=
"*Created by:
#{
issue
.
user
.
login
}
*
\n\n
#{
issue
.
body
}
"
body
=
"*Created by:
#{
issue
.
user
.
login
}
*
\n\n
#{
issue
.
body
}
"
if
issue
.
comments
>
0
if
issue
.
comments
>
0
body
+=
"
\n\n\n
**Imported comments:**
\n
"
body
+=
"
\n\n\n
**Imported comments:**
\n
"
client
.
issue_comments
(
project
.
import_source
,
issue
.
number
).
each
do
|
c
|
client
.
issue_comments
(
project
.
import_source
,
issue
.
number
).
each
do
|
c
|
...
@@ -23,7 +23,7 @@ module Gitlab
...
@@ -23,7 +23,7 @@ module Gitlab
end
end
project
.
issues
.
create!
(
project
.
issues
.
create!
(
description:
body
,
description:
body
,
title:
issue
.
title
,
title:
issue
.
title
,
state:
issue
.
state
==
'closed'
?
'closed'
:
'opened'
,
state:
issue
.
state
==
'closed'
?
'closed'
:
'opened'
,
author_id:
gl_user_id
(
project
,
issue
.
user
.
id
)
author_id:
gl_user_id
(
project
,
issue
.
user
.
id
)
...
@@ -36,7 +36,7 @@ module Gitlab
...
@@ -36,7 +36,7 @@ module Gitlab
def
octo_client
(
access_token
)
def
octo_client
(
access_token
)
::
Octokit
.
auto_paginate
=
true
::
Octokit
.
auto_paginate
=
true
::
Octokit
::
Client
.
new
(
:access_token
=>
access_token
)
::
Octokit
::
Client
.
new
(
access_token:
access_token
)
end
end
def
gl_user_id
(
project
,
github_id
)
def
gl_user_id
(
project
,
github_id
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment