cocoapods-repo-rsync 1.0.0.1 → 1.0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ab6853d30e34d94b06eb32519df0cd4682cc2c72
4
- data.tar.gz: 2a629795edd05f646f866b5271af6de9b1d76a3f
3
+ metadata.gz: c013a09c55fbd315e76d6a0014df1c123693a15f
4
+ data.tar.gz: b6586c230eb7e1606c4fd495af118dc658f95d30
5
5
  SHA512:
6
- metadata.gz: f5b672fc3300eb23a5c0cad9fb996fe7d49a9b998a07c536d5211669c2a00b22d87873a103ec99eb6497cbdfd5532fb6f1428a1fc396e73f6f3bac48919bfb36
7
- data.tar.gz: fe21b7cfff7604ecd274fb886024efa3aadf8f4120870644e5d4369fce08ac21c19c9dc34149849e6e0c773a98b5ccac5591540deb09b5ccb2d62a8b6fbe7317
6
+ metadata.gz: a20493c6de981cdfce96e5ead31f1c84988b3b67dd1f206eaaf8b474732d86f4da5fba1537985016cff6e58cf8b3a9bcd32d94069dd8cfcfd029681c2ed65e29
7
+ data.tar.gz: 02894bbfc3a30257c3446a46b966a8054c25c6b6b1bea48cded8532fa5e96c377d025d4917fe020e7472bf6ff800f28d3c904aaeeafcc7fdd6b6ff6b1522ae7f
@@ -2,5 +2,5 @@
2
2
  # The namespace of the Cocoapods repo rsync plugin.
3
3
  #
4
4
  module CocoapodsRepoRsync
5
- VERSION = '1.0.0.1'
5
+ VERSION = '1.0.0.3'
6
6
  end
@@ -9,23 +9,28 @@ if Gem::Dependency.new("", '>= 0.39').match?('', Pod::VERSION)
9
9
  Pod::HooksManager.register('cocoapods-repo-rsync', :source_provider) do |context, options|
10
10
  Pod::UI.message 'cocoapods-repo-rsync received source_provider hook'
11
11
  return unless sources = options['sources']
12
- sources.each do |url|
12
+ sources.each do |source|
13
+ url, ssh_argv = source
13
14
  url = url + "/" unless url.end_with?("/")
14
15
  source = Pod::RsyncSource.rsync_source_by_url(url)
15
16
  if source
16
17
  update = true
17
18
  # CP 1.0.0 not support
18
- update = Pod::Config.instance.skip_repo_update if Gem::Dependency.new("", '~> 0.39').match?('', Pod::VERSION)
19
+ update = !Pod::Config.instance.skip_repo_update if Gem::Dependency.new("", '~> 0.39').match?('', Pod::VERSION)
19
20
  if update
20
- argv = CLAide::ARGV.new([source.name])
21
- Pod::Command::RepoRsync::Update.new(argv).run()
21
+ if File.writable?(source.repo)
22
+ argv = CLAide::ARGV.new([source.name, ssh_argv])
23
+ Pod::Command::RepoRsync::Update.new(argv).run()
24
+ else
25
+ Pod::UI.puts "#{source.name} is readonly, skip update."
26
+ end
22
27
  end
23
28
  else
24
- argv = CLAide::ARGV.new([name_for_url(url), url])
29
+ argv = CLAide::ARGV.new([name_for_url(url), url, ssh_argv])
25
30
  Pod::Command::RepoRsync::Add.new(argv).run()
26
31
  source = Pod::RsyncSource.rsync_source_by_url(url)
27
32
  end
28
- context.add_source(source)
33
+ context.add_source(source) if source
29
34
  end
30
35
  end
31
36
 
@@ -11,11 +11,12 @@ module Pod
11
11
 
12
12
  self.arguments = [
13
13
  CLAide::Argument.new('NAME', true),
14
- CLAide::Argument.new('URL', true)
14
+ CLAide::Argument.new('URL', true),
15
+ CLAide::Argument.new('SSHARGV', false)
15
16
  ]
16
17
 
17
18
  def initialize(argv)
18
- @name, @url = argv.shift_argument, argv.shift_argument
19
+ @name, @url, @ssh_argv = argv.shift_argument, argv.shift_argument, argv.shift_argument
19
20
  if @url && !@url.end_with?("/")
20
21
  @url = @url+"/"
21
22
  end
@@ -34,13 +35,14 @@ module Pod
34
35
  config.repos_dir.mkpath
35
36
  dir=config.repos_dir+@name
36
37
  Dir.chdir(config.repos_dir) do
