Class: Heroku::Kensa::Manifest
- Inherits:
-
Object
- Object
- Heroku::Kensa::Manifest
- Defined in:
- lib/heroku/kensa/manifest.rb
Constant Summary collapse
- REGIONS =
%w(us eu frankfurt oregon tokyo virginia *)
Instance Method Summary collapse
- #foreman ⇒ Object
- #get_skeleton ⇒ Object
-
#initialize(options = {}) ⇒ Manifest
constructor
A new instance of Manifest.
- #post_skeleton ⇒ Object
- #skeleton ⇒ Object
- #skeleton_json ⇒ Object
- #write ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Manifest
Returns a new instance of Manifest.
8 9 10 11 12 |
# File 'lib/heroku/kensa/manifest.rb', line 8 def initialize( = {}) @method = .fetch(:method, 'post').to_sym @filename = [:filename] @options = end |
Instance Method Details
#foreman ⇒ Object
59 60 61 62 63 64 65 |
# File 'lib/heroku/kensa/manifest.rb', line 59 def foreman <<-ENV SSO_SALT=#{@sso_salt} HEROKU_USERNAME=myaddon HEROKU_PASSWORD=#{@password} ENV end |
#get_skeleton ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/heroku/kensa/manifest.rb', line 20 def get_skeleton <<-JSON { "id": "myaddon", "api": { "config_vars": [ "MYADDON_URL" ], "regions": [ "us" ], "password": "#{@password}",#{ sso_key } "production": "https://yourapp.com/", "test": "http://localhost:#{@port}/", "requires": [] } } JSON end |
#post_skeleton ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/heroku/kensa/manifest.rb', line 36 def post_skeleton <<-JSON { "id": "myaddon", "api": { "config_vars": [ "MYADDON_URL" ], "requires": [], "regions": [ "us" ], "password": "#{@password}",#{ sso_key } "production": { "base_url": "https://yourapp.com/heroku/resources", "sso_url": "https://yourapp.com/sso/login" }, "test": { "base_url": "http://localhost:#{@port}/heroku/resources", "sso_url": "http://localhost:#{@port}/sso/login" } } } JSON end |
#skeleton ⇒ Object
67 68 69 |
# File 'lib/heroku/kensa/manifest.rb', line 67 def skeleton OkJson.decode skeleton_json end |
#skeleton_json ⇒ Object
14 15 16 17 18 |
# File 'lib/heroku/kensa/manifest.rb', line 14 def skeleton_json @password = generate_password(16) @port = @options[:foreman] ? 5000 : 4567 (@method == :get) ? get_skeleton : post_skeleton end |
#write ⇒ Object
71 72 73 74 |
# File 'lib/heroku/kensa/manifest.rb', line 71 def write File.open(@filename, 'w') { |f| f << skeleton_json } File.open('.env', 'w') { |f| f << foreman } if @options[:foreman] end |