cocoapods-repo-svn 2.0.1 → 3.0.0

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: 53b6ef5aea5c94101fffa870e8d8f4c82850c463
4
- data.tar.gz: f3aad2fd9664ff4aa6976dbc14b0cc74a8743373
3
+ metadata.gz: ae3208e23c0883f8836e35c873cc8c9f71263a14
4
+ data.tar.gz: cb48f2f1178cfd4d135e43c5c42c7c69b7cf89d1
5
5
  SHA512:
6
- metadata.gz: 8e90662c19f71ce48d7eece883de131db04275861fbf02663c3267ef5e4e13ecd3ab30d8dd5a8c2b0c037ac2cafb008f036dd581b93093fd2e07e2d15214f3cf
7
- data.tar.gz: d7edb8edda98d80fd821e4cbd60ba1162a687c0f0118fbab975ed06b10b0b175b6739007ca7583658037ad3ff43ba0fe398f5905daccb46e2b3fb5a18667cfa9
6
+ metadata.gz: 5b8443ae4b2b499226fb2765010f5476667fb7eb908cf762c8cd04e37e916d50ed68d6fb93cbe5b0d41c6099c56e93ed2e184f6888f531d85e4ed1dd030a7f7c
7
+ data.tar.gz: 8906269fd77f922309a6c52d971a10b0f8f4ee64b882540bb26507cb5f4aa1d2946598dbbc0f3ba4ca2377ef5c1c9fa41f79673f5bec45f93bfa03e94cd7ae41
@@ -1,13 +1,13 @@
1
1
  # coding: utf-8
2
2
  lib = File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'repo_svn_ext/version'
4
+ require 'cocoapods_repo_svn'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = 'cocoapods-repo-svn'
8
- spec.version = RepoSvnExt::VERSION
8
+ spec.version = CocoapodsRepoSvn::VERSION
9
9
  spec.authors = ['Dustin Clark']
10
- spec.email = ['dusty@clarkda.com']
10
+ spec.email = ['dusty@isperldead.net']
11
11
  spec.description = %q{CocoaPod plugin to add subversion support for spec repositories}
12
12
  spec.summary = %q{Subversion support for spec repository}
13
13
  spec.homepage = 'https://github.com/clarkda/cocoapods-repo-svn'
@@ -20,4 +20,4 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_development_dependency 'bundler', '~> 1.3'
22
22
  spec.add_development_dependency 'rake'
23
- end
23
+ end
@@ -29,7 +29,7 @@ def update_or_add_source(source)
29
29
  cmd = Pod::Command::RepoSvn::Add.new(argv)
30
30
  end
31
31
 
32
- cmd.run()
32
+ cmd.run()
33
33
  end
34
34
 
35
35
  # @param [String] url The URL of the SVN repository
@@ -0,0 +1,7 @@
1
+ #
2
+ # The namespace of the Cocoapods repo svn plugin.
3
+ #
4
+ module CocoapodsRepoSvn
5
+ VERSION = '3.0.0'
6
+ GITHASH = `git rev-parse --short HEAD`
7
+ end
@@ -1,393 +1,19 @@
1
1
  require 'fileutils'
2
+ require 'cocoapods_repo_svn'
2
3
 
3
4
  module Pod
4
5
  class Command
5
6
  class RepoSvn < Command
6
- self.abstract_command = true
7
-
8
- self.summary = 'Manage spec-repositories using subversion'
9
-
10
- class Add < RepoSvn
11
- self.summary = 'Add a spec-repo using svn.'
12
-
13
- self.description = <<-DESC
14
- Check out `URL` in the local spec-repos directory at `~/.cocoapods/repos/`. The
15
- remote can later be referred to by `NAME`.
16
- DESC
17
-
18
- self.arguments = [
19
- CLAide::Argument.new('NAME', true),
20
- CLAide::Argument.new('URL', true)
21
- ]
22
-
23
- def initialize(argv)
24
- @name, @url = argv.shift_argument, argv.shift_argument
25
- super
26
- end
27
-
28
- def validate!
29
- super
30
- unless @name && @url
31
- help! "Adding a spec-repo needs a `NAME` and a `URL`."
32
- end
33
- end
34
-
35
- def run
36
- UI.section("Checking out spec-repo `#{@name}` from `#{@url}` using svn") do
37
- config.repos_dir.mkpath
38
- Dir.chdir(config.repos_dir) do
39
- command = "checkout --non-interactive --trust-server-cert '#{@url}' #{@name}"
40
- #!svn(command)
41
- `svn #{command}`
42
- end
43
- SourcesManager.check_version_information(dir) #todo: TEST ME
44
- end
45
- end
46
- end
47
-
48
- #-----------------------------------------------------------------------#
49
-
50
- class Update < RepoSvn
51
- self.summary = 'Update a svn spec-repo.'
52
-
53
- self.description = <<-DESC
54
- Updates the checked out spec-repo `NAME`.
55
- DESC
56
-
57
- self.arguments = [
58
- CLAide::Argument.new('NAME', true)
59
- ]
60
-
61
- def initialize(argv)
62
- @name = argv.shift_argument
63
- super
64
- end
65
-
66
- def validate!
67
- super
68
- unless @name
69
- help! "Updating a spec-repo needs a `NAME`."
70
- end
71
- end
72
-
73
- def run
74
- update(@name, true) #todo: dusty
75
- end
76
-
77
- #@!group Update helpers
78
- #-----------------------------------------------------------------------#
79
-
80
- private
81
-
82
- # Slightly modified SourcesManager->update to deal with subversion updates.
83
- #
84
- # Original contributors:
85
- #
86
- # Fabio Pelosin http://github.com/irrationalfab
87
- # Boris Bügling http://githun.com/neonichu
88
- #
89
-
90
- # Updates the local copy of the spec-repo with the given name
91
- #
92
- # @param [String] source_name name
93
- #
94
- # @return [void]
95
- #
96
- def update(source_name = nil, show_output = false)
97
- if source_name
98
- sources = [svn_source_named(source_name)]
99
- else
100
- sources = svn_sources
101
- end
102
-
103
- sources.each do |source|
104
- UI.section "Updating spec repo `#{source.name}`" do
105
- Dir.chdir(source.repo) do
106
- begin
107
- #output = svn('up --non-interactive --trust-server-cert')
108
- output = `svn up --non-interactive --trust-server-cert`
109
- UI.puts output if show_output && !config.verbose?
110
- rescue Informative => e
111
- UI.warn 'CocoaPods was not able to update the ' \
112
- "`#{source.name}` repo. If this is an unexpected issue " \
113
- 'and persists you can inspect it running ' \
114
- '`pod repo-svn update --verbose`'
115
- end
116
- end
117
- SourcesManager.check_version_information(source.repo)
118
- end
119
- end
120
- end
121
-
122
- # @return [Source] The svn source with the given name. If no svn source
123
- # with given name is found it raises.
124
- #
125
- # @param [String] name
126
- # The name of the source.
127
- #
128
- def svn_source_named(name)
129
- specified_source = SourcesManager.aggregate.sources.find { |s| s.name == name }
130
- unless specified_source
131
- raise Informative, "Unable to find the `#{name}` repo."
132
- end
133
- unless svn_repo?(specified_source.repo)
134
- raise Informative, "The `#{name}` repo is not a svn repo."
135
- end
136
- specified_source
137
- end
138
-
139
- # @return [Source] The list of the svn sources.
140
- #
141
- def svn_sources
142
- SourcesManager.all.select do |source|
143
- svn_repo?(source.repo)
144
- end
145
- end
146
-
147
- # Returns whether a source is a SVN repo.
148
- #
149
- # @param [Pathname] dir
150
- # The directory where the source is stored.
151
- #
152
- # @return [Bool] Whether the given source is a SVN repo.
153
- #
154
- def svn_repo?(dir)
155
- Dir.chdir(dir) { `svn info > /dev/null` }
156
- $?.success?
157
- end
158
- end
159
-
160
- #-----------------------------------------------------------------------#
161
-
162
- # ~Verbatim Repo->Lint
163
- #
164
- # Original contributors:
165
- #
166
- # Fabio Pelosin http://github.com/irrationalfab
167
- # Eloy Durán http://githun.com/alloy
168
-
169
- # Repo validation can probably be pulled out and stuck into core, pretty generic
170
-
171
- #todo: lint is blowing up, fix it - dusty
172
-
173
- class Lint < RepoSvn
174
- self.summary = 'Validates all specs in a repo.'
175
-
176
- self.description = <<-DESC
177
- Lints the spec-repo `NAME`. If a directory is provided it is assumed
178
- to be the root of a repo. Finally, if `NAME` is not provided this
179
- will lint all the spec-repos known to CocoaPods.
180
- DESC
181
-
182
- self.arguments = [
183
- CLAide::Argument.new(%w(NAME DIRECTORY), true)
184
- ]
7
+ require 'pod/command/repo_svn/add'
8
+ require 'pod/command/repo_svn/lint'
9
+ require 'pod/command/repo_svn/push'
10
+ require 'pod/command/repo_svn/remove'
11
+ require 'pod/command/repo_svn/update'
185
12
 
186
- def self.options
187
- [["--only-errors", "Lint presents only the errors"]].concat(super)
188
- end
189
-
190
- def initialize(argv)
191
- @name = argv.shift_argument
192
- @only_errors = argv.flag?('only-errors')
193
- super
194
- end
195
-
196
- # @todo Part of this logic needs to be ported to cocoapods-core so web
197
- # services can validate the repo.
198
- #
199
- # @todo add UI.print and enable print statements again.
200
- #
201
- def run
202
- if @name
203
- dirs = File.exists?(@name) ? [ Pathname.new(@name) ] : [ dir ]
204
- else
205
- dirs = config.repos_dir.children.select {|c| c.directory?}
206
- end
207
- dirs.each do |dir|
208
- SourcesManager.check_version_information(dir) #todo: test me
209
- UI.puts "\nLinting spec repo `#{dir.realpath.basename}`\n".yellow
210
-
211
- validator = Source::HealthReporter.new(dir)
212
- validator.pre_check do |name, version|
213
- UI.print '.'
214
- end
215
- report = validator.analyze
216
- UI.puts
217
- UI.puts
218
-
219
- report.pods_by_warning.each do |message, versions_by_name|
220
- UI.puts "-> #{message}".yellow
221
- versions_by_name.each { |name, versions| UI.puts " - #{name} (#{versions * ', '})" }
222
- UI.puts
223
- end
224
-
225
- report.pods_by_error.each do |message, versions_by_name|
226
- UI.puts "-> #{message}".red
227
- versions_by_name.each { |name, versions| UI.puts " - #{name} (#{versions * ', '})" }
228
- UI.puts
229
- end
230
-
231
- UI.puts "Analyzed #{report.analyzed_paths.count} podspecs files.\n\n"
232
- if report.pods_by_error.count.zero?
233
- UI.puts "All the specs passed validation.".green << "\n\n"
234
- else
235
- raise Informative, "#{report.pods_by_error.count} podspecs failed validation."
236
- end
237
- end
238
- end
239
- end
240
-
241
- #-----------------------------------------------------------------------#
242
-
243
- # ~Verbatim Repo->Remove
244
- #
245
- # Original contributors:
246
- #
247
- # Joshua Kalpin https://github.com/Kapin
248
- # Kyle Fuller https://github.com/kylef
249
-
250
- # Repo removal should probably be pulled out, also pretty generic
251
-
252
- class Remove < RepoSvn
253
- self.summary = 'Remove a spec repo'
254
-
255
- self.description = <<-DESC
256
- Deletes the checked out copy named `NAME` from the local spec-repos directory at `~/.cocoapods/repos/.`
257
- DESC
258
-
259
- self.arguments = [
260
- CLAide::Argument.new('NAME', true)
261
- ]
262
-
263
- def initialize(argv)
264
- @name = argv.shift_argument
265
- super
266
- end
267
-
268
- def validate!
269
- super
270
- help! 'Deleting a repo needs a `NAME`.' unless @name
271
- help! "repo #{@name} does not exist" unless File.directory?(dir)
272
- help! "You do not have permission to delete the #{@name} repository." \
273
- "Perhaps try prefixing this command with sudo." unless File.writable?(dir)
274
- end
275
-
276
- def run
277
- UI.section("Removing spec repo `#{@name}`") do
278
- FileUtils.rm_rf(dir)
279
- end
280
- end
281
- end
282
-
283
- #-----------------------------------------------------------------------#
284
- #
285
- # Pushes a podspec to the specified repo
286
- #
287
- # Most of this was taken directly from the CocoaPods `push` command
288
-
289
- class Push < RepoSvn
290
- self.summary = 'Push a podspec'
291
-
292
- self.description = <<-DESC
293
- Validates `NAME.podspec` or `*.podspec` in the current working dir, creates a
294
- directory and version folder for the pod in the local copy of `REPO`
295
- (~/.cocoapods/repos/[REPO]), copies the podspec file into the version directory,
296
- and finally it commits the changes to `REPO`
297
- DESC
298
-
299
- self.arguments = [
300
- CLAide::Argument.new('REPO', true),
301
- CLAide::Argument.new('NAME.podspec', false)
302
- ]
303
-
304
- def self.options
305
- [['--local-only', 'Does not perform the step of committing changes to REPO']].concat(super)
306
- end
307
-
308
- def initialize(argv)
309
- @local_only = argv.flag?('local-only')
310
- @repo = argv.shift_argument
311
- @podspec = argv.shift_argument
312
- super
313
- end
314
-
315
- def validate!
316
- super
317
- help! 'A spec-repo name is required.' unless @repo
318
- end
319
-
320
- def run
321
- update_repo
322
- add_specs_to_repo
323
- end
324
-
325
- # Updates the git repo against the remote.
326
- #
327
- # @return [void]
328
- #
329
- def update_repo
330
- UI.puts "Updating the `#{@repo}' repo\n".yellow
331
- Dir.chdir(repo_dir) { UI.puts `svn update .` }
332
- end
333
-
334
- def add_specs_to_repo
335
- UI.puts "\nAdding the #{'spec'.pluralize(podspec_files.count)} to the `#{@repo}' repo\n".yellow
336
- podspec_files.each do |spec_file|
337
- spec = Pod::Specification.from_file(spec_file)
338
- output_path = File.join(repo_dir, spec.name, spec.version.to_s)
339
- if Pathname.new(output_path).exist?
340
- message = "[Fix] #{spec}"
341
- elsif Pathname.new(File.join(repo_dir, spec.name)).exist?
342
- message = "[Update] #{spec}"
343
- else
344
- message = "[Add] #{spec}"
345
- end
346
-
347
- FileUtils.mkdir_p(output_path)
348
- FileUtils.cp(spec_file, output_path)
349
- if !@local_only
350
- Dir.chdir(repo_dir) do
351
- # only commit if modified
352
- UI.puts "Committing changes"
353
- UI.puts `svn add #{spec.name} --force 2> /dev/null`
354
- UI.puts `svn commit -m "#{message}"`
355
- end
356
- end
357
- end
358
- end
359
-
360
- private
361
-
362
- # @return [Array<Pathname>] The path of the specifications to push.
363
- #
364
- def podspec_files
365
- if @podspec
366
- path = Pathname(@podspec)
367
- raise Informative, "Couldn't find #{@podspec}" unless path.exist?
368
- [path]
369
- else
370
- files = Pathname.glob('*.podspec{,.json}')
371
- raise Informative, "Couldn't find any podspec files in current directory" if files.empty?
372
- files
373
- end
374
- end
375
-
376
- # @return [Pathname] The directory of the repository.
377
- #
378
- def repo_dir
379
- specs_dir = Pathname.new(File.join(config.repos_dir, @repo, 'Specs'))
380
- dir = config.repos_dir + @repo
381
- if specs_dir.exist?
382
- dir = specs_dir
383
- elsif dir.exist?
384
- dir
385
- else
386
- raise Informative, "`#{@repo}` repo not found either in #{specs_dir} or #{dir}"
387
- end
388
- dir
389
- end
390
- end
13
+ self.abstract_command = true
14
+ self.summary = <<-SUMMARY
15
+ Manage your Cocoapod spec repositories using subversion - v#{CocoapodsRepoSvn::VERSION}_#{CocoapodsRepoSvn::GITHASH}
16
+ SUMMARY
391
17
 
