fast_github 0.0.4 → 0.0.5
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/.gitignore +1 -0
- data/bin/fast_github +7 -0
- data/lib/fast_github/version.rb +1 -1
- data/lib/fast_github.rb +10 -3
- 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: 20f341b4a7d25127878b33b69f2b35dad81e7273
|
4
|
+
data.tar.gz: c5537b8f4e4c8a0f4b813be9d1542ca02fcc6b20
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d2655b6885811a503172ba7763400f9b440be0249ca3d7bbd7e2cd439a312ad66561c0a4257abc2d1dd65d3a66ae06a0979e0162cb29b8732bf78cb0766aff2
|
7
|
+
data.tar.gz: df775a54bd584a4b228440834144836a51d698fb31d1a76065087de98be6f1538bb9edb63e503fc9a0ac51deff5656b959145c5c8373f13006d0e06118970ed1
|
data/.gitignore
CHANGED
data/bin/fast_github
CHANGED
@@ -11,4 +11,11 @@ confirm = gets.chomp
|
|
11
11
|
if confirm.chomp.upcase == "Y" || confirm.chomp == ""
|
12
12
|
repo.create
|
13
13
|
repo.upload
|
14
|
+
if repo.upload_response == 'Failed'
|
15
|
+
auth.request_oauth
|
16
|
+
repo.upload
|
17
|
+
if repo.upload_response == 'Failed'
|
18
|
+
raise "Could not login to Github"
|
19
|
+
end
|
20
|
+
end
|
14
21
|
end
|
data/lib/fast_github/version.rb
CHANGED
data/lib/fast_github.rb
CHANGED
@@ -3,7 +3,6 @@ require "io/console"
|
|
3
3
|
require "net/http"
|
4
4
|
require "uri"
|
5
5
|
require "json"
|
6
|
-
require 'yaml'
|
7
6
|
|
8
7
|
module FastGithub
|
9
8
|
class Auth
|
@@ -50,7 +49,8 @@ module FastGithub
|
|
50
49
|
pass = STDIN.noecho(&:gets).chomp
|
51
50
|
puts ""
|
52
51
|
request.basic_auth(user.chomp, pass.chomp)
|
53
|
-
|
52
|
+
client_secret = File.open(File.dirname(__FILE__) + "/client_secret", &:readline).chomp
|
53
|
+
request.body = { "client_secret" => client_secret, "scopes" => [ "repo" ] }.to_json
|
54
54
|
response = http.request(request)
|
55
55
|
if response.code == "200" || response.code == "201"
|
56
56
|
json_response = JSON.parse(response.body)
|
@@ -63,11 +63,12 @@ module FastGithub
|
|
63
63
|
end
|
64
64
|
|
65
65
|
class Repo
|
66
|
-
attr_accessor :directory, :remote_name
|
66
|
+
attr_accessor :directory, :remote_name, :upload_response
|
67
67
|
|
68
68
|
def initialize(token, remote_name=nil, dir=Dir.pwd)
|
69
69
|
@token = token
|
70
70
|
@directory = dir
|
71
|
+
@upload_response = ''
|
71
72
|
if remote_name && !remote_name.empty?
|
72
73
|
@remote_name = remote_name
|
73
74
|
else
|
@@ -93,6 +94,12 @@ module FastGithub
|
|
93
94
|
request["Authorization"] = "token #{@token}"
|
94
95
|
request.body = { "name" => @remote_name }.to_json
|
95
96
|
response = http.request(request)
|
97
|
+
if response.code[0] == "2"
|
98
|
+
@upload_response == 'Success'
|
99
|
+
else
|
100
|
+
@upload_response == 'Failed'
|
101
|
+
return
|
102
|
+
end
|
96
103
|
repo_fullname = (JSON.parse response.body)['full_name']
|
97
104
|
puts `git remote add origin git@github.com:#{repo_fullname}.git`
|
98
105
|
puts `git push -u origin master`
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fast_github
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joel Smith
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-07-
|
11
|
+
date: 2014-07-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|