diff options
author | Douwe Maan <douwe@selenight.nl> | 2017-05-16 23:29:13 +0300 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2017-05-23 23:35:50 +0300 |
commit | 190b7b45a605475668a089a0ce43f3d89b9d7c47 (patch) | |
tree | a01ac60bc9c67af21d8d5faff747c43457b843b5 /lib | |
parent | 03db4f110613c73003f86d0ff98a7dcb6f0dae59 (diff) |
Autolink package names in podspec
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/dependency_linker.rb | 1 | ||||
-rw-r--r-- | lib/gitlab/dependency_linker/podspec_linker.rb | 24 |
2 files changed, 25 insertions, 0 deletions
diff --git a/lib/gitlab/dependency_linker.rb b/lib/gitlab/dependency_linker.rb index 44358d2634b..ffd6ab8e2f8 100644 --- a/lib/gitlab/dependency_linker.rb +++ b/lib/gitlab/dependency_linker.rb @@ -6,6 +6,7 @@ module Gitlab PackageJsonLinker, ComposerJsonLinker, PodfileLinker, + PodspecLinker, ].freeze def self.linker(blob_name) diff --git a/lib/gitlab/dependency_linker/podspec_linker.rb b/lib/gitlab/dependency_linker/podspec_linker.rb new file mode 100644 index 00000000000..a52c7a02439 --- /dev/null +++ b/lib/gitlab/dependency_linker/podspec_linker.rb @@ -0,0 +1,24 @@ +module Gitlab + module DependencyLinker + class PodspecLinker < MethodLinker + include Cocoapods + + STRING_REGEX = /['"](?<name>[^'"]+)['"]/.freeze + + self.file_type = :podspec + + private + + def link_dependencies + link_method_call('homepage', URL_REGEX, &:itself) + + link_regex(%r{(git:|:git\s*=>)\s*['"](?<name>#{URL_REGEX})['"]}, &:itself) + + link_method_call('license', &method(:license_url)) + link_regex(/license\s*=\s*\{\s*(type:|:type\s*=>)\s*#{STRING_REGEX}/, &method(:license_url)) + + link_method_call(%w[name dependency], &method(:package_url)) + end + end + end +end |