cocoapods-trunk 1.1.0.beta.1 → 1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2420bad5c8404637a01a359be2f5e6a5102985dd
4
- data.tar.gz: 7278abfb6ecdb18b3b7b632e21e58f140aee9bde
3
+ metadata.gz: 30da116433de3df7e249cb9d66efa4c0fc652b62
4
+ data.tar.gz: 77a48ab9bca55b783c12ec6863980d983b0f3a71
5
5
  SHA512:
6
- metadata.gz: 1ee5c3d4c895415ac0c42c96f85508878785d5ea9c117aa506ebc144cb2795c4d75191260faa09bef2c1cad7b5a2822d833fcbbe1a148a1c5533adc55e24c8e7
7
- data.tar.gz: a524a78baee39eaa47247134e22a9869e06e2d6058977db31560a6c460e6e68d9cc038388e7f407c7e04a161135d6e2e1137e3c628e62318b400dc6aa95aff41
6
+ metadata.gz: 7ccba11bb345a7c31fe6f7e67166fbfc207288f2580acb812e76ab83e2e37682e337763fda1caa65059cd591a0d51f616948c67799bbffc4d3218a1cec61e69a
7
+ data.tar.gz: edc020e706c3d2dd56a12a6b20622130251800588e53e258572dfa7517185e497b6109cb4b4d2f0b3ab9fcd97d3ff8be852cae1e1c16ed3f5e314ca77d4622bd
data/.travis.yml CHANGED
@@ -1,23 +1,21 @@
1
1
  # Sets Travis to run the Ruby specs on OS X machines to be as close as possible
2
2
  # to the user environment.
3
3
  #
4
+ osx_image: xcode7.3
4
5
  language: objective-c
6
+ cache: bundler
7
+ rvm:
8
+ - system
9
+ - 2.0.0-p451
10
+
5
11
  addons:
6
12
  code_climate:
7
13
  repo_token: 937468c2cbb0d7c0546b62d0fcbcba8a2a8b82714a64a52ffd0b951e71df626d
8
14
 
9
- env:
10
- - RVM_RUBY_VERSION=system
11
- # - RVM_RUBY_VERSION=1.8.7-p358
12
-
13
15
  before_install:
14
- - export LANG=en_US.UTF-8
15
- - curl http://curl.haxx.se/ca/cacert.pem -o /usr/local/share/cacert.pem
16
- - source ~/.rvm/scripts/rvm
17
- - if [[ $RVM_RUBY_VERSION != 'system' ]]; then rvm install $RVM_RUBY_VERSION; fi
18
- - rvm use $RVM_RUBY_VERSION
19
- - if [[ $RVM_RUBY_VERSION == 'system' ]]; then sudo gem update --system; fi
20
- - if [[ $RVM_RUBY_VERSION == 'system' ]]; then sudo gem install bundler --no-ri --no-rdoc; else gem install bundler --no-ri --no-rdoc; fi
16
+ - export GEM_HOME=$HOME/.gem
17
+ - export PATH=$GEM_HOME/bin:$PATH
18
+ - sudo gem install bundler
21
19
 
22
20
  install:
23
21
  - bundle install --without=documentation
