You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by mr...@apache.org on 2018/09/18 17:14:47 UTC
[incubator-openwhisk-website] branch master updated: Add Ruby to
list of runtimes (#336)
This is an automated email from the ASF dual-hosted git repository.
mrutkowski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-website.git
The following commit(s) were added to refs/heads/master by this push:
new 92dee13 Add Ruby to list of runtimes (#336)
92dee13 is described below
commit 92dee13ac2b0260272c7216617a14905f41bf621
Author: Justin Halsall <Ju...@users.noreply.github.com>
AuthorDate: Tue Sep 18 13:14:42 2018 -0400
Add Ruby to list of runtimes (#336)
* Add Ruby to list of runtimes
* add ruby action documentation
* mention Ruby on the homepage
* Sentence tweak
* Add more comments around the pending pull request
---
_includes/code/hello.rb | 5 ++
_includes/code/manifest-for-helloRuby-1.yaml | 5 ++
_includes/code/manifest-for-helloRuby-2.yaml | 11 +++
_layouts/documentation.html | 108 +++++++++++++++++++++++++++
_layouts/home.html | 3 +-
5 files changed, 131 insertions(+), 1 deletion(-)
diff --git a/_includes/code/hello.rb b/_includes/code/hello.rb
new file mode 100644
index 0000000..c53d1e6
--- /dev/null
+++ b/_includes/code/hello.rb
@@ -0,0 +1,5 @@
+def main(params = {})
+ name = params["name"] || "stranger"
+ greeting = "Hello #{name}!"
+ { "greeting": greeting }
+end
diff --git a/_includes/code/manifest-for-helloRuby-1.yaml b/_includes/code/manifest-for-helloRuby-1.yaml
new file mode 100644
index 0000000..7f29ca2
--- /dev/null
+++ b/_includes/code/manifest-for-helloRuby-1.yaml
@@ -0,0 +1,5 @@
+packages:
+ default:
+ actions:
+ hello_ruby:
+ function: hello.rb
diff --git a/_includes/code/manifest-for-helloRuby-2.yaml b/_includes/code/manifest-for-helloRuby-2.yaml
new file mode 100644
index 0000000..97cfffc
--- /dev/null
+++ b/_includes/code/manifest-for-helloRuby-2.yaml
@@ -0,0 +1,11 @@
+packages:
+ default:
+ actions:
+ hello_ruby:
+ code: |
+ def main(params = {})
+ name = params["name"] || "stranger"
+ greeting = "Hello #{name}!"
+ { "greeting": greeting }
+ end
+ runtime: ruby:2.5
diff --git a/_layouts/documentation.html b/_layouts/documentation.html
index f31ff68..7afb146 100644
--- a/_layouts/documentation.html
+++ b/_layouts/documentation.html
@@ -83,6 +83,12 @@ layout: default
<li><a href="#php-runtime">PHP Runtime</a></li>
<li><a href="#php-additional-resources">Additional Resources</a></li>
</ul>
+ <li class="index-menu-toggle"><a href="#ruby">Ruby</a></li>
+ <ul class="index-menuitems">
+ <li><a href="#ruby-actions">Creating and Invoking Action</a></li>
+ <li><a href="#ruby-runtime">Ruby Runtime</a></li>
+ <li><a href="#ruby-additional-resources">Additional Resources</a></li>
+ </ul>
<!--li class="index-menu-toggle"><a href="#swift">Swift</a></li>
<ul class="index-menuitems">
<li><a href="#swift-actions">Creating and Invoking Action</a></li>
@@ -215,6 +221,13 @@ layout: default
openwhisk-runtime-java
</a>
</p>
+ <p class="repo-title border-deeper-sky-blue">
+ <a
+ href="https://github.com/apache/incubator-openwhisk-runtime-ruby"
+ title="Apache openwhisk ruby runtime">
+ openwhisk-runtime-ruby
+ </a>
+ </p>
</div>
<div class="project-structure-repo theme-darkgoldenrod">
<h4>Deployments</h4>
@@ -828,6 +841,7 @@ $ wsk list
<li><a href="#python">Python</a> - OpenWhisk runtime for Python 2.7 and 3</li>
<li><a href="https://github.com/apache/incubator-openwhisk-runtime-swift/blob/master/README.md">Swift</a> - OpenWhisk runtime for Swift 3 and 4</li>
<li><a href="#java">Java</a> - OpenWhisk runtime for Java 8</li>
+ <li><a href="#ruby">Ruby</a> - OpenWhisk runtime for Ruby 2.5</li>
</ul>
<p>
@@ -1358,6 +1372,100 @@ $ jar cvf hello.jar Hello.class
</div>
</main>
+ <main class="doc">
+ <div class="content">
+ <a class="indexable" id="ruby"></a>
+ <h4>Ruby</h4>
+ <p></p>
+ <a class="indexable" id="ruby-actions"></a>
+ <h5>Creating and Invoking Ruby actions</h5>
+ <p>
+ Let's look at how to write a sample hello world action in Ruby. You can visit
+ <a href="https://github.com/apache/incubator-openwhisk/blob/master/docs/actions-ruby.md#creating-and-invoking-ruby-actions">Creating and Invoking Ruby actions</a>
+ page for further details.
+ </p>
+ <p>
+ <strong>Note:</strong> We will be using <i>wsk</i> CLI in this section. If you don't have it installed and configured,
+ please refer to the section on <a href="#wsk-cli">Configure the wsk CLI</a> to configure it.
+ </p>
+ <ol>
+ <li style="list-style-type: decimal">
+ Create a file named <i>hello.rb</i>:
+ <div class="terminal">
+{% highlight ruby linenos %}
+{% include code/hello.rb %}
+{% endhighlight %}
+ </div>
+ </li>
+ <li style="list-style-type: decimal">
+ Create an action called <i>hello_ruby</i> using <i>hello.rb</i>:
+ <div class="terminal">
+{% highlight bash %}$ wsk action create hello_ruby hello.rb{% endhighlight %}
+ </div>
+ <div class="terminal">
+{% highlight bash %}ok: created action hello_ruby{% endhighlight %}
+ </div>
+ </li>
+ <li style="list-style-type: decimal">
+ Invoke an action <i>hello_ruby</i>:
+ <div class="terminal">
+{% highlight bash %}$ wsk action invoke hello_ruby --blocking --result --param name World{% endhighlight %}
+ </div>
+ <div class="terminal">
+{% highlight yaml %}
+{
+ "greeting": "Hello World!"
+}
+{% endhighlight %}
+ </div>
+ </li>
+ <!--TODO: wskdeploy doesn't support ruby yet, uncomment the following once this pull request has been merged and released: https://github.com/apache/incubator-openwhisk-wskdeploy/pull/983 -->
+ <!--<li style="list-style-type: decimal">
+ Deploy using <i>wskdeploy</i>:
+ <p>
+ <strong>Note:</strong> We will be using <i>wskdeploy</i> in this section. If you don't have the binary,
+ please refer to the section on <a href="#wskdeploy">Whisk Deploy</a> to download it.
+ </p>
+ <ol>
+ <li>
+ Create <i>manifest.yaml</i> with the following YAML content:
+ <div class="terminal">
+{% highlight yaml linenos %}
+{% include code/manifest-for-helloRuby-1.yaml %}
+{% endhighlight %}
+ </div>
+ Or
+ <p></p>
+ <div class="terminal">
+{% highlight yaml linenos %}
+{% include code/manifest-for-helloRuby-2.yaml %}
+{% endhighlight %}
+ </div>
+ </li>
+ <li>
+ Run deployment with <i>wskdeploy</i>:
+ <div class="terminal">
+{% highlight bash %}$ wskdeploy -m manifest.yaml{% endhighlight %}
+ </div>
+ </li>
+ </ol>
+ </li>-->
+ </ol>
+ <a class="indexable" id="ruby-runtime"></a>
+ <h5>OpenWhisk Runtime for Ruby</h5>
+ <p>
+ OpenWhisk supports <strong>Ruby 2.5</strong> runtime.
+ If you wish to learn more about Ruby runtime, please visit
+ <a href="https://github.com/apache/incubator-openwhisk-runtime-ruby/blob/master/README.md">Ruby Runtime GitHub Repository</a>.
+ </p>
+ <a class="indexable" id="ruby-additional-resources"></a>
+ <h5>Additional Resources</h5>
+ <ul>
+ <li>Coming soon...</li>
+ </ul>
+ </div>
+ </main>
+
<!--main class="doc">
<div class="content">
<a class="indexable" id="swift"></a>
diff --git a/_layouts/home.html b/_layouts/home.html
index 579b1fb..e8e53c7 100644
--- a/_layouts/home.html
+++ b/_layouts/home.html
@@ -58,7 +58,8 @@ layout: default
<b><a href="https://github.com/apache/incubator-openwhisk-runtime-go">Go</a></b>,
<b><a href="https://github.com/apache/incubator-openwhisk-runtime-java">Scala</a></b>,
<b><a href="https://github.com/apache/incubator-openwhisk-runtime-python">Python</a></b>,
- <b><a href="https://github.com/apache/incubator-openwhisk-runtime-php">PHP</a></b>.
+ <b><a href="https://github.com/apache/incubator-openwhisk-runtime-php">PHP</a></b> and
+ <b><a href="https://github.com/apache/incubator-openwhisk-runtime-ruby">Ruby</a></b>.
</p>
<p>
If you need languages or libraries the current "out-of-the-box" runtimes do not support, you can create and customize your own executables as Zip Actions which run on the <b><a href="https://github.com/apache/incubator-openwhisk-runtime-docker/blob/master/README.md">Docker</a></b> runtime by using the <b><a href="https://github.com/apache/incubator-openwhisk-runtime-docker/blob/master/sdk/docker/README.md">Docker SDK</a></b>. Some examples of how to support other languag [...]