lib/cfoundry/v2/app.rb in cfoundry-0.3.3 vs lib/cfoundry/v2/app.rb in cfoundry-0.3.4

- old
+ new

@@ -1,11 +1,14 @@ require "fileutils" require "digest/sha1" require "pathname" require "tmpdir" +require "json" require "cfoundry/zip" +require "cfoundry/chatty_hash" + require "cfoundry/v2/model" module CFoundry::V2 # Class for representing a user's application on a given target (via # Client). @@ -33,9 +36,23 @@ alias :services :service_bindings alias :services= :service_bindings= alias :space :app_space alias :space= :app_space= + + private :environment_json, :environment_json= + + def env + @env ||= CFoundry::ChattyHash.new( + method(:env=), + JSON.parse(environment_json)) + end + + def env=(hash) + @env = hash + @diff["environment_json"] = hash + hash + end def debug_mode # TODO v2 nil end alias :console :debug_mode