-
-
Save janester/5951472 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 | |
#jane's personalization code --------------- | |
sleep 2 | |
system "echo personailizing app" | |
system "rm #{ARGV[0]}/Gemfile" | |
# system "cp gems.txt #{ARGV[0]}/Gemfile" | |
system "git clone https://gist.github.com/e390f24e63fe61cefc4c.git" #clones Gemfile | |
system "mv e390f24e63fe61cefc4c/Gemfile #{ARGV[0]}/" #moves it into the project | |
system "rm -rf e390f24e63fe61cefc4c/" #removes clone directory | |
system "rm #{ARGV[0]}/public/index.html" | |
system "touch #{ARGV[0]}/app/assets/stylesheets/#{ARGV[0]}.scss" | |
system "touch #{ARGV[0]}/app/assets/javascripts/#{ARGV[0]}.js" | |
sleep 1 | |
system "echo 'config/database.yml' >> #{ARGV[0]}/.gitignore" | |
system "rm #{ARGV[0]}/config/database.yml" | |
system "git clone https://gist.github.com/58dabffcf540da73bd0b.git" #clones db.yml file | |
system "sed 's/abcd/#{ARGV[0]}/g' 58dabffcf540da73bd0b/database.yml > #{ARGV[0]}/config/database.yml" #personalizes db.yml file | |
system "rm -rf 58dabffcf540da73bd0b/" #removes clone directory | |
system "echo Done!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment