Skip to content

added stack version to runtime, now you could set stack via "runtime 'ru... #174

Merged
merged 2 commits into from Dec 4, 2014
10 README.md
@@ -43,7 +43,8 @@ supplementary data, and other dependencies with it. `.worker` files make it easy
```ruby
# define the runtime language, this can be ruby, java, node, php, go, etc.
-runtime "ruby"
+# also you could set version of language(check of available versions via iron_worker stacks)
+runtime "ruby","2.1"
# exec is the file that will be executed:
exec "hello_worker.rb"
```
@@ -437,7 +438,12 @@ iron_worker stacks
And to specify stack add following line in your .worker file
```ruby
-# define the runtime language, this can be ruby, java, node, php, go, etc.
+runtime 'ruby', '2.1'
+```
+Or
+
+```ruby
+exec 'java.sh'
runtime 'binary'
stack 'java-1.7'
exec 'java.sh'
View
8 lib/iron_worker_ng/code/base.rb
@@ -179,7 +179,7 @@ def remote
@full_remote_build = true
end
- def runtime(runtime = nil)
+ def runtime(runtime = nil, version = nil)
return @runtime unless runtime
unless @runtime.nil?
@@ -189,6 +189,12 @@ def runtime(runtime = nil)
runtime_module = nil
runtime = runtime.to_s
+ if version
+ s = "#{runtime}-#{version}"
+ IronCore::Logger.info 'IronWorkerNG', "Trying to set stack to:#{s}'"
+ stack(s)
+ end
+
begin
runtime_module = IronWorkerNG::Code::Runtime.const_get(runtime.capitalize)
rescue
Something went wrong with that request. Please try again.