392
18
  extend Executable
393
19
  executable :svn
@@ -397,4 +23,4 @@ module Pod
397
23
  end
398
24
  end
399
25
  end
400
- end
26
+ end
@@ -0,0 +1,44 @@
1
+ module Pod
2
+ class Command
3
+ class RepoSvn
4
+ class Add < RepoSvn
5
+ self.summary = 'Add a spec-repo using svn.'
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
+ super
20
+ end
21
+
22
+ def validate!
23
+ super
24
+ unless @name && @url
25
+ help! "Adding a spec-repo needs a `NAME` and a `URL`."
26
+ end
27
+ end
28
+
29
+ def run
30
+ UI.section("Checking out spec-repo `#{@name}` from `#{@url}` using svn") do
31
+ config.repos_dir.mkpath
32
+ Dir.chdir(config.repos_dir) do
33
+ command = "checkout --non-interactive --trust-server-cert '#{@url}' #{@name}"
34
+ #!svn(command)
35
+ `svn #{command}`
36
+ end
37
+ # SourcesManager.check_version_information(dir) #todo: TEST ME
38
+ Config.instance.sources_manager.sources([dir.basename.to_s]).each(&:verify_compatibility!) #todo: TEST ME
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,76 @@
1
+ module Pod
2
+ class Command
3
+ class RepoSvn
4
+ class Lint < RepoSvn
5
+ self.summary = 'Validates all specs in a repo.'
6
+
7
+ self.description = <<-DESC
8
+ Lints the spec-repo `NAME`. If a directory is provided it is assumed
9
+ to be the root of a repo. Finally, if `NAME` is not provided this
10
+ will lint all the spec-repos known to CocoaPods.
11
+ DESC
12
+
13
+ self.arguments = [
14
+ CLAide::Argument.new(%w(NAME DIRECTORY), true)
15
+ ]
16
+
17
+ def self.options
18
+ [["--only-errors", "Lint presents only the errors"]].concat(super)
19
+ end
20
+
21
+ def initialize(argv)
22
+ @name = argv.shift_argument
23
+ @only_errors = argv.flag?('only-errors')
24
+ super
25
+ end
26
+
27
+ # @todo Part of this logic needs to be ported to cocoapods-core so web
28
+ # services can validate the repo.
29
+ #
30
+ # @todo add UI.print and enable print statements again.
31
+ #
32
+ def run
33
+ if @name
34
+ dirs = File.exists?(@name) ? [ Pathname.new(@name) ] : [ dir ]
35
+ else
36
+ dirs = config.repos_dir.children.select {|c| c.directory?}
37
+ end
38
+ dirs.each do |dir|
39
+ # SourcesManager.check_version_information(dir) #todo: test me
40
+ Config.instance.sources_manager.sources([dir.basename.to_s]).each(&:verify_compatibility!) #todo: TEST ME
41
+ UI.puts "\nLinting spec repo `#{dir.realpath.basename}`\n".yellow
42
+
43
+ validator = Source::HealthReporter.new(dir)
44
+ validator.pre_check do |name, version|
45
+ UI.print '.'
46
+ end
47
+ report = validator.analyze
48
+ UI.puts
49
+ UI.puts
50
+
51
+ report.pods_by_warning.each do |message, versions_by_name|
52
+ UI.puts "-> #{message}".yellow
53
+ versions_by_name.each { |name, versions| UI.puts " - #{name} (#{versions * ', '})" }
54
+ UI.puts
55
+ end
56
+
57
+ report.pods_by_error.each do |message, versions_by_name|
58
+ UI.puts "-> #{message}".red
59
+ versions_by_name.each { |name, versions| UI.puts " - #{name} (#{versions * ', '})" }
60
+ UI.puts
61
+ end
62
+
63
+ UI.puts "Analyzed #{report.analyzed_paths.count} podspecs files.\n\n"
64
+ if report.pods_by_error.count.zero?
65
+ UI.puts "All the specs passed validation.".green << "\n\n"
66
+ else
67
+ raise Informative, "#{report.pods_by_error.count} podspecs failed validation."
68
+ end
69
+ end
70
+ end
71
+ end
72
+ end
73
+ end
74
+ end
75
+
76
+ #----------------------
@@ -0,0 +1,108 @@
1
+ module Pod
2
+ class Command
3
+ class RepoSvn
4
+ class Push < RepoSvn
5
+ self.summary = 'Push a podspec'
6
+
7
+ self.description = <<-DESC
8
+ Validates `NAME.podspec` or `*.podspec` in the current working dir, creates a
9
+ directory and version folder for the pod in the local copy of `REPO`
10
+ (~/.cocoapods/repos/[REPO]), copies the podspec file into the version directory,
11
+ and finally it commits the changes to `REPO`
12
+ DESC
13
+
14
+ self.arguments = [
15
+ CLAide::Argument.new('REPO', true),
16
+ CLAide::Argument.new('NAME.podspec', false)
17
+ ]
18
+
19
+ def self.options
20
+ [['--local-only', 'Does not perform the step of committing changes to REPO']].concat(super)
21
+ end
22
+
23
+ def initialize(argv)
24
+ @local_only = argv.flag?('local-only')
25
+ @repo = argv.shift_argument
26
+ @podspec = argv.shift_argument
27
+ super
28
+ end
29
+
30
+ def validate!
31
+ super
32
+ help! 'A spec-repo name is required.' unless @repo
33
+ end
34
+
35
+ def run
36
+ update_repo
37
+ add_specs_to_repo
38
+ end
39
+
40
+ # Updates the git repo against the remote.
41
+ #
42
+ # @return [void]
43
+ #
44
+ def update_repo
45
+ UI.puts "Updating the `#{@repo}' repo\n".yellow
46
+ Dir.chdir(repo_dir) { UI.puts `svn update .` }
47
+ end
48
+
49
+ def add_specs_to_repo
50
+ UI.puts "\nAdding the #{'spec'.pluralize(podspec_files.count)} to the `#{@repo}' repo\n".yellow
51
+ podspec_files.each do |spec_file|
52
+ spec = Pod::Specification.from_file(spec_file)
53
+ output_path = File.join(repo_dir, spec.name, spec.version.to_s)
54
+ if Pathname.new(output_path).exist?
55
+ message = "[Fix] #{spec}"
56
+ elsif Pathname.new(File.join(repo_dir, spec.name)).exist?
57
+ message = "[Update] #{spec}"
58
+ else
59
+ message = "[Add] #{spec}"
60
+ end
61
+
62
+ FileUtils.mkdir_p(output_path)
63
+ FileUtils.cp(spec_file, output_path)
64
+ if !@local_only
65
+ Dir.chdir(repo_dir) do
66
+ # only commit if modified
67
+ UI.puts "Committing changes"
68
+ UI.puts `svn add #{spec.name} --force 2> /dev/null`
69
+ UI.puts `svn commit -m "#{message}"`
70
+ end
71
+ end
72
+ end
73
+ end
74
+
75
+ private
76
+
77
+ # @return [Array<Pathname>] The path of the specifications to push.
78
+ #
79
+ def podspec_files
80
+ if @podspec
81
+ path = Pathname(@podspec)
82
+ raise Informative, "Couldn't find #{@podspec}" unless path.exist?
83
+ [path]
84
+ else
85
+ files = Pathname.glob('*.podspec{,.json}')
86
+ raise Informative, "Couldn't find any podspec files in current directory" if files.empty?
87
+ files
88
+ end
89
+ end
90
+
91
+ # @return [Pathname] The directory of the repository.
92
+ #
93
+ def repo_dir
94
+ specs_dir = Pathname.new(File.join(config.repos_dir, @repo, 'Specs'))
95
+ dir = config.repos_dir + @repo
96
+ if specs_dir.exist?
97
+ dir = specs_dir
98
+ elsif dir.exist?
99
+ dir
100
+ else
101
+ raise Informative, "`#{@repo}` repo not found either in #{specs_dir} or #{dir}"
102
+ end
103
+ dir
104
+ end
105
+ end
106
+ end
107
+ end
108
+ end
File without changes
@@ -0,0 +1,119 @@
1
+ module Pod
2
+ class Command
3
+ class RepoSvn
4
+ class Update < RepoSvn
5
+ self.summary = 'Update a svn 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 = [svn_source_named(source_name)]
53
+ else
54
+ sources = svn_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
+ #output = svn('up --non-interactive --trust-server-cert')
62
+ output = `svn up --non-interactive --trust-server-cert`
63
+ UI.puts output if show_output && !config.verbose?
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-svn update --verbose`'
69
+ end
70
+ end
71
+ # SourcesManager.check_version_information(source.repo)
72
+ Config.instance.sources_manager.sources([source.repo.basename.to_s]).each(&:verify_compatibility!) #todo: TEST ME
73
+ end
74
+ end
75
+ end
76
+
77
+ # @return [Source] The svn source with the given name. If no svn source
78
+ # with given name is found it raises.
79
+ #
80
+ # @param [String] name
81
+ # The name of the source.
82
+ #
83
+ def svn_source_named(name)
84
+ specified_source = Config.instance.sources_manager.aggregate.sources.find { |s| s.name == name }
85
+ unless specified_source
86
+ raise Informative, "Unable to find the `#{name}` repo."
87
+ end
88
+ unless svn_repo?(specified_source.repo)
89
+ raise Informative, "The `#{name}` repo is not a svn repo."
90
+ end
91
+ specified_source
92
+ end
93
+
94
+ # @return [Source] The list of the svn sources.
95
+ #
96
+ def svn_sources
97
+ # SourcesManager.all.select do |source|
98
+ # svn_repo?(source.repo)
99
+ # end
100
+ Config.instance.sources_manager.all.select do |source|
101
+ svn_repo?(source.repo)
102
+ end
103
+ end
104
+
105
+ # Returns whether a source is a SVN repo.
106
+ #
107
+ # @param [Pathname] dir
108
+ # The directory where the source is stored.
109
+ #
110
+ # @return [Bool] Whether the given source is a SVN repo.
111
+ #
112
+ def svn_repo?(dir)
113
+ Dir.chdir(dir) { `svn info > /dev/null` }
114
+ $?.success?
115
+ end
116
+ end
117
+ end
118
+ end
119
+ end
@@ -19,7 +19,7 @@ module Pod
19
19
  it 'adds a svn spec repo' do
