create-repo 1.0.0
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 +7 -0
- data/LICENSE.md +20 -0
- data/README.md +5 -0
- data/bin/create-repo +10 -0
- data/create-repo.gemspec +16 -0
- data/lib/create-repo.rb +3 -0
- data/lib/create-repo/github.rb +66 -0
- metadata +66 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 835da65805e240bcd79c8d2b47cc97c9440b9bcb
|
4
|
+
data.tar.gz: a858742ec1598d124c0e509da15303ac75f2f037
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9a024f1af6b879d0221ee987ff2b326c755e09731386d128dc0611cf78845e8237761c4c9d493844daf399af17566a2c88f0127f91e05e50dc5444ba51d350b5
|
7
|
+
data.tar.gz: b1562029de2acb8ad3eee045940dba065e1ac5c0e8cf578a8c3644b6b0bb8332c223efba894fa3077a494d684d4e06186dfbf87f6168aef2d0a4dc29d472383f
|
data/LICENSE.md
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2017 Akshat Karnwal
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
data/bin/create-repo
ADDED
data/create-repo.gemspec
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = 'create-repo'
|
3
|
+
s.add_dependency 'octokit', '~> 4.0'
|
4
|
+
s.executables = ["create-repo"]
|
5
|
+
s.version = '1.0.0'
|
6
|
+
s.date = '2017-08-29'
|
7
|
+
s.summary = "Create github repository from terminal"
|
8
|
+
s.description = "create-repo is a ruby gem that automatically creates a Github repository and pushes your local repo to the remote repo. No need to go to the browser and sign in to Github."
|
9
|
+
s.authors = ["Akshat Karnwal"]
|
10
|
+
s.email = 'akforsn@gmail.com'
|
11
|
+
s.files = %w(LICENSE.md README.md create-repo.gemspec)
|
12
|
+
s.files += Dir['lib/**/*.rb']
|
13
|
+
s.homepage = 'https://github.com/3minus1/create-repo'
|
14
|
+
s.license = 'MIT'
|
15
|
+
s.required_ruby_version = '>= 2.0.0'
|
16
|
+
end
|
data/lib/create-repo.rb
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
require 'io/console'
|
2
|
+
require 'pathname'
|
3
|
+
module CreateRepo
|
4
|
+
class Github
|
5
|
+
def initialize
|
6
|
+
setup
|
7
|
+
end
|
8
|
+
|
9
|
+
def setup
|
10
|
+
print "Github Username: "
|
11
|
+
@username = STDIN.gets.chomp
|
12
|
+
print "Github Password: "
|
13
|
+
@password = STDIN.noecho(&:gets).chomp
|
14
|
+
end
|
15
|
+
|
16
|
+
def login
|
17
|
+
puts "\nLogging in..."
|
18
|
+
begin
|
19
|
+
@client = Octokit::Client.new \
|
20
|
+
:login => "#{@username}",
|
21
|
+
:password => "#{@password}" ; nil
|
22
|
+
user = @client.user
|
23
|
+
user.login
|
24
|
+
rescue
|
25
|
+
puts `echo "\033[1;31mLogin failed! Try again\033[0m"`
|
26
|
+
setup
|
27
|
+
login
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def get_repo_info
|
32
|
+
print "Repository Name (default: #{cwd=Pathname.new(Dir.getwd).basename.to_s}) : "
|
33
|
+
@repo_name = !(name=STDIN.gets.chomp).empty? ? name : cwd
|
34
|
+
if repository_exists?
|
35
|
+
puts `echo "\033[1;31mRepository already exists! Choose a different name\033[0m"`
|
36
|
+
get_repo_info
|
37
|
+
end
|
38
|
+
puts "Description: (Press enter to skip)"
|
39
|
+
@repo_desc = STDIN.gets.chomp
|
40
|
+
puts "Is this a private repository? (y) or (n)"
|
41
|
+
@isPrivate = ['y','Y'].include?(STDIN.gets.chomp)
|
42
|
+
@options = {}
|
43
|
+
@options['description'] = @repo_desc if !@repo_desc.empty?
|
44
|
+
@options['private'] = 'true' if @isPrivate
|
45
|
+
end
|
46
|
+
|
47
|
+
def create_repository
|
48
|
+
@repo = @client.create_repository(@repo_name,@options)
|
49
|
+
puts `echo "\033[0;32mRepository created!\033[0m"` if @repo
|
50
|
+
puts `sudo git init`
|
51
|
+
puts `sudo git remote add origin #{@repo[:html_url]}.git`
|
52
|
+
puts `sudo git add --all`
|
53
|
+
puts `sudo git commit -m "Set up remote repository"`
|
54
|
+
puts `sudo git push -u origin master`
|
55
|
+
puts `echo "\033[0;32mAll set now!\033[0m"`
|
56
|
+
end
|
57
|
+
|
58
|
+
def repository_exists?
|
59
|
+
repo = @client.repository(@username+"/"+@repo_name); nil
|
60
|
+
true
|
61
|
+
rescue
|
62
|
+
false
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
66
|
+
end
|
metadata
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: create-repo
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Akshat Karnwal
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-08-29 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: octokit
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '4.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '4.0'
|
27
|
+
description: create-repo is a ruby gem that automatically creates a Github repository
|
28
|
+
and pushes your local repo to the remote repo. No need to go to the browser and
|
29
|
+
sign in to Github.
|
30
|
+
email: akforsn@gmail.com
|
31
|
+
executables:
|
32
|
+
- create-repo
|
33
|
+
extensions: []
|
34
|
+
extra_rdoc_files: []
|
35
|
+
files:
|
36
|
+
- LICENSE.md
|
37
|
+
- README.md
|
38
|
+
- bin/create-repo
|
39
|
+
- create-repo.gemspec
|
40
|
+
- lib/create-repo.rb
|
41
|
+
- lib/create-repo/github.rb
|
42
|
+
homepage: https://github.com/3minus1/create-repo
|
43
|
+
licenses:
|
44
|
+
- MIT
|
45
|
+
metadata: {}
|
46
|
+
post_install_message:
|
47
|
+
rdoc_options: []
|
48
|
+
require_paths:
|
49
|
+
- lib
|
50
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 2.0.0
|
55
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '0'
|
60
|
+
requirements: []
|
61
|
+
rubyforge_project:
|
62
|
+
rubygems_version: 2.6.12
|
63
|
+
signing_key:
|
64
|
+
specification_version: 4
|
65
|
+
summary: Create github repository from terminal
|
66
|
+
test_files: []
|