cocoapods-trunk 0.1.4 → 0.2.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: 035d0047401ad8b12f4e62d3f123cb1caed00d3e
4
- data.tar.gz: c55831d514d345734253955005e21b4626bf5465
3
+ metadata.gz: 3087d99eca81ee3f8184330b448de89919ac4b04
4
+ data.tar.gz: c4886a4cb0adc76b0572ab28a4e35a179a4cd881
5
5
  SHA512:
6
- metadata.gz: 07e34200a2c9e83c1d95b48980e5acf4af3819e2d0573dacbe5e3836fcf68252454aa3bee3a743cfdb0b1e502de3cca792ff28808338e785b739f203fab3503b
7
- data.tar.gz: ede3bc0ff8d470205f194f93a2e8f79655f1ed4d746f18644e1839678af7f826f6e77cfd9f3e3f6b66670ea6601082129f9dfb153d363b1e5761e19fec542816
6
+ metadata.gz: ef437d0b6641510de85b84e02d2712764a7c1e3bb9db9e470af6ad0883a3d19d70a038f5de0e3792285fb9f5c24b0b528fcc934407658cd5a4ac58ceb1eaa25c
7
+ data.tar.gz: b1d68227ce1f7508ab4f97e3bd5680dc987741b76a0d398647e758233f532b418f53e44fe0292330538006067cca64fb57b5970e40c442bbd16d30aa62a9bc99
data/.gitignore CHANGED
@@ -14,3 +14,4 @@ spec/reports
14
14
  test/tmp
15
15
  test/version_tmp
16
16
  tmp
17
+ .idea
data/.rubocop.yml ADDED
@@ -0,0 +1,3 @@
1
+ inherit_from:
2
+ - .rubocop_todo.yml
3
+ - .rubocop_cocoapods.yml
@@ -0,0 +1,89 @@
1
+ AllCops:
2
+ Include:
3
+ - ./Rakefile
4
+ - ./Gemfile
5
+ - ./*.gemspec
6
+ Exclude:
7
+ - ./spec/fixtures/**/*
8
+
9
+ # At the moment not ready to be used
10
+ # https://github.com/bbatsov/rubocop/issues/947
11
+ Documentation:
12
+ Enabled: false
13
+
14
+ #- CocoaPods -----------------------------------------------------------------#
15
+
16
+ # We adopted raise instead of fail.
17
+ SignalException:
18
+ EnforcedStyle: only_raise
19
+
20
+ # They are idiomatic
21
+ AssignmentInCondition:
22
+ Enabled: false
23
+
24
+ # Allow backticks
25
+ AsciiComments:
26
+ Enabled: false
27
+
28
+ # Indentation clarifies logic branches in implementations
29
+ IfUnlessModifier:
30
+ Enabled: false
31
+
32
+ # No enforced convention here.
33
+ SingleLineBlockParams:
34
+ Enabled: false
35
+
36
+ # We only add the comment when needed.
37
+ Encoding:
38
+ Enabled: false
39
+
40
+ # Having these make it easier to *not* forget to add one when adding a new
41
+ # value and you can simply copy the previous line.
42
+ TrailingComma:
43
+ EnforcedStyleForMultiline: comma
44
+
45
+ # Clashes with CLAide Command#validate!
46
+ GuardClause:
47
+ Enabled: false
48
+
49
+ # Not always desirable: lib/claide/command/plugins_helper.rb:12:15
50
+ Next:
51
+ Enabled: false
52
+
53
+ #- CocoaPods support for Ruby 1.8.7 ------------------------------------------#
54
+
55
+ HashSyntax:
56
+ EnforcedStyle: hash_rockets
57
+
58
+ Lambda:
59
+ Enabled: false
60
+
61
+ DotPosition:
62
+ EnforcedStyle: trailing
63
+
64
+ EachWithObject:
65
+ Enabled: false
66
+
67
+ Style/SpecialGlobalVars:
68
+ Enabled: false
69
+
70
+ #- CocoaPods specs -----------------------------------------------------------#
71
+
72
+ # Allow for `should.match /regexp/`.
73
+ AmbiguousRegexpLiteral:
74
+ Exclude:
75
+ - spec/**/*
76
+
77
+ # Allow `object.should == object` syntax.
78
+ Void:
79
+ Exclude:
80
+ - spec/**/*
81
+
82
+ ClassAndModuleChildren:
83
+ Exclude:
84
+ - spec/**/*
85
+
86
+ UselessComparison:
87
+ Exclude:
88
+ - spec/**/*
89
+
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,33 @@
1
+ # This configuration was generated by `rubocop --auto-gen-config`
2
+ # on 2014-08-20 17:00:42 +0200 using RuboCop version 0.25.0.
3
+ # The point is for the user to remove these configuration records
4
+ # one by one as the offenses are removed from the code base.
5
+ # Note that changes in the inspected code, or installation of new
6
+ # versions of RuboCop, may require this file to be generated again.
7
+
8
+ # Offense count: 1
9
+ Metrics/CyclomaticComplexity:
10
+ Max: 8
11
+
12
+ # Offense count: 9
13
+ # Configuration parameters: AllowURI.
14
+ Metrics/LineLength:
15
+ Max: 105
16
+
17
+ # Offense count: 7
18
+ # Configuration parameters: CountComments.
19
+ Metrics/MethodLength:
20
+ Max: 42
21
+
22
+ # Offense count: 1
23
+ Metrics/PerceivedComplexity:
24
+ Max: 9
25
+
26
+ # Offense count: 1
27
+ Style/ClassVars:
28
+ Enabled: false
29
+
30
+ # Offense count: 1
31
+ # Configuration parameters: Keywords.
32
+ Style/CommentAnnotation:
33
+ Enabled: false
data/.travis.yml CHANGED
@@ -1,14 +1,24 @@
1
+ # Sets Travis to run the Ruby specs on OS X machines to be as close as possible
2
+ # to the user environment.
3
+ #
1
4
  language: objective-c
