cocoapods-repo-hg 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 +43 -0
- data/Gemfile +3 -0
- data/LICENSE +21 -0
- data/README.md +43 -0
- data/Rakefile +1 -0
- data/lib/cocoapods_plugin.rb +1 -0
- data/lib/pod/command/repo_hg.rb +249 -0
- data/lib/repo_hg_ext/version.rb +3 -0
- data/lib/repo_hg_ext.rb +5 -0
- data/repo_hg_ext.gemspec +23 -0
- metadata +82 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 59365763cdefd5c7e39e3dd0bc7bde1489a03b11
|
4
|
+
data.tar.gz: e69e9b004b761c1d644278bc5dc3303295e8c379
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f36d1bca71c1787e508c85e3ff2bc1a6245d430f75b56262fee3c8ac11959532ba22c09d4dcd7f126264900aa673dd07ee0cb690f24a69d0cc7009309e880c89
|
7
|
+
data.tar.gz: df6dc873ba958c1958a5591a26641fcd72804cd437b6a4470762a0c666e1cd7df1f66051f9be547ed4722ef607a1c430c07f65ab74ae8857babc8c469e3480e2
|
data/.gitignore
ADDED
@@ -0,0 +1,43 @@
|
|
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
|
+
Gemfile.lock
|
12
|
+
|
13
|
+
# Intellij
|
14
|
+
.idea/
|
15
|
+
*.iml
|
16
|
+
*.iws
|
17
|
+
|
18
|
+
# Mac
|
19
|
+
.DS_Store
|
20
|
+
|
21
|
+
## Specific to RubyMotion:
|
22
|
+
.dat*
|
23
|
+
.repl_history
|
24
|
+
build/
|
25
|
+
|
26
|
+
## Documentation cache and generated files:
|
27
|
+
/.yardoc/
|
28
|
+
/_yardoc/
|
29
|
+
/doc/
|
30
|
+
/rdoc/
|
31
|
+
|
32
|
+
## Environment normalisation:
|
33
|
+
/.bundle/
|
34
|
+
/lib/bundler/man/
|
35
|
+
|
36
|
+
# for a library or gem, you might want to ignore these files since the code is
|
37
|
+
# intended to run in multiple environments; otherwise, check them in:
|
38
|
+
# Gemfile.lock
|
39
|
+
# .ruby-version
|
40
|
+
# .ruby-gemset
|
41
|
+
|
42
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
43
|
+
.rvmrc
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2014 Dustin Clark
|
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,43 @@
|
|
1
|
+
# Cocoapods::RepoHg
|
2
|
+
|
3
|
+
Adds mercurial support to manage spec-repositories
|
4
|
+
|
5
|
+
## Brief
|
6
|
+
|
7
|
+
Our team had been using a in house fork of Cocoapods with svn, bzr, and hg spec-repo support. Since #1747 has been closed, I'm porting that code to plugins
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
$ gem install cocoapods-repo-hg
|
12
|
+
|
13
|
+
## Usage
|
14
|
+
|
15
|
+
Add
|
16
|
+
|
17
|
+
$ pod repo-hg add my-hg-repo hg-repo-url
|
18
|
+
|
19
|
+
Update
|
20
|
+
|
21
|
+
$ pod repo-hg update my-hg-repo
|
22
|
+
|
23
|
+
Remove
|
24
|
+
|
25
|
+
$ pod repo-hg remove my-hg-repo
|
26
|
+
|
27
|
+
|
28
|
+
## Contributing
|
29
|
+
|
30
|
+
..
|
31
|
+
|
32
|
+
## Building
|
33
|
+
|
34
|
+
$ rake build
|
35
|
+
|
36
|
+
## Installing
|
37
|
+
|
38
|
+
$ rake install
|
39
|
+
|
40
|
+
|
41
|
+
## Thoughts
|
42
|
+
|
43
|
+
Repo->Remove and Repo->Lint are generic enough to be lifted out of git specific command/repo
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'pod/command/repo_hg'
|
@@ -0,0 +1,249 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
|
3
|
+
module Pod
|
4
|
+
class Command
|
5
|
+
class RepoHg < Command
|
6
|
+
self.abstract_command = true
|
7
|
+
|
8
|
+
self.summary = 'Manage spec-repositories using mercurial'
|
9
|
+
|
10
|
+
class Add < RepoHg
|
11
|
+
self.summary = 'Add a spec-repo using hg.'
|
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 = 'NAME URL'
|
19
|
+
|
20
|
+
def initialize(argv)
|
21
|
+
@name, @url = argv.shift_argument, argv.shift_argument
|
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("Cloning spec-repo `#{@name}` from `#{@url}` using hg") do
|
34
|
+
config.repos_dir.mkpath
|
35
|
+
Dir.chdir(config.repos_dir) do
|
36
|
+
command = "clone '#{@url}' #{@name}"
|
37
|
+
!hg(command)
|
38
|
+
end
|
39
|
+
SourcesManager.check_version_information(dir) #todo: TEST ME
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
#-----------------------------------------------------------------------#
|
45
|
+
|
46
|
+
class Update < RepoHg
|
47
|
+
self.summary = 'Update a hg spec-repo.'
|
48
|
+
|
49
|
+
self.description = <<-DESC
|
50
|
+
Updates the checked out spec-repo `NAME`.
|
51
|
+
DESC
|
52
|
+
|
53
|
+
self.arguments = '[NAME]'
|
54
|
+
|
55
|
+
def initialize(argv)
|
56
|
+
@name = argv.shift_argument
|
57
|
+
super
|
58
|
+
end
|
59
|
+
|
60
|
+
def validate!
|
61
|
+
super
|
62
|
+
unless @name
|
63
|
+
help! "Updating a spec-repo needs a `NAME`."
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def run
|
68
|
+
update(@name, true) #todo: dusty
|
69
|
+
end
|
70
|
+
|
71
|
+
#@!group Update helpers
|
72
|
+
#-----------------------------------------------------------------------#
|
73
|
+
|
74
|
+
private
|
75
|
+
|
76
|
+
# Slightly modified SourcesManager->update to deal with mercurial updates.
|
77
|
+
#
|
78
|
+
# Original contributors:
|
79
|
+
#
|
80
|
+
# Fabio Pelosin http://github.com/irrationalfab
|
81
|
+
# Boris Bügling http://githun.com/neonichu
|
82
|
+
#
|
83
|
+
|
84
|
+
# Updates the local copy of the spec-repo with the given name
|
85
|
+
#
|
86
|
+
# @param [String] source_name name
|
87
|
+
#
|
88
|
+
# @return [void]
|
89
|
+
#
|
90
|
+
def update(source_name = nil, show_output = false)
|
91
|
+
if source_name
|
92
|
+
specified_source = SourcesManager.aggregate.all.find { |s| s.name == source_name }
|
93
|
+
raise Informative, "Unable to find the `#{source_name}` spec-repo." unless specified_source
|
94
|
+
raise Informative, "The `#{source_name}` repo is not a hg spec-repo." unless hg_repo?(specified_source.data_provider.repo)
|
95
|
+
sources = [specified_source]
|
96
|
+
end
|
97
|
+
|
98
|
+
sources.each do |source|
|
99
|
+
UI.section "Updating spec-repo `#{source.name}`" do
|
100
|
+
Dir.chdir(source.data_provider.repo) do
|
101
|
+
output = hg!('pull')
|
102
|
+
UI.puts output if show_output && !config.verbose?
|
103
|
+
end
|
104
|
+
SourcesManager.check_version_information(source.data_provider.repo) #todo: test me
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
# Returns whether a source is a HG repo.
|
110
|
+
#
|
111
|
+
# @param [Pathname] dir
|
112
|
+
# The directory where the source is stored.
|
113
|
+
#
|
114
|
+
# @return [Bool] Whether the given source is a HG repo.
|
115
|
+
#
|
116
|
+
def hg_repo?(dir)
|
117
|
+
Dir.chdir(dir) { hg('status >/dev/null 2>&1') }
|
118
|
+
$?.success?
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
#-----------------------------------------------------------------------#
|
123
|
+
|
124
|
+
# ~Verbatim Repo->Lint
|
125
|
+
#
|
126
|
+
# Original contributors:
|
127
|
+
#
|
128
|
+
# Fabio Pelosin http://github.com/irrationalfab
|
129
|
+
# Eloy Durán http://githun.com/alloy
|
130
|
+
|
131
|
+
# Repo validation can probably be pulled out and stuck into core, pretty generic
|
132
|
+
|
133
|
+
#todo: lint is blowing up, fix it - dusty
|
134
|
+
|
135
|
+
class Lint < RepoHg
|
136
|
+
self.summary = 'Validates all specs in a repo.'
|
137
|
+
|
138
|
+
self.description = <<-DESC
|
139
|
+
Lints the spec-repo `NAME`. If a directory is provided it is assumed
|
140
|
+
to be the root of a repo. Finally, if `NAME` is not provided this
|
141
|
+
will lint all the spec-repos known to CocoaPods.
|
142
|
+
DESC
|
143
|
+
|
144
|
+
self.arguments = '[ NAME | DIRECTORY ]'
|
145
|
+
|
146
|
+
def self.options
|
147
|
+
[["--only-errors", "Lint presents only the errors"]].concat(super)
|
148
|
+
end
|
149
|
+
|
150
|
+
def initialize(argv)
|
151
|
+
@name = argv.shift_argument
|
152
|
+
@only_errors = argv.flag?('only-errors')
|
153
|
+
super
|
154
|
+
end
|
155
|
+
|
156
|
+
# @todo Part of this logic needs to be ported to cocoapods-core so web
|
157
|
+
# services can validate the repo.
|
158
|
+
#
|
159
|
+
# @todo add UI.print and enable print statements again.
|
160
|
+
#
|
161
|
+
def run
|
162
|
+
if @name
|
163
|
+
dirs = File.exists?(@name) ? [ Pathname.new(@name) ] : [ dir ]
|
164
|
+
else
|
165
|
+
dirs = config.repos_dir.children.select {|c| c.directory?}
|
166
|
+
end
|
167
|
+
dirs.each do |dir|
|
168
|
+
SourcesManager.check_version_information(dir) #todo: test me
|
169
|
+
UI.puts "\nLinting spec repo `#{dir.realpath.basename}`\n".yellow
|
170
|
+
|
171
|
+
validator = Source::HealthReporter.new(dir)
|
172
|
+
validator.pre_check do |name, version|
|
173
|
+
UI.print '.'
|
174
|
+
end
|
175
|
+
report = validator.analyze
|
176
|
+
UI.puts
|
177
|
+
UI.puts
|
178
|
+
|
179
|
+
report.pods_by_warning.each do |message, versions_by_name|
|
180
|
+
UI.puts "-> #{message}".yellow
|
181
|
+
versions_by_name.each { |name, versions| UI.puts " - #{name} (#{versions * ', '})" }
|
182
|
+
UI.puts
|
183
|
+
end
|
184
|
+
|
185
|
+
report.pods_by_error.each do |message, versions_by_name|
|
186
|
+
UI.puts "-> #{message}".red
|
187
|
+
versions_by_name.each { |name, versions| UI.puts " - #{name} (#{versions * ', '})" }
|
188
|
+
UI.puts
|
189
|
+
end
|
190
|
+
|
191
|
+
UI.puts "Analyzed #{report.analyzed_paths.count} podspecs files.\n\n"
|
192
|
+
if report.pods_by_error.count.zero?
|
193
|
+
UI.puts "All the specs passed validation.".green << "\n\n"
|
194
|
+
else
|
195
|
+
raise Informative, "#{report.pods_by_error.count} podspecs failed validation."
|
196
|
+
end
|
197
|
+
end
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
201
|
+
#-----------------------------------------------------------------------#
|
202
|
+
|
203
|
+
# ~Verbatim Repo->Remove
|
204
|
+
#
|
205
|
+
# Original contributors:
|
206
|
+
#
|
207
|
+
# Joshua Kalpin https://github.com/Kapin
|
208
|
+
# Kyle Fuller https://github.com/kylef
|
209
|
+
|
210
|
+
# Repo removal should probably be pulled out, also pretty generic
|
211
|
+
|
212
|
+
class Remove < RepoHg
|
213
|
+
self.summary = 'Remove a spec repo'
|
214
|
+
|
215
|
+
self.description = <<-DESC
|
216
|
+
Deletes the checked out copy named `NAME` from the local spec-repos directory at `~/.cocoapods/repos/.`
|
217
|
+
DESC
|
218
|
+
|
219
|
+
self.arguments = 'NAME'
|
220
|
+
|
221
|
+
def initialize(argv)
|
222
|
+
@name = argv.shift_argument
|
223
|
+
super
|
224
|
+
end
|
225
|
+
|
226
|
+
def validate!
|
227
|
+
super
|
228
|
+
help! 'Deleting a repo needs a `NAME`.' unless @name
|
229
|
+
help! "repo #{@name} does not exist" unless File.directory?(dir)
|
230
|
+
help! "You do not have permission to delete the #{@name} repository." \
|
231
|
+
"Perhaps try prefixing this command with sudo." unless File.writable?(dir)
|
232
|
+
end
|
233
|
+
|
234
|
+
def run
|
235
|
+
UI.section("Removing spec repo `#{@name}`") do
|
236
|
+
FileUtils.rm_rf(dir)
|
237
|
+
end
|
238
|
+
end
|
239
|
+
end
|
240
|
+
|
241
|
+
extend Executable
|
242
|
+
executable :hg
|
243
|
+
|
244
|
+
def dir
|
245
|
+
config.repos_dir + @name
|
246
|
+
end
|
247
|
+
end
|
248
|
+
end
|
249
|
+
end
|
data/lib/repo_hg_ext.rb
ADDED
data/repo_hg_ext.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'repo_hg_ext/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'cocoapods-repo-hg'
|
8
|
+
spec.version = RepoHgExt::VERSION
|
9
|
+
spec.authors = ['Dustin Clark']
|
10
|
+
spec.email = ['dusty@clarkda.com']
|
11
|
+
spec.description = %q{CocoaPod plugin to add mercurial support for spec repositories}
|
12
|
+
spec.summary = %q{mercurial support for spec repository}
|
13
|
+
spec.homepage = 'https://github.com/clarkda/cocoapods-repo-hg'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
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
|
+
end
|
metadata
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cocoapods-repo-hg
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Dustin Clark
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-04-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.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
|
+
description: CocoaPod plugin to add mercurial support for spec repositories
|
42
|
+
email:
|
43
|
+
- dusty@clarkda.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- ".gitignore"
|
49
|
+
- Gemfile
|
50
|
+
- LICENSE
|
51
|
+
- README.md
|
52
|
+
- Rakefile
|
53
|
+
- lib/cocoapods_plugin.rb
|
54
|
+
- lib/pod/command/repo_hg.rb
|
55
|
+
- lib/repo_hg_ext.rb
|
56
|
+
- lib/repo_hg_ext/version.rb
|
57
|
+
- repo_hg_ext.gemspec
|
58
|
+
homepage: https://github.com/clarkda/cocoapods-repo-hg
|
59
|
+
licenses:
|
60
|
+
- MIT
|
61
|
+
metadata: {}
|
62
|
+
post_install_message:
|
63
|
+
rdoc_options: []
|
64
|
+
require_paths:
|
65
|
+
- lib
|
66
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '0'
|
71
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
requirements: []
|
77
|
+
rubyforge_project:
|
78
|
+
rubygems_version: 2.2.1
|
79
|
+
signing_key:
|
80
|
+
specification_version: 4
|
81
|
+
summary: mercurial support for spec repository
|
82
|
+
test_files: []
|