pod-synchronize 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +2 -0
- data/.rspec +3 -0
- data/.simplecov +4 -0
- data/.travis.yml +3 -0
- data/Gemfile +8 -0
- data/Gemfile.lock +67 -0
- data/LICENSE +22 -0
- data/README.md +73 -0
- data/Rakefile +5 -0
- data/bin/pod-synchronize +11 -0
- data/lib/updater/command.rb +23 -0
- data/lib/updater/configuration.rb +39 -0
- data/lib/updater/git.rb +40 -0
- data/lib/updater/pod.rb +27 -0
- data/lib/updater/specs.rb +30 -0
- data/lib/updater/synchronize.rb +87 -0
- data/lib/updater/version.rb +38 -0
- data/lib/updater.rb +7 -0
- data/pod-synchronize.gemspec +22 -0
- data/spec/configuration_spec.rb +60 -0
- data/spec/fixtures/config.yml +14 -0
- data/spec/fixtures/specs/NBNRealmBrowser/0.1.0/NBNRealmBrowser.podspec.json +26 -0
- data/spec/fixtures/specs/NBNRealmBrowser/0.2.0/NBNRealmBrowser.podspec.json +26 -0
- data/spec/fixtures/specs/NBNRealmBrowser/0.3.0/NBNRealmBrowser.podspec.json +26 -0
- data/spec/fixtures/specs/XNGAPIClient/0.1.0/XNGAPIClient.podspec.json +35 -0
- data/spec/fixtures/specs/XNGAPIClient/0.2.0/XNGAPIClient.podspec.json +36 -0
- data/spec/fixtures/specs/XNGAPIClient/0.2.1/XNGAPIClient.podspec.json +45 -0
- data/spec/fixtures/specs/XNGAPIClient/0.2.2/XNGAPIClient.podspec.json +45 -0
- data/spec/fixtures/specs/XNGAPIClient/0.3.0/XNGAPIClient.podspec.json +45 -0
- data/spec/fixtures/specs/XNGAPIClient/0.3.1/XNGAPIClient.podspec.json +45 -0
- data/spec/fixtures/specs/XNGAPIClient/0.4.0/XNGAPIClient.podspec.json +45 -0
- data/spec/fixtures/specs/XNGAPIClient/1.0.0/XNGAPIClient.podspec.json +42 -0
- data/spec/fixtures/specs/XNGAPIClient/1.1.0/XNGAPIClient.podspec.json +42 -0
- data/spec/fixtures/specs/XNGAPIClient/1.1.1/XNGAPIClient.podspec.json +42 -0
- data/spec/fixtures/specs/XNGAPIClient/1.2.0/XNGAPIClient.podspec.json +42 -0
- data/spec/fixtures/specs/XNGOAuth1Client/0.0.1/XNGOAuth1Client.podspec.json +26 -0
- data/spec/fixtures/specs/XNGOAuth1Client/0.0.2/XNGOAuth1Client.podspec.json +26 -0
- data/spec/fixtures/specs/XNGOAuth1Client/1.0.0/XNGOAuth1Client.podspec.json +26 -0
- data/spec/fixtures/specs/XNGOAuth1Client/2.0.0/XNGOAuth1Client.podspec.json +26 -0
- data/spec/fixtures/specs/XNGOAuth1Client/2.0.1/XNGOAuth1Client.podspec.json +26 -0
- data/spec/fixtures/specs_other/NBNPhotoChooser/0.0.1/NBNPhotoChooser.podspec.json +25 -0
- data/spec/fixtures/specs_other/NBNPhotoChooser/0.0.2/NBNPhotoChooser.podspec.json +25 -0
- data/spec/fixtures/specs_other/NBNPhotoChooser/0.0.6/NBNPhotoChooser.podspec.json +25 -0
- data/spec/fixtures/specs_other/NBNPhotoChooser/0.1.0/NBNPhotoChooser.podspec.json +25 -0
- data/spec/fixtures/specs_other/NBNPhotoChooser/0.2.0/NBNPhotoChooser.podspec.json +25 -0
- data/spec/fixtures/specs_other/NBNPhotoChooser/0.2.1/NBNPhotoChooser.podspec.json +25 -0
- data/spec/git_spec.rb +60 -0
- data/spec/pod_spec.rb +54 -0
- data/spec/spec_helper.rb +102 -0
- data/spec/specs_spec.rb +51 -0
- data/spec/version_spec.rb +45 -0
- metadata +186 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 7ad04e2e3697211aca9010cd884e026b01e7c913
|
4
|
+
data.tar.gz: c8dcac0b1f5c3bff0d590742b5653599e777c8d4
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f6932cd548b293f1b6fc430f7c3870a32c0933dbe5bce3318c8f50e747e7250996601c3cb339411c624de71dd703a17621953063a006dc9efa2078c179a748c5
|
7
|
+
data.tar.gz: eb2c049982754b089e3348eeeeb4af2be93cd7add8b6a20bf95059f2c86451e95abacabf441a41521a7f3c263b9d35e4afbd282a6c7caea01e0fd5eb93830702
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.simplecov
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
pod-synchronize (0.1.0)
|
5
|
+
claide (~> 0.8.1)
|
6
|
+
colored
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
claide (0.8.1)
|
12
|
+
colored (1.2)
|
13
|
+
coveralls (0.8.1)
|
14
|
+
json (~> 1.8)
|
15
|
+
rest-client (>= 1.6.8, < 2)
|
16
|
+
simplecov (~> 0.10.0)
|
17
|
+
term-ansicolor (~> 1.3)
|
18
|
+
thor (~> 0.19.1)
|
19
|
+
diff-lcs (1.2.5)
|
20
|
+
docile (1.1.5)
|
21
|
+
domain_name (0.5.24)
|
22
|
+
unf (>= 0.0.5, < 1.0.0)
|
23
|
+
http-cookie (1.0.2)
|
24
|
+
domain_name (~> 0.5)
|
25
|
+
json (1.8.2)
|
26
|
+
mime-types (2.5)
|
27
|
+
netrc (0.10.3)
|
28
|
+
rake (10.4.2)
|
29
|
+
rest-client (1.8.0)
|
30
|
+
http-cookie (>= 1.0.2, < 2.0)
|
31
|
+
mime-types (>= 1.16, < 3.0)
|
32
|
+
netrc (~> 0.7)
|
33
|
+
rspec (3.2.0)
|
34
|
+
rspec-core (~> 3.2.0)
|
35
|
+
rspec-expectations (~> 3.2.0)
|
36
|
+
rspec-mocks (~> 3.2.0)
|
37
|
+
rspec-core (3.2.3)
|
38
|
+
rspec-support (~> 3.2.0)
|
39
|
+
rspec-expectations (3.2.1)
|
40
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
41
|
+
rspec-support (~> 3.2.0)
|
42
|
+
rspec-mocks (3.2.1)
|
43
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
44
|
+
rspec-support (~> 3.2.0)
|
45
|
+
rspec-support (3.2.2)
|
46
|
+
simplecov (0.10.0)
|
47
|
+
docile (~> 1.1.0)
|
48
|
+
json (~> 1.8)
|
49
|
+
simplecov-html (~> 0.10.0)
|
50
|
+
simplecov-html (0.10.0)
|
51
|
+
term-ansicolor (1.3.0)
|
52
|
+
tins (~> 1.0)
|
53
|
+
thor (0.19.1)
|
54
|
+
tins (1.5.1)
|
55
|
+
unf (0.1.4)
|
56
|
+
unf_ext
|
57
|
+
unf_ext (0.0.7.1)
|
58
|
+
|
59
|
+
PLATFORMS
|
60
|
+
ruby
|
61
|
+
|
62
|
+
DEPENDENCIES
|
63
|
+
bundler (~> 1.7)
|
64
|
+
coveralls
|
65
|
+
pod-synchronize!
|
66
|
+
rake (~> 10.0)
|
67
|
+
rspec
|
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 XING AG
|
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,73 @@
|
|
1
|
+
# XNGPodSynchronizer
|
2
|
+
|
3
|
+
[![Build Status](https://travis-ci.org/xing/XNGPodsSynchronizer.svg?branch=master)](https://travis-ci.org/xing/XNGPodSynchronizer)
|
4
|
+
[![Coverage Status](https://coveralls.io/repos/xing/XNGPodsSynchronizer/badge.svg?branch=master)](https://coveralls.io/r/xing/XNGPodSynchronizer?branch=master)
|
5
|
+
|
6
|
+
XNGPodSynchronizer reads `Podfile.locks` of your projects, copies the `.podspec`s from the CocoaPods master repository and mirrors it to your own `git` repository (e.g. GitHub Enterprise). This helps you get independent from `github.com`.
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
XNGPodSynchronizer is distributed as a Ruby gem and can be installed using the following command:
|
11
|
+
|
12
|
+
```bash
|
13
|
+
$ gem install pod-synchronize
|
14
|
+
```
|
15
|
+
|
16
|
+
## Usage
|
17
|
+
|
18
|
+
XNGPodSynchronizer takes a `config.yml` as an argument an example `Yaml` would look like this:
|
19
|
+
|
20
|
+
```yaml
|
21
|
+
# config.yml
|
22
|
+
---
|
23
|
+
master_repo: https://github.com/CocoaPods/Specs.git
|
24
|
+
mirror:
|
25
|
+
specs_push_url: git@git.hooli.xyz:pods-mirror/Specs.git
|
26
|
+
source_push_url: git@git.hooli.xyz:pods-mirror
|
27
|
+
source_clone_url: git://git.hooli.xyz/pods-mirror
|
28
|
+
github:
|
29
|
+
acccess_token: 0y83t1ihosjklgnuioa
|
30
|
+
organisation: pods-mirror
|
31
|
+
endpoint: https://git.hooli.xyz/api/v3
|
32
|
+
podfiles:
|
33
|
+
- "https://git.hooli.xyz/ios/moonshot/raw/master/Podfile.lock"
|
34
|
+
- "https://git.hooli.xyz/ios/nucleus/raw/master/Podfile.lock"
|
35
|
+
- "https://git.hooli.xyz/ios/bro2bro/raw/master/Podfile.lock"
|
36
|
+
```
|
37
|
+
|
38
|
+
|key|meaning|
|
39
|
+
|:----|:----|
|
40
|
+
|master_repo|CocoaPods master repository (usually: https://github.com/CocoaPods/Specs.git)|
|
41
|
+
|mirror.specs_push_url|Git URL used to clone & push the mirrored specs|
|
42
|
+
|mirror.source_push_url|Git URL used to push the mirrored repositories|
|
43
|
+
|mirror.source_clone_url|Git URL used to change the download URLs in the podspecs|
|
44
|
+
|mirror.github.access_token|Access token used to create new repositories|
|
45
|
+
|mirror.github.organisation|The GitHub organization used for mirrored repositories|
|
46
|
+
|mirror.github.endpoint|API Endpoint of your GitHub api|
|
47
|
+
|podfiles|List of __Podfile.lock__ in __Plain Text__ format|
|
48
|
+
|
49
|
+
We use Jenkins to run the synchronize process twice daily. To do that use the following command:
|
50
|
+
|
51
|
+
```
|
52
|
+
$ pod-synchronize synchronize config.yml
|
53
|
+
```
|
54
|
+
|
55
|
+
## TODO
|
56
|
+
|
57
|
+
* Support Gitlab [#1](https://github.com/xing/XNGPodSynchronizer/issue/1)
|
58
|
+
|
59
|
+
## Contributing
|
60
|
+
|
61
|
+
1. Fork it ( https://github.com/xing/XNGPodSynchronizer/fork )
|
62
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
63
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
64
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
65
|
+
5. Create a new Pull Request
|
66
|
+
|
67
|
+
## Authors
|
68
|
+
|
69
|
+
[Matthias Männich](https://github.com/matthias-maennich) and [Piet Brauer](https://github.com/pietbrauer)
|
70
|
+
|
71
|
+
Copyright (c) 2015 [XING AG](https://xing.com/)
|
72
|
+
|
73
|
+
Released under the MIT license. For full details see LICENSE included in this distribution.
|
data/Rakefile
ADDED
data/bin/pod-synchronize
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
if $PROGRAM_NAME == __FILE__
|
4
|
+
ENV['BUNDLE_GEMFILE'] = File.expand_path('../../Gemfile', __FILE__)
|
5
|
+
require 'rubygems'
|
6
|
+
require 'bundler/setup'
|
7
|
+
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
8
|
+
end
|
9
|
+
|
10
|
+
require 'updater'
|
11
|
+
PodSynchronize::Command.run(ARGV)
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'claide'
|
2
|
+
require 'colored'
|
3
|
+
|
4
|
+
module PodSynchronize
|
5
|
+
class PlainInformative < StandardError
|
6
|
+
include CLAide::InformativeError
|
7
|
+
end
|
8
|
+
|
9
|
+
class Informative < PlainInformative
|
10
|
+
def message
|
11
|
+
"[!] #{super}".red
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
class Command < CLAide::Command
|
16
|
+
require "updater"
|
17
|
+
|
18
|
+
self.abstract_command = true
|
19
|
+
self.command = 'pod-synchronize'
|
20
|
+
self.version = '0.1.0'
|
21
|
+
self.description = 'Pods Synchronizer'
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
|
3
|
+
class Configuration
|
4
|
+
attr_reader :yaml
|
5
|
+
Mirror = Struct.new(:specs_push_url, :source_push_url, :source_clone_url, :github)
|
6
|
+
Github = Struct.new(:access_token, :organisation, :endpoint)
|
7
|
+
|
8
|
+
def initialize(path:)
|
9
|
+
@yaml = YAML.load_file(path)
|
10
|
+
end
|
11
|
+
|
12
|
+
def master_repo
|
13
|
+
@yaml['master_repo']
|
14
|
+
end
|
15
|
+
|
16
|
+
def podfiles
|
17
|
+
@yaml['podfiles']
|
18
|
+
end
|
19
|
+
|
20
|
+
def mirror
|
21
|
+
context = @yaml['mirror']
|
22
|
+
Mirror.new(
|
23
|
+
context['specs_push_url'],
|
24
|
+
context['source_push_url'],
|
25
|
+
context['source_clone_url'],
|
26
|
+
github)
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def github
|
32
|
+
context = @yaml['mirror']['github']
|
33
|
+
Github.new(
|
34
|
+
context['acccess_token'],
|
35
|
+
context['organisation'],
|
36
|
+
context['endpoint'])
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
data/lib/updater/git.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
class Git
|
2
|
+
attr_accessor :path
|
3
|
+
|
4
|
+
def initialize(path: Dir.pwd)
|
5
|
+
@path = path
|
6
|
+
end
|
7
|
+
|
8
|
+
def commit(message:)
|
9
|
+
execute('git add', '--all')
|
10
|
+
execute('git commit', '-m', "'#{message}'")
|
11
|
+
end
|
12
|
+
|
13
|
+
def push(remote: 'origin master', options: nil)
|
14
|
+
execute('git push', remote, options)
|
15
|
+
end
|
16
|
+
|
17
|
+
def clone(url:, options: '.')
|
18
|
+
execute('git clone', url, options)
|
19
|
+
end
|
20
|
+
|
21
|
+
def set_origin(url:)
|
22
|
+
execute('git remote', 'set-url origin', url)
|
23
|
+
end
|
24
|
+
|
25
|
+
def create_github_repo(access_token:, org:, name:, endpoint:)
|
26
|
+
execute('curl',
|
27
|
+
"#{endpoint}/orgs/#{org}/repos?access_token=#{access_token}",
|
28
|
+
'-d', "'{\"name\":\"#{name}\"}'")
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def execute(*command)
|
34
|
+
FileUtils.mkdir_p(path) unless Dir.exists?(path)
|
35
|
+
Dir.chdir(path) do
|
36
|
+
system(*command.join(" ").strip)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
data/lib/updater/pod.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
class Pod
|
2
|
+
attr_reader :path, :name
|
3
|
+
|
4
|
+
def initialize(path:)
|
5
|
+
@path = path
|
6
|
+
@name = @path.split(File::SEPARATOR).last
|
7
|
+
end
|
8
|
+
|
9
|
+
def versions
|
10
|
+
@versions ||= Dir.glob(File.join(@path, '*')).map do |version_path|
|
11
|
+
Version.new(path: version_path)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def git_source
|
16
|
+
versions.sort.last.contents["source"]["git"]
|
17
|
+
end
|
18
|
+
|
19
|
+
def save
|
20
|
+
versions.each(&:save)
|
21
|
+
end
|
22
|
+
|
23
|
+
def git
|
24
|
+
@git ||= Git.new(path: @path)
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
|
3
|
+
class Specs
|
4
|
+
attr_reader :path, :whitelist, :specs_root
|
5
|
+
|
6
|
+
def initialize(path:, whitelist: [], specs_root: '')
|
7
|
+
@path = path
|
8
|
+
@whitelist = whitelist
|
9
|
+
@specs_root = File.join(@path, specs_root)
|
10
|
+
end
|
11
|
+
|
12
|
+
def pods
|
13
|
+
@pods ||= Dir.glob(File.join(@specs_root, '*')).map do |pod_path|
|
14
|
+
pod = Pod.new(path: pod_path)
|
15
|
+
@whitelist.any? && !@whitelist.include?(pod.name) ? nil : pod
|
16
|
+
end.compact
|
17
|
+
end
|
18
|
+
|
19
|
+
def merge_pods(other_pods)
|
20
|
+
other_pods.each do |pod|
|
21
|
+
FileUtils.cp_r(pod.path, @path)
|
22
|
+
end
|
23
|
+
@pods = nil
|
24
|
+
end
|
25
|
+
|
26
|
+
def git
|
27
|
+
@git ||= Git.new(path: @path)
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
@@ -0,0 +1,87 @@
|
|
1
|
+
require 'open-uri'
|
2
|
+
|
3
|
+
module PodSynchronize
|
4
|
+
class Command
|
5
|
+
class Synchronize < Command
|
6
|
+
self.command = 'synchronize'
|
7
|
+
self.summary = 'Synchronize the public CocoaPods repository with your mirror'
|
8
|
+
|
9
|
+
self.arguments = [
|
10
|
+
CLAide::Argument.new('CONFIG', :true),
|
11
|
+
]
|
12
|
+
|
13
|
+
def initialize(argv)
|
14
|
+
@yml_path = argv.shift_argument
|
15
|
+
end
|
16
|
+
|
17
|
+
def validate!
|
18
|
+
raise Informative, "Please specify a valid CONFIG path" unless @yml_path
|
19
|
+
end
|
20
|
+
|
21
|
+
def setup(temp_path:)
|
22
|
+
@config = Configuration.new(path: @yml_path)
|
23
|
+
@master_specs = Specs.new(path: File.join(temp_path, 'master'), whitelist: dependencies, specs_root: 'Specs')
|
24
|
+
@internal_specs = Specs.new(path: File.join(temp_path, 'local'))
|
25
|
+
end
|
26
|
+
|
27
|
+
def bootstrap
|
28
|
+
@internal_specs.git.clone(url: @config.mirror.specs_push_url)
|
29
|
+
@master_specs.git.clone(url: @config.master_repo, options: '. --depth 1')
|
30
|
+
end
|
31
|
+
|
32
|
+
def update_specs
|
33
|
+
@internal_specs.merge_pods(@master_specs.pods)
|
34
|
+
|
35
|
+
@internal_specs.pods.each do |pod|
|
36
|
+
pod.versions.each do |version|
|
37
|
+
if version.contents["source"]["git"]
|
38
|
+
version.contents["source"]["git"] = "#{@config.mirror.source_clone_url}/#{pod.name}.git"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
pod.save
|
42
|
+
end
|
43
|
+
@internal_specs.git.commit(message: commit_message)
|
44
|
+
@internal_specs.git.push
|
45
|
+
end
|
46
|
+
|
47
|
+
def commit_message
|
48
|
+
time_str = Time.now.strftime('%c')
|
49
|
+
"Update #{time_str}"
|
50
|
+
end
|
51
|
+
|
52
|
+
def update_sources(temp_path:)
|
53
|
+
@master_specs.pods.each do |pod|
|
54
|
+
pod.git.path = File.join(temp_path, 'source_cache', pod.name)
|
55
|
+
pod.git.clone(url: pod.git_source, options: ". --bare")
|
56
|
+
pod.git.create_github_repo(
|
57
|
+
access_token: @config.mirror.github.access_token,
|
58
|
+
org: @config.mirror.github.organisation,
|
59
|
+
name: pod.name,
|
60
|
+
endpoint: @config.mirror.github.endpoint
|
61
|
+
)
|
62
|
+
pod.git.set_origin(url: "#{@config.mirror.source_push_url}/#{pod.name}.git")
|
63
|
+
pod.git.push(remote: nil, options: '--mirror')
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def dependencies
|
68
|
+
pods_dependencies = []
|
69
|
+
|
70
|
+
@config.podfiles.each do |podfile|
|
71
|
+
podfile_contents = open(podfile, {ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE}) { |io| io.read }
|
72
|
+
pods_dependencies << YAML.load(podfile_contents)["SPEC CHECKSUMS"].keys
|
73
|
+
end
|
74
|
+
pods_dependencies.flatten!.uniq!
|
75
|
+
end
|
76
|
+
|
77
|
+
def run
|
78
|
+
Dir.mktmpdir do |dir|
|
79
|
+
self.setup(temp_path: dir)
|
80
|
+
self.bootstrap
|
81
|
+
self.update_specs
|
82
|
+
self.update_sources(temp_path: dir)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
class Version
|
4
|
+
attr_reader :path, :version
|
5
|
+
attr_accessor :contents
|
6
|
+
|
7
|
+
def initialize(path:)
|
8
|
+
@path = path
|
9
|
+
@version = @path.split(File::SEPARATOR).last
|
10
|
+
@contents = fetch_podspec
|
11
|
+
end
|
12
|
+
|
13
|
+
def save
|
14
|
+
File.write(podspec_path, JSON.pretty_generate(@contents))
|
15
|
+
end
|
16
|
+
|
17
|
+
def <=>(other)
|
18
|
+
own_version = @version.split('.').map(&:to_i)
|
19
|
+
other_version = other.version.split('.').map(&:to_i)
|
20
|
+
own_version <=> other_version
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def podspec_path
|
26
|
+
filepath = Dir.glob(File.join(@path, '*')).first
|
27
|
+
unless filepath.end_with? 'podspec.json'
|
28
|
+
raise "Couldn't find podspec file, got #{filepath}"
|
29
|
+
end
|
30
|
+
filepath
|
31
|
+
end
|
32
|
+
|
33
|
+
def fetch_podspec
|
34
|
+
file = File.read(podspec_path)
|
35
|
+
JSON.parse(file)
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
data/lib/updater.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
Gem::Specification.new do |spec|
|
3
|
+
spec.name = "pod-synchronize"
|
4
|
+
spec.version = "0.1.0"
|
5
|
+
spec.authors = ["Matthias Männich", "Piet Brauer"]
|
6
|
+
spec.email = ["matthias.maennich@xing.com", "piet.brauer@xing.com"]
|
7
|
+
spec.summary = %q{Mirrors CocoaPods specs}
|
8
|
+
spec.description = %q{Synchronizes the public CocoaPods Specs repo with your internal mirror.}
|
9
|
+
spec.homepage = "https://github.com/xing/XNGPodsSynchronizer"
|
10
|
+
spec.license = "MIT"
|
11
|
+
|
12
|
+
spec.files = `git ls-files -z`.split("\x0")
|
13
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
14
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
15
|
+
spec.require_paths = ["lib"]
|
16
|
+
|
17
|
+
spec.add_dependency "claide", "~> 0.8.1"
|
18
|
+
spec.add_dependency "colored", "~> 1.2"
|
19
|
+
|
20
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
21
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
22
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
describe Configuration do
|
2
|
+
|
3
|
+
describe "#initialize" do
|
4
|
+
it "loads the yaml config at the specified path" do
|
5
|
+
config = Configuration.new(path: File.join('spec', 'fixtures', 'config.yml'))
|
6
|
+
expect(config.yaml).to_not be_empty
|
7
|
+
end
|
8
|
+
|
9
|
+
it "throws an exception if the file at the path does not exist" do
|
10
|
+
expect { Configuration.new(path: 'invalid/path') }.to raise_exception
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
before :all do
|
15
|
+
@config = Configuration.new(path: 'spec/fixtures/config.yml')
|
16
|
+
end
|
17
|
+
|
18
|
+
it '#master_repo should exist' do
|
19
|
+
expect(@config.master_repo).to eql("https://github.com/CocoaPods/Specs.git")
|
20
|
+
end
|
21
|
+
|
22
|
+
describe '#podfiles' do
|
23
|
+
it 'should parse the podfiles correctly' do
|
24
|
+
expected_result = [
|
25
|
+
"https://git.hooli.xyz/ios/moonshot/raw/master/Podfile.lock",
|
26
|
+
"https://git.hooli.xyz/ios/nucleus/raw/master/Podfile.lock",
|
27
|
+
"https://git.hooli.xyz/ios/bro2bro/raw/master/Podfile.lock"]
|
28
|
+
expect(@config.podfiles).to eql(expected_result)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe "#mirror" do
|
33
|
+
it 'should have the correct @specs_push_url' do
|
34
|
+
expect(@config.mirror.specs_push_url).to eql("git@git.hooli.xyz:pods-mirror/Specs.git")
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'should have the correct @source_push_url' do
|
38
|
+
expect(@config.mirror.source_push_url).to eql("git@git.hooli.xyz:pods-mirror")
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'should have the correct @source_clone_url' do
|
42
|
+
expect(@config.mirror.source_clone_url).to eql("git://git.hooli.xyz/pods-mirror")
|
43
|
+
end
|
44
|
+
|
45
|
+
describe '#github' do
|
46
|
+
it 'should have the correct @source_clone_url' do
|
47
|
+
expect(@config.mirror.github.access_token).to eql("0y83t1ihosjklgnuioa")
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'should have the correct @organisation' do
|
51
|
+
expect(@config.mirror.github.organisation).to eql("pods-mirror")
|
52
|
+
end
|
53
|
+
|
54
|
+
it 'should have the correct @endpoint' do
|
55
|
+
expect(@config.mirror.github.endpoint).to eql("https://git.hooli.xyz/api/v3")
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
---
|
2
|
+
master_repo: https://github.com/CocoaPods/Specs.git
|
3
|
+
mirror:
|
4
|
+
specs_push_url: git@git.hooli.xyz:pods-mirror/Specs.git
|
5
|
+
source_push_url: git@git.hooli.xyz:pods-mirror
|
6
|
+
source_clone_url: git://git.hooli.xyz/pods-mirror
|
7
|
+
github:
|
8
|
+
acccess_token: 0y83t1ihosjklgnuioa
|
9
|
+
organisation: pods-mirror
|
10
|
+
endpoint: https://git.hooli.xyz/api/v3
|
11
|
+
podfiles:
|
12
|
+
- "https://git.hooli.xyz/ios/moonshot/raw/master/Podfile.lock"
|
13
|
+
- "https://git.hooli.xyz/ios/nucleus/raw/master/Podfile.lock"
|
14
|
+
- "https://git.hooli.xyz/ios/bro2bro/raw/master/Podfile.lock"
|
@@ -0,0 +1,26 @@
|
|
1
|
+
{
|
2
|
+
"name": "NBNRealmBrowser",
|
3
|
+
"version": "0.1.0",
|
4
|
+
"summary": "NBNRealmBrowser is the iOS companion to the\n Realm Browser for Mac.",
|
5
|
+
"description": " NBNRealmBrowser is the iOS companion to the\n Realm Browser for Mac.\n It displays all information for your current\n Realm for debugging purposes.\n",
|
6
|
+
"homepage": "https://github.com/nerdishbynature/NBNRealmBrowser",
|
7
|
+
"license": "MIT",
|
8
|
+
"authors": {
|
9
|
+
"Piet Brauer": "piet@nerdishbynature.com"
|
10
|
+
},
|
11
|
+
"source": {
|
12
|
+
"git": "https://github.com/nerdishbynature/NBNRealmBrowser.git",
|
13
|
+
"tag": "0.1.0"
|
14
|
+
},
|
15
|
+
"social_media_url": "https://twitter.com/pietbrauer",
|
16
|
+
"platforms": {
|
17
|
+
"ios": "7.0"
|
18
|
+
},
|
19
|
+
"requires_arc": true,
|
20
|
+
"source_files": "Pod/Classes",
|
21
|
+
"dependencies": {
|
22
|
+
"Realm": [
|
23
|
+
"~> 0.85"
|
24
|
+
]
|
25
|
+
}
|
26
|
+
}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
{
|
2
|
+
"name": "NBNRealmBrowser",
|
3
|
+
"version": "0.2.0",
|
4
|
+
"summary": "NBNRealmBrowser is the iOS companion to the Realm Browser for Mac.",
|
5
|
+
"description": " NBNRealmBrowser is the iOS companion to the\n Realm Browser for Mac.\n It displays all information for your current\n Realm for debugging purposes.\n",
|
6
|
+
"homepage": "https://github.com/nerdishbynature/NBNRealmBrowser",
|
7
|
+
"license": "MIT",
|
8
|
+
"authors": {
|
9
|
+
"Piet Brauer": "piet@nerdishbynature.com"
|
10
|
+
},
|
11
|
+
"source": {
|
12
|
+
"git": "https://github.com/nerdishbynature/NBNRealmBrowser.git",
|
13
|
+
"tag": "0.2.0"
|
14
|
+
},
|
15
|
+
"social_media_url": "https://twitter.com/pietbrauer",
|
16
|
+
"platforms": {
|
17
|
+
"ios": "7.0"
|
18
|
+
},
|
19
|
+
"requires_arc": true,
|
20
|
+
"source_files": "Pod/Classes",
|
21
|
+
"dependencies": {
|
22
|
+
"Realm": [
|
23
|
+
"~> 0.85"
|
24
|
+
]
|
25
|
+
}
|
26
|
+
}
|