5
+ addons:
6
+ code_climate:
7
+ repo_token: 937468c2cbb0d7c0546b62d0fcbcba8a2a8b82714a64a52ffd0b951e71df626d
8
+
2
9
  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
10
+ - RVM_RUBY_VERSION=system
11
+ # - RVM_RUBY_VERSION=1.8.7-p358
12
+
6
13
  before_install:
14
+ - export LANG=en_US.UTF-8
7
15
  - curl http://curl.haxx.se/ca/cacert.pem -o /usr/local/share/cacert.pem
8
16
  - source ~/.rvm/scripts/rvm
9
17
  - if [[ $RVM_RUBY_VERSION != 'system' ]]; then rvm install $RVM_RUBY_VERSION; fi
10
18
  - rvm use $RVM_RUBY_VERSION
11
- - if [[ $RVM_RUBY_VERSION == 'system' ]]; then export ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future; fi
12
19
  - if [[ $RVM_RUBY_VERSION == 'system' ]]; then sudo gem install bundler --no-ri --no-rdoc; else gem install bundler --no-ri --no-rdoc; fi
13
- install: eval $RUBY_VERSION_SPECIFIC && bundle install --path ./travis_bundle_dir
20
+
21
+ install:
22
+ - sudo bundle install --without=documentation
23
+
14
24
  script: bundle exec rake spec
