rubyuno 0.3.0 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,88 @@
1
+ # rubyuno
2
+
3
+ rubyuno is a Ruby-UNO (Universal Network Object; ['ju:nou]) bridge. UNO is used to
4
+ construct OpenOffice.org so that you can play with the office. Rubyuno
5
+ is implemented as Ruby extension library written in C++, but the bridge
6
+ is not so fast because value conversion and multiple API call consume time.
7
+ Rubyuno is not well suited for task like template creation; generating ODF (Open
8
+ Document Format) files is a better option.
9
+
10
+ rubyuno is a fork of [RUNO](https://github.com/hanya/RUNO), converted into a gem so that the extensions do not need to be compiled manually. However, it has not been tested on a wide variety of platforms. If you encounter compilation difficulties and are able to resolve them, please create a pull request so that we can get this working on as many platforms as possible!
11
+
12
+ ## Installation
13
+
14
+ Add this line to your application's Gemfile:
15
+
16
+ gem 'rubyuno'
17
+
18
+ And then execute:
19
+
20
+ $ bundle
21
+
22
+ Or install it yourself as:
23
+
24
+ $ gem install rubyuno
25
+
26
+ ### Pre-requisites
27
+ In order for rubyuno to compile, the following must already be installed on the system:
28
+
29
+ * OpenOffice.org and OpenOffice.org SDK (tested with version 3.4).
30
+
31
+ The SDK will need to be set up after installation. In order to do this, `configure.pl` within
32
+ the SDK's installation directory (eg. /opt/openoffice.org/basis3.4/sdk) needs to be run. This
33
+ will create an SDK directory within the current user's home directory (the script has an
34
+ option to change the installation directory but seems to not work) with some shell scripts.
35
+
36
+ The shell scripts will be named something like <code>setsdkenv_*env*.*ext*</code>, where `env`
37
+ is your server environment and `ext` is a shell type (ie. `setsdkenv_unix.sh`).
38
+ Please read the SDK documentation for more information.
39
+
40
+ * Ruby 1.9 and its headers (you may need to compile Ruby with the `--enable-shared` flag)
41
+
42
+ ### Environment variables
43
+ In addition to the SDK's environment variable set up script (as mentioned above), rubyuno needs two
44
+ environment variables to function correctly.
45
+
46
+ * `LD_LIBRARY_PATH` (for Linux or UNIX) or `PATH` (for Windows)
47
+
48
+ Used to find libraries of UNO (or OpenOffice.org). Should be setup by the `setsdkenv` script.
49
+
50
+ * `URE_BOOTSTRAP`
51
+
52
+ Specifies fundamental(rc|.ini) file with vnd.sun.star.pathname protocol.
53
+
54
+ You may wish to update your `/etc/profile` or the like with the following to automatically set these up:
55
+
56
+ . ~/openoffice.org3.4_sdk/$(hostname)/setsdkenv_unix.sh >/dev/null
57
+ export URE_BOOTSTRAP="vnd.sun.star.pathname:$OFFICE_PROGRAM_PATH/fundamentalrc"
58
+
59
+ ## Usage
60
+
61
+ OpenOffice must be running as a service first in order to interact with it (rubyuno uses port 2083 by default):
62
+
63
+ soffice -headless -nologo -nofirststartwizard - accept="socket,host=localhost,port=2083;urp;StarOffice.ServiceManager"
64
+
65
+ Once it is running, you can connect to it from ruby:
66
+
67
+ require 'rubyuno'
68
+ ctx = Uno::Connector.bootstrap
69
+ smgr = ctx.getServiceManager
70
+ desktop = smgr.createInstanceWithContext("com.sun.star.frame.Desktop", ctx)
71
+ doc = desktop.loadComponentFromURL("private:factory/swriter", "_blank", 0, [])
72
+ doc.getText.setString("Hello from Ruby!")
73
+
74
+ ### Common Errors & Resolutions
75
+
76
+ #### LoadError: cannot open shared object file
77
+
78
+ LoadError: libuno_cppuhelpergcc3.so.3: cannot open shared object file: No such file or directory - /usr/local/lib/ruby/gems/1.9.1/gems/rubyuno-0.3.0/lib/rubyuno/rubyuno.so
79
+ from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
80
+
81
+ `$LD_LIBRARY_PATH` environment variable is not set up correctly. Ensure it contains `$OO_SDK_URE_HOME/lib`.
82
+
83
+ #### TypeError: wrong argument type Rubyuno::Com::Sun::Star::Connection::NoConnectException from <code>Uno::Connector.bootstrap</code>
84
+ `soffice` is either not running as a service or is its `-accept` option parameters do not match the arguments to `Uno::Connector.bootstrap`. Ensure the port is correct.
85
+
86
+ #### Binary URP bridge disposed during call
87
+
88
+ `$URE_BOOTSTRAP` environment variable is not set up correctly. Ensure it points to the `fundamentalrc` or `fundamental.ini` file with the `vnd.sun.star.pathname protocol` protocol.
@@ -192,7 +192,7 @@ public:
192
192
 
193
193
  VALUE any_to_VALUE(const com::sun::star::uno::Any &a) const throw (com::sun::star::uno::RuntimeException);
194
194
  com::sun::star::uno::Any value_to_any(VALUE value) const throw (com::sun::star::uno::RuntimeException);
195
- com::sun::star::uno::Sequence< com::sun::star::uno::Type > getTypes(const Runtime &runtime, VALUE *value) const;
195
+ static com::sun::star::uno::Sequence< com::sun::star::uno::Type > getTypes(const Runtime &runtime, VALUE *value);
196
196
  };
197
197
 
198
198
 
@@ -123,14 +123,14 @@ void Runtime::initialize(const Reference< XComponentContext > &ctx) throw (Runti
123
123
  }
124
124
 
125
125
 
126
- static Sequence< Type >
127
- getTypes(const Runtime &runtime, VALUE *value)
126
+ Sequence< Type >
127
+ Runtime::getTypes(const Runtime &runtime, VALUE *value)
128
128
  {
129
129
  Sequence< Type > ret;
130
130
  ID id = rb_intern("getTypes");
131
131
 
132
132
  if (! rb_respond_to(*value, id))
133
- rb_raise(rb_eArgError, "illegal argument does not support com.sun.star.lang.XTypeProvider interface");
133
+ rb_raise(rb_eArgError, "illegal argument does not support com.sun.star.lang.XTypeProvider interface (%s)", value);
134
134
  VALUE types = rb_funcall(*value, id, 0);
135
135
 
136
136
  long size = RARRAY_LEN(types);
@@ -1,3 +1,3 @@
1
1
  module Rubyuno
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubyuno
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-07-06 00:00:00.000000000 Z
13
+ date: 2012-07-07 00:00:00.000000000 Z
14
14
  dependencies: []
15
15
  description: Ruby-OpenOffice UNO native bridge
16
16
  email:
@@ -25,7 +25,7 @@ files:
25
25
  - CHANGES
26
26
  - Gemfile
27
27
  - LICENSE
28
- - README
28
+ - README.md
29
29
  - Rakefile
30
30
  - doc/Rakefile
31
31
  - doc/index.rd
data/README DELETED
@@ -1,46 +0,0 @@
1
-
2
- = RUNO
3
-
4
- RUNO is a Ruby-UNO ['ju:nou] (Universal Network Object) bridge. UNO is used to
5
- construct OpenOffice.org so that you can play with the office. RUNO
6
- is implemented as Ruby extension library written in C++, but the bridge
7
- is not so fast because value conversion and multiple API call consume time.
8
- RUNO is not suite task like template creation, generating ODF (Open
9
- Document Format) is better for the task.
10
-
11
-
12
- = How to Compile
13
- You need following things to compile:
14
- * OpenOffice.org and OpenOffice.org SDK (3.x?)
15
- * Ruby (> 1.8.7?) and its header
16
-
17
- Package version is not well checked.
18
-
19
- Install OpenOffice.org and SDK. And then setup the SDK with configure.pl
20
- script equipped in the SDK. After that you can find shell script named
21
- "setsdkenv_ENV.EXT" to set environmet variables for compilation in the
22
- ~/openoffice.orgVERSION_sdk/HOST.DOMAIN directory. The directory and file
23
- name is system dependent, please read SDK documentation.
24
-
25
- For example, compilation procedure is like the following:
26
- > . ~/openoffice.org3.2_sdk/localhost/localdomain/setsdkenv_unix.sh
27
- > ruby extconf.rb
28
- > make
29
- > make site-install
30
- compilation is successfully finished, runo.so file is created.
31
-
32
- Current version has problem to link against ruby library on Windows
33
- environment. I couldn't fix it, investication required.
34
-
35
- = Environment Variables
36
-
37
- RUNO needs a few environmet variable settings befor to run work correctly.
38
-
39
- * LD_LIBRARY_PATH (for Linux or UNIX) or PATH (for Windows)
40
- To find libraries of UNO (or OpenOffice.org).
41
-
42
- * URE_BOOTSTRAP
43
- Specifies fundamental(rc|.ini) file with vnd.sun.star.pathname protocol.
44
- e.g. vnd.sun.star.pathname:/opt/ooo-dev3/program/fundamentalrc
45
-
46
-