cocoapods-trunk 0.4.0 → 0.4.1
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 +4 -4
- data/.rubocop_cocoapods.yml +22 -0
- data/CHANGELOG.md +16 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +16 -16
- data/cocoapods-trunk.gemspec +2 -2
- data/lib/cocoapods_trunk.rb +3 -0
- data/lib/pod/command/trunk.rb +4 -328
- data/lib/pod/command/trunk/add_owner.rb +44 -0
- data/lib/pod/command/trunk/me.rb +117 -0
- data/lib/pod/command/trunk/push.rb +114 -0
- data/lib/pod/command/trunk/register.rb +75 -0
- data/spec/command/trunk/push_spec.rb +1 -1
- metadata +7 -4
- data/lib/trunk.rb +0 -7
- data/lib/trunk/version.rb +0 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 94cb63750c2a1c96259b49e0f5a551cdb70cf456
|
|
4
|
+
data.tar.gz: 52a4b68041e9c1fe535f39e24390b6244a3fbbdb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3a71c8f8aae5896c00ecd59fb8693929ae5862e3e9c0d4c2d565a17c75a662418e8fba83e1355e66d67c7ab0a56740e0add1c11a44fbcec576b9c9eed3bc0e46
|
|
7
|
+
data.tar.gz: ee6ba3be0dcc8972b15ad510e7364df215d72372956a09683a902b491d6428e017d2b3db7d436db31e6490bd8e276cfc4f2cdddc40c7b3fe2f01fb88c957a634
|
data/.rubocop_cocoapods.yml
CHANGED
|
@@ -42,6 +42,9 @@ Encoding:
|
|
|
42
42
|
TrailingComma:
|
|
43
43
|
EnforcedStyleForMultiline: comma
|
|
44
44
|
|
|
45
|
+
Style/MultilineOperationIndentation:
|
|
46
|
+
EnforcedStyle: indented
|
|
47
|
+
|
|
45
48
|
# Clashes with CLAide Command#validate!
|
|
46
49
|
GuardClause:
|
|
47
50
|
Enabled: false
|
|
@@ -50,6 +53,25 @@ GuardClause:
|
|
|
50
53
|
Next:
|
|
51
54
|
Enabled: false
|
|
52
55
|
|
|
56
|
+
# Arbitrary max lengths for classes simply do not work and enabling this will
|
|
57
|
+
# lead to a never ending stream of annoyance and changes.
|
|
58
|
+
Metrics/ClassLength:
|
|
59
|
+
Enabled: false
|
|
60
|
+
|
|
61
|
+
# No enforced convention here.
|
|
62
|
+
Metrics/BlockNesting:
|
|
63
|
+
Enabled: false
|
|
64
|
+
|
|
65
|
+
# It will be obvious which code is complex, Rubocop should only lint simple
|
|
66
|
+
# rules for us.
|
|
67
|
+
Metrics/AbcSize:
|
|
68
|
+
Enabled: false
|
|
69
|
+
|
|
70
|
+
# It will be obvious which code is complex, Rubocop should only lint simple
|
|
71
|
+
# rules for us.
|
|
72
|
+
Metrics/CyclomaticComplexity:
|
|
73
|
+
Enabled: false
|
|
74
|
+
|
|
53
75
|
#- CocoaPods support for Ruby 1.8.7 ------------------------------------------#
|
|
54
76
|
|
|
55
77
|
HashSyntax:
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
## 0.4.1
|
|
2
|
+
|
|
3
|
+
##### Enhancements
|
|
4
|
+
|
|
5
|
+
* Improved code readability and structure by splitting subcommands
|
|
6
|
+
into individual files.
|
|
7
|
+
[Olivier Halligon](https://github.com/alisoftware)
|
|
8
|
+
[#21](https://github.com/CocoaPods/CocoaPods/issues/21)
|
|
9
|
+
|
|
10
|
+
##### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* Updates for changes in CocoaPods regarding `--allow-warnings`.
|
|
13
|
+
[Kyle Fuller](https://github.com/kylef)
|
|
14
|
+
[Cocoapods#2831](https://github.com/CocoaPods/CocoaPods/pull/2831)
|
|
15
|
+
|
|
16
|
+
|
|
1
17
|
## 0.4.0
|
|
2
18
|
|
|
3
19
|
##### Bug Fixes
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
GIT
|
|
2
2
|
remote: https://github.com/CocoaPods/CLAide.git
|
|
3
|
-
revision:
|
|
3
|
+
revision: b1eccc296b68b1a432e42ecf0c4b799d8551c75c
|
|
4
4
|
branch: master
|
|
5
5
|
specs:
|
|
6
6
|
claide (0.7.0)
|
|
7
7
|
|
|
8
8
|
GIT
|
|
9
9
|
remote: https://github.com/CocoaPods/CocoaPods.git
|
|
10
|
-
revision:
|
|
10
|
+
revision: 1703a3464674baecf54bd7e766f4b37ed8fc43f7
|
|
11
11
|
branch: master
|
|
12
12
|
specs:
|
|
13
|
-
cocoapods (0.35.0.
|
|
13
|
+
cocoapods (0.35.0.rc2)
|
|
14
14
|
activesupport (>= 3.2.15)
|
|
15
15
|
claide (~> 0.7.0)
|
|
16
|
-
cocoapods-core (= 0.35.0.
|
|
17
|
-
cocoapods-downloader (~> 0.
|
|
16
|
+
cocoapods-core (= 0.35.0.rc2)
|
|
17
|
+
cocoapods-downloader (~> 0.8.0)
|
|
18
18
|
cocoapods-plugins (~> 0.3.1)
|
|
19
19
|
cocoapods-trunk (~> 0.4.0)
|
|
20
20
|
cocoapods-try (~> 0.4.2)
|
|
@@ -23,14 +23,14 @@ GIT
|
|
|
23
23
|
molinillo (~> 0.1.1)
|
|
24
24
|
nap (~> 0.8)
|
|
25
25
|
open4 (~> 1.3)
|
|
26
|
-
xcodeproj (~> 0.20.
|
|
26
|
+
xcodeproj (~> 0.20.2)
|
|
27
27
|
|
|
28
28
|
GIT
|
|
29
29
|
remote: https://github.com/CocoaPods/Core.git
|
|
30
|
-
revision:
|
|
30
|
+
revision: 60a486e8141323390dc5ff7f6676cf893a251a48
|
|
31
31
|
branch: master
|
|
32
32
|
specs:
|
|
33
|
-
cocoapods-core (0.35.0.
|
|
33
|
+
cocoapods-core (0.35.0.rc2)
|
|
34
34
|
activesupport (>= 3.2.15)
|
|
35
35
|
fuzzy_match (~> 2.0.4)
|
|
36
36
|
nap (~> 0.8.0)
|
|
@@ -38,14 +38,14 @@ GIT
|
|
|
38
38
|
PATH
|
|
39
39
|
remote: .
|
|
40
40
|
specs:
|
|
41
|
-
cocoapods-trunk (0.4.
|
|
41
|
+
cocoapods-trunk (0.4.1)
|
|
42
42
|
nap (>= 0.8)
|
|
43
43
|
netrc (= 0.7.8)
|
|
44
44
|
|
|
45
45
|
GEM
|
|
46
46
|
remote: https://rubygems.org/
|
|
47
47
|
specs:
|
|
48
|
-
activesupport (4.1.
|
|
48
|
+
activesupport (4.1.8)
|
|
49
49
|
i18n (~> 0.6, >= 0.6.9)
|
|
50
50
|
json (~> 1.7, >= 1.7.7)
|
|
51
51
|
minitest (~> 5.1)
|
|
@@ -55,7 +55,7 @@ GEM
|
|
|
55
55
|
astrolabe (1.3.0)
|
|
56
56
|
parser (>= 2.2.0.pre.3, < 3.0)
|
|
57
57
|
bacon (1.2.0)
|
|
58
|
-
cocoapods-downloader (0.
|
|
58
|
+
cocoapods-downloader (0.8.0)
|
|
59
59
|
cocoapods-plugins (0.3.2)
|
|
60
60
|
nap
|
|
61
61
|
cocoapods-try (0.4.2)
|
|
@@ -76,7 +76,7 @@ GEM
|
|
|
76
76
|
rb-inotify (>= 0.9)
|
|
77
77
|
rb-kqueue (>= 0.2)
|
|
78
78
|
metaclass (0.0.4)
|
|
79
|
-
minitest (5.4.
|
|
79
|
+
minitest (5.4.3)
|
|
80
80
|
mocha (1.1.0)
|
|
81
81
|
metaclass (~> 0.0.1)
|
|
82
82
|
mocha-on-bacon (0.2.2)
|
|
@@ -100,9 +100,9 @@ GEM
|
|
|
100
100
|
ffi (>= 0.5.0)
|
|
101
101
|
rb-kqueue (0.2.3)
|
|
102
102
|
ffi (>= 0.5.0)
|
|
103
|
-
rubocop (0.
|
|
103
|
+
rubocop (0.27.1)
|
|
104
104
|
astrolabe (~> 1.3)
|
|
105
|
-
parser (>= 2.2.0.pre.
|
|
105
|
+
parser (>= 2.2.0.pre.7, < 3.0)
|
|
106
106
|
powerpack (~> 0.0.6)
|
|
107
107
|
rainbow (>= 1.99.1, < 3.0)
|
|
108
108
|
ruby-progressbar (~> 1.4)
|
|
@@ -116,7 +116,7 @@ GEM
|
|
|
116
116
|
thread_safe (0.3.4)
|
|
117
117
|
tzinfo (1.2.2)
|
|
118
118
|
thread_safe (~> 0.1)
|
|
119
|
-
xcodeproj (0.20.
|
|
119
|
+
xcodeproj (0.20.2)
|
|
120
120
|
activesupport (>= 3)
|
|
121
121
|
colored (~> 1.2)
|
|
122
122
|
|
|
@@ -137,4 +137,4 @@ DEPENDENCIES
|
|
|
137
137
|
mocha-on-bacon
|
|
138
138
|
prettybacon
|
|
139
139
|
rake
|
|
140
|
-
rubocop
|
|
140
|
+
rubocop
|
data/cocoapods-trunk.gemspec
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
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 '
|
|
4
|
+
require 'cocoapods_trunk'
|
|
5
5
|
|
|
6
6
|
Gem::Specification.new do |spec|
|
|
7
7
|
spec.name = "cocoapods-trunk"
|
|
8
|
-
spec.version =
|
|
8
|
+
spec.version = CocoaPodsTrunk::VERSION
|
|
9
9
|
spec.authors = ["Eloy Durán"]
|
|
10
10
|
spec.email = ["eloy.de.enige@gmail.com"]
|
|
11
11
|
spec.summary = "Interact with trunk.cocoapods.org"
|
data/lib/pod/command/trunk.rb
CHANGED
|
@@ -13,334 +13,10 @@ module Pod
|
|
|
13
13
|
SCHEME_AND_HOST = ENV['TRUNK_SCHEME_AND_HOST'] || 'https://trunk.cocoapods.org'
|
|
14
14
|
BASE_URL = "#{SCHEME_AND_HOST}/api/v1"
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
-
CLAide::Argument.new('EMAIL', true),
|
|
40
|
-
CLAide::Argument.new('NAME', false),
|
|
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
|
-
rescue REST::Error => e
|
|
76
|
-
raise Informative, 'There was an error registering with trunk: ' \
|
|
77
|
-
"#{e.message}"
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
def save_token(token)
|
|
81
|
-
netrc['trunk.cocoapods.org'] = @email, token
|
|
82
|
-
netrc.save
|
|
83
|
-
end
|
|
84
|
-
end
|
|
85
|
-
|
|
86
|
-
class Me < Trunk
|
|
87
|
-
self.summary = 'Display information about your sessions'
|
|
88
|
-
self.description = <<-DESC
|
|
89
|
-
Includes information about your registration, followed by all your
|
|
90
|
-
sessions.
|
|
91
|
-
|
|
92
|
-
These are your current session, other valid sessions, unverified
|
|
93
|
-
sessions, and expired sessions.
|
|
94
|
-
DESC
|
|
95
|
-
|
|
96
|
-
def validate!
|
|
97
|
-
super
|
|
98
|
-
unless token
|
|
99
|
-
help! 'You need to register a session first.'
|
|
100
|
-
end
|
|
101
|
-
end
|
|
102
|
-
|
|
103
|
-
def run
|
|
104
|
-
me = json(request_path(:get, 'sessions', auth_headers))
|
|
105
|
-
owner = json(request_path(:get, "owners/#{me['email']}"))
|
|
106
|
-
UI.labeled 'Name', owner['name']
|
|
107
|
-
UI.labeled 'Email', owner['email']
|
|
108
|
-
UI.labeled 'Since', formatted_time(owner['created_at'])
|
|
109
|
-
|
|
110
|
-
pods = owner['pods'] || []
|
|
111
|
-
pods = pods.map { |pod| pod['name'] }
|
|
112
|
-
pods = 'None' unless pods.any?
|
|
113
|
-
UI.labeled 'Pods', pods
|
|
114
|
-
|
|
115
|
-
sessions = me['sessions'].map do |session|
|
|
116
|
-
hash = {
|
|
117
|
-
:created_at => formatted_time(session['created_at']),
|
|
118
|
-
:valid_until => formatted_time(session['valid_until']),
|
|
119
|
-
:created_from_ip => session['created_from_ip'],
|
|
120
|
-
:description => session['description'],
|
|
121
|
-
}
|
|
122
|
-
if Time.parse(session['valid_until']) <= Time.now.utc
|
|
123
|
-
hash[:color] = :red
|
|
124
|
-
elsif session['verified']
|
|
125
|
-
hash[:color] = session['current'] ? :cyan : :green
|
|
126
|
-
else
|
|
127
|
-
hash[:color] = :yellow
|
|
128
|
-
hash[:valid_until] = 'Unverified'
|
|
129
|
-
end
|
|
130
|
-
hash
|
|
131
|
-
end
|
|
132
|
-
|
|
133
|
-
columns = [:created_at, :valid_until, :created_from_ip, :description].map do |key|
|
|
134
|
-
find_max_size(sessions, key)
|
|
135
|
-
end
|
|
136
|
-
|
|
137
|
-
sessions = sessions.map do |session|
|
|
138
|
-
created_at = session[:created_at].ljust(columns[0])
|
|
139
|
-
valid_until = session[:valid_until].rjust(columns[1])
|
|
140
|
-
created_from_ip = session[:created_from_ip].ljust(columns[2])
|
|
141
|
-
description = session[:description]
|
|
142
|
-
msg = "#{created_at} - #{valid_until}. IP: #{created_from_ip}"
|
|
143
|
-
msg << " Description: #{description}" if description
|
|
144
|
-
msg.send(session[:color])
|
|
145
|
-
end
|
|
146
|
-
|
|
147
|
-
UI.labeled 'Sessions', sessions
|
|
148
|
-
|
|
149
|
-
rescue REST::Error => e
|
|
150
|
-
raise Informative, 'There was an error fetching your info ' \
|
|
151
|
-
"from trunk: #{e.message}"
|
|
152
|
-
end
|
|
153
|
-
|
|
154
|
-
private
|
|
155
|
-
|
|
156
|
-
def find_max_size(sessions, key)
|
|
157
|
-
sessions.map { |s| (s[key] || '').size }.max
|
|
158
|
-
end
|
|
159
|
-
|
|
160
|
-
class CleanSessions < Me
|
|
161
|
-
self.summary = 'Remove sessions'
|
|
162
|
-
self.description = <<-DESC
|
|
163
|
-
By default this will clean-up your sessions by removing expired and
|
|
164
|
-
unverified sessions.
|
|
165
|
-
|
|
166
|
-
To remove all your sessions, except for the one you are currently
|
|
167
|
-
using, specify the `--all` flag.
|
|
168
|
-
DESC
|
|
169
|
-
|
|
170
|
-
def self.options
|
|
171
|
-
[
|
|
172
|
-
['--all', 'Removes all your sessions, except for the current one'],
|
|
173
|
-
].concat(super)
|
|
174
|
-
end
|
|
175
|
-
|
|
176
|
-
def initialize(argv)
|
|
177
|
-
@remove_all = argv.flag?('all', false)
|
|
178
|
-
super
|
|
179
|
-
end
|
|
180
|
-
|
|
181
|
-
def validate!
|
|
182
|
-
super
|
|
183
|
-
unless token
|
|
184
|
-
help! 'You need to register a session first.'
|
|
185
|
-
end
|
|
186
|
-
end
|
|
187
|
-
|
|
188
|
-
def run
|
|
189
|
-
path = @remove_all ? 'sessions/all' : 'sessions'
|
|
190
|
-
request_path(:delete, path, auth_headers)
|
|
191
|
-
rescue REST::Error => e
|
|
192
|
-
raise Informative, 'There was an error cleaning up your ' \
|
|
193
|
-
"sessions from trunk: #{e.message}"
|
|
194
|
-
end
|
|
195
|
-
end
|
|
196
|
-
end
|
|
197
|
-
|
|
198
|
-
class AddOwner < Trunk
|
|
199
|
-
self.summary = 'Add an owner to a pod'
|
|
200
|
-
self.description = <<-DESC
|
|
201
|
-
Adds the registered user with specified `OWNER-EMAIL` as an owner
|
|
202
|
-
of the given `POD`.
|
|
203
|
-
An ‘owner’ is a registered user whom is allowed to make changes to a
|
|
204
|
-
pod, such as pushing new versions and adding other ‘owners’.
|
|
205
|
-
DESC
|
|
206
|
-
|
|
207
|
-
self.arguments = [
|
|
208
|
-
CLAide::Argument.new('POD', true),
|
|
209
|
-
CLAide::Argument.new('OWNER-EMAIL', true),
|
|
210
|
-
]
|
|
211
|
-
|
|
212
|
-
def initialize(argv)
|
|
213
|
-
@pod, @email = argv.shift_argument, argv.shift_argument
|
|
214
|
-
super
|
|
215
|
-
end
|
|
216
|
-
|
|
217
|
-
def validate!
|
|
218
|
-
super
|
|
219
|
-
unless token
|
|
220
|
-
help! 'You need to register a session first.'
|
|
221
|
-
end
|
|
222
|
-
unless @pod && @email
|
|
223
|
-
help! 'Specify the pod name and the new owner’s email address.'
|
|
224
|
-
end
|
|
225
|
-
end
|
|
226
|
-
|
|
227
|
-
def run
|
|
228
|
-
body = { 'email' => @email }.to_json
|
|
229
|
-
json = json(request_path(:patch, "pods/#{@pod}/owners", body, auth_headers))
|
|
230
|
-
UI.labeled 'Owners', json.map { |o| "#{o['name']} <#{o['email']}>" }
|
|
231
|
-
rescue REST::Error => e
|
|
232
|
-
raise Informative, "There was an error adding #{@email} to " \
|
|
233
|
-
"#{@pod} on trunk: #{e.message}"
|
|
234
|
-
end
|
|
235
|
-
end
|
|
236
|
-
|
|
237
|
-
class Push < Trunk
|
|
238
|
-
self.summary = 'Publish a podspec'
|
|
239
|
-
self.description = <<-DESC
|
|
240
|
-
Publish the podspec at `PATH` to make it available to all users of
|
|
241
|
-
the ‘master’ spec-repo. If `PATH` is not provided, defaults to the
|
|
242
|
-
current directory.
|
|
243
|
-
|
|
244
|
-
Before pushing the podspec to cocoapods.org, this will perform a local
|
|
245
|
-
lint of the podspec, including a build of the library. However, it
|
|
246
|
-
remains *your* responsibility to ensure that the published podspec
|
|
247
|
-
will actually work for your users. Thus it is recommended that you
|
|
248
|
-
*first* try to use the podspec to integrate the library into your demo
|
|
249
|
-
and/or real application.
|
|
250
|
-
|
|
251
|
-
If this is the first time you publish a spec for this pod, you will
|
|
252
|
-
automatically be registered as the ‘owner’ of this pod. (Note that
|
|
253
|
-
‘owner’ in this case implies a person that is allowed to publish new
|
|
254
|
-
versions and add other ‘owners’, not necessarily the library author.)
|
|
255
|
-
DESC
|
|
256
|
-
|
|
257
|
-
self.arguments = [
|
|
258
|
-
CLAide::Argument.new('PATH', false),
|
|
259
|
-
]
|
|
260
|
-
|
|
261
|
-
def self.options
|
|
262
|
-
[
|
|
263
|
-
['--allow-warnings', 'Allows push even if there are lint warnings'],
|
|
264
|
-
].concat(super)
|
|
265
|
-
end
|
|
266
|
-
|
|
267
|
-
def initialize(argv)
|
|
268
|
-
@allow_warnings = argv.flag?('allow-warnings')
|
|
269
|
-
@path = argv.shift_argument || '.'
|
|
270
|
-
find_podspec_file if File.directory?(@path)
|
|
271
|
-
super
|
|
272
|
-
end
|
|
273
|
-
|
|
274
|
-
def validate!
|
|
275
|
-
super
|
|
276
|
-
unless token
|
|
277
|
-
help! 'You need to register a session first.'
|
|
278
|
-
end
|
|
279
|
-
unless @path
|
|
280
|
-
help! 'Please specify the path to the podspec file.'
|
|
281
|
-
end
|
|
282
|
-
unless File.exist?(@path) && !File.directory?(@path)
|
|
283
|
-
help! "The specified path `#{@path}` does not point to " \
|
|
284
|
-
'an existing podspec file.'
|
|
285
|
-
end
|
|
286
|
-
end
|
|
287
|
-
|
|
288
|
-
def run
|
|
289
|
-
validate_podspec
|
|
290
|
-
response = request_path(:post, 'pods', spec.to_json, auth_headers)
|
|
291
|
-
url = response.headers['location'].first
|
|
292
|
-
json = json(request_url(:get, url, default_headers))
|
|
293
|
-
|
|
294
|
-
# Using UI.labeled here is dangerous, as it wraps the URL and indents
|
|
295
|
-
# it, which breaks the URL when you try to copy-paste it.
|
|
296
|
-
$stdout.puts " - Data URL: #{json['data_url']}"
|
|
297
|
-
|
|
298
|
-
messages = json['messages'].map do |entry|
|
|
299
|
-
at, message = entry.to_a.flatten
|
|
300
|
-
"#{formatted_time(at)}: #{message}"
|
|
301
|
-
end
|
|
302
|
-
UI.labeled 'Log messages', messages
|
|
303
|
-
rescue REST::Error => e
|
|
304
|
-
raise Informative, 'There was an error pushing a new version ' \
|
|
305
|
-
"to trunk: #{e.message}"
|
|
306
|
-
end
|
|
307
|
-
|
|
308
|
-
private
|
|
309
|
-
|
|
310
|
-
def find_podspec_file
|
|
311
|
-
podspecs = Dir[Pathname(@path) + '*.podspec{.json,}']
|
|
312
|
-
case podspecs.count
|
|
313
|
-
when 0
|
|
314
|
-
UI.notice "No podspec found in directory `#{@path}`"
|
|
315
|
-
when 1
|
|
316
|
-
UI.notice "Found podspec `#{podspecs[0]}`"
|
|
317
|
-
else
|
|
318
|
-
UI.notice "Multiple podspec files in directory `#{@path}`. " \
|
|
319
|
-
'You need to explicitly specify which one to use.'
|
|
320
|
-
end
|
|
321
|
-
@path = (podspecs.count == 1) ? podspecs[0] : nil
|
|
322
|
-
end
|
|
323
|
-
|
|
324
|
-
def spec
|
|
325
|
-
@spec ||= Pod::Specification.from_file(@path)
|
|
326
|
-
rescue Informative # TODO: this should be a more specific error
|
|
327
|
-
raise Informative, 'Unable to interpret the specified path as a ' \
|
|
328
|
-
'podspec.'
|
|
329
|
-
end
|
|
330
|
-
|
|
331
|
-
# Performs a full lint against the podspecs.
|
|
332
|
-
#
|
|
333
|
-
# TODO: Currently copied verbatim from `pod push`.
|
|
334
|
-
def validate_podspec
|
|
335
|
-
UI.puts 'Validating podspec'.yellow
|
|
336
|
-
validator = Validator.new(spec, %w(https://github.com/CocoaPods/Specs.git))
|
|
337
|
-
validator.only_errors = @allow_warnings
|
|
338
|
-
validator.validate
|
|
339
|
-
unless validator.validated?
|
|
340
|
-
raise Informative, 'The podspec does not validate.'
|
|
341
|
-
end
|
|
342
|
-
end
|
|
343
|
-
end
|
|
16
|
+
require 'pod/command/trunk/register'
|
|
17
|
+
require 'pod/command/trunk/me'
|
|
18
|
+
require 'pod/command/trunk/add_owner'
|
|
19
|
+
require 'pod/command/trunk/push'
|
|
344
20
|
|
|
345
21
|
private
|
|
346
22
|
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
module Pod
|
|
2
|
+
class Command
|
|
3
|
+
class Trunk
|
|
4
|
+
class AddOwner < Trunk
|
|
5
|
+
self.summary = 'Add an owner to a pod'
|
|
6
|
+
self.description = <<-DESC
|
|
7
|
+
Adds the registered user with specified `OWNER-EMAIL` as an owner
|
|
8
|
+
of the given `POD`.
|
|
9
|
+
An ‘owner’ is a registered user whom is allowed to make changes to a
|
|
10
|
+
pod, such as pushing new versions and adding other ‘owners’.
|
|
11
|
+
DESC
|
|
12
|
+
|
|
13
|
+
self.arguments = [
|
|
14
|
+
CLAide::Argument.new('POD', true),
|
|
15
|
+
CLAide::Argument.new('OWNER-EMAIL', true),
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
def initialize(argv)
|
|
19
|
+
@pod, @email = argv.shift_argument, argv.shift_argument
|
|
20
|
+
super
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def validate!
|
|
24
|
+
super
|
|
25
|
+
unless token
|
|
26
|
+
help! 'You need to register a session first.'
|
|
27
|
+
end
|
|
28
|
+
unless @pod && @email
|
|
29
|
+
help! 'Specify the pod name and the new owner’s email address.'
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def run
|
|
34
|
+
body = { 'email' => @email }.to_json
|
|
35
|
+
json = json(request_path(:patch, "pods/#{@pod}/owners", body, auth_headers))
|
|
36
|
+
UI.labeled 'Owners', json.map { |o| "#{o['name']} <#{o['email']}>" }
|
|
37
|
+
rescue REST::Error => e
|
|
38
|
+
raise Informative, "There was an error adding #{@email} to " \
|
|
39
|
+
"#{@pod} on trunk: #{e.message}"
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
module Pod
|
|
2
|
+
class Command
|
|
3
|
+
class Trunk
|
|
4
|
+
class Me < Trunk
|
|
5
|
+
self.summary = 'Display information about your sessions'
|
|
6
|
+
self.description = <<-DESC
|
|
7
|
+
Includes information about your registration, followed by all your
|
|
8
|
+
sessions.
|
|
9
|
+
|
|
10
|
+
These are your current session, other valid sessions, unverified
|
|
11
|
+
sessions, and expired sessions.
|
|
12
|
+
DESC
|
|
13
|
+
|
|
14
|
+
def validate!
|
|
15
|
+
super
|
|
16
|
+
unless token
|
|
17
|
+
help! 'You need to register a session first.'
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def run
|
|
22
|
+
me = json(request_path(:get, 'sessions', auth_headers))
|
|
23
|
+
owner = json(request_path(:get, "owners/#{me['email']}"))
|
|
24
|
+
UI.labeled 'Name', owner['name']
|
|
25
|
+
UI.labeled 'Email', owner['email']
|
|
26
|
+
UI.labeled 'Since', formatted_time(owner['created_at'])
|
|
27
|
+
|
|
28
|
+
pods = owner['pods'] || []
|
|
29
|
+
pods = pods.map { |pod| pod['name'] }
|
|
30
|
+
pods = 'None' unless pods.any?
|
|
31
|
+
UI.labeled 'Pods', pods
|
|
32
|
+
|
|
33
|
+
sessions = me['sessions'].map do |session|
|
|
34
|
+
hash = {
|
|
35
|
+
:created_at => formatted_time(session['created_at']),
|
|
36
|
+
:valid_until => formatted_time(session['valid_until']),
|
|
37
|
+
:created_from_ip => session['created_from_ip'],
|
|
38
|
+
:description => session['description'],
|
|
39
|
+
}
|
|
40
|
+
if Time.parse(session['valid_until']) <= Time.now.utc
|
|
41
|
+
hash[:color] = :red
|
|
42
|
+
elsif session['verified']
|
|
43
|
+
hash[:color] = session['current'] ? :cyan : :green
|
|
44
|
+
else
|
|
45
|
+
hash[:color] = :yellow
|
|
46
|
+
hash[:valid_until] = 'Unverified'
|
|
47
|
+
end
|
|
48
|
+
hash
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
columns = [:created_at, :valid_until, :created_from_ip, :description].map do |key|
|
|
52
|
+
find_max_size(sessions, key)
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
sessions = sessions.map do |session|
|
|
56
|
+
created_at = session[:created_at].ljust(columns[0])
|
|
57
|
+
valid_until = session[:valid_until].rjust(columns[1])
|
|
58
|
+
created_from_ip = session[:created_from_ip].ljust(columns[2])
|
|
59
|
+
description = session[:description]
|
|
60
|
+
msg = "#{created_at} - #{valid_until}. IP: #{created_from_ip}"
|
|
61
|
+
msg << " Description: #{description}" if description
|
|
62
|
+
msg.send(session[:color])
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
UI.labeled 'Sessions', sessions
|
|
66
|
+
|
|
67
|
+
rescue REST::Error => e
|
|
68
|
+
raise Informative, 'There was an error fetching your info ' \
|
|
69
|
+
"from trunk: #{e.message}"
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
private
|
|
73
|
+
|
|
74
|
+
def find_max_size(sessions, key)
|
|
75
|
+
sessions.map { |s| (s[key] || '').size }.max
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
class CleanSessions < Me
|
|
79
|
+
self.summary = 'Remove sessions'
|
|
80
|
+
self.description = <<-DESC
|
|
81
|
+
By default this will clean-up your sessions by removing expired and
|
|
82
|
+
unverified sessions.
|
|
83
|
+
|
|
84
|
+
To remove all your sessions, except for the one you are currently
|
|
85
|
+
using, specify the `--all` flag.
|
|
86
|
+
DESC
|
|
87
|
+
|
|
88
|
+
def self.options
|
|
89
|
+
[
|
|
90
|
+
['--all', 'Removes all your sessions, except for the current one'],
|
|
91
|
+
].concat(super)
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def initialize(argv)
|
|
95
|
+
@remove_all = argv.flag?('all', false)
|
|
96
|
+
super
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def validate!
|
|
100
|
+
super
|
|
101
|
+
unless token
|
|
102
|
+
help! 'You need to register a session first.'
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
def run
|
|
107
|
+
path = @remove_all ? 'sessions/all' : 'sessions'
|
|
108
|
+
request_path(:delete, path, auth_headers)
|
|
109
|
+
rescue REST::Error => e
|
|
110
|
+
raise Informative, 'There was an error cleaning up your ' \
|
|
111
|
+
"sessions from trunk: #{e.message}"
|
|
112
|
+
end
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
end
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
module Pod
|
|
2
|
+
class Command
|
|
3
|
+
class Trunk
|
|
4
|
+
class Push < Trunk
|
|
5
|
+
self.summary = 'Publish a podspec'
|
|
6
|
+
self.description = <<-DESC
|
|
7
|
+
Publish the podspec at `PATH` to make it available to all users of
|
|
8
|
+
the ‘master’ spec-repo. If `PATH` is not provided, defaults to the
|
|
9
|
+
current directory.
|
|
10
|
+
|
|
11
|
+
Before pushing the podspec to cocoapods.org, this will perform a local
|
|
12
|
+
lint of the podspec, including a build of the library. However, it
|
|
13
|
+
remains *your* responsibility to ensure that the published podspec
|
|
14
|
+
will actually work for your users. Thus it is recommended that you
|
|
15
|
+
*first* try to use the podspec to integrate the library into your demo
|
|
16
|
+
and/or real application.
|
|
17
|
+
|
|
18
|
+
If this is the first time you publish a spec for this pod, you will
|
|
19
|
+
automatically be registered as the ‘owner’ of this pod. (Note that
|
|
20
|
+
‘owner’ in this case implies a person that is allowed to publish new
|
|
21
|
+
versions and add other ‘owners’, not necessarily the library author.)
|
|
22
|
+
DESC
|
|
23
|
+
|
|
24
|
+
self.arguments = [
|
|
25
|
+
CLAide::Argument.new('PATH', false),
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
def self.options
|
|
29
|
+
[
|
|
30
|
+
['--allow-warnings', 'Allows push even if there are lint warnings'],
|
|
31
|
+
].concat(super)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def initialize(argv)
|
|
35
|
+
@allow_warnings = argv.flag?('allow-warnings')
|
|
36
|
+
@path = argv.shift_argument || '.'
|
|
37
|
+
find_podspec_file if File.directory?(@path)
|
|
38
|
+
super
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def validate!
|
|
42
|
+
super
|
|
43
|
+
unless token
|
|
44
|
+
help! 'You need to register a session first.'
|
|
45
|
+
end
|
|
46
|
+
unless @path
|
|
47
|
+
help! 'Please specify the path to the podspec file.'
|
|
48
|
+
end
|
|
49
|
+
unless File.exist?(@path) && !File.directory?(@path)
|
|
50
|
+
help! "The specified path `#{@path}` does not point to " \
|
|
51
|
+
'an existing podspec file.'
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def run
|
|
56
|
+
validate_podspec
|
|
57
|
+
response = request_path(:post, 'pods', spec.to_json, auth_headers)
|
|
58
|
+
url = response.headers['location'].first
|
|
59
|
+
json = json(request_url(:get, url, default_headers))
|
|
60
|
+
|
|
61
|
+
# Using UI.labeled here is dangerous, as it wraps the URL and indents
|
|
62
|
+
# it, which breaks the URL when you try to copy-paste it.
|
|
63
|
+
$stdout.puts " - Data URL: #{json['data_url']}"
|
|
64
|
+
|
|
65
|
+
messages = json['messages'].map do |entry|
|
|
66
|
+
at, message = entry.to_a.flatten
|
|
67
|
+
"#{formatted_time(at)}: #{message}"
|
|
68
|
+
end
|
|
69
|
+
UI.labeled 'Log messages', messages
|
|
70
|
+
rescue REST::Error => e
|
|
71
|
+
raise Informative, 'There was an error pushing a new version ' \
|
|
72
|
+
"to trunk: #{e.message}"
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
private
|
|
76
|
+
|
|
77
|
+
def find_podspec_file
|
|
78
|
+
podspecs = Dir[Pathname(@path) + '*.podspec{.json,}']
|
|
79
|
+
case podspecs.count
|
|
80
|
+
when 0
|
|
81
|
+
UI.notice "No podspec found in directory `#{@path}`"
|
|
82
|
+
when 1
|
|
83
|
+
UI.notice "Found podspec `#{podspecs[0]}`"
|
|
84
|
+
else
|
|
85
|
+
UI.notice "Multiple podspec files in directory `#{@path}`. " \
|
|
86
|
+
'You need to explicitly specify which one to use.'
|
|
87
|
+
end
|
|
88
|
+
@path = (podspecs.count == 1) ? podspecs[0] : nil
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
def spec
|
|
92
|
+
@spec ||= Pod::Specification.from_file(@path)
|
|
93
|
+
rescue Informative # TODO: this should be a more specific error
|
|
94
|
+
raise Informative, 'Unable to interpret the specified path as a ' \
|
|
95
|
+
'podspec.'
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
# Performs a full lint against the podspecs.
|
|
99
|
+
#
|
|
100
|
+
# TODO: Currently copied verbatim from `pod push`.
|
|
101
|
+
def validate_podspec
|
|
102
|
+
UI.puts 'Validating podspec'.yellow
|
|
103
|
+
|
|
104
|
+
validator = Validator.new(spec, %w(https://github.com/CocoaPods/Specs.git))
|
|
105
|
+
validator.allow_warnings = @allow_warnings
|
|
106
|
+
validator.validate
|
|
107
|
+
unless validator.validated?
|
|
108
|
+
raise Informative, 'The podspec does not validate.'
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
end
|
|
114
|
+
end
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
module Pod
|
|
2
|
+
class Command
|
|
3
|
+
class Trunk
|
|
4
|
+
class Register < Trunk
|
|
5
|
+
self.summary = 'Manage sessions'
|
|
6
|
+
self.description = <<-DESC
|
|
7
|
+
Register a new account, or create a new session.
|
|
8
|
+
|
|
9
|
+
If this is your first registration, both an `EMAIL` address and your
|
|
10
|
+
`NAME` are required. If you've already registered with trunk, you may
|
|
11
|
+
omit the `NAME` (unless you would like to change it).
|
|
12
|
+
|
|
13
|
+
It is recommended that you provide a description of the session, so
|
|
14
|
+
that it will be easier to identify later on. For instance, when you
|
|
15
|
+
would like to clean-up your sessions. A common example is to specify
|
|
16
|
+
the location where the machine, that you are using the session for, is
|
|
17
|
+
physically located.
|
|
18
|
+
|
|
19
|
+
Examples:
|
|
20
|
+
|
|
21
|
+
$ pod trunk register eloy@example.com 'Eloy Durán' --description='Personal Laptop'
|
|
22
|
+
$ pod trunk register eloy@example.com --description='Work Laptop'
|
|
23
|
+
$ pod trunk register eloy@example.com
|
|
24
|
+
DESC
|
|
25
|
+
|
|
26
|
+
self.arguments = [
|
|
27
|
+
CLAide::Argument.new('EMAIL', true),
|
|
28
|
+
CLAide::Argument.new('NAME', false),
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
def self.options
|
|
32
|
+
[
|
|
33
|
+
['--description=DESCRIPTION', 'An arbitrary description to ' \
|
|
34
|
+
'easily identify your session ' \
|
|
35
|
+
'later on.'],
|
|
36
|
+
].concat(super)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def initialize(argv)
|
|
40
|
+
@session_description = argv.option('description')
|
|
41
|
+
@email, @name = argv.shift_argument, argv.shift_argument
|
|
42
|
+
super
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def validate!
|
|
46
|
+
super
|
|
47
|
+
unless @email
|
|
48
|
+
help! 'Specify at least your email address.'
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def run
|
|
53
|
+
body = {
|
|
54
|
+
'email' => @email,
|
|
55
|
+
'name' => @name,
|
|
56
|
+
'description' => @session_description,
|
|
57
|
+
}.to_json
|
|
58
|
+
json = json(request_path(:post, 'sessions', body, default_headers))
|
|
59
|
+
save_token(json['token'])
|
|
60
|
+
# TODO UI.notice inserts an empty line :/
|
|
61
|
+
puts '[!] Please verify the session by clicking the link in the ' \
|
|
62
|
+
"verification email that has been sent to #{@email}".yellow
|
|
63
|
+
rescue REST::Error => e
|
|
64
|
+
raise Informative, 'There was an error registering with trunk: ' \
|
|
65
|
+
"#{e.message}"
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def save_token(token)
|
|
69
|
+
netrc['trunk.cocoapods.org'] = @email, token
|
|
70
|
+
netrc.save
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
end
|
|
@@ -30,7 +30,7 @@ module Pod
|
|
|
30
30
|
# Execute `pod trunk push` with this dir as parameter
|
|
31
31
|
command = Command.parse(%w( trunk push ) + [dir])
|
|
32
32
|
path = command.instance_eval { @path }
|
|
33
|
-
return
|
|
33
|
+
return File.basename(path) if path
|
|
34
34
|
end
|
|
35
35
|
end
|
|
36
36
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cocoapods-trunk
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.4.
|
|
4
|
+
version: 0.4.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Eloy Durán
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2014-11-
|
|
11
|
+
date: 2014-11-19 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: nap
|
|
@@ -87,9 +87,12 @@ files:
|
|
|
87
87
|
- Rakefile
|
|
88
88
|
- cocoapods-trunk.gemspec
|
|
89
89
|
- lib/cocoapods_plugin.rb
|
|
90
|
+
- lib/cocoapods_trunk.rb
|
|
90
91
|
- lib/pod/command/trunk.rb
|
|
91
|
-
- lib/trunk.rb
|
|
92
|
-
- lib/trunk/
|
|
92
|
+
- lib/pod/command/trunk/add_owner.rb
|
|
93
|
+
- lib/pod/command/trunk/me.rb
|
|
94
|
+
- lib/pod/command/trunk/push.rb
|
|
95
|
+
- lib/pod/command/trunk/register.rb
|
|
93
96
|
- spec/command/trunk/addowner_spec.rb
|
|
94
97
|
- spec/command/trunk/me_spec.rb
|
|
95
98
|
- spec/command/trunk/push_spec.rb
|
data/lib/trunk.rb
DELETED