Module: Heroku::Samorau::Manifest

Defined in:
lib/heroku/samorau.rb

Class Method Summary collapse

Class Method Details

.generate_passwordObject



39
40
41
# File 'lib/heroku/samorau.rb', line 39

def self.generate_password
  Array.new(8) { rand(256) }.pack('C*').unpack('H*').first
end

.init(filename) ⇒ Object



12
13
14
15
# File 'lib/heroku/samorau.rb', line 12

def self.init(filename)
  json = Yajl::Encoder.encode(skeleton, :pretty => true)
  open(filename, 'w') {|f| f << json }
end

.skeletonObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/heroku/samorau.rb', line 17

def self.skeleton
  {
    "name" => "myaddon",

    "api" => {
      "username" => "heroku",
      "password" => generate_password,
      "test" => "http://localhost:4567/",
      "production" => "https://yourapp.com/",
      "config_vars" => ["MYADDON_URL"]
    },

    "plans" => [
      {
        "name" => "Basic",
        "price" => "0",
        "price_unit" => "month"
      }
    ]
  }
end