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
Boxiang Sun
gitlab-ce
Commits
03db4f11
Commit
03db4f11
authored
May 16, 2017
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Autolink package names in Podfile
parent
fbec6dbd
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
87 additions
and
0 deletions
+87
-0
lib/gitlab/dependency_linker.rb
lib/gitlab/dependency_linker.rb
+1
-0
lib/gitlab/dependency_linker/cocoapods.rb
lib/gitlab/dependency_linker/cocoapods.rb
+10
-0
lib/gitlab/dependency_linker/podfile_linker.rb
lib/gitlab/dependency_linker/podfile_linker.rb
+15
-0
spec/lib/gitlab/dependency_linker/podfile_linker_spec.rb
spec/lib/gitlab/dependency_linker/podfile_linker_spec.rb
+53
-0
spec/lib/gitlab/dependency_linker_spec.rb
spec/lib/gitlab/dependency_linker_spec.rb
+8
-0
No files found.
lib/gitlab/dependency_linker.rb
View file @
03db4f11
...
@@ -5,6 +5,7 @@ module Gitlab
...
@@ -5,6 +5,7 @@ module Gitlab
GemspecLinker
,
GemspecLinker
,
PackageJsonLinker
,
PackageJsonLinker
,
ComposerJsonLinker
,
ComposerJsonLinker
,
PodfileLinker
,
].
freeze
].
freeze
def
self
.
linker
(
blob_name
)
def
self
.
linker
(
blob_name
)
...
...
lib/gitlab/dependency_linker/cocoapods.rb
0 → 100644
View file @
03db4f11
module
Gitlab
module
DependencyLinker
module
Cocoapods
def
package_url
(
name
)
package
=
name
.
split
(
"/"
,
2
).
first
"https://cocoapods.org/pods/
#{
package
}
"
end
end
end
end
lib/gitlab/dependency_linker/podfile_linker.rb
0 → 100644
View file @
03db4f11
module
Gitlab
module
DependencyLinker
class
PodfileLinker
<
GemfileLinker
include
Cocoapods
self
.
file_type
=
:podfile
private
def
link_packages
link_method_call
(
'pod'
,
&
method
(
:package_url
))
end
end
end
end
spec/lib/gitlab/dependency_linker/podfile_linker_spec.rb
0 → 100644
View file @
03db4f11
require
'rails_helper'
describe
Gitlab
::
DependencyLinker
::
PodfileLinker
,
lib:
true
do
describe
'.support?'
do
it
'supports Podfile'
do
expect
(
described_class
.
support?
(
'Podfile'
)).
to
be_truthy
end
it
'does not support other files'
do
expect
(
described_class
.
support?
(
'Podfile.lock'
)).
to
be_falsey
end
end
describe
'#link'
do
let
(
:file_name
)
{
"Podfile"
}
let
(
:file_content
)
do
<<-
CONTENT
.
strip_heredoc
source 'https://github.com/artsy/Specs.git'
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
inhibit_all_warnings!
target 'Artsy' do
pod 'AFNetworking', "~> 2.5"
pod 'Interstellar/Core', git: 'https://github.com/ashfurrow/Interstellar.git', branch: 'observable-unsubscribe'
end
CONTENT
end
subject
{
Gitlab
::
Highlight
.
highlight
(
file_name
,
file_content
)
}
def
link
(
name
,
url
)
%{<a href="#{url}" rel="nofollow noreferrer noopener" target="_blank">#{name}</a>}
end
it
'links sources'
do
expect
(
subject
).
to
include
(
link
(
'https://github.com/artsy/Specs.git'
,
'https://github.com/artsy/Specs.git'
))
expect
(
subject
).
to
include
(
link
(
'https://github.com/CocoaPods/Specs.git'
,
'https://github.com/CocoaPods/Specs.git'
))
end
it
'links packages'
do
expect
(
subject
).
to
include
(
link
(
'AFNetworking'
,
'https://cocoapods.org/pods/AFNetworking'
))
expect
(
subject
).
to
include
(
link
(
'Interstellar/Core'
,
'https://cocoapods.org/pods/Interstellar'
))
end
it
'links Git repos'
do
expect
(
subject
).
to
include
(
link
(
'https://github.com/ashfurrow/Interstellar.git'
,
'https://github.com/ashfurrow/Interstellar.git'
))
end
end
end
spec/lib/gitlab/dependency_linker_spec.rb
View file @
03db4f11
...
@@ -33,5 +33,13 @@ describe Gitlab::DependencyLinker, lib: true do
...
@@ -33,5 +33,13 @@ describe Gitlab::DependencyLinker, lib: true do
described_class
.
link
(
blob_name
,
nil
,
nil
)
described_class
.
link
(
blob_name
,
nil
,
nil
)
end
end
it
'links using PodfileLinker'
do
blob_name
=
'Podfile'
expect
(
described_class
::
PodfileLinker
).
to
receive
(
:link
)
described_class
.
link
(
blob_name
,
nil
,
nil
)
end
end
end
end
end
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