Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Heroku accounts #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ source :rubygems
gem 'sinatra', require: 'sinatra/base'
gem 'sinatra-contrib'
gem 'slim'
gem 'thin'
gem 'heroku' # deprecated
24 changes: 24 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,13 +1,31 @@
GEM
remote: http://rubygems.org/
specs:
addressable (2.3.2)
backports (2.3.0)
daemons (1.1.9)
eventmachine (1.0.0)
excon (0.16.10)
heroku (2.35.0)
heroku-api (~> 0.3.7)
launchy (>= 0.3.2)
netrc (~> 0.7.7)
rest-client (~> 1.6.1)
rubyzip
heroku-api (0.3.7)
excon (~> 0.16.10)
launchy (2.2.0)
addressable (~> 2.3)
mime-types (1.21)
netrc (0.7.7)
rack (1.5.2)
rack-protection (1.3.2)
rack
rack-test (0.6.2)
rack (>= 1.0)
rest-client (1.6.7)
mime-types (>= 1.16)
rubyzip (0.9.9)
sinatra (1.3.4)
rack (~> 1.4)
rack-protection (~> 1.3)
Expand All @@ -23,12 +41,18 @@ GEM
temple (~> 0.5.5)
tilt (~> 1.3.3)
temple (0.5.5)
thin (1.5.0)
daemons (>= 1.0.9)
eventmachine (>= 0.12.6)
rack (>= 1.0.0)
tilt (1.3.3)

PLATFORMS
ruby

DEPENDENCIES
heroku
sinatra
sinatra-contrib
slim
thin
36 changes: 30 additions & 6 deletions clone_all_the_things.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,32 @@
Dir.chdir './repos'
`heroku apps`.each_line do |line|
next if line.strip.empty?
next if line =~ /\A===/
app_name = line[/^[^\s]+/]
`git clone [email protected]:#{app_name}.git`
class Import
def prompt_and_start
while true
print "Are You using heroku accounts? [y/n]: "
case gets.strip
when 'Y', 'y', 'j', 'J', 'yes', 'ja'
STDOUT.puts "Heroku account to use for heroku repos"
system 'stty echo'
account = STDIN.gets.chomp
system 'stty echo'
get_repos(account)
when /\A[nN]o?\Z/ #n or no
print "Using default heroku account"
get_repos("com")
end
end
end

def get_repos(account="work")
Dir.chdir './repos'
`heroku apps`.each_line do |line|
next if line.strip.empty?
next if line =~ /\A===/
app_name = line[/^[^\s]+/]
`git clone git@heroku.#{account}:#{app_name}.git`
end
end
end


Import.new.prompt_and_start
exit