Skip to content

Commit

Permalink
Merge branch 'smart_rails2' of https://github.com/fschwahn/powder int…
Browse files Browse the repository at this point in the history
…o fschwahn-smart_rails2
  • Loading branch information
rodreegez committed Apr 13, 2011
2 parents 948f725 + 0445eb6 commit a8863a4
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions bin/powder
Expand Up @@ -3,7 +3,7 @@
require 'rubygems'
require 'thor'
require 'fileutils'
require "net/https"
require 'net/https'

class Powder < Thor
include Thor::Actions
Expand Down Expand Up @@ -73,10 +73,8 @@ class Powder < Thor
def is_powable?
if File.exists?('config.ru') || File.exists?('public/index.html')
true
else
say "This does not appear to be a rack app as there is no config.ru."
say "Pow can also host static apps if there is an index.html in public/"
say "If you are in a Rails 2 application, you need a config.ru file"
elsif is_rails2_app?
say "This appears to be a Rails 2 applicaton. You need a config.ru file."
if yes? "Do you want to autogenerate a basic config.ru for Rails 2?"
uri = URI.parse("https://gist.github.com/909308.txt")
http = Net::HTTP.new(uri.host, uri.port)
Expand All @@ -89,8 +87,16 @@ class Powder < Thor
say "Did not create config.ru"
return false
end
else
say "This does not appear to be a rack app as there is no config.ru."
say "Pow can also host static apps if there is an index.html in public/"
return false
end
end

def is_rails2_app?
File.exists?('config/environment.rb') && !`grep RAILS_GEM_VERSION config/environment.rb`.empty?
end

def domain
if File.exists? '~/.powconfig'
Expand Down

0 comments on commit a8863a4

Please sign in to comment.