bin/powder in powder-0.1.3 vs bin/powder in powder-0.1.4
- old
+ new
@@ -87,12 +87,17 @@
def install
%x{curl get.pow.cx | sh}
end
desc "log", "Tails the Pow log"
- def log(name=nil)
- system "tail -f ~/Library/Logs/Pow/apps/#{name || current_dir_pow_name}.log"
+ def log
+ path_to_log_file = "#{ENV['HOME']}/Library/Logs/Pow/apps/#{current_dir_name}.log"
+ if File.exist? path_to_log_file
+ system "tail -f #{path_to_log_file}"
+ else
+ say "There is no Pow log file, have you set this application up yet?"
+ end
end
desc "applog", "Tails in current app"
def applog(env="development")
system "tail -f log/#{env}.log" if is_powable?
@@ -107,21 +112,25 @@
def version
say "powder #{Powder::VERSION}"
end
private
+
+ def current_dir_name
+ File.basename(%x{pwd}.chomp)
+ end
def current_dir_pow_name
- File.basename(%x{pwd}.chomp).tr('_', '-')
+ current_dir_name.tr('_', '-')
end
def is_powable?
if File.exists?('config.ru') || File.exists?('public/index.html')
true
- 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?"
+ elsif legacy = (is_rails2_app? || is_radiant_app?)
+ say "This appears to be a #{legacy} applicaton. You need a config.ru file."
+ if yes? "Do you want to autogenerate a basic config.ru for #{legacy}?"
uri = URI.parse("https://gist.github.com/909308.txt")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(uri.request_uri)
@@ -137,10 +146,16 @@
return false
end
end
def is_rails2_app?
- File.exists?('config/environment.rb') && !`grep RAILS_GEM_VERSION config/environment.rb`.empty?
+ File.exists?('config/environment.rb') &&
+ !`grep RAILS_GEM_VERSION config/environment.rb`.empty? ? 'Rails 2' : nil
+ end
+
+ def is_radiant_app?
+ File.exists?('config/environment.rb') &&
+ !`grep Radiant::Initializer config/environment.rb`.empty? ? 'Radiant' : nil
end
def domain
if File.exists? '~/.powconfig'
returned_domain = %x{source ~/.powconfig; echo $POW_DOMAINS}.gsub("\n", "").split(",").first