Permalink
Browse files

Syncing to NG.

  • Loading branch information...
1 parent d64ac5d commit 3dcc6b2320ee326d330c5c7874ed4ecc8e7ca497 Andrew Kirilenko committed Apr 25, 2012
View
@@ -16,21 +16,26 @@ Client client = new Client("IRON_IO_TOKEN", "IRON_IO_PROJECT_ID");
## Create Code Package
-This isn't implemented in this library yet, so you need to create zip which will contain all jars you need and runner.rb which will simply run java executable.
+This isn't implemented in this library yet, so you need to create zip which will contain all jars you need and __runner__.sh which will simply run java executable.
-```ruby
-root = nil
+```sh
+root() {
+ while [ $# -gt 0 ]; do
+ if [ "$1" = "-d" ]; then
+ printf "%s\n" "$2"
+ break
+ fi
+ done
+}
-($*.length - 2).downto(0) do |i|
- root = $*[i + 1] if $*[i] == '-d'
-end
+cd "$(root "$@")"
-Dir.chdir(root)
-
-puts `java -jar MyWorker.jar -cp Xerces.jar`
+java -cp xerces.jar -jar worker.jar "$@"
```
+You can also use https://github.com/iron-io/iron_worker_ruby_ng/ to create and upload code package.
+
## Upload Code Package
You need to specify name by which you'll call your worker later and path to zip created at previous step.
@@ -121,7 +121,7 @@ public TaskEntity createTask(String codeName, Map<String, Object> params, Map<St
params = new HashMap<String, Object>();
}
- JsonObject tasks = api.tasksCreate(codeName, gson.toJson(Params.create("token", api.getToken(), "project_id", api.getProjectId(), "params", params)), options);
+ JsonObject tasks = api.tasksCreate(codeName, gson.toJson(params), options);
JsonObject task = tasks.get("tasks").getAsJsonArray().get(0).getAsJsonObject();
return gson.fromJson(task, TaskEntity.class);
@@ -204,7 +204,7 @@ public ScheduleEntity createSchedule(String codeName, Map<String, Object> params
params = new HashMap<String, Object>();
}
- JsonObject schedules = api.schedulesCreate(codeName, gson.toJson(Params.create("token", api.getToken(), "project_id", api.getProjectId(), "params", params)), options);
+ JsonObject schedules = api.schedulesCreate(codeName, gson.toJson(params), options);
JsonObject schedule = schedules.get("schedules").getAsJsonArray().get(0).getAsJsonObject();
return gson.fromJson(schedule, ScheduleEntity.class);
@@ -2,6 +2,6 @@
public class JavaCode extends BaseCode {
public JavaCode(String name, String file) {
- super(name, file, "ruby", "runner.rb");
+ super(name, file, "sh", "__runner__.sh");
}
}

0 comments on commit 3dcc6b2

Please sign in to comment.