Sha256: 300dddf68399c57b133d9c38ecfaa64cae1ef2c26ff05011add362e0a5f71383

Contents?: true

Size: 993 Bytes

Versions: 2

Compression:

Stored size: 993 Bytes

Contents

module Citrin
  class App
    def initialize(name, env="prod")
      @name = name
      @env = env
      @env ||= "prod"
    end

    def name
      @name
    end

    def env
      @env
    end

    def fullenv
      case(@env)
        when "prod"
          return "production"
        when "dev"
          return "development"
        when "test"
          return "test"
      else
        raise "Invalid Environment"
      end
    end

    def app_root
      "/var/www/rails_apps/#{@env}/#{@name}"
    end

    def url
      if @env == "dev"
        "dev.#{@name}.#{`hostname -f`}"
      elsif @env == "prod"
        "#{@name}.#{`hostname -f`}"
      else
        raise "Invalid Environment"
      end
    end
    def webserver_config_file
      "/etc/apache2/sites-enabled/#{@env}.#{@name}.conf"
    end

    def db_name
      "#{@name}_#{@env}"
    end

    def db_user
      "#{@name}_#{@env}"
    end

    def db_pass
      @db_pass ||=`pwgen -1`.chomp
      @db_pass
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
citrin-0.0.10 lib/citrin/app.rb
citrin-0.0.9 lib/citrin/app.rb