37
- cmd = "rsync -rtlz#{config.verbose? ? "v" : ""} \"#{@url}\" \"#{dir}\""
38
+ cmd = "rsync #{@ssh_argv || ""} -rtlz#{config.verbose? ? "v" : ""} --exclude=.rsync_config \"#{@url}\" \"#{dir}\""
38
39
  UI.puts cmd if config.verbose?
39
40
  system(cmd)
40
41
  if $?.success?
41
- File.open(dir+".rsync_config", "w:UTF-8") do |f|
42
- f.write @url
43
- end
42
+ source = RsyncSource.new(dir)
43
+ source.url = @url
44
+ source.argv = @ssh_argv
45
+ source.save_config
44
46
  end
45
47
  end
46
48
  end
@@ -9,11 +9,12 @@ module Pod
9
9
  DESC
10
10
 
11
11
  self.arguments = [
12
- CLAide::Argument.new('NAME', true)
12
+ CLAide::Argument.new('NAME', true),
13
+ CLAide::Argument.new('ARGV', false)
13
14
  ]
14
15
 
15
16
  def initialize(argv)
16
- @name = argv.shift_argument
17
+ @name, @ssh_argv = argv.shift_argument, argv.shift_argument
17
18
  super
18
19
  end
19
20
 
@@ -25,7 +26,7 @@ module Pod
25
26
  # end
26
27
 
27
28
  def run
28
- update(@name, true) #todo: dusty
29
+ update(@name, @ssh_argv) #todo: dusty
29
30
  end
30
31
 
31
32
  #@!group Update helpers
@@ -47,7 +48,7 @@ module Pod
47
48
  #
48
49
  # @return [void]
49
50
  #
50
- def update(source_name = nil, show_output = false)
51
+ def update(source_name = nil, argv = nil)
51
52
  if source_name
52
53
  sources = [rsync_source_named(source_name)]
53
54
  else
@@ -58,7 +59,7 @@ module Pod
58
59
  UI.section "Updating spec repo `#{source.name}`" do
59
60
  Dir.chdir(source.repo) do
60
61
  begin
61
- cmd = "rsync -rtl#{config.verbose? ? "v" : ""} \"#{source.url}\" \"#{source.repo}\""
62
+ cmd = "rsync #{argv || source.argv || ""} -rtl#{config.verbose? ? "v" : ""} --exclude=.rsync_config \"#{source.url}\" \"#{source.repo}\""
62
63
  UI.puts cmd if config.verbose?
63
64
  system(cmd)
64
65
  rescue Informative => e
@@ -1,10 +1,13 @@
1
1
  module Pod
2
2
  class Podfile
3
3
  module DSL
4
- def rsync_source(source)
4
+ def rsync_source(source, argv=nil)
5
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)
6
+ sources = hash_plugins["cocoapods-repo-rsync"]["sources"]
7
+ unless sources.map { |s| s.class == Array ? s[0] : s }.include?(source)
8
+ sources << (argv.nil? ? source : [source, argv])
9
+ set_hash_value('plugins', hash_plugins)
10
+ end
8
11
  end
9
12
  end
10
13
  end
data/lib/rsync_source.rb CHANGED
@@ -2,12 +2,35 @@ module Pod
2
2
  # Subclass of Pod::Source to provide support for RSYNC Specs repositories
3
3
  #
4
4
  class RsyncSource < Source
5
+ def parse_config
6
+ @url, @argv = File.open(repo + '.rsync_config', "r:UTF-8", &:read).split("\n").map { |c| c.strip }
7
+ @url + "/" unless @url.end_with?("/")
8
+ @argv ||= "" unless @argv
9
+ end
10
+
11
+ def save_config
12
+ File.open(repo+".rsync_config", "w:UTF-8") do |f|
13
+ f.write "#{@url}\n#{@argv}"
14
+ end
15
+ end
16
+
5
17
  def url
6
- u = File.open(repo + '.rsync_config', "r:UTF-8", &:read).strip
7
- u = u+"/" unless u.end_with?("/")
8
- u
18
+ parse_config unless @url
19
+ @url
9
20
  end
10
21
 
22
+ def url=(url)
23
+ @url = url
24
+ end
25
+
26
+ def argv
27
+ parse_config unless @argv
28
+ @argv
29
+ end
30
+
31
+ def argv=(argv)
32
+ @argv = argv
33
+ end
11
34
 
12
35
  def self.rsync_repo?(dir)
13
36
  (dir+".rsync_config").exist?
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-repo-rsync
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.1
4
+ version: 1.0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Whirlwind
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-15 00:00:00.000000000 Z
11
+ date: 2016-06-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler