cocoapods-git_url_rewriter 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +34 -0
- data/Gemfile +14 -0
- data/Gemfile.lock +87 -0
- data/LICENSE.txt +22 -0
- data/README.md +43 -0
- data/Rakefile +26 -0
- data/cocoapods-git_url_rewriter.gemspec +22 -0
- data/lib/cocoapods_plugin.rb +18 -0
- data/lib/pod/src/rewriter.rb +42 -0
- data/lib/pod/version.rb +4 -0
- data/spec/rewriter_spec.rb +1 -0
- data/spec/spec_helper.rb +42 -0
- metadata +86 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e90be058212ec12939bd3895ced2786e75b14236
|
4
|
+
data.tar.gz: 09e7cea020f9bc9f4149381de1efc0572bbdc6a6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5d297f88c833b61c4b915005648c19cde3298cbdf79b0adb09c2ab57c8070f368cea05398873303377f28e55329901b94505a3e2e1fbbffe838bb78fd3aa9a95
|
7
|
+
data.tar.gz: 3258fead5f554d2a12fb3ea0c6efc3b2ffdafa06269ef454eb0eef9e631ed57cf976a16d494708662e36f127b76f86642953a7116b38317689052018abaec2a2
|
data/.gitignore
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/test/tmp/
|
9
|
+
/test/version_tmp/
|
10
|
+
/tmp/
|
11
|
+
|
12
|
+
## Specific to RubyMotion:
|
13
|
+
.dat*
|
14
|
+
.repl_history
|
15
|
+
build/
|
16
|
+
|
17
|
+
## Documentation cache and generated files:
|
18
|
+
/.yardoc/
|
19
|
+
/_yardoc/
|
20
|
+
/doc/
|
21
|
+
/rdoc/
|
22
|
+
|
23
|
+
## Environment normalisation:
|
24
|
+
/.bundle/
|
25
|
+
/lib/bundler/man/
|
26
|
+
|
27
|
+
# for a library or gem, you might want to ignore these files since the code is
|
28
|
+
# intended to run in multiple environments; otherwise, check them in:
|
29
|
+
# Gemfile.lock
|
30
|
+
# .ruby-version
|
31
|
+
# .ruby-gemset
|
32
|
+
|
33
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
34
|
+
.rvmrc
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
cocoapods-git_url_rewriter (1.0.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
activesupport (4.2.3)
|
10
|
+
i18n (~> 0.7)
|
11
|
+
json (~> 1.7, >= 1.7.7)
|
12
|
+
minitest (~> 5.1)
|
13
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
14
|
+
tzinfo (~> 1.1)
|
15
|
+
ast (2.0.0)
|
16
|
+
astrolabe (1.3.1)
|
17
|
+
parser (~> 2.2)
|
18
|
+
bacon (1.2.0)
|
19
|
+
claide (0.8.2)
|
20
|
+
cocoapods (0.37.2)
|
21
|
+
activesupport (>= 3.2.15)
|
22
|
+
claide (~> 0.8.1)
|
23
|
+
cocoapods-core (= 0.37.2)
|
24
|
+
cocoapods-downloader (~> 0.9.0)
|
25
|
+
cocoapods-plugins (~> 0.4.2)
|
26
|
+
cocoapods-trunk (~> 0.6.1)
|
27
|
+
cocoapods-try (~> 0.4.5)
|
28
|
+
colored (~> 1.2)
|
29
|
+
escape (~> 0.0.4)
|
30
|
+
molinillo (~> 0.2.3)
|
31
|
+
nap (~> 0.8)
|
32
|
+
xcodeproj (~> 0.24.2)
|
33
|
+
cocoapods-core (0.37.2)
|
34
|
+
activesupport (>= 3.2.15)
|
35
|
+
fuzzy_match (~> 2.0.4)
|
36
|
+
nap (~> 0.8.0)
|
37
|
+
cocoapods-downloader (0.9.1)
|
38
|
+
cocoapods-plugins (0.4.2)
|
39
|
+
nap
|
40
|
+
cocoapods-trunk (0.6.1)
|
41
|
+
nap (>= 0.8)
|
42
|
+
netrc (= 0.7.8)
|
43
|
+
cocoapods-try (0.4.5)
|
44
|
+
colored (1.2)
|
45
|
+
escape (0.0.4)
|
46
|
+
fuzzy_match (2.0.4)
|
47
|
+
i18n (0.7.0)
|
48
|
+
json (1.8.3)
|
49
|
+
metaclass (0.0.4)
|
50
|
+
minitest (5.7.0)
|
51
|
+
mocha (1.1.0)
|
52
|
+
metaclass (~> 0.0.1)
|
53
|
+
mocha-on-bacon (0.2.2)
|
54
|
+
mocha (>= 0.13.0)
|
55
|
+
molinillo (0.2.3)
|
56
|
+
nap (0.8.0)
|
57
|
+
netrc (0.7.8)
|
58
|
+
parser (2.2.2.6)
|
59
|
+
ast (>= 1.1, < 3.0)
|
60
|
+
powerpack (0.1.1)
|
61
|
+
rainbow (2.0.0)
|
62
|
+
rake (10.4.2)
|
63
|
+
rubocop (0.32.1)
|
64
|
+
astrolabe (~> 1.3)
|
65
|
+
parser (>= 2.2.2.5, < 3.0)
|
66
|
+
powerpack (~> 0.1)
|
67
|
+
rainbow (>= 1.99.1, < 3.0)
|
68
|
+
ruby-progressbar (~> 1.4)
|
69
|
+
ruby-progressbar (1.7.5)
|
70
|
+
thread_safe (0.3.5)
|
71
|
+
tzinfo (1.2.2)
|
72
|
+
thread_safe (~> 0.1)
|
73
|
+
xcodeproj (0.24.3)
|
74
|
+
activesupport (>= 3)
|
75
|
+
colored (~> 1.2)
|
76
|
+
|
77
|
+
PLATFORMS
|
78
|
+
ruby
|
79
|
+
|
80
|
+
DEPENDENCIES
|
81
|
+
bacon
|
82
|
+
bundler (~> 1.7)
|
83
|
+
cocoapods
|
84
|
+
cocoapods-git_url_rewriter!
|
85
|
+
mocha-on-bacon
|
86
|
+
rake (~> 10.0)
|
87
|
+
rubocop
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 Brian Michel
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# Git URL Rewriter
|
2
|
+
|
3
|
+
A simple gem that will allow the rewriting of Cocoapods git dependency URLs just before they are downloaded. This can be useful if certain network access is blocked.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
`gem 'cocoapods-git_url_rewriter', '1.0.0'`
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install cocoapods-git_url_rewriter
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
Intended usage of this Cocoapods plugin is as follows. It it designed to be used as an inline declaration with your projects Podfile.
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
plugin 'cocoapods-git_url_rewriter', {
|
25
|
+
"string literal to match against" => "replacement string literal"
|
26
|
+
}
|
27
|
+
```
|
28
|
+
|
29
|
+
A more concrete example would be as follows
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
plugin 'cocoapods-git_url_rewriter', {
|
33
|
+
'git@git.my-cool-company.com:' => 'https://sekrittoken@my-cool-company.com/'
|
34
|
+
}
|
35
|
+
```
|
36
|
+
|
37
|
+
## Contributing
|
38
|
+
|
39
|
+
1. Fork it ( https://github.com/brianmichel/cocoapods-git_url_rewriter/fork )
|
40
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
41
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
42
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
43
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
begin
|
2
|
+
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'bundler/gem_tasks'
|
5
|
+
|
6
|
+
def specs(dir)
|
7
|
+
FileList["spec/#{dir}/*_spec.rb"].shuffle.join(' ')
|
8
|
+
end
|
9
|
+
|
10
|
+
desc 'Runs all the specs'
|
11
|
+
task :spec do
|
12
|
+
sh "bundle exec bacon #{specs('**')}"
|
13
|
+
Rake::Task['rubocop'].invoke
|
14
|
+
end
|
15
|
+
|
16
|
+
require 'rubocop/rake_task'
|
17
|
+
RuboCop::RakeTask.new
|
18
|
+
|
19
|
+
task default: :spec
|
20
|
+
|
21
|
+
rescue LoadError, NameError
|
22
|
+
$stderr.puts "\033[0;31m" \
|
23
|
+
'[!] Some Rake tasks haven been disabled because the environment ' \
|
24
|
+
'couldn’t be loaded. Be sure to run `rake bootstrap` first.' \
|
25
|
+
"\e[0m"
|
26
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'pod/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'cocoapods-git_url_rewriter'
|
8
|
+
spec.version = SourceURLRewriter::VERSION
|
9
|
+
spec.authors = ['Brian Michel']
|
10
|
+
spec.email = ['brian.michel@gmail.com']
|
11
|
+
spec.summary = 'Used to rewrite git source urls before they are downloaded.'
|
12
|
+
spec.homepage = 'https://github.com/brianmichel/cocoapods-git_url_rewriter'
|
13
|
+
spec.license = 'MIT'
|
14
|
+
|
15
|
+
spec.files = `git ls-files -z`.split("\x0")
|
16
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
|
+
spec.require_paths = ['lib']
|
19
|
+
|
20
|
+
spec.add_development_dependency 'bundler', '~> 1.7'
|
21
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
22
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'cocoapods'
|
2
|
+
require 'pod/src/rewriter'
|
3
|
+
|
4
|
+
module Pod
|
5
|
+
module Downloader
|
6
|
+
# Reopening the Git downloader class
|
7
|
+
class Git
|
8
|
+
alias_method :git_url_rewriter_url, :url
|
9
|
+
def url
|
10
|
+
source_url_rewriter.url_for(git_url_rewriter_url)
|
11
|
+
end
|
12
|
+
|
13
|
+
def source_url_rewriter
|
14
|
+
@source_url_rewriter ||= SourceURLRewriter::Rewriter.new
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module SourceURLRewriter
|
2
|
+
# Used to provide rewritten urls
|
3
|
+
# People using this pod would install as follows
|
4
|
+
# plugin 'cocoapods-github_token_http_rewriter', {
|
5
|
+
# "pattern" => "replacement"
|
6
|
+
# }
|
7
|
+
class Rewriter
|
8
|
+
def url_for(url)
|
9
|
+
if user_options
|
10
|
+
transformed_key = transform_key(url)
|
11
|
+
|
12
|
+
if transformed_key
|
13
|
+
rewritten_url = url.sub(transformed_key, user_options[transformed_key])
|
14
|
+
Pod::UI.info("Transforming URL #{url} into #{rewritten_url}")
|
15
|
+
return rewritten_url
|
16
|
+
end
|
17
|
+
else
|
18
|
+
Pod::UI.notice('No options have been specified for rewriting.')
|
19
|
+
end
|
20
|
+
|
21
|
+
url
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def transform_key(url)
|
27
|
+
user_options.keys.find do |key|
|
28
|
+
url.start_with?(key)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def user_options
|
33
|
+
@options ||= podfile.plugins['cocoapods-git_url_rewriter']
|
34
|
+
Pod::UI.notice('No options have been specified for rewriting') unless @options
|
35
|
+
@options
|
36
|
+
end
|
37
|
+
|
38
|
+
def podfile
|
39
|
+
Pod::Config.instance.podfile
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
data/lib/pod/version.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require File.expand_path('../spec_helper', __FILE__)
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
ROOT = Pathname.new(File.expand_path('../../', __FILE__))
|
3
|
+
$LOAD_PATH.unshift((ROOT + 'lib').to_s)
|
4
|
+
$LOAD_PATH.unshift((ROOT + 'spec').to_s)
|
5
|
+
|
6
|
+
require 'bundler/setup'
|
7
|
+
require 'bacon'
|
8
|
+
require 'mocha-on-bacon'
|
9
|
+
require 'cocoapods'
|
10
|
+
|
11
|
+
require 'cocoapods_plugin'
|
12
|
+
|
13
|
+
# Top level module
|
14
|
+
module Pod
|
15
|
+
# Disable the wrapping so the output is deterministic in the tests.
|
16
|
+
#
|
17
|
+
UI.disable_wrap = true
|
18
|
+
|
19
|
+
# Redirects the messages to an internal store.
|
20
|
+
#
|
21
|
+
module UI
|
22
|
+
@output = ''
|
23
|
+
@warnings = ''
|
24
|
+
|
25
|
+
class << self
|
26
|
+
attr_accessor :output
|
27
|
+
attr_accessor :warnings
|
28
|
+
|
29
|
+
def puts(message = '')
|
30
|
+
@output << "#{message}\n"
|
31
|
+
end
|
32
|
+
|
33
|
+
def warn(message = '', _actions = [])
|
34
|
+
@warnings << "#{message}\n"
|
35
|
+
end
|
36
|
+
|
37
|
+
def print(message)
|
38
|
+
@output << message
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
metadata
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cocoapods-git_url_rewriter
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Brian Michel
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-08-10 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.7'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
description:
|
42
|
+
email:
|
43
|
+
- brian.michel@gmail.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- ".gitignore"
|
49
|
+
- Gemfile
|
50
|
+
- Gemfile.lock
|
51
|
+
- LICENSE.txt
|
52
|
+
- README.md
|
53
|
+
- Rakefile
|
54
|
+
- cocoapods-git_url_rewriter.gemspec
|
55
|
+
- lib/cocoapods_plugin.rb
|
56
|
+
- lib/pod/src/rewriter.rb
|
57
|
+
- lib/pod/version.rb
|
58
|
+
- spec/rewriter_spec.rb
|
59
|
+
- spec/spec_helper.rb
|
60
|
+
homepage: https://github.com/brianmichel/cocoapods-git_url_rewriter
|
61
|
+
licenses:
|
62
|
+
- MIT
|
63
|
+
metadata: {}
|
64
|
+
post_install_message:
|
65
|
+
rdoc_options: []
|
66
|
+
require_paths:
|
67
|
+
- lib
|
68
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '0'
|
73
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
requirements: []
|
79
|
+
rubyforge_project:
|
80
|
+
rubygems_version: 2.2.2
|
81
|
+
signing_key:
|
82
|
+
specification_version: 4
|
83
|
+
summary: Used to rewrite git source urls before they are downloaded.
|
84
|
+
test_files:
|
85
|
+
- spec/rewriter_spec.rb
|
86
|
+
- spec/spec_helper.rb
|