cocoapods-repo-rsync 0.39.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a4d92f8b189b4a2681bc6daa82df27c0822b52e6
4
+ data.tar.gz: 459f1d3c159f12c8ac75dd94313fbb0f41de9ba7
5
+ SHA512:
6
+ metadata.gz: 29b01ddc618196cbb4a723c6443da788a8ba0719797c4e6f5ab6ec1f1e9400d6bb652af0349b394a79a90595a1fb47f286e978e70d6af8805b4e1b064e3c3a21
7
+ data.tar.gz: 3aedd1e055de49e0031db06074fa4eeb77531035f3958fff239d7874d065f73704f01e320f7944457e4aa3083e9d272bf9e350bfec93562ee480dbea2be2a7be
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ # Cocoapods::repo-rsync changelog
2
+
3
+ ## 1.0.0
4
+
5
+ * Initial release
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Alibaba
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,57 @@
1
+ [![Gem Version](https://badge.fury.io/rb/cocoapods-repo-rsync.svg)](http://badge.fury.io/rb/cocoapods-repo-rsync)
2
+ [![Code Climate](https://codeclimate.com/github/clarkda/cocoapods-repo-rsync/badges/gpa.svg)](https://codeclimate.com/github/clarkda/cocoapods-repo-rsync)
3
+
4
+ # Cocoapods::RepoRsync
5
+
6
+ Adds subversion support to manage spec-repositories
7
+
8
+ ## Brief
9
+
10
+ Our team had been using a in house fork of Cocoapods with rsync, bzr, and hg spec-repo support. Since #1747 has been closed, I'm porting that code to plugins
11
+
12
+ ## Installation
13
+
14
+ $ gem install cocoapods-repo-rsync
15
+
16
+ # Usage
17
+
18
+ ## Commands
19
+
20
+ Add
21
+
22
+ $ pod repo-rsync add my-rsync-repo http://rsync-repo-url
23
+
24
+ Update
25
+
26
+ $ pod repo-rsync update my-rsync-repo
27
+
28
+ Remove
29
+
30
+ $ pod repo-rsync remove my-rsync-repo
31
+
32
+ ## Podfile integration
33
+
34
+ To include your sources in the install phase of your project, do the following:
35
+ ```ruby
36
+ plugin 'cocoapods-repo-rsync', :sources => [
37
+ 'https://rsync.myrepository.com'
38
+ ]
39
+ ```
40
+
41
+
42
+ ## Contributing
43
+
44
+ ..
45
+
46
+ ## Building
47
+
48
+ $ rake build
49
+
50
+ ## Installing
51
+
52
+ $ rake install
53
+
54
+
55
+ ## Thoughts
56
+
57
+ Repo->Remove and Repo->Lint are generic enough to be lifted out of git specific command/repo
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'cocoapods-repo-rsync'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'cocoapods-repo-rsync'
8
+ spec.version = CocoapodsRepoRsync::VERSION
9
+ spec.authors = ['Whirlwind']
10
+ spec.email = ['whirlwindjames@foxmail.com']
11
+ spec.description = %q{CocoaPod plugin to add rsync support for spec repositories}
12
+ spec.summary = %q{Rsync support for spec repository}
13
+ spec.homepage = 'https://github.com/clarkda/cocoapods-repo-rsync'
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(\.|Gemfile|Rakefile)}) }
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.add_development_dependency 'bundler', '~> 1.3'
22
+ spec.add_development_dependency 'rake'
23
+
24
+ spec.add_dependency 'cocoapods', '<1.0.0'
25
+ end
@@ -0,0 +1,6 @@
1
+ #
2
+ # The namespace of the Cocoapods repo rsync plugin.
3
+ #
4
+ module CocoapodsRepoRsync
5
+ VERSION = '0.39.0.2'
6
+ end
@@ -0,0 +1,36 @@
1
+ require 'pod/command/repo_rsync'
2
+ require 'pod/podfile/dsl'
3
+ require 'rsync_source'
4
+
5
+ # This pre_install hook requires cocoapods v. 0.38.0.beta.2 or higher
6
+ Pod::HooksManager.register('cocoapods-repo-rsync', :source_provider) do |context, options|
7
+ Pod::UI.message 'cocoapods-repo-rsync received source_provider hook'
8
+ return unless sources = options['sources']
9
+ sources.each do |url|
10
+ url = url + "/" unless url.end_with?("/")
11
+ source = Pod::RsyncSource.rsync_source_by_url(url)
12
+ if source
13
+ unless Pod::Config.instance.skip_repo_update
14
+ argv = CLAide::ARGV.new([source.name])
15
+ Pod::Command::RepoRsync::Update.new(argv).run()
16
+ end
17
+ else
18
+ argv = CLAide::ARGV.new([name_for_url(url), url])
19
+ Pod::Command::RepoRsync::Add.new(argv).run()
20
+ source = Pod::RsyncSource.rsync_source_by_url(url)
21
+ end
22
+ context.add_source(source)
23
+ end
24
+ end
25
+
26
+ # @param [String] url The URL of the RSYNC repository
27
+ #
28
+ # @return [String] a name for the repository
29
+ #
30
+ # For now, this uses the host and the last component of the URL as the name
31
+ # So spec@my.server.com:/home/spec will return my-server-com-spec
32
+ def name_for_url(url)
33
+ host, path = url.split(":")
34
+ path = path.split("/").last
35
+ return path.gsub(".", "-").downcase
36
+ end
@@ -0,0 +1,23 @@
1
+ require 'fileutils'
2
+ require 'cocoapods-repo-rsync'
3
+
4
+ module Pod
5
+ class Command
6
+ class RepoRsync < Command
7
+ require 'pod/command/repo_rsync/add'
8
+ require 'pod/command/repo_rsync/update'
9
+
10
+ self.abstract_command = true
11
+ self.summary = <<-SUMMARY
12
+ Manage your Cocoapod spec repositories using subversion - v#{CocoapodsRepoRsync::VERSION}
13
+ SUMMARY
14
+
15
+ extend Executable
16
+ executable :rsync
17
+
18
+ def dir
19
+ config.repos_dir + @name
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,52 @@
1
+ module Pod
2
+ class Command
3
+ class RepoRsync
4
+ class Add < RepoRsync
5
+ self.summary = 'Add a spec-repo using rsync.'
6
+
7
+ self.description = <<-DESC
8
+ Check out `URL` in the local spec-repos directory at `~/.cocoapods/repos/`. The
9
+ remote can later be referred to by `NAME`.
10
+ DESC
11
+
12
+ self.arguments = [
13
+ CLAide::Argument.new('NAME', true),
14
+ CLAide::Argument.new('URL', true)
15
+ ]
16
+
17
+ def initialize(argv)
18
+ @name, @url = argv.shift_argument, argv.shift_argument
19
+ if @url && !@url.end_with?("/")
20
+ @url = @url+"/"
21
+ end
22
+ super
23
+ end
24
+
25
+ def validate!
26
+ super
27
+ unless @name && @url
28
+ help! "Adding a spec-repo needs a `NAME` and a `URL`."
29
+ end
30
+ end
31
+
32
+ def run
33
+ UI.section("Checking out spec-repo `#{@name}` from `#{@url}` using rsync") do
34
+ config.repos_dir.mkpath
35
+ dir=config.repos_dir+@name
36
+ Dir.chdir(config.repos_dir) do
37
+ cmd = "rsync -rtlz#{config.verbose? ? "v" : ""} \"#{@url}\" \"#{dir}\""
38
+ UI.puts cmd if config.verbose?
39
+ system(cmd)
40
+ if $?.success?
41
+ File.open(dir+".rsync_config", "w:UTF-8") do |f|
42
+ f.write @url
43
+ end
44
+ end
45
+ end
46
+ SourcesManager.check_version_information(dir) #todo: TEST ME
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,95 @@
1
+ module Pod
2
+ class Command
3
+ class RepoRsync
4
+ class Update < RepoRsync
5
+ self.summary = 'Update a rsync spec-repo.'
6
+
7
+ self.description = <<-DESC
8
+ Updates the checked out spec-repo `NAME`.
9
+ DESC
10
+
11
+ self.arguments = [
12
+ CLAide::Argument.new('NAME', true)
13
+ ]
14
+
15
+ def initialize(argv)
16
+ @name = argv.shift_argument
17
+ super
18
+ end
19
+
20
+ # def validate!
21
+ # super
22
+ # unless @name
23
+ # help! "Updating a spec-repo needs a `NAME`."
24
+ # end
25
+ # end
26
+
27
+ def run
28
+ update(@name, true) #todo: dusty
29
+ end
30
+
31
+ #@!group Update helpers
32
+ #-----------------------------------------------------------------------#
33
+
34
+ private
35
+
36
+ # Slightly modified SourcesManager->update to deal with subversion updates.
37
+ #
38
+ # Original contributors:
39
+ #
40
+ # Fabio Pelosin http://github.com/irrationalfab
41
+ # Boris Bügling http://githun.com/neonichu
42
+ #
43
+
44
+ # Updates the local copy of the spec-repo with the given name
45
+ #
46
+ # @param [String] source_name name
47
+ #
48
+ # @return [void]
49
+ #
50
+ def update(source_name = nil, show_output = false)
51
+ if source_name
52
+ sources = [rsync_source_named(source_name)]
53
+ else
54
+ sources = RsyncSource.rsync_sources
55
+ end
56
+
57
+ sources.each do |source|
58
+ UI.section "Updating spec repo `#{source.name}`" do
59
+ Dir.chdir(source.repo) do
60
+ begin
61
+ cmd = "rsync -rtl#{config.verbose? ? "v" : ""} \"#{source.url}\" \"#{source.repo}\""
62
+ UI.puts cmd if config.verbose?
63
+ system(cmd)
64
+ rescue Informative => e
65
+ UI.warn 'CocoaPods was not able to update the ' \
66
+ "`#{source.name}` repo. If this is an unexpected issue " \
67
+ 'and persists you can inspect it running ' \
68
+ '`pod repo-rsync update --verbose`'
69
+ end
70
+ end
71
+ SourcesManager.check_version_information(source.repo)
72
+ end
73
+ end
74
+ end
75
+
76
+ # @return [Source] The rsync source with the given name. If no rsync source
77
+ # with given name is found it raises.
78
+ #
79
+ # @param [String] name
80
+ # The name of the source.
81
+ #
82
+ def rsync_source_named(name)
83
+ specified_source = SourcesManager.aggregate.sources.find { |s| s.name == name }
84
+ unless specified_source
85
+ raise Informative, "Unable to find the `#{name}` repo."
86
+ end
87
+ unless RsyncSource.rsync_repo?(specified_source.repo)
88
+ raise Informative, "The `#{name}` repo is not a rsync repo."
89
+ end
90
+ RsyncSource.new(specified_source.repo)
91
+ end
92
+ end
93
+ end
94
+ end
95
+ end
@@ -0,0 +1,11 @@
1
+ module Pod
2
+ class Podfile
3
+ module DSL
4
+ def rsync_source(source)
5
+ hash_plugins = get_hash_value('plugins') || {"cocoapods-repo-rsync"=>{"sources"=>[]}}
6
+ hash_plugins["cocoapods-repo-rsync"]["sources"] << source
7
+ set_hash_value('plugins', hash_plugins)
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,30 @@
1
+ module Pod
2
+ # Subclass of Pod::Source to provide support for RSYNC Specs repositories
3
+ #
4
+ class RsyncSource < Source
5
+ def url
6
+ u = File.open(repo + '.rsync_config', "r:UTF-8", &:read).strip
7
+ u = u+"/" unless u.end_with?("/")
8
+ u
9
+ end
10
+
11
+
12
+ def self.rsync_repo?(dir)
13
+ (dir+".rsync_config").exist?
14
+ end
15
+
16
+ def self.rsync_sources
17
+ dirs = Pod::Config.instance.repos_dir.children.select(&:directory?)
18
+ dirs = dirs.select do |dir|
19
+ RsyncSource.rsync_repo?(dir)
20
+ end
21
+ dirs.map { |dir| RsyncSource.new(dir) }
22
+ end
23
+
24
+ def self.rsync_source_by_url(url)
25
+ rsync_sources.find do |source|
26
+ source.url == url
27
+ end
28
+ end
29
+ end
30
+ end
metadata ADDED
@@ -0,0 +1,97 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cocoapods-repo-rsync
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.39.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Whirlwind
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-05-13 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.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: cocoapods
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "<"
46
+ - !ruby/object:Gem::Version
47
+ version: 1.0.0
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "<"
53
+ - !ruby/object:Gem::Version
54
+ version: 1.0.0
55
+ description: CocoaPod plugin to add rsync support for spec repositories
56
+ email:
57
+ - whirlwindjames@foxmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - CHANGELOG.md
63
+ - LICENSE
64
+ - README.md
65
+ - cocoapods-repo-rsync.gemspec
66
+ - lib/cocoapods-repo-rsync.rb
67
+ - lib/cocoapods_plugin.rb
68
+ - lib/pod/command/repo_rsync.rb
69
+ - lib/pod/command/repo_rsync/add.rb
70
+ - lib/pod/command/repo_rsync/update.rb
71
+ - lib/pod/podfile/dsl.rb
72
+ - lib/rsync_source.rb
73
+ homepage: https://github.com/clarkda/cocoapods-repo-rsync
74
+ licenses:
75
+ - MIT
76
+ metadata: {}
77
+ post_install_message:
78
+ rdoc_options: []
79
+ require_paths:
80
+ - lib
81
+ required_ruby_version: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ required_rubygems_version: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ requirements: []
92
+ rubyforge_project:
93
+ rubygems_version: 2.6.4
94
+ signing_key:
95
+ specification_version: 4
96
+ summary: Rsync support for spec repository
97
+ test_files: []