20
20
  set_up_test_repo
21
21
  puts tmp_svn_path
22
- run_command('repo-svn', 'add', 'private', tmp_svn_path)
22
+ run_command('repo-svn', 'add', 'private', 'file://' + tmp_svn_path)
23
23
  end
24
24
  end
25
25
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-repo-svn
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dustin Clark
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-10 00:00:00.000000000 Z
11
+ date: 2016-11-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -40,7 +40,7 @@ dependencies:
40
40
  version: '0'
41
41
  description: CocoaPod plugin to add subversion support for spec repositories
42
42
  email:
43
- - dusty@clarkda.com
43
+ - dusty@isperldead.net
44
44
  executables: []
45
45
  extensions: []
46
46
  extra_rdoc_files: []
@@ -51,12 +51,16 @@ files:
51
51
  - LICENSE
52
52
  - README.md
53
53
  - Rakefile
54
+ - cocoapods_repo_svn.gemspec
54
55
  - lib/cocoapods_plugin.rb
56
+ - lib/cocoapods_repo_svn.rb
55
57
  - lib/pod/command/repo_svn.rb
56
- - lib/repo_svn_ext.rb
57
- - lib/repo_svn_ext/version.rb
58
+ - lib/pod/command/repo_svn/add.rb
59
+ - lib/pod/command/repo_svn/lint.rb
60
+ - lib/pod/command/repo_svn/push.rb
61
+ - lib/pod/command/repo_svn/remove.rb
62
+ - lib/pod/command/repo_svn/update.rb
58
63
  - lib/svn_source.rb
59
- - repo_svn_ext.gemspec
60
64
  - spec/command/repo-svn/add_spec.rb
61
65
  - spec/command/repo-svn/remove_spec.rb
62
66
  - spec/command/repo-svn/update_spec.rb
@@ -88,7 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
88
92
  version: '0'
89
93
  requirements: []
90
94
  rubyforge_project:
91
- rubygems_version: 2.4.6
95
+ rubygems_version: 2.5.1
92
96
  signing_key:
93
97
  specification_version: 4
94
98
  summary: Subversion support for spec repository
@@ -1,5 +0,0 @@
1
- require 'repo_svn_ext/version'
2
-
3
- module RepoSvnExt
4
- # ..
5
- end
@@ -1,3 +0,0 @@
1
- module RepoSvnExt
2
- VERSION = '2.0.1'
3
- end