cocoapods-trunk 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/.travis.yml +10 -0
- data/Gemfile +13 -0
- data/LICENSE.txt +22 -0
- data/README.md +31 -0
- data/Rakefile +13 -0
- data/cocoapods-trunk.gemspec +25 -0
- data/lib/cocoapods_plugin.rb +1 -0
- data/lib/pod/command/trunk.rb +394 -0
- data/lib/trunk.rb +7 -0
- data/lib/trunk/version.rb +5 -0
- data/spec/command/trunk/addowner_spec.rb +12 -0
- data/spec/command/trunk/me_spec.rb +18 -0
- data/spec/command/trunk/push_spec.rb +12 -0
- data/spec/command/trunk/register_spec.rb +12 -0
- data/spec/command/trunk_spec.rb +12 -0
- data/spec/spec_helper.rb +47 -0
- metadata +138 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f0503a4ad7919d77483385df1b5761b2c781425b
|
4
|
+
data.tar.gz: 4fec57266e4712f666e6dc1ff37984f58bde1b95
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 66d04d45ed35a46b5b3f7769f0104ea8ca486bae6e60302a9462c24d37375456445a3aeb234522745f8567bbd6b155e03623ac58b979ff1bbce72eb3e9baa598
|
7
|
+
data.tar.gz: b415475ba1b75b444e968ab867d53032305deb6539ea6cb9c98706ba8795b249c1e4f8c1b80dc2a38608a23de0420494ae12adf3e7c9a09ba78d44b6f597bb1b
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
language: objective-c
|
2
|
+
env:
|
3
|
+
# This is what 10.8.x comes with and we want to support that.
|
4
|
+
- RVM_RUBY_VERSION=system NOEXEC_DISABLE=1 RUBY_VERSION_SPECIFIC='sudo ln -s /usr/bin/llvm-gcc-4.2 /usr/bin/gcc-4.2' SSL_CERT_FILE=/usr/local/share/cacert.pem GIT_AUTHOR_NAME=CocoaPods GIT_AUTHOR_EMAIL=cocoapods@example.com PYTHONPATH=/usr/local/lib/python2.7/site-packages
|
5
|
+
- RVM_RUBY_VERSION=2.0.0-p247 NOEXEC_DISABLE=1 RUBY_VERSION_SPECIFIC='sudo gem install bundler --no-ri --no-rdoc' GIT_AUTHOR_NAME=CocoaPods GIT_AUTHOR_EMAIL=cocoapods@example.com PYTHONPATH=/usr/local/lib/python2.7/site-packages
|
6
|
+
before_install:
|
7
|
+
- curl http://curl.haxx.se/ca/cacert.pem -o /usr/local/share/cacert.pem
|
8
|
+
- source ~/.rvm/scripts/rvm && rvm use $RVM_RUBY_VERSION
|
9
|
+
install: eval $RUBY_VERSION_SPECIFIC && rake bootstrap[use_bundle_dir]
|
10
|
+
script: bundle exec rake specs
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Eloy Durán
|
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,31 @@
|
|
1
|
+
# Cocoapods::Trunk
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'cocoapods-trunk'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install cocoapods-trunk
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
With a local install of `trunk.cocoapods.org` up and running:
|
22
|
+
|
23
|
+
$ env TRUNK_SCHEME_AND_HOST=http://localhost:4567 bundle exec pod trunk --help
|
24
|
+
|
25
|
+
## Contributing
|
26
|
+
|
27
|
+
1. Fork it
|
28
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
29
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
30
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
31
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -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 'trunk/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "cocoapods-trunk"
|
8
|
+
spec.version = Cocoapods::Trunk::VERSION
|
9
|
+
spec.authors = ["Eloy Durán"]
|
10
|
+
spec.email = ["eloy.de.enige@gmail.com"]
|
11
|
+
spec.summary = "Interact with trunk.cocoapods.org"
|
12
|
+
spec.homepage = ""
|
13
|
+
spec.license = "MIT"
|
14
|
+
|
15
|
+
spec.files = `git ls-files`.split($/)
|
16
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
|
+
spec.require_paths = ["lib"]
|
19
|
+
|
20
|
+
spec.add_dependency 'nap', '>= 0.6'
|
21
|
+
spec.add_dependency 'json', '~> 1.8'
|
22
|
+
spec.add_dependency 'netrc'
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
24
|
+
spec.add_development_dependency "rake"
|
25
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'pod/command/trunk'
|
@@ -0,0 +1,394 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
require 'json'
|
4
|
+
require 'rest'
|
5
|
+
require 'netrc'
|
6
|
+
|
7
|
+
module Pod
|
8
|
+
class Command
|
9
|
+
class Trunk < Command
|
10
|
+
self.abstract_command = true
|
11
|
+
self.summary = 'Interact with trunk.cocoapods.org'
|
12
|
+
|
13
|
+
SCHEME_AND_HOST = ENV['TRUNK_SCHEME_AND_HOST'] || 'https://trunk.cocoapods.org'
|
14
|
+
BASE_URL = "#{SCHEME_AND_HOST}/api/v1"
|
15
|
+
|
16
|
+
class Register < Trunk
|
17
|
+
self.summary = 'Manage sessions'
|
18
|
+
self.description = <<-DESC
|
19
|
+
Register a new account, or create a new session.
|
20
|
+
|
21
|
+
If this is your first registration, both an `EMAIL` address and your
|
22
|
+
`NAME` are required. If you've already registered with trunk, you may
|
23
|
+
omit the `NAME` (unless you would like to change it).
|
24
|
+
|
25
|
+
It is recommended that you provide a description of the session, so
|
26
|
+
that it will be easier to identify later on. For instance, when you
|
27
|
+
would like to clean-up your sessions. A common example is to specify
|
28
|
+
the location where the machine, that you are using the session for, is
|
29
|
+
physically located.
|
30
|
+
|
31
|
+
Examples:
|
32
|
+
|
33
|
+
$ pod trunk register eloy@example.com 'Eloy Durán' --description='Personal Laptop'
|
34
|
+
$ pod trunk register eloy@example.com --description='Work Laptop'
|
35
|
+
$ pod trunk register eloy@example.com
|
36
|
+
DESC
|
37
|
+
|
38
|
+
self.arguments = [
|
39
|
+
['EMAIL', :required],
|
40
|
+
['NAME', :optional],
|
41
|
+
]
|
42
|
+
|
43
|
+
def self.options
|
44
|
+
[
|
45
|
+
['--description=DESCRIPTION', 'An arbitrary description to ' \
|
46
|
+
'easily identify your session ' \
|
47
|
+
'later on.']
|
48
|
+
].concat(super)
|
49
|
+
end
|
50
|
+
|
51
|
+
def initialize(argv)
|
52
|
+
@session_description = argv.option('description')
|
53
|
+
@email, @name = argv.shift_argument, argv.shift_argument
|
54
|
+
super
|
55
|
+
end
|
56
|
+
|
57
|
+
def validate!
|
58
|
+
super
|
59
|
+
unless @email
|
60
|
+
help! 'Specify at least your email address.'
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def run
|
65
|
+
body = {
|
66
|
+
'email' => @email,
|
67
|
+
'name' => @name,
|
68
|
+
'description' => @session_description
|
69
|
+
}.to_json
|
70
|
+
json = json(request_path(:post, "sessions", body, default_headers))
|
71
|
+
save_token(json['token'])
|
72
|
+
# TODO UI.notice inserts an empty line :/
|
73
|
+
puts '[!] Please verify the session by clicking the link in the ' \
|
74
|
+
"verification email that has been sent to #{@email}".yellow
|
75
|
+
end
|
76
|
+
|
77
|
+
def save_token(token)
|
78
|
+
netrc['trunk.cocoapods.org'] = @email, token
|
79
|
+
netrc.save
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
class Me < Trunk
|
84
|
+
self.summary = 'Display information about your sessions'
|
85
|
+
self.description = <<-DESC
|
86
|
+
Includes information about your registration, followed by all your
|
87
|
+
sessions.
|
88
|
+
|
89
|
+
These are your current session, other valid sessions, unverified
|
90
|
+
sessions, and expired sessions.
|
91
|
+
DESC
|
92
|
+
|
93
|
+
def validate!
|
94
|
+
super
|
95
|
+
unless token
|
96
|
+
help! 'You need to register a session first.'
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
def run
|
101
|
+
json = json(request_path(:get, "sessions", auth_headers))
|
102
|
+
UI.labeled 'Name', json['name']
|
103
|
+
UI.labeled 'Email', json['email']
|
104
|
+
UI.labeled 'Since', formatted_time(json['created_at'])
|
105
|
+
|
106
|
+
sessions = json['sessions'].map do |session|
|
107
|
+
hash = {
|
108
|
+
:created_at => formatted_time(session['created_at']),
|
109
|
+
:valid_until => formatted_time(session['valid_until']),
|
110
|
+
:created_from_ip => session['created_from_ip'],
|
111
|
+
:description => session['description']
|
112
|
+
}
|
113
|
+
if Time.parse(session['valid_until']) <= Time.now.utc
|
114
|
+
hash[:color] = :red
|
115
|
+
elsif session['verified']
|
116
|
+
hash[:color] = session['current'] ? :cyan : :green
|
117
|
+
else
|
118
|
+
hash[:color] = :yellow
|
119
|
+
hash[:valid_until] = 'Unverified'
|
120
|
+
end
|
121
|
+
hash
|
122
|
+
end
|
123
|
+
|
124
|
+
columns = [:created_at, :valid_until, :created_from_ip, :description].map do |key|
|
125
|
+
find_max_size(sessions, key)
|
126
|
+
end
|
127
|
+
|
128
|
+
sessions = sessions.map do |session|
|
129
|
+
created_at = session[:created_at].ljust(columns[0])
|
130
|
+
valid_until = session[:valid_until].rjust(columns[1])
|
131
|
+
created_from_ip = session[:created_from_ip].ljust(columns[2])
|
132
|
+
description = session[:description]
|
133
|
+
msg = "#{created_at} - #{valid_until}. IP: #{created_from_ip}"
|
134
|
+
msg << " Description: #{description}" if description
|
135
|
+
msg.send(session[:color])
|
136
|
+
end
|
137
|
+
|
138
|
+
UI.labeled 'Sessions', sessions
|
139
|
+
end
|
140
|
+
|
141
|
+
private
|
142
|
+
|
143
|
+
def find_max_size(sessions, key)
|
144
|
+
sessions.map { |s| (s[key] || '').size }.max
|
145
|
+
end
|
146
|
+
|
147
|
+
class CleanSessions < Me
|
148
|
+
self.summary = 'Remove sessions'
|
149
|
+
self.description = <<-DESC
|
150
|
+
By default this will clean-up your sessions by removing expired and
|
151
|
+
unverified sessions.
|
152
|
+
|
153
|
+
To remove all your sessions, except for the one you are currently
|
154
|
+
using, specify the `--all` flag.
|
155
|
+
DESC
|
156
|
+
|
157
|
+
def self.options
|
158
|
+
[
|
159
|
+
['--all', 'Removes all your sessions, except for the current one'],
|
160
|
+
].concat(super)
|
161
|
+
end
|
162
|
+
|
163
|
+
def initialize(argv)
|
164
|
+
@remove_all = argv.flag?('all', false)
|
165
|
+
super
|
166
|
+
end
|
167
|
+
|
168
|
+
def validate!
|
169
|
+
super
|
170
|
+
unless token
|
171
|
+
help! 'You need to register a session first.'
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
def run
|
176
|
+
path = @remove_all ? 'sessions/all' : 'sessions'
|
177
|
+
request_path(:delete, path, auth_headers)
|
178
|
+
end
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
class AddOwner < Trunk
|
183
|
+
self.summary = 'Add an owner to a pod'
|
184
|
+
self.description = <<-DESC
|
185
|
+
An ‘owner’ is a registered user whom is allowed to make changes to a
|
186
|
+
pod, such as pushing new versions and adding other ‘owners’.
|
187
|
+
DESC
|
188
|
+
|
189
|
+
self.arguments = [
|
190
|
+
['POD', :required],
|
191
|
+
['OWNER-EMAIL', :required],
|
192
|
+
]
|
193
|
+
|
194
|
+
def initialize(argv)
|
195
|
+
@pod, @email = argv.shift_argument, argv.shift_argument
|
196
|
+
super
|
197
|
+
end
|
198
|
+
|
199
|
+
def validate!
|
200
|
+
super
|
201
|
+
unless token
|
202
|
+
help! 'You need to register a session first.'
|
203
|
+
end
|
204
|
+
unless @pod && @email
|
205
|
+
help! 'Specify the pod name and the new owner’s email address.'
|
206
|
+
end
|
207
|
+
end
|
208
|
+
|
209
|
+
def run
|
210
|
+
body = { 'email' => @email }.to_json
|
211
|
+
json = json(request_path(:patch, "pods/#{@pod}/owners", body, auth_headers))
|
212
|
+
UI.labeled 'Owners', json.map { |o| "#{o['name']} <#{o['email']}>" }
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
216
|
+
class Push < Trunk
|
217
|
+
self.summary = 'Publish a podspec'
|
218
|
+
self.description = <<-DESC
|
219
|
+
By publishing a podspec you make this available to all users of the
|
220
|
+
‘master’ spec-repo.
|
221
|
+
|
222
|
+
Before pushing the podspec to cocoapods.org, this will perform a local
|
223
|
+
lint of the podspec, including a build of the library. However, it
|
224
|
+
remains *your* responsibility to ensure that the published podspec
|
225
|
+
will actually work for your users. Thus it is recommended that you
|
226
|
+
*first* try to use the podspec to integrate the library into your demo
|
227
|
+
and/or real application.
|
228
|
+
|
229
|
+
If this is the first time you publish a spec for this pod, you will
|
230
|
+
automatically be registered as the ‘owner’ of this pod. (Note that
|
231
|
+
‘owner’ in this case implies a person that is allowed to publish new
|
232
|
+
versions and add other ‘owners’, not necessarily the library author.)
|
233
|
+
DESC
|
234
|
+
|
235
|
+
self.arguments = [['PATH', :required]]
|
236
|
+
|
237
|
+
def self.options
|
238
|
+
[
|
239
|
+
["--allow-warnings", "Allows push even if there are lint warnings"],
|
240
|
+
].concat(super)
|
241
|
+
end
|
242
|
+
|
243
|
+
def initialize(argv)
|
244
|
+
@allow_warnings = argv.flag?('allow-warnings')
|
245
|
+
@path = argv.shift_argument
|
246
|
+
super
|
247
|
+
end
|
248
|
+
|
249
|
+
def validate!
|
250
|
+
super
|
251
|
+
unless token
|
252
|
+
help! 'You need to register a session first.'
|
253
|
+
end
|
254
|
+
unless @path
|
255
|
+
help! 'Specify the path to the podspec file.'
|
256
|
+
end
|
257
|
+
unless File.exist?(@path) && !File.directory?(@path)
|
258
|
+
help! 'No podspec found at the specified path.'
|
259
|
+
end
|
260
|
+
end
|
261
|
+
|
262
|
+
def run
|
263
|
+
validate_podspec
|
264
|
+
|
265
|
+
response = request_path(:post, "pods", spec.to_json, auth_headers)
|
266
|
+
url = response.headers['location'].first
|
267
|
+
json = json(request_url(:get, url, default_headers))
|
268
|
+
|
269
|
+
UI.labeled 'Data URL', json['data_url']
|
270
|
+
messages = json['messages'].map do |entry|
|
271
|
+
at, message = entry.to_a.flatten
|
272
|
+
"#{formatted_time(at)}: #{message}"
|
273
|
+
end
|
274
|
+
UI.labeled 'Log messages', messages
|
275
|
+
end
|
276
|
+
|
277
|
+
private
|
278
|
+
|
279
|
+
def spec
|
280
|
+
@spec ||= Pod::Specification.from_file(@path)
|
281
|
+
rescue Informative # TODO: this should be a more specific error
|
282
|
+
raise Informative, 'Unable to interpret the specified path as a ' \
|
283
|
+
'podspec.'
|
284
|
+
end
|
285
|
+
|
286
|
+
# Performs a full lint against the podspecs.
|
287
|
+
#
|
288
|
+
# TODO: Currently copied verbatim from `pod push`.
|
289
|
+
def validate_podspec
|
290
|
+
UI.puts 'Validating podspec'.yellow
|
291
|
+
validator = Validator.new(spec)
|
292
|
+
validator.only_errors = @allow_warnings
|
293
|
+
begin
|
294
|
+
validator.validate
|
295
|
+
rescue Exception
|
296
|
+
# TODO: We should add `CLAide::InformativeError#wraps_exception`
|
297
|
+
# which would include the original error message on `--verbose`.
|
298
|
+
# https://github.com/CocoaPods/CLAide/issues/31
|
299
|
+
raise Informative, "The podspec does not validate."
|
300
|
+
end
|
301
|
+
unless validator.validated?
|
302
|
+
raise Informative, "The podspec does not validate."
|
303
|
+
end
|
304
|
+
end
|
305
|
+
end
|
306
|
+
|
307
|
+
private
|
308
|
+
|
309
|
+
def request_url(action, url, *args)
|
310
|
+
response = create_request(action, url, *args)
|
311
|
+
if (400...600).include?(response.status_code)
|
312
|
+
print_error(response.body)
|
313
|
+
end
|
314
|
+
response
|
315
|
+
end
|
316
|
+
|
317
|
+
def request_path(action, path, *args)
|
318
|
+
request_url(action, "#{BASE_URL}/#{path}", *args)
|
319
|
+
end
|
320
|
+
|
321
|
+
def create_request(*args)
|
322
|
+
if verbose?
|
323
|
+
REST.send(*args) do |request|
|
324
|
+
request.set_debug_output($stdout)
|
325
|
+
end
|
326
|
+
else
|
327
|
+
REST.send(*args)
|
328
|
+
end
|
329
|
+
end
|
330
|
+
|
331
|
+
def print_error(body)
|
332
|
+
begin
|
333
|
+
json = JSON.parse(body)
|
334
|
+
rescue JSON::ParseError
|
335
|
+
json = {}
|
336
|
+
end
|
337
|
+
|
338
|
+
case error = json['error']
|
339
|
+
when Hash
|
340
|
+
lines = error.sort_by(&:first).map do |attr, messages|
|
341
|
+
attr = attr[0,1].upcase << attr[1..-1]
|
342
|
+
messages.sort.map do |message|
|
343
|
+
"- #{attr} #{message}."
|
344
|
+
end
|
345
|
+
end.flatten
|
346
|
+
count = lines.size
|
347
|
+
lines.unshift "The following #{'validation'.pluralize(count)} failed:"
|
348
|
+
error = lines.join("\n")
|
349
|
+
when nil
|
350
|
+
error = "An unexpected error ocurred: #{body}"
|
351
|
+
end
|
352
|
+
|
353
|
+
raise Informative, error
|
354
|
+
end
|
355
|
+
|
356
|
+
def json(response)
|
357
|
+
JSON.parse(response.body)
|
358
|
+
end
|
359
|
+
|
360
|
+
def netrc
|
361
|
+
@@netrc ||= Netrc.read
|
362
|
+
end
|
363
|
+
|
364
|
+
def token
|
365
|
+
netrc['trunk.cocoapods.org'] && netrc['trunk.cocoapods.org'].last
|
366
|
+
end
|
367
|
+
|
368
|
+
def default_headers
|
369
|
+
{
|
370
|
+
'Content-Type' => 'application/json; charset=utf-8',
|
371
|
+
'Accept' => 'application/json; charset=utf-8'
|
372
|
+
}
|
373
|
+
end
|
374
|
+
|
375
|
+
def auth_headers
|
376
|
+
default_headers.merge('Authorization' => "Token #{token}")
|
377
|
+
end
|
378
|
+
|
379
|
+
def formatted_time(time_string)
|
380
|
+
require 'active_support/time'
|
381
|
+
@tz_offset ||= Time.zone_offset(`/bin/date +%Z`.strip)
|
382
|
+
@current_year ||= Date.today.year
|
383
|
+
|
384
|
+
time = Time.parse(time_string) + @tz_offset
|
385
|
+
formatted = time.to_formatted_s(:long_ordinal)
|
386
|
+
# No need to show the current year, the user will probably know.
|
387
|
+
if time.year == @current_year
|
388
|
+
formatted.sub!(" #{@current_year}", '')
|
389
|
+
end
|
390
|
+
formatted
|
391
|
+
end
|
392
|
+
end
|
393
|
+
end
|
394
|
+
end
|
data/lib/trunk.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
require File.expand_path('../../../spec_helper', __FILE__)
|
2
|
+
|
3
|
+
module Pod
|
4
|
+
describe Command::Trunk::AddOwner do
|
5
|
+
describe "CLAide" do
|
6
|
+
it "registers it self" do
|
7
|
+
Command.parse(%w{ trunk add-owner }).should.be.instance_of Command::Trunk::AddOwner
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require File.expand_path('../../../spec_helper', __FILE__)
|
2
|
+
|
3
|
+
module Pod
|
4
|
+
describe Command::Trunk::Me do
|
5
|
+
describe "CLAide" do
|
6
|
+
it "registers it self" do
|
7
|
+
Command.parse(%w{ trunk me }).should.be.instance_of Command::Trunk::Me
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should error if we don't have a token" do
|
12
|
+
Netrc.any_instance.stubs(:[]).returns(nil)
|
13
|
+
command = Command.parse(%w{ trunk me })
|
14
|
+
lambda { command.validate! }.should.raise CLAide::Help
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require File.expand_path('../../../spec_helper', __FILE__)
|
2
|
+
|
3
|
+
module Pod
|
4
|
+
describe Command::Trunk::Push do
|
5
|
+
describe "CLAide" do
|
6
|
+
it "registers it self" do
|
7
|
+
Command.parse(%w{ trunk push }).should.be.instance_of Command::Trunk::Push
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require File.expand_path('../../../spec_helper', __FILE__)
|
2
|
+
|
3
|
+
module Pod
|
4
|
+
describe Command::Trunk::Register do
|
5
|
+
describe "CLAide" do
|
6
|
+
it "registers it self" do
|
7
|
+
Command.parse(%w{ trunk register }).should.be.instance_of Command::Trunk::Register
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
ROOT = Pathname.new(File.expand_path('../../', __FILE__))
|
3
|
+
$:.unshift((ROOT + 'lib').to_s)
|
4
|
+
$:.unshift((ROOT + 'spec').to_s)
|
5
|
+
|
6
|
+
require 'bundler/setup'
|
7
|
+
require 'bacon'
|
8
|
+
require 'mocha-on-bacon'
|
9
|
+
require 'pretty_bacon'
|
10
|
+
require 'cocoapods'
|
11
|
+
|
12
|
+
require 'cocoapods_plugin'
|
13
|
+
|
14
|
+
#-----------------------------------------------------------------------------#
|
15
|
+
|
16
|
+
module Pod
|
17
|
+
|
18
|
+
# Disable the wrapping so the output is deterministic in the tests.
|
19
|
+
#
|
20
|
+
UI.disable_wrap = true
|
21
|
+
|
22
|
+
# Redirects the messages to an internal store.
|
23
|
+
#
|
24
|
+
module UI
|
25
|
+
@output = ''
|
26
|
+
@warnings = ''
|
27
|
+
|
28
|
+
class << self
|
29
|
+
attr_accessor :output
|
30
|
+
attr_accessor :warnings
|
31
|
+
|
32
|
+
def puts(message = '')
|
33
|
+
@output << "#{message}\n"
|
34
|
+
end
|
35
|
+
|
36
|
+
def warn(message = '', actions = [])
|
37
|
+
@warnings << "#{message}\n"
|
38
|
+
end
|
39
|
+
|
40
|
+
def print(message)
|
41
|
+
@output << message
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
#-----------------------------------------------------------------------------#
|
metadata
ADDED
@@ -0,0 +1,138 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cocoapods-trunk
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Eloy Durán
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-05-19 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: nap
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.6'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.6'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: json
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.8'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.8'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: netrc
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bundler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.3'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.3'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description:
|
84
|
+
email:
|
85
|
+
- eloy.de.enige@gmail.com
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- ".gitignore"
|
91
|
+
- ".travis.yml"
|
92
|
+
- Gemfile
|
93
|
+
- LICENSE.txt
|
94
|
+
- README.md
|
95
|
+
- Rakefile
|
96
|
+
- cocoapods-trunk.gemspec
|
97
|
+
- lib/cocoapods_plugin.rb
|
98
|
+
- lib/pod/command/trunk.rb
|
99
|
+
- lib/trunk.rb
|
100
|
+
- lib/trunk/version.rb
|
101
|
+
- spec/command/trunk/addowner_spec.rb
|
102
|
+
- spec/command/trunk/me_spec.rb
|
103
|
+
- spec/command/trunk/push_spec.rb
|
104
|
+
- spec/command/trunk/register_spec.rb
|
105
|
+
- spec/command/trunk_spec.rb
|
106
|
+
- spec/spec_helper.rb
|
107
|
+
homepage: ''
|
108
|
+
licenses:
|
109
|
+
- MIT
|
110
|
+
metadata: {}
|
111
|
+
post_install_message:
|
112
|
+
rdoc_options: []
|
113
|
+
require_paths:
|
114
|
+
- lib
|
115
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
116
|
+
requirements:
|
117
|
+
- - ">="
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '0'
|
120
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
requirements: []
|
126
|
+
rubyforge_project:
|
127
|
+
rubygems_version: 2.2.2
|
128
|
+
signing_key:
|
129
|
+
specification_version: 4
|
130
|
+
summary: Interact with trunk.cocoapods.org
|
131
|
+
test_files:
|
132
|
+
- spec/command/trunk/addowner_spec.rb
|
133
|
+
- spec/command/trunk/me_spec.rb
|
134
|
+
- spec/command/trunk/push_spec.rb
|
135
|
+
- spec/command/trunk/register_spec.rb
|
136
|
+
- spec/command/trunk_spec.rb
|
137
|
+
- spec/spec_helper.rb
|
138
|
+
has_rdoc:
|