13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
# File 'lib/homesteading/commands/deploy.rb', line 13
def heroku
puts
options = parse_options
Dir.glob("#{Dir.pwd}/homesteading-#{options[:app]}*/").each do |app_dir|
app = app_dir.split("/").last.sub(/homesteading-/, "").downcase
app_file_path = app_dir + "app.json"
if File.exist?(app_file_path) && File.exist?(app_dir + ".git")
if options[:verbose]
g = Git.open(app_dir, :log => Logger.new(STDOUT))
else
g = Git.open(app_dir)
end
heroku_remote = g.remotes.map { |r| r if r.name == "heroku" }
if heroku_remote.first
puts "* Deploying #{app}..."
g.push(g.remote("heroku"))
puts "* ...done"
else
puts "* Tried deploying #{app}..."
puts "* No git remote named 'heroku'"
puts "* Creating heroku app for #{app}..."
system "heroku apps:create"
puts "* Deploying #{app}..."
g.push(g.remote("heroku"))
puts "* ...done"
Homesteading::Command.create("init").default(nil, server: :heroku, app: app)
end
end
end
Homesteading::Command.create("routes").push
puts
end
|