octocat 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +4 -16
- data/lib/octocat/command_line.rb +34 -8
- data/lib/octocat/version.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: 7fd0821bdcc0d5b82a4bdff4b813ae4f4b4bdb78
|
4
|
+
data.tar.gz: b732cd5cb812f43492ae61165c488c32886d8150
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ef147dbda2c7b51df1ae7089510e9373b283a2947003cbc764269b745a812408d0a3e49a05a91df2b6ea9270ee247ee15f37059250124538ed86da28dfe3878
|
7
|
+
data.tar.gz: f4b59eb18e4d868d02e182c5ad0fc3abbf89bc547887d33b5581c74298a736e57f4a91b02ceebbedddaea385b7a71d095a6b7cbef4b61ea024e82fc590c15f0e
|
data/README.md
CHANGED
@@ -1,24 +1,12 @@
|
|
1
|
-
# Octocat
|
1
|
+
# Octocat :octocat:
|
2
2
|
|
3
|
-
|
3
|
+
An OSX command line tool for GitHub
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
7
|
-
|
7
|
+
Octocat is OSX specific due to its relience on the credential-osxkeychain. You'll need to setup credential-osxkeychain correctly.
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
And then execute:
|
12
|
-
|
13
|
-
$ bundle
|
14
|
-
|
15
|
-
Or install it yourself as:
|
16
|
-
|
17
|
-
$ gem install octocat
|
18
|
-
|
19
|
-
## Usage
|
20
|
-
|
21
|
-
TODO: Write usage instructions here
|
9
|
+
If you have GitHub 2FA enabled, you'll want to generate a Personal Access Token.
|
22
10
|
|
23
11
|
## Contributing
|
24
12
|
|
data/lib/octocat/command_line.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'uri'
|
2
|
+
|
1
3
|
module Octocat
|
2
4
|
class CommandLine
|
3
5
|
COMMANDS = %w(open-branch new-pr open-pr compare-branch help)
|
@@ -8,17 +10,24 @@ module Octocat
|
|
8
10
|
end
|
9
11
|
|
10
12
|
def run
|
11
|
-
|
12
|
-
|
13
|
-
|
13
|
+
if command
|
14
|
+
run_command
|
15
|
+
else
|
16
|
+
puts "Octocat Version #{VERSION}"
|
17
|
+
help
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def run_command
|
22
|
+
if command == "open-branch"
|
14
23
|
api.open_branch(project, current_branch)
|
15
|
-
elsif
|
24
|
+
elsif command == "new-pr"
|
16
25
|
api.new_pr(project, current_branch)
|
17
|
-
elsif
|
26
|
+
elsif command == "open-pr"
|
18
27
|
api.open_pr(project, current_branch)
|
19
|
-
elsif
|
28
|
+
elsif command == "compare-branch"
|
20
29
|
api.compare_branch(project, current_branch)
|
21
|
-
elsif
|
30
|
+
elsif command == "help"
|
22
31
|
help
|
23
32
|
else
|
24
33
|
puts "Unknown Command. The known commands are:"
|
@@ -39,6 +48,23 @@ module Octocat
|
|
39
48
|
|
40
49
|
private
|
41
50
|
|
42
|
-
attr_reader :api
|
51
|
+
attr_reader :api, :command
|
52
|
+
|
53
|
+
def git_url
|
54
|
+
@git_url ||= `git remote show -n origin | grep 'URL' | head -1`.chomp.split(": ", 2).last
|
55
|
+
end
|
56
|
+
|
57
|
+
def project
|
58
|
+
@project ||= get_project
|
59
|
+
end
|
60
|
+
|
61
|
+
def get_project
|
62
|
+
if git_url.include? "@"
|
63
|
+
git_url.split(":", 2).last.gsub(/\.git$/, "")
|
64
|
+
else
|
65
|
+
URI(git_url).path[1..-1].gsub(/\.git$/, "")
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
43
69
|
end
|
44
70
|
end
|
data/lib/octocat/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: octocat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- halogenandtoast
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03-
|
11
|
+
date: 2014-03-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|