Skip to content

Instantly share code, notes, and snippets.

@BrainScraps
Last active December 18, 2015 00:49
Show Gist options
  • Save BrainScraps/5699372 to your computer and use it in GitHub Desktop.
Save BrainScraps/5699372 to your computer and use it in GitHub Desktop.
This is a script that I made for quickly creating a new directory, GitHub repository, local respository, and linking the two up - all with one command! Dependencies: git github account & credentials the 'octokit' gem (gem install octokit) Usage: First, edit the script to include your GitHub username and password. ruby quickly.rb newprojectname
#This is a script that I made for quickly creating a new directory, GitHub repository,
#local respository, and linking the two up - all with one command!
#Dependencies:
#git
#github account & credentials
#the 'octokit' gem (gem install octokit)
#Usage:
#First, edit the script to include your GitHub username and password.
#ruby quickly.rb newprojectname
require "octokit"
require "fileutils"
user = "your_username" #replace this with your info
pw = "yourpassword" #replace this with your info
client = Octokit::Client.new(:login => user, :password => pw)
system "echo waiting for Github authentication"
sleep 2
response = client.create_repository(ARGV[0])
system "echo waiting for creation of new respository"
sleep 3
system "rails new #{ARGV[0]} -d postgresql"
system "echo #{response["ssh_url"]}"
Dir.chdir(ARGV[0]) do
system "git init"
system "git remote add origin #{response["ssh_url"]}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment