cocoapods-trunk 0.1.3 → 0.1.4

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: 367df1c17f4cbcd0bb02a075f36ec7ae0968ecf3
4
- data.tar.gz: fbe3b697376e192c759901060ab3250e55dcd394
3
+ metadata.gz: 035d0047401ad8b12f4e62d3f123cb1caed00d3e
4
+ data.tar.gz: c55831d514d345734253955005e21b4626bf5465
5
5
  SHA512:
6
- metadata.gz: c2df7ac3367353cbf9f1ade495ee5321cc4360a47be6f374f89d8e21def4a135557bb646be552e7533ffd0e2bc0523767786586be078e6e3c957c444fd6abffe
7
- data.tar.gz: 62f1bba5c95b986177a9eb6e65fbd8d5f568ef90b7a15f7c344b5b0b65df76c6ba5be06fab87e59959d13853ad044fe04c3e5cfc1f9a0f4d819c3c9fd515a76c
6
+ metadata.gz: 07e34200a2c9e83c1d95b48980e5acf4af3819e2d0573dacbe5e3836fcf68252454aa3bee3a743cfdb0b1e502de3cca792ff28808338e785b739f203fab3503b
7
+ data.tar.gz: ede3bc0ff8d470205f194f93a2e8f79655f1ed4d746f18644e1839678af7f826f6e77cfd9f3e3f6b66670ea6601082129f9dfb153d363b1e5761e19fec542816
data/.gitignore CHANGED
@@ -3,7 +3,6 @@
3
3
  .bundle
4
4
  .config
5
5
  .yardoc
6
- Gemfile.lock
7
6
  InstalledFiles
8
7
  _yardoc
9
8
  coverage
data/.kick ADDED
@@ -0,0 +1,29 @@
1
+ recipe :ruby
2
+
3
+ Kicker::Recipes::Ruby.runner_bin = 'bacon --quiet'
4
+
5
+ process do |files|
6
+ specs = files.take_and_map do |file|
7
+ if file =~ %r{lib/(.+?)\.rb$}
8
+ s = Dir.glob("spec/**/#{File.basename(file, '.rb')}_spec.rb")
9
+ s.uniq unless s.empty?
10
+ end
11
+ end
12
+ Kicker::Recipes::Ruby.run_tests(specs)
13
+ end
14
+
15
+ # Have written this so many times, probably should make a recipe out of it.
16
+ process do |files|
17
+ files.each do |file|
18
+ case file
19
+ when 'Gemfile'
20
+ files.delete(file)
21
+ execute 'bundle install'
22
+ end
23
+ end
24
+ end
25
+
26
+ recipe :ignore
27
+ ignore(/.*\/?tags/)
28
+ ignore(/.*\/?\.git/)
29
+
data/.travis.yml CHANGED
@@ -5,6 +5,10 @@ env:
5
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
6
  before_install:
7
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
8
+ - source ~/.rvm/scripts/rvm
9
+ - if [[ $RVM_RUBY_VERSION != 'system' ]]; then rvm install $RVM_RUBY_VERSION; fi
10
+ - 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
+ - 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
14
+ script: bundle exec rake spec
data/Gemfile CHANGED
@@ -8,6 +8,8 @@ group :development do
8
8
  gem 'bacon'
9
9
  gem 'mocha-on-bacon'
10
10
  gem 'mocha', '~> 0.11.4'
11
+ gem 'psych' # Needed by Mocha
11
12
  gem 'prettybacon'
13
+ gem 'kicker'
12
14
  end
13
15
 
data/Gemfile.lock ADDED
@@ -0,0 +1,89 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ cocoapods-trunk (0.1.4)
5
+ json_pure (~> 1.8)
6
+ nap (>= 0.6)
7
+ netrc
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ 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
+ cocoapods (0.33.1)
18
+ activesupport (>= 3.2.15, < 4)
19
+ claide (~> 0.6.1)
20
+ cocoapods-core (= 0.33.1)
21
+ cocoapods-downloader (~> 0.6.1)
22
+ cocoapods-plugins (~> 0.2.0)
23
+ cocoapods-trunk (~> 0.1.1)
24
+ cocoapods-try (~> 0.3.0)
25
+ colored (~> 1.2)
26
+ escape (~> 0.0.4)
27
+ json_pure (~> 1.8)
28
+ nap (~> 0.7)
29
+ open4 (~> 1.3)
30
+ xcodeproj (~> 0.17.0)
31
+ cocoapods-core (0.33.1)
32
+ activesupport (>= 3.2.15)
33
+ fuzzy_match (~> 2.0.4)
34
+ json_pure (~> 1.8)
35
+ nap (~> 0.5)
36
+ cocoapods-downloader (0.6.1)
37
+ cocoapods-plugins (0.2.0)
38
+ nap
39
+ cocoapods-try (0.3.0)
40
+ colored (1.2)
41
+ escape (0.0.4)
42
+ ffi (1.9.3)
43
+ fuzzy_match (2.0.4)
44
+ i18n (0.6.9)
45
+ json_pure (1.8.1)
46
+ kicker (3.0.0)
47
+ listen (~> 1.3.0)
48
+ notify (~> 0.5.2)
49
+ listen (1.3.1)
50
+ rb-fsevent (>= 0.9.3)
51
+ rb-inotify (>= 0.9)
52
+ rb-kqueue (>= 0.2)
53
+ metaclass (0.0.4)
54
+ mocha (0.11.4)
55
+ metaclass (~> 0.0.1)
56
+ mocha-on-bacon (0.2.1)
57
+ mocha (>= 0.9.8)
58
+ multi_json (1.10.1)
59
+ nap (0.8.0)
60
+ netrc (0.7.7)
61
+ notify (0.5.2)
62
+ open4 (1.3.4)
63
+ prettybacon (0.0.2)
64
+ bacon (~> 1.2)
65
+ psych (2.0.5)
66
+ rake (10.3.2)
67
+ rb-fsevent (0.9.4)
68
+ rb-inotify (0.9.5)
69
+ ffi (>= 0.5.0)
70
+ rb-kqueue (0.2.3)
71
+ ffi (>= 0.5.0)
72
+ xcodeproj (0.17.0)
73
+ activesupport (~> 3.0)
74
+ colored (~> 1.2)
75
+
76
+ PLATFORMS
77
+ ruby
78
+
79
+ DEPENDENCIES
80
+ bacon
81
+ bundler (~> 1.3)
82
+ cocoapods
83
+ cocoapods-trunk!
84
+ kicker
85
+ mocha (~> 0.11.4)
86
+ mocha-on-bacon
87
+ prettybacon
88
+ psych
89
+ rake
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Cocoapods::Trunk
2
2
 
