github-pr 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/github-pr/cli.rb +4 -0
- data/lib/github-pr/poster.rb +2 -1
- data/test/test_github-pr.rb +10 -0
- data/test/test_token.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d9e31620e9fa376ef53932d193a653196e017cc
|
4
|
+
data.tar.gz: e15553bca567c78481828507eb22860a36c76283
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e585f60431886c9364736b622cc2abffa55845ced35d38a40974535cf61f2755054355fe7751be11a8b31622c93a40b0efddc63922189a6ae97bbe7d67dd465
|
7
|
+
data.tar.gz: bddb97a45bef454ec9137b213e8ec1aebab3ba4ad396b2e0e4d5e3d981e1828bf8ff766fc21f020ddd40c377d86cbd8857a6f83b45d7b4737200cd5da443eb10
|
data/lib/github-pr/cli.rb
CHANGED
@@ -32,6 +32,9 @@ module GitHubPr
|
|
32
32
|
opts.on("-g", "--github-token GITHUBTOKEN", "Generated user token from GitHub") do |t|
|
33
33
|
options[:token] = t
|
34
34
|
end
|
35
|
+
opts.on("-u", "--url GITHUBURL", "GitHub repo url, optional. We will try to get url from git.") do |t|
|
36
|
+
options[:url] = t
|
37
|
+
end
|
35
38
|
end.parse!(argv)
|
36
39
|
|
37
40
|
raise 'You must assign to someone' if options[:assign].nil?
|
@@ -41,6 +44,7 @@ module GitHubPr
|
|
41
44
|
options[:feature] = self.current_branch if options[:feature].nil?
|
42
45
|
options[:title] = options[:feature] if options[:title].nil?
|
43
46
|
options[:token] = options[:token] if options[:token].nil?
|
47
|
+
options[:url] = options[:url] if options[:url].nil?
|
44
48
|
|
45
49
|
return options
|
46
50
|
end
|
data/lib/github-pr/poster.rb
CHANGED
@@ -17,7 +17,8 @@ module GitHubPr
|
|
17
17
|
end
|
18
18
|
end
|
19
19
|
def postPrivate(client, options)
|
20
|
-
repo_url =
|
20
|
+
repo_url = options[:url]
|
21
|
+
repo_url = Poster.repo_url() if repo_url.nil?
|
21
22
|
repo = cut_scheme_and_host(repo_url)
|
22
23
|
pull_request = client.create_pull_request(repo,
|
23
24
|
options[:base],
|
data/test/test_github-pr.rb
CHANGED
@@ -37,6 +37,16 @@ module GitHubPr
|
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
+
describe "when passed token, assagnee and repo url" do
|
41
|
+
it "must contain assign field" do
|
42
|
+
options = CLI.parse(['-a', 'hovox', '-g', 'sometoken', '-u', 'https://somegithuburl.com'])
|
43
|
+
options[:token].must_equal 'sometoken'
|
44
|
+
options[:base].must_equal 'master'
|
45
|
+
options[:assign].must_equal 'hovox'
|
46
|
+
options[:url].must_equal 'https://somegithuburl.com'
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
40
50
|
end
|
41
51
|
|
42
52
|
end
|
data/test/test_token.rb
CHANGED
@@ -28,7 +28,7 @@ module GitHubPr
|
|
28
28
|
end
|
29
29
|
|
30
30
|
it "must return token from file if exists" do
|
31
|
-
some_token = '
|
31
|
+
some_token = '14bebe34582d1dc606d72f36df0886d699ff04e5'
|
32
32
|
path = File.expand_path '~/.config/gh-pr-token'
|
33
33
|
# puts 'cache path is:' + path
|
34
34
|
|