summaryrefslogtreecommitdiffstats
path: root/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/ruby/extension
diff options
context:
space:
mode:
authordims <dims@13f79535-47bb-0310-9956-ffa450edef68>2008-06-17 00:23:01 +0000
committerdims <dims@13f79535-47bb-0310-9956-ffa450edef68>2008-06-17 00:23:01 +0000
commitbdd0a41aed7edf21ec2a65cfa17a86af2ef8c48a (patch)
tree38a92061c0793434c4be189f1d70c3458b6bc41d /tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/ruby/extension
Move Tuscany from Incubator to top level.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@668359 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/ruby/extension')
-rw-r--r--tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/ruby/extension/Makefile.am34
-rw-r--r--tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/ruby/extension/deploy.bat59
-rw-r--r--tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/ruby/extension/src/Extension.cpp56
-rw-r--r--tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/ruby/extension/src/extconf.rb25
4 files changed, 174 insertions, 0 deletions
diff --git a/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/ruby/extension/Makefile.am b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/ruby/extension/Makefile.am
new file mode 100644
index 0000000000..41ce75925b
--- /dev/null
+++ b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/ruby/extension/Makefile.am
@@ -0,0 +1,34 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+SUBDIRS =
+
+libdir=$(prefix)/extensions/ruby/lib
+BUILT_SOURCES = extension_build
+
+EXTRA_DIST = src
+
+extension_build: src/Extension.cpp src/extconf.rb
+ cd src; ruby extconf.rb; make
+ touch extension_build
+
+clean:
+ cd src;make clean
+ rm -f extension_build
+
+install-exec-hook:
+ cp src/tuscany_sca_ruby.* $(libdir)
+
diff --git a/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/ruby/extension/deploy.bat b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/ruby/extension/deploy.bat
new file mode 100644
index 0000000000..8c8d1e0794
--- /dev/null
+++ b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/ruby/extension/deploy.bat
@@ -0,0 +1,59 @@
+@echo off
+
+@REM Licensed to the Apache Software Foundation (ASF) under one
+@REM or more contributor license agreements. See the NOTICE file
+@REM distributed with this work for additional information
+@REM regarding copyright ownership. The ASF licenses this file
+@REM to you under the Apache License, Version 2.0 (the
+@REM "License"); you may not use this file except in compliance
+@REM with the License. You may obtain a copy of the License at
+@REM
+@REM http://www.apache.org/licenses/LICENSE-2.0
+@REM
+@REM Unless required by applicable law or agreed to in writing,
+@REM software distributed under the License is distributed on an
+@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+@REM KIND, either express or implied. See the License for the
+@REM specific language governing permissions and limitations
+@REM under the License.
+
+
+setlocal
+
+if . == .%1 (
+echo sca root not specified
+goto usage
+)
+set rootdir=%1
+set deploydir=%rootdir%\deploy
+set extdir=%deploydir%\extensions
+set rubyextdir=%extdir%\ruby
+
+if . == .%2 (
+echo input directory not specified
+goto usage
+)
+set inpath=%2
+echo %inpath%
+
+
+if not exist %deploydir% mkdir %deploydir%
+if not exist %extdir% mkdir %extdir%
+if not exist %rubyextdir% mkdir %rubyextdir%
+if not exist %rubyextdir%\bin mkdir %rubyextdir%\bin
+if not exist %rubyextdir%\lib mkdir %rubyextdir%\lib
+
+del %rubyextdir%\bin\tuscany_sca_ruby.*
+del %rubyextdir%\lib\tuscany_sca_ruby.lib
+
+copy %inpath%\tuscany_sca_ruby.lib %rubyextdir%\lib
+copy %inpath%\tuscany_sca_ruby.dll %rubyextdir%\bin
+
+if exist %inpath%\tuscany_sca_ruby.pdb copy %inpath%\tuscany_sca_ruby.pdb %rubyextdir%\bin
+
+goto end
+:usage
+echo Usage: deploy <sca-root> <build-output>
+:end
+
+endlocal
diff --git a/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/ruby/extension/src/Extension.cpp b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/ruby/extension/src/Extension.cpp
new file mode 100644
index 0000000000..458700e5f1
--- /dev/null
+++ b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/ruby/extension/src/Extension.cpp
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/* $Rev$ $Date$ */
+
+#if defined(WIN32) || defined (_WINDOWS)
+#define SCA_RUBYEXTENSION_API __declspec(dllexport)
+#else
+#define SCA_RUBYEXTENSION_API
+#endif
+
+#include "tuscany/sca/ruby/Ruby.h"
+#include "tuscany/sca/ruby/RubyCompositeContext.h"
+
+extern "C"
+{
+
+ // Implement the Sca::locateService module function
+ SCA_RUBYEXTENSION_API VALUE tuscany_sca_ruby_locateService(VALUE module, VALUE value)
+ {
+ // Locate the service
+ const char* serviceName = rb_string_value_cstr(&value);
+ return tuscany::sca::ruby::RubyCompositeContext::locateService(serviceName);
+ }
+
+ // Initialize the Ruby extension
+ SCA_RUBYEXTENSION_API void Init_tuscany_sca_ruby()
+ {
+
+ // Define the Sca::locateService() function
+ VALUE module = rb_define_module("SCA");
+ rb_define_module_function(module, "locateService", (VALUE(*)(ANYARGS))tuscany_sca_ruby_locateService, 1);
+
+ }
+
+ SCA_RUBYEXTENSION_API void Init_libtuscany_sca_ruby()
+ {
+ Init_tuscany_sca_ruby();
+ }
+}
diff --git a/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/ruby/extension/src/extconf.rb b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/ruby/extension/src/extconf.rb
new file mode 100644
index 0000000000..9c41843d63
--- /dev/null
+++ b/tags/native-sca-1.0.incubating-M3-RC4/runtime/extensions/ruby/extension/src/extconf.rb
@@ -0,0 +1,25 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+ require 'mkmf'
+ CONFIG["CC"] = "g++"
+ $CPPFLAGS << " -I../../src "
+ $LIBPATH << "../../src/.libs"
+ $LIBS << " -ltuscany_sca_ruby_lang "
+ create_makefile 'tuscany_sca_ruby'