data/CHANGELOG.md CHANGED
@@ -1,3 +1,20 @@
1
+ ## 1.1.0 (2016-10-19)
2
+
3
+ ##### Enhancements
4
+
5
+ * Passes the pod's version of Swift used for deployment to the CocoaPods Specs repo
6
+ [Orta](https://github.com/orta)
7
+ [#92](https://github.com/CocoaPods/cocoapods-trunk/pull/72)
8
+
9
+ * Prettier success message when successfully pushed a new version
10
+ [Marin](https://github.com/icanzilb)
11
+ [#76](https://github.com/CocoaPods/cocoapods-trunk/pull/76)
12
+
13
+ ##### Bug Fixes
14
+
15
+ * None.
16
+
17
+
1
18
  ## 1.1.0.beta.1 (2016-10-10)
2
19
 
3
20
  ##### Enhancements
data/Gemfile.lock CHANGED
@@ -19,7 +19,7 @@ GIT
19
19
  cocoapods-plugins (>= 1.0.0, < 2.0)
20
20
  cocoapods-search (>= 1.0.0, < 2.0)
21
21
  cocoapods-stats (>= 1.0.0, < 2.0)
22
- cocoapods-trunk (= 1.1.0.beta.1)
22
+ cocoapods-trunk (= 1.1.0)
23
23
  cocoapods-try (>= 1.1.0, < 2.0)
24
24
  colored (~> 1.2)
25
25
  escape (~> 0.0.4)
@@ -49,7 +49,7 @@ GIT
49
49
  PATH
50
50
  remote: .
51
51
  specs:
52
- cocoapods-trunk (1.1.0.beta.1)
52
+ cocoapods-trunk (1.1.0)
53
53
  nap (>= 0.8, < 2.0)
54
54
  netrc (= 0.7.8)
55
55
 
@@ -1,3 +1,3 @@
1
1
  module CocoaPodsTrunk
2
- VERSION = '1.1.0.beta.1'.freeze
2
+ VERSION = '1.1.0'.freeze
3
3
  end
@@ -70,16 +70,32 @@ module Pod
70
70
  raise Informative, error
71
71
  end
72
72
 
73
- def print_messages(data_url, messages)
74
- # Using UI.labeled here is dangerous, as it wraps the URL and indents
75
- # it, which breaks the URL when you try to copy-paste it.
76
- UI.puts " - Data URL: #{data_url}"
77
-
78
- messages = messages.map do |entry|
79
- at, message = entry.to_a.flatten
80
- "#{formatted_time(at)}: #{message}"
73
+ def print_messages(data_url, messages, spec = nil, action = nil)
74
+ if verbose? || spec.nil?
75
+ # Using UI.labeled here is dangerous, as it wraps the URL and indents
76
+ # it, which breaks the URL when you try to copy-paste it.
77
+ UI.puts " - Data URL: #{data_url}"
78
+
79
+ server_logs = messages.map do |entry|
80
+ at, message = entry.to_a.flatten
81
+ "#{formatted_time(at)}: #{message}"
82
+ end
83
+ UI.labeled 'Log messages', server_logs
84
+ else
85
+ separator = '-' * 80
86
+ UI.puts
87
+ UI.puts separator
88
+ UI.puts " 🎉 Congrats"
89
+ UI.puts
90
+ UI.puts " 🚀 #{spec.name} (#{spec.version}) successfully #{action}"
91
+ unless messages.empty?
92
+ at = messages.first.to_a.flatten.first
93
+ UI.puts " 📅 #{formatted_time(at)}"
94
+ end
95
+ UI.puts " 🌎 https://cocoapods.org/pods/#{spec.name}"
96
+ UI.puts " 👍 Tell your friends!"
97
+ UI.puts separator
81
98
  end
82
- UI.labeled 'Log messages', messages
83
99
  end
84
100
 
85
101
  def json(response)
@@ -34,7 +34,7 @@ module Pod
34
34
  def run
35
35
  return unless confirm_deletion?
36
36
  json = delete
37
- print_messages(json['data_url'], json['messages'])
37
+ print_messages(json['data_url'], json['messages'], nil, nil)
38
38
  end
39
39
 
40
40
  private
@@ -28,7 +28,7 @@ module Pod
28
28
 
29
29
  def run
30
30
  json = deprecate
31
- print_messages(json['data_url'], json['messages'])
31
+ print_messages(json['data_url'], json['messages'], nil, nil)
32
32
  end
33
33
 
34
34
  def deprecate
@@ -62,18 +62,24 @@ module Pod
62
62
  def run
63
63
  update_master_repo
64
64
  validate_podspec
65
- json = push_to_trunk
65
+ status, json = push_to_trunk
66
66
  update_master_repo
67
- print_messages(json['data_url'], json['messages'])
67
+
68
+ if (400...600).cover?(status)
69
+ print_messages(json['data_url'], json['messages'], nil)
70
+ else
71
+ print_messages(json['data_url'], json['messages'], spec, 'published')
72
+ end
68
73
  end
69
74
 
70
75
  private
71
76
 
72
77
  def push_to_trunk
78
+ spec.attributes_hash[:pushed_with_swift_version] = @swift_version
73
79
  response = request_path(:post, "pods?allow_warnings=#{@allow_warnings}",
74
80
  spec.to_json, auth_headers)
75
81
  url = response.headers['location'].first
76
- json(request_url(:get, url, default_headers))
82
+ return response.status_code, json(request_url(:get, url, default_headers))
77
83
  rescue REST::Error => e
78
84
  raise Informative, 'There was an error pushing a new version ' \
79
85
  "to trunk: #{e.message}"
@@ -114,6 +120,10 @@ module Pod
114
120
  unless validator.validated?
115
121
  raise Informative, "The spec did not pass validation, due to #{validator.failure_reason}."
116
122
  end
123
+
124
+ # Let the validator's logic for the swift version
125
+ # set the value for the trunk JSON uploader
126
+ @swift_version = validator.used_swift_version
117
127
  end
118
128
 
119
129
  def update_master_repo
@@ -3,6 +3,20 @@ require 'tmpdir'
3
3
 
4
4
  module Pod
5
5
  describe Command::Trunk::Push do
6
+ def success_json
7
+ {
8
+ 'messages' => [
9
+ {
10
+ '2015-12-05 02:00:25 UTC' => "Push for `BananaLib 0.96.3' initiated.",
11
+ },
12
+ {
13
+ '2015-12-05 02:00:26 UTC' => "Push for `BananaLib 0.96.3' has been pushed (1.02409270 s).",
14
+ },
15
+ ],
16
+ 'data_url' => 'https://raw.githubusercontent.com/CocoaPods/Specs/ce4efe9f986d297008e8c61010a4b0d5881c50d0/Specs/BananaLib/0.96.3/BananaLib.podspec.json',
17
+ }
18
+ end
19
+
6
20
  before do
7
21
  Command::Trunk::Push.any_instance.stubs(:update_master_repo)
8
22
  end
@@ -98,6 +112,7 @@ module Pod
98
112
  Validator.any_instance.stubs(:install_pod)
99
113
  Validator.any_instance.stubs(:build_pod)
100
114
  Validator.any_instance.stubs(:add_app_project_import)
115
+ Validator.any_instance.stubs(:used_swift_version).returns(nil)
101
116
  %i(prepare resolve_dependencies download_dependencies).each do |m|
102
117
  Installer.any_instance.stubs(m)
103
118
  end
@@ -110,6 +125,14 @@ module Pod
110
125
  cmd.send(:validate_podspec)
111
126
  end
112
127
 
128
+ it 'passes a swift version back to command, to handle .swift-version files' do
129
+ Validator.any_instance.stubs(:used_swift_version).returns('1.2.3')
130
+
131
+ cmd = Command.parse(%w(trunk push spec/fixtures/BananaLib.podspec))
132
+ cmd.send(:validate_podspec)
133
+ cmd.instance_variable_get(:@swift_version).should == '1.2.3'
134
+ end
135
+
113
136
  it 'validates specs as frameworks by default' do
114
137
  Validator.any_instance.expects(:podfile_from_spec).
115
138
  with(:ios, '8.0', true).once.returns(Podfile.new)
@@ -149,22 +172,44 @@ module Pod
149
172
  end
150
173
  end
151
174
 
175
+ describe 'sending the swift version up to trunk' do
176
+ before do
177
+ # This won't get called
178
+ Command::Trunk::Push.any_instance.unstub(:update_master_repo)
179
+ # For faking the networking when sending
180
+ Pod::Command::Trunk.any_instance.expects(:json).returns({})
181
+ Pod::Command::Trunk.any_instance.expects(:auth_headers).returns({})
182
+ end
183
+
184
+ it 'passes the value to trunk' do
185
+ # Fakes for the network response
186
+ response = mock
187
+ response.expects(:headers).returns('location' => ['http://theinternet.com'])
188
+ response.expects(:status_code).returns(200)
189
+
190
+ cmd = Command.parse(%w(trunk push spec/fixtures/BananaLib.podspec --swift-version=1.1.2))
191
+
192
+ # Using a blank podspec - JSON should include `"pushed_with_swift_version":"1.1.2"`
193
+ cmd.stubs(:spec).returns(Pod::Specification.new)
194
+
195
+ json = <<-JSON
196
+ {"name":null,"pushed_with_swift_version":"1.1.2","platforms":{"osx":null,"ios":null,"tvos":null,"watchos":null}}
197
+ JSON
198
+
199
+ cmd.stubs(:validate_podspec)
200
+ cmd.stubs(:request_url)
201
+
202
+ api_route = 'pods?allow_warnings=false'
203
+ cmd.expects(:request_path).with(:post, api_route, json, {}).returns(response)
204
+ cmd.send(:push_to_trunk)
205
+ end
206
+ end
207
+
152
208
  describe 'updating the master repo' do
153
209
  before do
154
210
  @cmd = Command.parse(%w(trunk push spec/fixtures/BananaLib.podspec))
155
211
  @cmd.stubs(:validate_podspec)
156
- version_response = {
157
- 'messages' => [
158
- {
159
- '2015-12-05 02:00:25 UTC' => "Push for `BananaLib 0.96.3' initiated.",
160
- },
161
- {
162
- '2015-12-05 02:00:26 UTC' => "Push for `BananaLib 0.96.3' has been pushed (1.02409270 s).",
163
- },
164
- ],
165
- 'data_url' => 'https://raw.githubusercontent.com/CocoaPods/Specs/ce4efe9f986d297008e8c61010a4b0d5881c50d0/Specs/BananaLib/0.96.3/BananaLib.podspec.json',
166
- }
167
- @cmd.stubs(:push_to_trunk).returns(version_response)
212
+ @cmd.stubs(:push_to_trunk).returns([200, success_json])
168
213
  Command::Trunk::Push.any_instance.unstub(:update_master_repo)
169
214
  end
170
215
 
@@ -183,5 +228,39 @@ module Pod
183
228
  @cmd.run
184
229
  end
185
230
  end
231
+
232
+ describe 'Presenting Responses to the user' do
233
+ before do
234
+ Command::Trunk::Push.any_instance.stubs(:update_master_repo)
235
+ Config.instance.sources_manager.stubs(:master_repo_functional?).returns(true)
236
+ end
237
+
238
+ it 'shows full logs when verbose' do
239
+ cmd = Command.parse(%w(trunk push spec/fixtures/BananaLib.podspec --verbose))
240
+ cmd.stubs(:validate_podspec)
241
+ cmd.stubs(:push_to_trunk).returns([200, success_json])
242
+
243
+ cmd.run
244
+ UI.output.should.match %r{- Data URL: https://raw.githubusercontent.com/CocoaPods/Specs}
245
+ end
246
+
247
+ it 'shows full logs when errored' do
248
+ cmd = Command.parse(%w(trunk push spec/fixtures/BananaLib.podspec --verbose))
249
+ cmd.stubs(:validate_podspec)
250
+ cmd.stubs(:push_to_trunk).returns([400, success_json])
251
+
252
+ cmd.run
253
+ UI.output.should.match %r{- Data URL: https://raw.githubusercontent.com/CocoaPods/Specs}
254
+ end
255
+
256
+ it 'shows thanks emojis when success' do
257
+ cmd = Command.parse(%w(trunk push spec/fixtures/BananaLib.podspec))
258
+ cmd.stubs(:validate_podspec)
259
+ cmd.stubs(:push_to_trunk).returns([200, success_json])
260
+ cmd.run
261
+
262
+ UI.output.should.match %r{https://cocoapods.org/pods/BananaLib}
263
+ end
264
+ end
186
265
  end
187
266
  end
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: 1.1.0.beta.1
4
+ version: 1.1.0
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: 2016-10-10 00:00:00.000000000 Z
11
+ date: 2016-10-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nap
@@ -129,9 +129,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
129
129
  version: 2.0.0
130
130
  required_rubygems_version: !ruby/object:Gem::Requirement
131
131
  requirements:
132
- - - ">"
132
+ - - ">="
133
133
  - !ruby/object:Gem::Version
134
- version: 1.3.1
134
+ version: '0'
135
135
  requirements: []
136
136
  rubyforge_project:
137
137
  rubygems_version: 2.4.5.1