3
- [![Build Status](https://travis-ci.org/CocoaPods/cocoapods-trunk.svg)](https://travis-ci.org/CocoaPods/cocoapods-trunk)
3
+ [![Build Status](http://img.shields.io/travis/CocoaPods/cocoapods-trunk/master.svg?style=flat)](https://travis-ci.org/CocoaPods/cocoapods-trunk)
4
4
 
5
5
  CocoaPods plugin for trunk.
6
6
 
data/Rakefile CHANGED
@@ -1,13 +1,52 @@
1
- require "bundler/gem_tasks"
1
+ # encoding: utf-8
2
2
 
3
- def specs(dir)
4
- FileList["spec/#{dir}/*_spec.rb"].shuffle.join(' ')
3
+ #-- Bootstrap --------------------------------------------------------------#
4
+
5
+ desc 'Initializes your working copy to run the specs'
6
+ task :bootstrap do
7
+ if system('which bundle')
8
+ title 'Installing gems'
9
+ sh 'bundle install'
10
+ else
11
+ $stderr.puts "\033[0;31m" \
12
+ "[!] Please install the bundler gem manually:\n" \
13
+ ' $ [sudo] gem install bundler'
14
+ "\e[0m"
15
+ exit 1
16
+ end
5
17
  end
6
18
 
7
- desc "Runs all the specs"
8
- task :specs do
9
- sh "bundle exec bacon #{specs('**')}"
19
+ begin
20
+ require "bundler/gem_tasks"
21
+ task :default => :spec
22
+
23
+ desc 'Runs all the specs'
24
+ task :spec do
25
+ title 'Running Unit Tests'
26
+ files = FileList['spec/**/*_spec.rb'].shuffle.join(' ')
27
+ sh "bundle exec bacon #{files}"
28
+ end
29
+
30
+ desc 'Automatically run specs for updated files'
31
+ task :kick do
32
+ exec 'bundle exec kicker -c'
33
+ end
34
+
35
+ rescue LoadError
36
+ $stderr.puts "\033[0;31m" \
37
+ '[!] Some Rake tasks haven been disabled because the environment' \
38
+ ' couldn’t be loaded. Be sure to run `rake bootstrap` first.' \
39
+ "\e[0m"
10
40
  end
11
41
 
12
- task :default => :specs
42
+ #-- Helpers ------------------------------------------------------------------#
43
+
44
+ def title(title)
45
+ cyan_title = "\033[0;36m#{title}\033[0m"
46
+ puts
47
+ puts '-' * 80
48
+ puts cyan_title
49
+ puts '-' * 80
50
+ puts
51
+ end
13
52
 
@@ -98,12 +98,18 @@ module Pod
98
98
  end
99
99
 
100
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|
101
+ me = json(request_path(:get, "sessions", auth_headers))
102
+ owner = json(request_path(:get, "owners/#{me['email']}"))
103
+ UI.labeled 'Name', owner['name']
104
+ UI.labeled 'Email', owner['email']
105
+ UI.labeled 'Since', formatted_time(owner['created_at'])
106
+
107
+ pods = owner['pods'] || []
108
+ pods = pods.map { |pod| pod['name'] }
109
+ pods = 'None' unless pods.any?
110
+ UI.labeled 'Pods', pods
111
+
112
+ sessions = me['sessions'].map do |session|
107
113
  hash = {
108
114
  :created_at => formatted_time(session['created_at']),
109
115
  :valid_until => formatted_time(session['valid_until']),
@@ -216,8 +222,9 @@ module Pod
216
222
  class Push < Trunk
217
223
  self.summary = 'Publish a podspec'
218
224
  self.description = <<-DESC
219
- By publishing a podspec you make this available to all users of the
220
- ‘master’ spec-repo.
225
+ Publish the podspec at `PATH` to make it available to all users of
226
+ the ‘master’ spec-repo. If `PATH` is not provided, defaults to the
227
+ current directory.
221
228
 
222
229
  Before pushing the podspec to cocoapods.org, this will perform a local
223
230
  lint of the podspec, including a build of the library. However, it
@@ -242,7 +249,8 @@ module Pod
242
249
 
243
250
  def initialize(argv)
244
251
  @allow_warnings = argv.flag?('allow-warnings')
245
- @path = argv.shift_argument
252
+ @path = argv.shift_argument || '.'
253
+ find_podspec_file if File.directory?(@path)
246
254
  super
247
255
  end
248
256
 
@@ -252,16 +260,16 @@ module Pod
252
260
  help! 'You need to register a session first.'
253
261
  end
254
262
  unless @path
255
- help! 'Specify the path to the podspec file.'
263
+ help! 'Please specify the path to the podspec file.'
256
264
  end
257
265
  unless File.exist?(@path) && !File.directory?(@path)
258
- help! 'No podspec found at the specified path.'
266
+ help! "The specified path `#{@path}` does not point to " \
267
+ 'an existing podspec file.'
259
268
  end
260
269
  end
261
270
 
262
271
  def run
263
272
  validate_podspec
264
-
265
273
  response = request_path(:post, "pods", spec.to_json, auth_headers)
266
274
  url = response.headers['location'].first
267
275
  json = json(request_url(:get, url, default_headers))
@@ -279,6 +287,20 @@ module Pod
279
287
 
280
288
  private
281
289
 
290
+ def find_podspec_file
291
+ podspecs = Dir[Pathname(@path) + '*.podspec{.json,}']
292
+ case podspecs.count
293
+ when 0
294
+ UI.notice "No podspec found in directory `#{@path}`"
295
+ when 1
296
+ UI.notice "Found podspec `#{podspecs[0]}`"
297
+ else
298
+ UI.notice "Multiple podspec files in directory `#{@path}`. " \
299
+ 'You need to explicitly specify which one to use.'
300
+ end
301
+ @path = (podspecs.count == 1) ? podspecs[0] : nil
302
+ end
303
+
282
304
  def spec
283
305
  @spec ||= Pod::Specification.from_file(@path)
284
306
  rescue Informative # TODO: this should be a more specific error
data/lib/trunk/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Cocoapods
2
2
  module Trunk
3
- VERSION = "0.1.3"
3
+ VERSION = "0.1.4"
4
4
  end
5
5
  end
@@ -1,4 +1,5 @@
1
1
  require File.expand_path('../../../spec_helper', __FILE__)
2
+ require 'tmpdir'
2
3
 
3
4
  module Pod
4
5
  describe Command::Trunk::Push do
@@ -7,6 +8,53 @@ module Pod
7
8
  Command.parse(%w{ trunk push }).should.be.instance_of Command::Trunk::Push
8
9
  end
9
10
  end
11
+
12
+ describe 'PATH' do
13
+ before {
14
+ UI.output = ''
15
+ }
16
+ it 'defaults to the current directory' do
17
+ # Disable the podspec finding algorithm so we can check the raw path
18
+ Command::Trunk::Push.any_instance.stubs(:find_podspec_file) { |path| path }
19
+ command = Command.parse(%w{ trunk push })
20
+ command.instance_eval { @path }.should == '.'
21
+ end
22
+
23
+ def found_podspec_among_files(files)
24
+ # Create a temp directory with the dummy `files` in it
25
+ Dir.mktmpdir do |dir|
26
+ files.each do |filename|
27
+ path = Pathname(dir) + filename
28
+ File.open(path, 'w') { }
29
+ end
30
+ # Execute `pod trunk push` with this dir as parameter
31
+ command = Command.parse(%w{ trunk push } + [dir])
32
+ path = command.instance_eval { @path }
33
+ return path ? File.basename(path) : nil
34
+ end
35
+ end
36
+
37
+ it 'should find the only JSON podspec in a given directory' do
38
+ files = %w(foo bar.podspec.json baz)
39
+ found_podspec_among_files(files).should == files[1]
40
+ end
41
+
42
+ it 'should find the only Ruby podspec in a given directory' do
43
+ files = %w(foo bar.podspec baz)
44
+ found_podspec_among_files(files).should == files[1]
45
+ end
46
+
47
+ it 'should warn when no podspec found in a given directory' do
48
+ files = %w(foo bar baz)
49
+ found_podspec_among_files(files).should == nil
50
+ UI.output.should.match /No podspec found in directory/
51
+ end
52
+
53
+ it 'should warn when multiple podspecs found in a given directory' do
54
+ files = %w(foo bar.podspec bar.podspec.json baz)
55
+ found_podspec_among_files(files).should == nil
56
+ UI.output.should.match /Multiple podspec files in directory/
57
+ end
58
+ end
10
59
  end
11
60
  end
12
-
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.3
4
+ version: 0.1.4
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-05-23 00:00:00.000000000 Z
11
+ date: 2014-07-04 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
19
  version: '0.6'
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
26
  version: '0.6'
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,11 @@ executables: []
87
87
  extensions: []
88
88
  extra_rdoc_files: []
89
89
  files:
90
- - .gitignore
91
- - .travis.yml
90
+ - ".gitignore"
91
+ - ".kick"
92
+ - ".travis.yml"
92
93
  - Gemfile
94
+ - Gemfile.lock
93
95
  - LICENSE.txt
94
96
  - README.md
95
97
  - Rakefile
@@ -114,12 +116,12 @@ require_paths:
114
116
  - lib
115
117
  required_ruby_version: !ruby/object:Gem::Requirement
116
118
  requirements:
117
- - - '>='
119
+ - - ">="
118
120
  - !ruby/object:Gem::Version
119
121
  version: '0'
120
122
  required_rubygems_version: !ruby/object:Gem::Requirement
121
123
  requirements:
122
- - - '>='
124
+ - - ">="
123
125
  - !ruby/object:Gem::Version
124
126
  version: '0'
125
127
  requirements: []
@@ -135,4 +137,3 @@ test_files:
135
137
  - spec/command/trunk/register_spec.rb
136
138
  - spec/command/trunk_spec.rb
137
139
  - spec/spec_helper.rb
138
- has_rdoc: