pully 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -0
- data/lib/pully.rb +6 -0
- data/lib/pully/version.rb +1 -1
- data/spec/lib_spec.rb +27 -4
- data/spec/lib_test_spec.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 15aced5ebd989571182099d514dd95204f171d4c
|
4
|
+
data.tar.gz: a8699568b82ee6746394536fcf2b11e6738716d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c28429a2fa152c8e25bfd03fc5ff23c9a08928f99fb67b44fa23888891b4e7e3f02bb644c77fc4e956d8f1d9bf8ad01fec23e90fd2742a1b8ac9a0a6615e5ac6
|
7
|
+
data.tar.gz: 692396019e51debe2746ab23ea54d18a5ddfffdeccd5f9b7af33b2ce0150ea7cfd4a7ae191cc6abeecc9e7b0c2195d74301e37064553e22f37cbc5afc3cf25ec
|
data/README.md
CHANGED
@@ -23,6 +23,9 @@ pully = Pully.new(user:"github_username", pass:"github_password", repo:"my_repos
|
|
23
23
|
#Get a list of all open pull requests (An array of pull numbers)
|
24
24
|
open = pully.pull_requests
|
25
25
|
|
26
|
+
#Get a list of all open pull requests marked as pending or success
|
27
|
+
open_and_pending_or_success = pully.open_or_pending_pull_requests
|
28
|
+
|
26
29
|
#Create a new pull request to merge 'my_branch' into 'master' with the title 'My pull request' and the message 'Hey XXX...'
|
27
30
|
pull_number = pully.create_pull_request(from:"my_branch", to:"master", subject:"My pull request", message:"Hey XXXX, can you merge this for me?")
|
28
31
|
|
data/lib/pully.rb
CHANGED
@@ -52,6 +52,12 @@ module Pully
|
|
52
52
|
return @gh_client.pull_requests(@repo_selector, :state => 'open').map{|e| e["number"]}
|
53
53
|
end
|
54
54
|
|
55
|
+
def open_or_pending_pull_requests
|
56
|
+
requests = @gh_client.pull_requests(@repo_selector, :state => 'open').map{|e| e["number"]}
|
57
|
+
requests.select!{|e| ["open", "pending"].include? pull_request_status(e) }
|
58
|
+
requests
|
59
|
+
end
|
60
|
+
|
55
61
|
def set_pull_request_status(pull_number, status)
|
56
62
|
sha = sha_for_pull_request pull_number
|
57
63
|
@gh_client.create_status(@repo_selector, sha, status)
|
data/lib/pully/version.rb
CHANGED
data/spec/lib_spec.rb
CHANGED
@@ -26,11 +26,11 @@ RSpec.describe "Library" do
|
|
26
26
|
expect { pully = Pully.new(user: gh_info["user"], pass: gh_info["pass"], repo: SecureRandom.hex) }.to raise_error(Pully::Pully::Error::NonExistantRepository)
|
27
27
|
end
|
28
28
|
|
29
|
-
|
30
|
-
|
31
|
-
|
29
|
+
it "Does throw an exception with correct credentials while creating an object with an alternate owner but without specifying that owner" do
|
30
|
+
expect { pully = Pully.new(user: gh_info["user"], pass: gh_info["pass"], repo: gh_info["org_repo"])}.to raise_error
|
31
|
+
end
|
32
32
|
|
33
|
-
|
33
|
+
it "Can call create a new pull request and returns an integer for the pull request #" do
|
34
34
|
sleep 10
|
35
35
|
#test branch creator
|
36
36
|
new_branch_name = SecureRandom.hex
|
@@ -237,4 +237,27 @@ RSpec.describe "Library" do
|
|
237
237
|
th.delete_branch(new_branch_name)
|
238
238
|
|
239
239
|
end
|
240
|
+
|
241
|
+
it "Can list all success and pending pull requests" do
|
242
|
+
sleep 10
|
243
|
+
new_branch_name = SecureRandom.hex
|
244
|
+
new_branch_name2 = SecureRandom.hex
|
245
|
+
th = Pully::TestHelpers::Branch.new(user: gh_info["user"], pass: gh_info["pass"], repo_selector: repo_selector(user: gh_info["user"], repo: gh_info["repo"], owner:nil), clone_url: gh_info["clone_url"])
|
246
|
+
th.create_branch(new_branch_name)
|
247
|
+
th.commit_new_random_file(new_branch_name)
|
248
|
+
|
249
|
+
th.create_branch(new_branch_name2)
|
250
|
+
th.commit_new_random_file(new_branch_name2)
|
251
|
+
|
252
|
+
pully = Pully.new(user: gh_info["user"], pass: gh_info["pass"], repo: gh_info["repo"])
|
253
|
+
pull_number = pully.create_pull_request(from:new_branch_name, to:"master", subject:"My pull request", message:"Hey XXXX, can you merge this for me?")
|
254
|
+
pull_number2 = pully.create_pull_request(from:new_branch_name2, to:"master", subject:"My pull request", message:"Hey XXXX, can you merge this for me?")
|
255
|
+
pully.set_pull_request_status(pull_number, 'error')
|
256
|
+
|
257
|
+
expect(pully.open_or_pending_pull_requests).not_to include(pull_number)
|
258
|
+
expect(pully.open_or_pending_pull_requests).to include(pull_number2)
|
259
|
+
|
260
|
+
th.delete_branch(new_branch_name)
|
261
|
+
|
262
|
+
end
|
240
263
|
end
|
data/spec/lib_test_spec.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pully
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Seo Townsend
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-04-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|