cocoapods-trunk 0.4.1 → 0.5.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: 94cb63750c2a1c96259b49e0f5a551cdb70cf456
4
- data.tar.gz: 52a4b68041e9c1fe535f39e24390b6244a3fbbdb
3
+ metadata.gz: 59b4de692c8f9b3d9e59e840e3293eec2d40d491
4
+ data.tar.gz: 1ac058c477bf478299066aab29c63f47b404fbdf
5
5
  SHA512:
6
- metadata.gz: 3a71c8f8aae5896c00ecd59fb8693929ae5862e3e9c0d4c2d565a17c75a662418e8fba83e1355e66d67c7ab0a56740e0add1c11a44fbcec576b9c9eed3bc0e46
7
- data.tar.gz: ee6ba3be0dcc8972b15ad510e7364df215d72372956a09683a902b491d6428e017d2b3db7d436db31e6490bd8e276cfc4f2cdddc40c7b3fe2f01fb88c957a634
6
+ metadata.gz: 250a29d1c1052e3f042a4d3aa1b114f665c303f288fab9912baecbfd65d8c9016310eb58f6f90ba58a196a1cd5147738bf94069323a962a1e1b6ef09b4462d61
7
+ data.tar.gz: d54b60e9653e0e37f0cc4a7182f3a80681727e583d8e67706ac538af8ebf7f0c07a6b0115853f7e0e3cdecb6494cb7974e8a2a32e26eda490e9baa907e849bcf
data/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ## 0.5.0
2
+
3
+ ##### Enhancements
4
+
5
+ * Added `pod trunk remove-owner` command to remove an owner from a pod.
6
+ [Samuel Giddins](https://github.com/segiddins)
7
+ [#35](https://github.com/CocoaPods/cocoapods-trunk/issues/35)
8
+
9
+ * Added `pod trunk info` command to get information for a pod, including the
10
+ owners.
11
+ [Kyle Fuller](https://github.com/kylef)
12
+ [#15](https://github.com/CocoaPods/cocoapods-trunk/issues/15)
13
+
14
+
1
15
  ## 0.4.1
2
16
 
3
17
  ##### Enhancements
data/Gemfile CHANGED
@@ -15,6 +15,7 @@ group :development do
15
15
  gem 'mocha'
16
16
  gem 'mocha-on-bacon'
17
17
  gem 'prettybacon'
18
+ gem 'webmock'
18
19
 
19
20
  gem 'codeclimate-test-reporter', :require => nil
20
21
  gem 'rubocop'
data/Gemfile.lock CHANGED
@@ -1,36 +1,36 @@
1
1
  GIT
2
2
  remote: https://github.com/CocoaPods/CLAide.git
3
- revision: b1eccc296b68b1a432e42ecf0c4b799d8551c75c
3
+ revision: 9e8b9072fd66f69b91999cd3838a4bbba043a7e5
4
4
  branch: master
5
5
  specs:
6
- claide (0.7.0)
6
+ claide (0.8.0)
7
7
 
8
8
  GIT
9
9
  remote: https://github.com/CocoaPods/CocoaPods.git
10
- revision: 1703a3464674baecf54bd7e766f4b37ed8fc43f7
10
+ revision: 26b9a555f1fa57675d46a0fb678f8ed7f37e361f
11
11
  branch: master
12
12
  specs:
13
- cocoapods (0.35.0.rc2)
13
+ cocoapods (0.35.0)
14
14
  activesupport (>= 3.2.15)
15
- claide (~> 0.7.0)
16
- cocoapods-core (= 0.35.0.rc2)
15
+ claide (~> 0.8.0)
16
+ cocoapods-core (= 0.35.0)
17
17
  cocoapods-downloader (~> 0.8.0)
18
18
  cocoapods-plugins (~> 0.3.1)
19
- cocoapods-trunk (~> 0.4.0)
20
- cocoapods-try (~> 0.4.2)
19
+ cocoapods-trunk (~> 0.5.0)
20
+ cocoapods-try (~> 0.4.3)
21
21
  colored (~> 1.2)
22
22
  escape (~> 0.0.4)
23
- molinillo (~> 0.1.1)
23
+ molinillo (~> 0.2.0)
24
24
  nap (~> 0.8)
25
25
  open4 (~> 1.3)
26
- xcodeproj (~> 0.20.2)
26
+ xcodeproj (~> 0.21.0)
27
27
 
28
28
  GIT
29
29
  remote: https://github.com/CocoaPods/Core.git
30
- revision: 60a486e8141323390dc5ff7f6676cf893a251a48
30
+ revision: 7d2b3c0cba15d4c62639c5b390df306a30cc1d40
31
31
  branch: master
32
32
  specs:
33
- cocoapods-core (0.35.0.rc2)
33
+ cocoapods-core (0.35.0)
34
34
  activesupport (>= 3.2.15)
35
35
  fuzzy_match (~> 2.0.4)
36
36
  nap (~> 0.8.0)
@@ -38,19 +38,20 @@ GIT
38
38
  PATH
39
39
  remote: .
40
40
  specs:
41
- cocoapods-trunk (0.4.1)
41
+ cocoapods-trunk (0.5.0)
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.8)
49
- i18n (~> 0.6, >= 0.6.9)
48
+ activesupport (4.2.0)
49
+ i18n (~> 0.7)
50
50
  json (~> 1.7, >= 1.7.7)
51
51
  minitest (~> 5.1)
52
- thread_safe (~> 0.1)
52
+ thread_safe (~> 0.3, >= 0.3.4)
53
53
  tzinfo (~> 1.1)
54
+ addressable (2.3.6)
54
55
  ast (2.0.0)
55
56
  astrolabe (1.3.0)
56
57
  parser (>= 2.2.0.pre.3, < 3.0)
@@ -58,15 +59,17 @@ GEM
58
59
  cocoapods-downloader (0.8.0)
59
60
  cocoapods-plugins (0.3.2)
60
61
  nap
61
- cocoapods-try (0.4.2)
62
+ cocoapods-try (0.4.3)
62
63
  codeclimate-test-reporter (0.4.1)
63
64
  simplecov (>= 0.7.1, < 1.0.0)
64
65
  colored (1.2)
66
+ crack (0.4.2)
67
+ safe_yaml (~> 1.0.0)
65
68
  docile (1.1.5)
66
69
  escape (0.0.4)
67
70
  ffi (1.9.6)
68
71
  fuzzy_match (2.0.4)
69
- i18n (0.6.11)
72
+ i18n (0.7.0)
70
73
  json (1.7.7)
71
74
  kicker (3.0.0)
72
75
  listen (~> 1.3.0)
@@ -76,18 +79,18 @@ GEM
76
79
  rb-inotify (>= 0.9)
77
80
  rb-kqueue (>= 0.2)
78
81
  metaclass (0.0.4)
79
- minitest (5.4.3)
82
+ minitest (5.5.0)
80
83
  mocha (1.1.0)
81
84
  metaclass (~> 0.0.1)
82
85
  mocha-on-bacon (0.2.2)
83
86
  mocha (>= 0.13.0)
84
- molinillo (0.1.1)
87
+ molinillo (0.2.0)
85
88
  multi_json (1.10.1)
86
89
  nap (0.8.0)
87
90
  netrc (0.7.8)
88
91
  notify (0.5.2)
89
92
  open4 (1.3.4)
90
- parser (2.2.0.pre.7)
93
+ parser (2.2.0.pre.8)
91
94
  ast (>= 1.1, < 3.0)
92
95
  slop (~> 3.4, >= 3.4.5)
93
96
  powerpack (0.0.9)
@@ -107,6 +110,7 @@ GEM
107
110
  rainbow (>= 1.99.1, < 3.0)
108
111
  ruby-progressbar (~> 1.4)
109
112
  ruby-progressbar (1.7.0)
113
+ safe_yaml (1.0.4)
110
114
  simplecov (0.9.1)
111
115
  docile (~> 1.1.0)
112
116
  multi_json (~> 1.0)
@@ -116,7 +120,10 @@ GEM
116
120
  thread_safe (0.3.4)
117
121
  tzinfo (1.2.2)
118
122
  thread_safe (~> 0.1)
119
- xcodeproj (0.20.2)
123
+ webmock (1.20.4)
124
+ addressable (>= 2.3.6)
125
+ crack (>= 0.3.2)
126
+ xcodeproj (0.21.0)
120
127
  activesupport (>= 3)
121
128
  colored (~> 1.2)
122
129
 
@@ -138,3 +145,4 @@ DEPENDENCIES
138
145
  prettybacon
139
146
  rake
140
147
  rubocop
148
+ webmock
@@ -1,3 +1,3 @@
1
1
  module CocoaPodsTrunk
2
- VERSION = '0.4.1'
2
+ VERSION = '0.5.0'
3
3
  end
@@ -16,7 +16,9 @@ module Pod
16
16
  require 'pod/command/trunk/register'
17
17
  require 'pod/command/trunk/me'
18
18
  require 'pod/command/trunk/add_owner'
19
+ require 'pod/command/trunk/remove_owner'
19
20
  require 'pod/command/trunk/push'
21
+ require 'pod/command/trunk/info'
20
22
 
21
23
  private
22
24
 
@@ -7,7 +7,7 @@ module Pod
7
7
  Adds the registered user with specified `OWNER-EMAIL` as an owner
8
8
  of the given `POD`.
9
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’.
10
+ pod, such as pushing new versions and adding and removing other ‘owners’.
11
11
  DESC
12
12
 
13
13
  self.arguments = [
@@ -0,0 +1,33 @@
1
+ module Pod
2
+ class Command
3
+ class Trunk
4
+ class Info < Trunk
5
+ self.summary = 'Returns information about a Pod.'
6
+ self.arguments = [
7
+ CLAide::Argument.new('NAME', true),
8
+ ]
9
+
10
+ def initialize(argv)
11
+ @name = argv.shift_argument
12
+ super
13
+ end
14
+
15
+ def validate!
16
+ super
17
+ help! 'Please specify a pod name.' unless @name
18
+ end
19
+
20
+ def run
21
+ response = json(request_path(:get, "pods/#{@name}", auth_headers))
22
+ versions = response['versions'] || []
23
+ owners = response['owners'] || []
24
+
25
+ UI.title(@name) do
26
+ UI.labeled 'Versions', versions.map { |v| "#{v['name']} (#{v['created_at']})" }
27
+ UI.labeled 'Owners', owners.map { |o| "#{o['name']} <#{o['email']}>" }
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,43 @@
1
+ module Pod
2
+ class Command
3
+ class Trunk
4
+ class RemoveOwner < Trunk
5
+ self.summary = 'Remove an owner from a pod'
6
+ self.description = <<-DESC
7
+ Removes the user with specified `OWNER-EMAIL` from being 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 and removing 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 owner’s email address.'
30
+ end
31
+ end
32
+
33
+ def run
34
+ json = json(request_path(:delete, "pods/#{@pod}/owners/#{@email}", auth_headers))
35
+ UI.labeled 'Owners', json.map { |o| "#{o['name']} <#{o['email']}>" }
36
+ rescue REST::Error => e
37
+ raise Informative, "There was an error removing #{@email} from " \
38
+ "#{@pod} on trunk: #{e.message}"
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -4,8 +4,49 @@ module Pod
4
4
  describe Command::Trunk::AddOwner do
5
5
  describe 'CLAide' do
6
6
  it 'registers it self' do
7
- Command.parse(%w( trunk add-owner )).should.be.instance_of Command::Trunk::AddOwner
7
+ Command.parse(%w( trunk add-owner )).should.be.instance_of Command::Trunk::AddOwner
8
8
  end
9
9
  end
10
+
11
+ describe 'validation' do
12
+ it "should error if we don't have a token" do
13
+ Netrc.any_instance.stubs(:[]).returns(nil)
14
+ command = Command.parse(%w( trunk push ))
15
+ exception = lambda { command.validate! }.should.raise CLAide::Help
16
+ exception.message.should.include 'register a session'
17
+ end
18
+
19
+ it 'should error if pod name is not supplied' do
20
+ command = Command.parse(%w( trunk add-owner ))
21
+ command.stubs(:token).returns('token')
22
+ exception = lambda { command.validate! }.should.raise CLAide::Help
23
+ exception.message.should.include 'pod name'
24
+ end
25
+
26
+ it 'should error if new owners email is not supplied' do
27
+ command = Command.parse(%w( trunk add-owner QueryKit ))
28
+ command.stubs(:token).returns('token')
29
+ exception = lambda { command.validate! }.should.raise CLAide::Help
30
+ exception.message.should.include 'email'
31
+ end
32
+
33
+ it 'should should validate with valid pod and email' do
34
+ command = Command.parse(%w( trunk add-owner QueryKit kyle@cocoapods.org ))
35
+ command.stubs(:token).returns('token')
36
+ lambda { command.validate! }.should.not.raise CLAide::Help
37
+ end
38
+ end
39
+
40
+ it 'should successfully add an owner' do
41
+ url = 'https://trunk.cocoapods.org/api/v1/pods/QueryKit/owners'
42
+ WebMock::API.stub_request(:patch, url).
43
+ with(:body => "{\"email\":\"kyle@cocoapods.org\"}",
44
+ :headers => { 'Authorization' => 'Token 527d11fe429f3426cb8dbeba183a0d80' }).
45
+ to_return(:status => 200, :body => '[]', :headers => {})
46
+
47
+ command = Command.parse(%w( trunk add-owner QueryKit kyle@cocoapods.org ))
48
+ command.stubs(:token).returns('527d11fe429f3426cb8dbeba183a0d80')
49
+ lambda { command.run }.should.not.raise
50
+ end
10
51
  end
11
52
  end
@@ -0,0 +1,36 @@
1
+ require File.expand_path('../../../spec_helper', __FILE__)
2
+ require 'tmpdir'
3
+
4
+ module Pod
5
+ describe Command::Trunk::Info do
6
+ describe 'CLAide' do
7
+ it 'registers it self' do
8
+ Command.parse(%w( trunk info )).should.be.instance_of Command::Trunk::Info
9
+ end
10
+ end
11
+
12
+ it 'should error without a pod name' do
13
+ command = Command.parse(%w( trunk info ))
14
+ lambda { command.validate! }.should.raise CLAide::Help
15
+ end
16
+
17
+ it 'should show information for a pod' do
18
+ url = 'https://trunk.cocoapods.org/api/v1/pods/Stencil'
19
+ WebMock::API.stub_request(:get, url).to_return(:body => {
20
+ 'owners' => [
21
+ {
22
+ 'name' => 'Kyle Fuller',
23
+ 'email' => 'kyle@example.com',
24
+ },
25
+ ],
26
+ }.to_json)
27
+
28
+ command = Command.parse(%w( trunk info Stencil ))
29
+ lambda { command.validate! }.should.not.raise CLAide::Help
30
+ command.run
31
+
32
+ UI.output.should.include 'Owners'
33
+ UI.output.should.include 'Kyle Fuller <kyle@example.com>'
34
+ end
35
+ end
36
+ end
@@ -9,6 +9,13 @@ module Pod
9
9
  end
10
10
  end
11
11
 
12
+ it "should error if we don't have a token" do
13
+ Netrc.any_instance.stubs(:[]).returns(nil)
14
+ command = Command.parse(%w( trunk push ))
15
+ exception = lambda { command.validate! }.should.raise CLAide::Help
16
+ exception.message.should.include 'register a session'
17
+ end
18
+
12
19
  describe 'PATH' do
13
20
  before do
14
21
  UI.output = ''
@@ -4,8 +4,28 @@ module Pod
4
4
  describe Command::Trunk::Register do
5
5
  describe 'CLAide' do
6
6
  it 'registers it self' do
7
- Command.parse(%w( trunk register )).should.be.instance_of Command::Trunk::Register
7
+ Command.parse(%w( trunk register )).should.be.instance_of Command::Trunk::Register
8
8
  end
9
9
  end
10
+
11
+ it 'should error if email is not supplied' do
12
+ Netrc.any_instance.stubs(:[]).returns(nil)
13
+ command = Command.parse(%w( trunk register ))
14
+ exception = lambda { command.validate! }.should.raise CLAide::Help
15
+ exception.message.should.include 'email address'
16
+ end
17
+
18
+ it 'should register user' do
19
+ url = 'https://trunk.cocoapods.org/api/v1/sessions'
20
+ WebMock::API.stub_request(:post, url).
21
+ with(:body => WebMock::API.hash_including('email' => 'kyle@cocoapods.org')).
22
+ to_return(:status => 200, :body => '{"token": "acct"}')
23
+ Netrc.any_instance.stubs(:[]).returns(nil)
24
+ Netrc.any_instance.expects(:[]=).with('trunk.cocoapods.org', ['kyle@cocoapods.org', 'acct'])
25
+ Netrc.any_instance.expects(:save)
26
+
27
+ command = Command.parse(%w( trunk register kyle@cocoapods.org ))
28
+ lambda { command.run }.should.not.raise
29
+ end
10
30
  end
11
31
  end
@@ -0,0 +1,51 @@
1
+ require File.expand_path('../../../spec_helper', __FILE__)
2
+
3
+ module Pod
4
+ describe Command::Trunk::RemoveOwner do
5
+ describe 'CLAide' do
6
+ it 'registers itself' do
7
+ Command.parse(%w( trunk remove-owner )).should.be.instance_of Command::Trunk::RemoveOwner
8
+ end
9
+ end
10
+
11
+ describe 'validation' do
12
+ it "should error if we don't have a token" do
13
+ Netrc.any_instance.stubs(:[]).returns(nil)
14
+ command = Command.parse(%w( trunk remove-owner ))
15
+ exception = lambda { command.validate! }.should.raise CLAide::Help
16
+ exception.message.should.include 'register a session'
17
+ end
18
+
19
+ it 'should error if pod name is not supplied' do
20
+ command = Command.parse(%w( trunk remove-owner ))
21
+ command.stubs(:token).returns('token')
22
+ exception = lambda { command.validate! }.should.raise CLAide::Help
23
+ exception.message.should.include 'pod name'
24
+ end
25
+
26
+ it 'should error if new owners email is not supplied' do
27
+ command = Command.parse(%w( trunk remove-owner QueryKit ))
28
+ command.stubs(:token).returns('token')
29
+ exception = lambda { command.validate! }.should.raise CLAide::Help
30
+ exception.message.should.include 'email'
31
+ end
32
+
33
+ it 'should should validate with valid pod and email' do
34
+ command = Command.parse(%w( trunk remove-owner QueryKit kyle@cocoapods.org ))
35
+ command.stubs(:token).returns('token')
36
+ lambda { command.validate! }.should.not.raise CLAide::Help
37
+ end
38
+ end
39
+
40
+ it 'should successfully remove an owner' do
41
+ url = 'https://trunk.cocoapods.org/api/v1/pods/QueryKit/owners/kyle@cocoapods.org'
42
+ WebMock::API.stub_request(:delete, url).
43
+ with(:headers => { 'Authorization' => 'Token 527d11fe429f3426cb8dbeba183a0d80' }).
44
+ to_return(:status => 200, :body => '[]', :headers => {})
45
+
46
+ command = Command.parse(%w( trunk remove-owner QueryKit kyle@cocoapods.org ))
47
+ command.stubs(:token).returns('527d11fe429f3426cb8dbeba183a0d80')
48
+ lambda { command.run }.should.not.raise
49
+ end
50
+ end
51
+ end
data/spec/spec_helper.rb CHANGED
@@ -21,6 +21,9 @@ require 'bundler/setup'
21
21
  require 'bacon'
22
22
  require 'mocha-on-bacon'
23
23
  require 'pretty_bacon'
24
+ require 'webmock'
25
+ WebMock.disable_net_connect!(:allow => 'codeclimate.com')
26
+
24
27
  require 'cocoapods'
25
28
 
26
29
  require 'cocoapods_plugin'
@@ -57,3 +60,15 @@ module Pod
57
60
  end
58
61
  end
59
62
  end
63
+
64
+ module Bacon
65
+ class Context
66
+ alias_method :after_webmock, :after
67
+ def after(&block)
68
+ after_webmock do
69
+ block.call
70
+ WebMock.reset!
71
+ end
72
+ end
73
+ end
74
+ 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: 0.4.1
4
+ version: 0.5.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-11-19 00:00:00.000000000 Z
11
+ date: 2014-12-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nap
@@ -90,13 +90,17 @@ files:
90
90
  - lib/cocoapods_trunk.rb
91
91
  - lib/pod/command/trunk.rb
92
92
  - lib/pod/command/trunk/add_owner.rb
93
+ - lib/pod/command/trunk/info.rb
93
94
  - lib/pod/command/trunk/me.rb
94
95
  - lib/pod/command/trunk/push.rb
95
96
  - lib/pod/command/trunk/register.rb
97
+ - lib/pod/command/trunk/remove_owner.rb
96
98
  - spec/command/trunk/addowner_spec.rb
99
+ - spec/command/trunk/info_spec.rb
97
100
  - spec/command/trunk/me_spec.rb
98
101
  - spec/command/trunk/push_spec.rb
99
102
  - spec/command/trunk/register_spec.rb
103
+ - spec/command/trunk/remove_owner_spec.rb
100
104
  - spec/command/trunk_spec.rb
101
105
  - spec/spec_helper.rb
102
106
  homepage: ''
@@ -125,8 +129,10 @@ specification_version: 4
125
129
  summary: Interact with trunk.cocoapods.org
126
130
  test_files:
127
131
  - spec/command/trunk/addowner_spec.rb
132
+ - spec/command/trunk/info_spec.rb
128
133
  - spec/command/trunk/me_spec.rb
129
134
  - spec/command/trunk/push_spec.rb
130
135
  - spec/command/trunk/register_spec.rb
136
+ - spec/command/trunk/remove_owner_spec.rb
131
137
  - spec/command/trunk_spec.rb
132
138
  - spec/spec_helper.rb