class AppHill::IO

Public Class Methods

appname_available(appname) click to toggle source
# File lib/apphill.rb, line 73
def self.appname_available(appname)
   return !File.directory?(appname)
end
appname_is_valid(appname) click to toggle source
# File lib/apphill.rb, line 77
def self.appname_is_valid(appname)
   !appname.match(/\s/)
end
generate_file(destination, filename, data) click to toggle source
# File lib/apphill.rb, line 100
def self.generate_file(destination, filename, data)
    content = self.template_bind filename, data
File.open(destination, 'w') {|f| f.write(content) }
end
init_app(appname) click to toggle source
# File lib/apphill.rb, line 63
 def self.init_app (appname)
license =  self.license(:copyright_year => AppHill::Config.copyright_year, 
                                                        :copyright_name => AppHill::Config.copyright_name, 
                                                        :copyright_link => AppHill::Config.copyright_link)

    AppHill::IOS.new_project appname, {:app_id => "io.apphill.#{appname}", 
                                                                      :app_name => appname,
                                                                      :license => license}
 end
license(data) click to toggle source
# File lib/apphill.rb, line 96
def self.license (data)
   self.template_bind @license_filename, data
end
template_bind(filename, data) click to toggle source
# File lib/apphill.rb, line 91
    def self.template_bind(filename, data)
       template = self.template_file filename
       ERB.new(template).result(self::BIND.new(data).get_binding)
end
template_file(filename) click to toggle source
# File lib/apphill.rb, line 85
def self.template_file (filename)
   filepath = self.template_filepath filename
   file     = File.open(filepath, 'r').read
   return file
end
template_filepath(filename) click to toggle source
# File lib/apphill.rb, line 81
def self.template_filepath (filename)
   File.join @templates_dir, filename + ".erb"
end