lib/shelly/app.rb in shelly-0.0.44.pre vs lib/shelly/app.rb in shelly-0.0.44.pre2
- old
+ new
@@ -136,9 +136,22 @@
def delete_config(path)
shelly.app_delete_config(code_name, path)
end
+ # returns result of execution of given code, or false when app was not
+ # running
+ def run(file_name_or_code)
+ code = if File.exists?(file_name_or_code)
+ File.read(file_name_or_code)
+ else
+ file_name_or_code
+ end
+
+ response = shelly.run(code_name, code)
+ response["result"]
+ end
+
def attributes
@attributes ||= shelly.app(code_name)
end
def web_server_ip