lib/shelly/app.rb in shelly-0.1.3 vs lib/shelly/app.rb in shelly-0.1.4.pre
- old
+ new
@@ -175,26 +175,12 @@
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.command(code_name, code, :ruby)
- response["result"]
- end
-
def rake(task)
- response = shelly.command(code_name, task, :rake)
- response["result"]
+ ssh("rake_runner \"#{task}\"")
end
def attributes
@attributes ||= shelly.app(code_name)
end
@@ -234,11 +220,15 @@
def node_and_port
shelly.node_and_port(code_name)
end
def console
+ ssh
+ end
+
+ def ssh(command = "")
params = node_and_port
- exec "ssh -o StrictHostKeyChecking=no -p #{params['port']} -l #{params['user']} #{params['node_ip']}"
+ exec "ssh -o StrictHostKeyChecking=no -p #{params['port']} -l #{params['user']} #{params['node_ip']} #{command}"
end
def upload(path)
params = node_and_port
exec "rsync -avz -e 'ssh -o StrictHostKeyChecking=no -p #{params['port']}' --progress #{path} #{params['user']}@#{params['node_ip']}:/srv/glusterfs/disk"