data/CHANGELOG.md ADDED
@@ -0,0 +1,14 @@
1
+ ## Master
2
+
3
+ ##### Enhancements
4
+
5
+ * Network errors are now gracefully handled.
6
+ [Samuel E. Giddins](https://github.com/segiddins)
7
+
8
+ * Adopted new argument format of CLAide.
9
+ [Olivier Halligon](https://github.com/AliSoftware)
10
+
11
+
12
+ ## 0.1.0
13
+
14
+ * Initial release.
data/Gemfile CHANGED
@@ -1,15 +1,23 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- # Specify your gem's dependencies in cocoapods-trunk.gemspec
4
3
  gemspec
5
4
 
6
5
  group :development do
7
- gem 'cocoapods'
6
+ gem 'cocoapods', :git => "https://github.com/CocoaPods/CocoaPods.git", :branch => 'master'
7
+ gem 'cocoapods-core', :git => "https://github.com/CocoaPods/Core.git", :branch => 'master'
8
+ gem 'claide', :git => 'https://github.com/CocoaPods/CLAide.git', :branch => 'master'
9
+
8
10
  gem 'bacon'
11
+ gem 'kicker'
12
+ gem 'mocha'
9
13
  gem 'mocha-on-bacon'
10
- gem 'mocha', '~> 0.11.4'
11
- gem 'psych' # Needed by Mocha
12
14
  gem 'prettybacon'
13
- gem 'kicker'
15
+
16
+
17
+ if RUBY_VERSION >= '1.9.3'
18
+ gem 'codeclimate-test-reporter', :require => nil
19
+ gem 'rubocop'
20
+ end
14
21
  end
15
22
 
23
+
data/Gemfile.lock CHANGED
@@ -1,47 +1,72 @@
1
- PATH
2
- remote: .
1
+ GIT
2
+ remote: https://github.com/CocoaPods/CLAide.git
3
+ revision: 31e74fae76461e9832e488f77a9e8116703c201b
4
+ branch: master
3
5
  specs:
4
- cocoapods-trunk (0.1.4)
5
- json_pure (~> 1.8)
6
- nap (>= 0.6)
7
- netrc
6
+ claide (0.7.0)
8
7
 
9
- GEM
10
- remote: https://rubygems.org/
8
+ GIT
9
+ remote: https://github.com/CocoaPods/CocoaPods.git
10
+ revision: 21bcfb15d3e5dfc1540cd9aeff12ea92ad46e2d9
11
+ branch: master
11
12
  specs:
12
- activesupport (3.2.19)
13
- i18n (~> 0.6, >= 0.6.4)
14
- multi_json (~> 1.0)
15
- bacon (1.2.0)
16
- claide (0.6.1)
17
13
  cocoapods (0.33.1)
18
14
  activesupport (>= 3.2.15, < 4)
19
- claide (~> 0.6.1)
15
+ claide (~> 0.7.0)
20
16
  cocoapods-core (= 0.33.1)
21
17
  cocoapods-downloader (~> 0.6.1)
22
- cocoapods-plugins (~> 0.2.0)
23
- cocoapods-trunk (~> 0.1.1)
24
- cocoapods-try (~> 0.3.0)
18
+ cocoapods-plugins (~> 0.3.0)
19
+ cocoapods-trunk (~> 0.2.0)
20
+ cocoapods-try (~> 0.4.0)
25
21
  colored (~> 1.2)
26
22
  escape (~> 0.0.4)
27
23
  json_pure (~> 1.8)
28
- nap (~> 0.7)
24
+ nap (~> 0.8)
29
25
  open4 (~> 1.3)
30
- xcodeproj (~> 0.17.0)
26
+ xcodeproj (~> 0.18.0)
27
+
28
+ GIT
29
+ remote: https://github.com/CocoaPods/Core.git
30
+ revision: 2c5be5dbb1157c10e86ff75223a119b74d01ae7f
31
+ branch: master
32
+ specs:
31
33
  cocoapods-core (0.33.1)
32
34
  activesupport (>= 3.2.15)
33
35
  fuzzy_match (~> 2.0.4)
34
36
  json_pure (~> 1.8)
35
- nap (~> 0.5)
37
+ nap (~> 0.8.0)
38
+
39
+ PATH
40
+ remote: .
41
+ specs:
42
+ cocoapods-trunk (0.2.0)
43
+ json_pure (~> 1.8)
44
+ nap (>= 0.8)
45
+ netrc
46
+
47
+ GEM
48
+ remote: https://rubygems.org/
49
+ specs:
50
+ CFPropertyList (2.2.8)
51
+ activesupport (3.2.19)
52
+ i18n (~> 0.6, >= 0.6.4)
53
+ multi_json (~> 1.0)
54
+ ast (2.0.0)
55
+ astrolabe (1.3.0)
56
+ parser (>= 2.2.0.pre.3, < 3.0)
57
+ bacon (1.2.0)
36
58
  cocoapods-downloader (0.6.1)
37
- cocoapods-plugins (0.2.0)
59
+ cocoapods-plugins (0.3.0)
38
60
  nap
39
- cocoapods-try (0.3.0)
61
+ cocoapods-try (0.4.0)
62
+ codeclimate-test-reporter (0.4.0)
63
+ simplecov (>= 0.7.1, < 1.0.0)
40
64
  colored (1.2)
65
+ docile (1.1.5)
41
66
  escape (0.0.4)
42
67
  ffi (1.9.3)
43
68
  fuzzy_match (2.0.4)
44
- i18n (0.6.9)
69
+ i18n (0.6.11)
45
70
  json_pure (1.8.1)
46
71
  kicker (3.0.0)
47
72
  listen (~> 1.3.0)
@@ -51,25 +76,43 @@ GEM
51
76
  rb-inotify (>= 0.9)
52
77
  rb-kqueue (>= 0.2)
53
78
  metaclass (0.0.4)
54
- mocha (0.11.4)
79
+ mocha (1.1.0)
55
80
  metaclass (~> 0.0.1)
56
- mocha-on-bacon (0.2.1)
57
- mocha (>= 0.9.8)
81
+ mocha-on-bacon (0.2.2)
82
+ mocha (>= 0.13.0)
58
83
  multi_json (1.10.1)
59
84
  nap (0.8.0)
60
85
  netrc (0.7.7)
61
86
  notify (0.5.2)
62
87
  open4 (1.3.4)
88
+ parser (2.2.0.pre.4)
89
+ ast (>= 1.1, < 3.0)
90
+ slop (~> 3.4, >= 3.4.5)
91
+ powerpack (0.0.9)
63
92
  prettybacon (0.0.2)
64
93
  bacon (~> 1.2)
65
- psych (2.0.5)
94
+ rainbow (2.0.0)
66
95
  rake (10.3.2)
67
96
  rb-fsevent (0.9.4)
68
97
  rb-inotify (0.9.5)
69
98
  ffi (>= 0.5.0)
70
99
  rb-kqueue (0.2.3)
71
100
  ffi (>= 0.5.0)
72
- xcodeproj (0.17.0)
101
+ rubocop (0.26.0)
102
+ astrolabe (~> 1.3)
103
+ parser (>= 2.2.0.pre.4, < 3.0)
104
+ powerpack (~> 0.0.6)
105
+ rainbow (>= 1.99.1, < 3.0)
106
+ ruby-progressbar (~> 1.4)
107
+ ruby-progressbar (1.5.1)
108
+ simplecov (0.9.0)
109
+ docile (~> 1.1.0)
110
+ multi_json
111
+ simplecov-html (~> 0.8.0)
112
+ simplecov-html (0.8.0)
113
+ slop (3.6.0)
114
+ xcodeproj (0.18.0)
115
+ CFPropertyList (~> 2.2)
73
116
  activesupport (~> 3.0)
74
117
  colored (~> 1.2)
75
118
 
@@ -79,11 +122,14 @@ PLATFORMS
79
122
  DEPENDENCIES
80
123
  bacon
81
124
  bundler (~> 1.3)
82
- cocoapods
125
+ claide!
126
+ cocoapods!
127
+ cocoapods-core!
83
128
  cocoapods-trunk!
129
+ codeclimate-test-reporter
84
130
  kicker
85
- mocha (~> 0.11.4)
131
+ mocha
86
132
  mocha-on-bacon
87
133
  prettybacon
88
- psych
89
134
  rake
135
+ rubocop
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # Cocoapods::Trunk
2
2
 
3
- [![Build Status](http://img.shields.io/travis/CocoaPods/cocoapods-trunk/master.svg?style=flat)](https://travis-ci.org/CocoaPods/cocoapods-trunk)
3
+ [![Build Status](https://img.shields.io/travis/CocoaPods/cocoapods-trunk/master.svg?style=flat)](https://travis-ci.org/CocoaPods/cocoapods-trunk)
4
+ [![Coverage](https://img.shields.io/codeclimate/coverage/github/CocoaPods/cocoapods-trunk.svg?style=flat)](https://codeclimate.com/github/CocoaPods/cocoapods-trunk)
5
+ [![Code Climate](https://img.shields.io/codeclimate/github/CocoaPods/cocoapods-trunk.svg?style=flat)](https://codeclimate.com/github/CocoaPods/cocoapods-trunk)
4
6
 
5
7
  CocoaPods plugin for trunk.
6
8
 
data/Rakefile CHANGED
@@ -20,23 +20,40 @@ begin
20
20
  require "bundler/gem_tasks"
21
21
  task :default => :spec
22
22
 
23
+ #-- Specs ------------------------------------------------------------------#
24
+
23
25
  desc 'Runs all the specs'
24
26
  task :spec do
25
27
  title 'Running Unit Tests'
26
28
  files = FileList['spec/**/*_spec.rb'].shuffle.join(' ')
27
29
  sh "bundle exec bacon #{files}"
30
+
31
+ title 'Checking code style...'
32
+ Rake::Task['rubocop'].invoke if RUBY_VERSION >= '1.9.3'
28
33
  end
29
34
 
35
+ #-- Kick -------------------------------------------------------------------#
36
+
30
37
  desc 'Automatically run specs for updated files'
31
38
  task :kick do
32
39
  exec 'bundle exec kicker -c'
33
40
  end
34
41
 
42
+ #-- RuboCop ----------------------------------------------------------------#
43
+
44
+ if RUBY_VERSION >= '1.9.3'
45
+ require 'rubocop/rake_task'
46
+ RuboCop::RakeTask.new
47
+ end
48
+
35
49
  rescue LoadError
36
50
  $stderr.puts "\033[0;31m" \
37
51
  '[!] Some Rake tasks haven been disabled because the environment' \
38
52
  ' couldn’t be loaded. Be sure to run `rake bootstrap` first.' \
39
53
  "\e[0m"
54
+ $stderr.puts e.message
55
+ $stderr.puts e.backtrace
56
+ $stderr.puts
40
57
  end
41
58
 
42
59
  #-- Helpers ------------------------------------------------------------------#
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
17
17
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
18
  spec.require_paths = ["lib"]
19
19
 
20
- spec.add_dependency 'nap', '>= 0.6'
20
+ spec.add_dependency 'nap', '>= 0.8'
21
21
  spec.add_dependency 'json_pure', '~> 1.8'
22
22
  spec.add_dependency 'netrc'
23
23
  spec.add_development_dependency "bundler", "~> 1.3"
@@ -36,15 +36,15 @@ module Pod
36
36
  DESC
37
37
 
38
38
  self.arguments = [
39
- ['EMAIL', :required],
40
- ['NAME', :optional],
39
+ CLAide::Argument.new('EMAIL', true),
40
+ CLAide::Argument.new('NAME', false),
41
41
  ]
42
42
 
43
43
  def self.options
44
44
  [
45
45
  ['--description=DESCRIPTION', 'An arbitrary description to ' \
46
46
  'easily identify your session ' \
47
- 'later on.']
47
+ 'later on.'],
48
48
  ].concat(super)
49
49
  end
50
50
 
@@ -65,13 +65,16 @@ module Pod
65
65
  body = {
66
66
  'email' => @email,
67
67
  'name' => @name,
68
- 'description' => @session_description
68
+ 'description' => @session_description,
69
69
  }.to_json
70
- json = json(request_path(:post, "sessions", body, default_headers))
70
+ json = json(request_path(:post, 'sessions', body, default_headers))
71
71
  save_token(json['token'])
72
72
  # TODO UI.notice inserts an empty line :/
73
73
  puts '[!] Please verify the session by clicking the link in the ' \
74
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}"
75
78
  end
76
79
 
77
80
  def save_token(token)
@@ -98,7 +101,7 @@ module Pod
98
101
  end
99
102
 
100
103
  def run
101
- me = json(request_path(:get, "sessions", auth_headers))
104
+ me = json(request_path(:get, 'sessions', auth_headers))
102
105
  owner = json(request_path(:get, "owners/#{me['email']}"))
103
106
  UI.labeled 'Name', owner['name']
104
107
  UI.labeled 'Email', owner['email']
@@ -114,7 +117,7 @@ module Pod
114
117
  :created_at => formatted_time(session['created_at']),
115
118
  :valid_until => formatted_time(session['valid_until']),
116
119
  :created_from_ip => session['created_from_ip'],
117
- :description => session['description']
120
+ :description => session['description'],
118
121
  }
119
122
  if Time.parse(session['valid_until']) <= Time.now.utc
120
123
  hash[:color] = :red
@@ -142,6 +145,10 @@ module Pod
142
145
  end
143
146
 
144
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}"
145
152
  end
146
153
 
147
154
  private
@@ -181,6 +188,9 @@ module Pod
181
188
  def run
182
189
  path = @remove_all ? 'sessions/all' : 'sessions'
183
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}"
184
194
  end
185
195
  end
186
196
  end
@@ -188,13 +198,15 @@ module Pod
188
198
  class AddOwner < Trunk
189
199
  self.summary = 'Add an owner to a pod'
190
200
  self.description = <<-DESC
201
+ Adds the registered user with specified `OWNER-EMAIL` as an owner
202
+ of the given `POD`.
191
203
  An ‘owner’ is a registered user whom is allowed to make changes to a
192
204
  pod, such as pushing new versions and adding other ‘owners’.
193
205
  DESC
194
206
 
195
207
  self.arguments = [
196
- ['POD', :required],
197
- ['OWNER-EMAIL', :required],
208
+ CLAide::Argument.new('POD', true),
209
+ CLAide::Argument.new('OWNER-EMAIL', true),
198
210
  ]
199
211
 
200
212
  def initialize(argv)
@@ -216,6 +228,9 @@ module Pod
216
228
  body = { 'email' => @email }.to_json
217
229
  json = json(request_path(:patch, "pods/#{@pod}/owners", body, auth_headers))
218
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}"
219
234
  end
220
235
  end
221
236
 
@@ -239,11 +254,13 @@ module Pod
239
254
  versions and add other ‘owners’, not necessarily the library author.)
240
255
  DESC
241
256
 
242
- self.arguments = [['PATH', :required]]
257
+ self.arguments = [
258
+ CLAide::Argument.new('PATH', false),
259
+ ]
243
260
 
244
261
  def self.options
245
262
  [
246
- ["--allow-warnings", "Allows push even if there are lint warnings"],
263
+ ['--allow-warnings', 'Allows push even if there are lint warnings'],
247
264
  ].concat(super)
248
265
  end
249
266
 
@@ -270,7 +287,7 @@ module Pod
270
287
 
271
288
  def run
272
289
  validate_podspec
273
- response = request_path(:post, "pods", spec.to_json, auth_headers)
290
+ response = request_path(:post, 'pods', spec.to_json, auth_headers)
274
291
  url = response.headers['location'].first
275
292
  json = json(request_url(:get, url, default_headers))
276
293
 
@@ -283,6 +300,9 @@ module Pod
283
300
  "#{formatted_time(at)}: #{message}"
284
301
  end
285
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}"
286
306
  end
287
307
 
288
308
  private
@@ -317,14 +337,14 @@ module Pod
317
337
  validator.only_errors = @allow_warnings
318
338
  begin
319
339
  validator.validate
320
- rescue Exception
340
+ rescue
321
341
  # TODO: We should add `CLAide::InformativeError#wraps_exception`
322
342
  # which would include the original error message on `--verbose`.
323
343
  # https://github.com/CocoaPods/CLAide/issues/31
324
- raise Informative, "The podspec does not validate."
344
+ raise Informative, 'The podspec does not validate.'
325
345
  end
326
346
  unless validator.validated?
327
- raise Informative, "The podspec does not validate."
347
+ raise Informative, 'The podspec does not validate.'
328
348
  end
329
349
  end
330
350
  end
@@ -363,7 +383,7 @@ module Pod
363
383
  case error = json['error']
364
384
  when Hash
365
385
  lines = error.sort_by(&:first).map do |attr, messages|
366
- attr = attr[0,1].upcase << attr[1..-1]
386
+ attr = attr[0, 1].upcase << attr[1..-1]
367
387
  messages.sort.map do |message|
368
388
  "- #{attr} #{message}."
369
389
  end
@@ -393,7 +413,7 @@ module Pod
393
413
  def default_headers
394
414
  {
395
415
  'Content-Type' => 'application/json; charset=utf-8',
396
- 'Accept' => 'application/json; charset=utf-8'
416
+ 'Accept' => 'application/json; charset=utf-8',
397
417
  }
398
418
  end
399
419
 
data/lib/trunk.rb CHANGED
@@ -1,4 +1,4 @@
1
- require "cocoapods/trunk/version"
1
+ require 'cocoapods/trunk/version'
2
2
 
3
3
  module Cocoapods
4
4
  module Trunk
data/lib/trunk/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Cocoapods
2
2
  module Trunk
3
- VERSION = "0.1.4"
3
+ VERSION = '0.2.0'
4
4
  end
5
5
  end
@@ -2,11 +2,10 @@ require File.expand_path('../../../spec_helper', __FILE__)
2
2
 
3
3
  module Pod
4
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
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
8
  end
9
9
  end
10
10
  end
11
11
  end
12
-
@@ -2,17 +2,16 @@ require File.expand_path('../../../spec_helper', __FILE__)
2
2
 
3
3
  module Pod
4
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
5
+ describe 'CLAide' do
6
+ it 'registers it self' do
7
+ Command.parse(%w( trunk me )).should.be.instance_of Command::Trunk::Me
8
8
  end
9
9
  end
10
10
 
11
11
  it "should error if we don't have a token" do
12
12
  Netrc.any_instance.stubs(:[]).returns(nil)
13
- command = Command.parse(%w{ trunk me })
13
+ command = Command.parse(%w( trunk me ))
14
14
  lambda { command.validate! }.should.raise CLAide::Help
15
15
  end
16
16
  end
17
17
  end
18
-
@@ -3,20 +3,20 @@ require 'tmpdir'
3
3
 
4
4
  module Pod
5
5
  describe Command::Trunk::Push do
6
- describe "CLAide" do
7
- it "registers it self" do
8
- Command.parse(%w{ trunk push }).should.be.instance_of Command::Trunk::Push
6
+ describe 'CLAide' do
7
+ it 'registers it self' do
8
+ Command.parse(%w( trunk push )).should.be.instance_of Command::Trunk::Push
9
9
  end
10
10
  end
11
11
 
12
12
  describe 'PATH' do
13
- before {
13
+ before do
14
14
  UI.output = ''
15
- }
15
+ end
16
16
  it 'defaults to the current directory' do
17
17
  # Disable the podspec finding algorithm so we can check the raw path
18
18
  Command::Trunk::Push.any_instance.stubs(:find_podspec_file) { |path| path }
19
- command = Command.parse(%w{ trunk push })
19
+ command = Command.parse(%w( trunk push ))
20
20
  command.instance_eval { @path }.should == '.'
21
21
  end
22
22
 
@@ -25,10 +25,10 @@ module Pod
25
25
  Dir.mktmpdir do |dir|
26
26
  files.each do |filename|
27
27
  path = Pathname(dir) + filename
28
- File.open(path, 'w') { }
28
+ File.open(path, 'w') {}
29
29
  end
30
30
  # Execute `pod trunk push` with this dir as parameter
31
- command = Command.parse(%w{ trunk push } + [dir])
31
+ command = Command.parse(%w( trunk push ) + [dir])
32
32
  path = command.instance_eval { @path }
33
33
  return path ? File.basename(path) : nil
34
34
  end
@@ -46,13 +46,13 @@ module Pod
46
46
 
47
47
  it 'should warn when no podspec found in a given directory' do
48
48
  files = %w(foo bar baz)
49
- found_podspec_among_files(files).should == nil
49
+ found_podspec_among_files(files).should.nil?
50
50
  UI.output.should.match /No podspec found in directory/
51
51
  end
52
52
 
53
53
  it 'should warn when multiple podspecs found in a given directory' do
54
54
  files = %w(foo bar.podspec bar.podspec.json baz)
55
- found_podspec_among_files(files).should == nil
55
+ found_podspec_among_files(files).should.nil?
56
56
  UI.output.should.match /Multiple podspec files in directory/
57
57
  end
58
58
  end
@@ -2,11 +2,10 @@ require File.expand_path('../../../spec_helper', __FILE__)
2
2
 
3
3
  module Pod
4
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
5
+ describe 'CLAide' do
6
+ it 'registers it self' do
7
+ Command.parse(%w( trunk register )).should.be.instance_of Command::Trunk::Register
8
8
  end
9
9
  end
10
10
  end
11
11
  end
12
-
@@ -2,11 +2,10 @@ require File.expand_path('../../spec_helper', __FILE__)
2
2
 
3
3
  module Pod
4
4
  describe Command::Trunk do
5
- describe "CLAide" do
6
- it "registers it self" do
7
- Command.parse(%w{ trunk }).should.be.instance_of Command::Trunk
5
+ describe 'CLAide' do
6
+ it 'registers it self' do
7
+ Command.parse(%w( trunk )).should.be.instance_of Command::Trunk
8
8
  end
9
9
  end
10
10
  end
11
11
  end
12
-
data/spec/spec_helper.rb CHANGED
@@ -1,3 +1,17 @@
1
+ # Set up coverage analysis
2
+ #-----------------------------------------------------------------------------#
3
+
4
+ if RUBY_VERSION >= '1.9.3'
5
+ require 'codeclimate-test-reporter'
6
+ CodeClimate::TestReporter.configure do |config|
7
+ config.logger.level = Logger::WARN
8
+ end
9
+ CodeClimate::TestReporter.start
10
+ end
11
+
12
+ # Set up
13
+ #-----------------------------------------------------------------------------#
14
+
1
15
  require 'pathname'
2
16
  ROOT = Pathname.new(File.expand_path('../../', __FILE__))
3
17
  $:.unshift((ROOT + 'lib').to_s)
@@ -11,10 +25,10 @@ require 'cocoapods'
11
25
 
12
26
  require 'cocoapods_plugin'
13
27
 
28
+ # Helpers
14
29
  #-----------------------------------------------------------------------------#
15
30
 
16
31
  module Pod
17
-
18
32
  # Disable the wrapping so the output is deterministic in the tests.
19
33
  #
20
34
  UI.disable_wrap = true
@@ -33,7 +47,7 @@ module Pod
33
47
  @output << "#{message}\n"
34
48
  end
35
49
 
36
- def warn(message = '', actions = [])
50
+ def warn(message = '', _actions = [])
37
51
  @warnings << "#{message}\n"
38
52
  end
39
53
 
@@ -43,5 +57,3 @@ module Pod
43
57
  end
44
58
  end
45
59
  end
46
-
47
- #-----------------------------------------------------------------------------#
metadata CHANGED
@@ -1,83 +1,83 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-trunk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.2.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: 2014-07-04 00:00:00.000000000 Z
11
+ date: 2014-09-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nap
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - '>='
18
18
  - !ruby/object:Gem::Version
19
- version: '0.6'
19
+ version: '0.8'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - '>='
25
25
  - !ruby/object:Gem::Version
26
- version: '0.6'
26
+ version: '0.8'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: json_pure
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ~>
32
32
  - !ruby/object:Gem::Version
33
33
  version: '1.8'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ~>
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.8'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: netrc
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - '>='
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: bundler
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ~>
60
60
  - !ruby/object:Gem::Version
61
61
  version: '1.3'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ~>
67
67
  - !ruby/object:Gem::Version
68
68
  version: '1.3'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rake
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - '>='
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ">="
80
+ - - '>='
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  description:
@@ -87,9 +87,13 @@ executables: []
87
87
  extensions: []
88
88
  extra_rdoc_files: []
89
89
  files:
90
- - ".gitignore"
91
- - ".kick"
92
- - ".travis.yml"
90
+ - .gitignore
91
+ - .kick
92
+ - .rubocop.yml
93
+ - .rubocop_cocoapods.yml
94
+ - .rubocop_todo.yml
95
+ - .travis.yml
96
+ - CHANGELOG.md
93
97
  - Gemfile
94
98
  - Gemfile.lock
95
99
  - LICENSE.txt
@@ -116,12 +120,12 @@ require_paths:
116
120
  - lib
117
121
  required_ruby_version: !ruby/object:Gem::Requirement
118
122
  requirements:
119
- - - ">="
123
+ - - '>='
120
124
  - !ruby/object:Gem::Version
121
125
  version: '0'
122
126
  required_rubygems_version: !ruby/object:Gem::Requirement
123
127
  requirements:
124
- - - ">="
128
+ - - '>='
125
129
  - !ruby/object:Gem::Version
126
130
  version: '0'
127
131
  requirements: []
@@ -137,3 +141,4 @@ test_files:
137
141
  - spec/command/trunk/register_spec.rb
138
142
  - spec/command/trunk_spec.rb
139
143
  - spec/spec_helper.rb
144
+ has_rdoc: