oracle-model-generator 0.4.1 → 0.5.0
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.
- checksums.yaml +5 -5
- checksums.yaml.gz.sig +0 -0
- data/{CHANGES → CHANGES.md} +14 -8
- data/DOCKER.md +152 -0
- data/Dockerfile +87 -0
- data/Gemfile +2 -0
- data/LICENSE +177 -0
- data/{MANIFEST → MANIFEST.md} +3 -3
- data/README-Docker.md +140 -0
- data/README.md +169 -0
- data/Rakefile +14 -10
- data/bin/omg +0 -0
- data/certs/djberg96_pub.pem +22 -17
- data/docker-compose.yml +41 -0
- data/lib/oracle/model/generator.rb +1 -1
- data/oracle-model-generator.gemspec +13 -14
- data/spec/oracle_model_generator_spec.rb +176 -0
- data/spec/spec_helper.rb +30 -0
- data/spec/support/oracle_connection.rb +126 -0
- data.tar.gz.sig +0 -0
- metadata +60 -55
- metadata.gz.sig +0 -0
- data/README +0 -150
- data/test/test_oracle_model_generator.rb +0 -68
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b8f35e4437d649d4ba51871b95819456a0124d3e2b7deba20c70891d6067b71e
|
4
|
+
data.tar.gz: ec7b1645ca0e9af856003908b74ef0feb44deb5130f0d279874b6b56cb99c60f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 869db7912de3481e85ff70e0e09ffc7b0bd795efe031e5411f8b48016e17be764d85cb9a8dbed9bb840e7501ada4fb47a4b95edd8d43e812b2d55784562e2ab1
|
7
|
+
data.tar.gz: ecc1acb26c4d4651cfab1912d00dfc491acff6dc2c1fa62de883969e716493247e6810d7af80d80a01bed27654e492b5ee8fcc364f6cb97702b57e900c23e9d5
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/{CHANGES → CHANGES.md}
RENAMED
@@ -1,23 +1,29 @@
|
|
1
|
-
|
1
|
+
## 0.5.0 - 22-Jul-2025
|
2
|
+
* Added docker related files, so you can now fire up an Oracle container and
|
3
|
+
run the specs against that.
|
4
|
+
* Replaced test-unit with rspec.
|
5
|
+
* Changed the license to Apache-2.0.
|
6
|
+
|
7
|
+
## 0.4.1 - 1-Feb-2016
|
2
8
|
* This gem is now signed.
|
3
9
|
* Updated the gem related tasks in the Rakefile.
|
4
10
|
* Added an oracle-model-generator.rb file for convenience.
|
5
11
|
|
6
|
-
|
12
|
+
## 0.4.0 - 7-Nov-2014
|
7
13
|
* Added support for minitest test file output.
|
8
14
|
|
9
|
-
|
15
|
+
## 0.3.2 - 6-Nov-2014
|
10
16
|
* Removed explicit references to Rails 3 in documentation. It's now simply
|
11
17
|
Rails 2, or Rails 3 or higher.
|
12
18
|
* Some minor updates in generated test file text, as test-unit 2 no longer
|
13
19
|
requires the require workaround.
|
14
20
|
* Updates to Rakefile and gemspec.
|
15
21
|
|
16
|
-
|
22
|
+
## 0.3.1 - 3-Apr-2012
|
17
23
|
* Added the --class option that allows you to specify the model name on the
|
18
24
|
command line. Thanks go to Daniel Luna for the patch (plus some minor fixes).
|
19
25
|
|
20
|
-
|
26
|
+
## 0.3.0 - 12-May-2011
|
21
27
|
* Added automatic test generation. In addition to the active record model file,
|
22
28
|
a test file will be generated that includes a series of stock tests that
|
23
29
|
are based on the model's validations. At the moment only test-unit is
|
@@ -31,12 +37,12 @@
|
|
31
37
|
* The default output file name will now chop any trailing 's' characters.
|
32
38
|
* More tests and comments added.
|
33
39
|
|
34
|
-
|
40
|
+
## 0.2.1 - 3-May-2011
|
35
41
|
* Fixed a bug where the omg binary blew up if you didn't have the dbi-dbrc
|
36
42
|
library installed. It's supposed to be optional. Thanks go to Jason Roth
|
37
43
|
for the spot.
|
38
44
|
|
39
|
-
|
45
|
+
## 0.2.0 - 8-Mar-2011
|
40
46
|
* Added the -r/--rails command line option. By default the omg binary will
|
41
47
|
now generate Rails 3 style validations. If you want Rails 2 validations,
|
42
48
|
specify "-r 2" on the command line.
|
@@ -44,5 +50,5 @@
|
|
44
50
|
scale and precision exactly as defined instead of rounding to the nearest
|
45
51
|
whole number, for Rails 3 anyway.
|
46
52
|
|
47
|
-
|
53
|
+
## 0.1.0 - 6-Oct-2010
|
48
54
|
* Initial release.
|
data/DOCKER.md
ADDED
@@ -0,0 +1,152 @@
|
|
1
|
+
# Docker Testing Environment for Oracle Model Generator
|
2
|
+
|
3
|
+
This directory contains Docker configuration files to create a complete testing environment for the oracle-model-generator library.
|
4
|
+
|
5
|
+
## Quick Start
|
6
|
+
|
7
|
+
### Using Docker Compose (Recommended)
|
8
|
+
|
9
|
+
The easiest way to test the library is using Docker Compose, which will start both an Oracle database and the testing environment:
|
10
|
+
|
11
|
+
```bash
|
12
|
+
# Build and start the services
|
13
|
+
docker-compose up --build
|
14
|
+
|
15
|
+
# This will:
|
16
|
+
# 1. Download and start Oracle Express Edition
|
17
|
+
# 2. Build the oracle-model-generator testing image
|
18
|
+
# 3. Set up the HR sample schema
|
19
|
+
# 4. Start an interactive shell in the testing container
|
20
|
+
```
|
21
|
+
|
22
|
+
### Manual Docker Build
|
23
|
+
|
24
|
+
If you prefer to build just the testing image:
|
25
|
+
|
26
|
+
```bash
|
27
|
+
# Build the Docker image
|
28
|
+
docker build -t oracle-model-generator-test .
|
29
|
+
|
30
|
+
# Run with a separate Oracle database
|
31
|
+
docker run -it --rm \
|
32
|
+
-e ORACLE_HOST=your-oracle-host \
|
33
|
+
-e ORACLE_PORT=1521 \
|
34
|
+
-e ORACLE_USER=hr \
|
35
|
+
-e ORACLE_PASSWORD=hr \
|
36
|
+
oracle-model-generator-test
|
37
|
+
```
|
38
|
+
|
39
|
+
## Running Tests
|
40
|
+
|
41
|
+
Once inside the container, you can run various commands:
|
42
|
+
|
43
|
+
```bash
|
44
|
+
# Run the Docker environment test to verify everything is working
|
45
|
+
bundle exec ruby test/docker_environment_test.rb
|
46
|
+
|
47
|
+
# Run the test suite
|
48
|
+
bundle exec ruby test/test_oracle_model_generator.rb
|
49
|
+
|
50
|
+
# Test the command-line tool
|
51
|
+
bundle exec ruby -Ilib bin/omg --help
|
52
|
+
|
53
|
+
# Interactive Ruby with the library loaded
|
54
|
+
irb -I lib -r oracle/model/generator
|
55
|
+
```
|
56
|
+
|
57
|
+
## Environment Variables
|
58
|
+
|
59
|
+
The Docker environment supports these environment variables:
|
60
|
+
|
61
|
+
- `ORACLE_HOST`: Oracle database hostname (default: localhost)
|
62
|
+
- `ORACLE_PORT`: Oracle database port (default: 1521)
|
63
|
+
- `ORACLE_SID`: Oracle database SID (default: XE)
|
64
|
+
- `ORACLE_USER`: Database username (default: hr)
|
65
|
+
- `ORACLE_PASSWORD`: Database password (default: hr)
|
66
|
+
|
67
|
+
## Summary
|
68
|
+
|
69
|
+
The Docker setup provides a robust testing environment for the Oracle Model Generator that:
|
70
|
+
|
71
|
+
- ✅ Works on all platforms (Linux, macOS, Windows)
|
72
|
+
- ✅ Includes Oracle Instant Client and ruby-oci8
|
73
|
+
- ✅ Has comprehensive environment verification
|
74
|
+
- ✅ Supports both standalone and full-stack testing
|
75
|
+
- ✅ Uses optimized gem installation for containers
|
76
|
+
- ⚠️ Oracle XE database has some macOS compatibility limitations
|
77
|
+
|
78
|
+
This gives you a reliable way to test Oracle connectivity without installing Oracle client libraries on your host system.
|
79
|
+
|
80
|
+
## Troubleshooting
|
81
|
+
|
82
|
+
### macOS Docker Issues
|
83
|
+
|
84
|
+
On macOS, you might encounter shared memory issues with the Oracle XE container:
|
85
|
+
|
86
|
+
```
|
87
|
+
ORA-27104: system-defined limits for shared memory was misconfigured
|
88
|
+
```
|
89
|
+
|
90
|
+
**Workaround**: Test the application container directly:
|
91
|
+
|
92
|
+
```bash
|
93
|
+
# Build and test just the application
|
94
|
+
docker build -t oracle-model-generator-test .
|
95
|
+
|
96
|
+
# Run the environment verification test
|
97
|
+
docker run --rm oracle-model-generator-test bundle exec ruby test/docker_environment_test.rb
|
98
|
+
|
99
|
+
# Interactive testing without database
|
100
|
+
docker run -it --rm oracle-model-generator-test bash
|
101
|
+
```
|
102
|
+
|
103
|
+
### Connection Issues
|
104
|
+
|
105
|
+
If you get Oracle connection errors:
|
106
|
+
|
107
|
+
1. Check that the Oracle database is running: `docker-compose ps`
|
108
|
+
2. Wait for the database to be fully initialized (can take 2-3 minutes)
|
109
|
+
3. Verify connection parameters match your setup
|
110
|
+
|
111
|
+
### Build Issues
|
112
|
+
|
113
|
+
If the Docker build fails:
|
114
|
+
|
115
|
+
1. Make sure you have internet access (downloads Oracle Instant Client)
|
116
|
+
2. Try rebuilding: `docker-compose build --no-cache`
|
117
|
+
|
118
|
+
### Test Failures
|
119
|
+
|
120
|
+
If tests fail but connection works:
|
121
|
+
|
122
|
+
1. Verify the HR schema is properly installed
|
123
|
+
2. Check that sample data is present
|
124
|
+
3. Ensure the user has necessary permissions
|
125
|
+
|
126
|
+
## Development
|
127
|
+
|
128
|
+
To develop/debug the library using Docker:
|
129
|
+
|
130
|
+
```bash
|
131
|
+
# Start the container with a bash shell
|
132
|
+
docker-compose run oracle-model-generator bash
|
133
|
+
|
134
|
+
# Or mount the local directory for live editing
|
135
|
+
docker run -it --rm -v $(pwd):/app oracle-model-generator-test bash
|
136
|
+
```
|
137
|
+
|
138
|
+
## Cleaning Up
|
139
|
+
|
140
|
+
To remove all Docker resources:
|
141
|
+
|
142
|
+
```bash
|
143
|
+
# Stop and remove containers
|
144
|
+
docker-compose down
|
145
|
+
|
146
|
+
# Also remove volumes (this will delete the Oracle database data)
|
147
|
+
docker-compose down -v
|
148
|
+
|
149
|
+
# Remove the built images
|
150
|
+
docker rmi oracle-model-generator-test
|
151
|
+
docker rmi gvenzl/oracle-xe:21-slim
|
152
|
+
```
|
data/Dockerfile
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
# Dockerfile for testing oracle-model-generator library
|
2
|
+
FROM ruby:3.1-bullseye
|
3
|
+
|
4
|
+
# Install system dependencies
|
5
|
+
RUN apt-get update && apt-get install -y \
|
6
|
+
wget \
|
7
|
+
unzip \
|
8
|
+
libaio1 \
|
9
|
+
libaio-dev \
|
10
|
+
build-essential \
|
11
|
+
&& rm -rf /var/lib/apt/lists/*
|
12
|
+
|
13
|
+
# Download and install Oracle Instant Client
|
14
|
+
WORKDIR /opt/oracle
|
15
|
+
RUN wget https://download.oracle.com/otn_software/linux/instantclient/1913000/instantclient-basic-linux.x64-19.13.0.0.0dbru.zip && \
|
16
|
+
wget https://download.oracle.com/otn_software/linux/instantclient/1913000/instantclient-sdk-linux.x64-19.13.0.0.0dbru.zip && \
|
17
|
+
unzip instantclient-basic-linux.x64-19.13.0.0.0dbru.zip && \
|
18
|
+
unzip instantclient-sdk-linux.x64-19.13.0.0.0dbru.zip && \
|
19
|
+
rm -f *.zip
|
20
|
+
|
21
|
+
# Set Oracle environment variables
|
22
|
+
ENV ORACLE_HOME=/opt/oracle/instantclient_19_13
|
23
|
+
ENV LD_LIBRARY_PATH=$ORACLE_HOME
|
24
|
+
ENV PATH=$ORACLE_HOME:$PATH
|
25
|
+
|
26
|
+
# Create symbolic links for OCI8 compilation
|
27
|
+
RUN cd $ORACLE_HOME && \
|
28
|
+
ln -sf libclntsh.so.19.1 libclntsh.so && \
|
29
|
+
ln -sf libocci.so.19.1 libocci.so
|
30
|
+
|
31
|
+
# Set working directory for the application
|
32
|
+
WORKDIR /app
|
33
|
+
|
34
|
+
# Copy gemspec and Gemfile first for better Docker layer caching
|
35
|
+
COPY oracle-model-generator.gemspec Gemfile ./
|
36
|
+
|
37
|
+
# Install Ruby dependencies
|
38
|
+
RUN bundle config set --local deployment false && \
|
39
|
+
bundle install --verbose
|
40
|
+
|
41
|
+
# Copy the rest of the application
|
42
|
+
COPY . .
|
43
|
+
|
44
|
+
# Create a script to run tests with Oracle connection
|
45
|
+
RUN echo '#!/bin/bash\n\
|
46
|
+
echo "Starting Oracle Model Generator test environment..."\n\
|
47
|
+
echo ""\n\
|
48
|
+
echo "This Docker container includes:"\n\
|
49
|
+
echo "- Ruby $(ruby --version)"\n\
|
50
|
+
echo "- Oracle Instant Client 19.13"\n\
|
51
|
+
echo "- All required gems for oracle-model-generator"\n\
|
52
|
+
echo ""\n\
|
53
|
+
echo "To run tests, you need to:"\n\
|
54
|
+
echo "1. Have an Oracle database running (Oracle XE recommended)"\n\
|
55
|
+
echo "2. Ensure the '\''hr'\'' schema is available with sample data"\n\
|
56
|
+
echo "3. Update connection parameters in test file if needed"\n\
|
57
|
+
echo ""\n\
|
58
|
+
echo "Available commands:"\n\
|
59
|
+
echo " bundle exec ruby test/test_oracle_model_generator.rb # Run tests"\n\
|
60
|
+
echo " bundle exec ruby -Ilib bin/omg --help # Run CLI tool"\n\
|
61
|
+
echo " irb -I lib -r oracle/model/generator # Interactive Ruby"\n\
|
62
|
+
echo ""\n\
|
63
|
+
echo "Current Oracle environment:"\n\
|
64
|
+
echo " ORACLE_HOME: $ORACLE_HOME"\n\
|
65
|
+
echo " LD_LIBRARY_PATH: $LD_LIBRARY_PATH"\n\
|
66
|
+
echo ""\n\
|
67
|
+
\n\
|
68
|
+
# Check if arguments were passed to run specific commands\n\
|
69
|
+
if [ $# -eq 0 ]; then\n\
|
70
|
+
echo "No command specified. Starting bash shell..."\n\
|
71
|
+
exec /bin/bash\n\
|
72
|
+
else\n\
|
73
|
+
exec "$@"\n\
|
74
|
+
fi' > /app/run_tests.sh
|
75
|
+
|
76
|
+
RUN chmod +x /app/run_tests.sh
|
77
|
+
|
78
|
+
# Expose any ports that might be needed (none for this library)
|
79
|
+
# EXPOSE 8080
|
80
|
+
|
81
|
+
# Set the default command
|
82
|
+
CMD ["/app/run_tests.sh"]
|
83
|
+
|
84
|
+
# Add some helpful labels
|
85
|
+
LABEL maintainer="Testing Environment for oracle-model-generator"
|
86
|
+
LABEL description="Docker image for testing the oracle-model-generator Ruby library with Oracle Instant Client"
|
87
|
+
LABEL version="1.0"
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,177 @@
|
|
1
|
+
|
2
|
+
Apache License
|
3
|
+
Version 2.0, January 2004
|
4
|
+
http://www.apache.org/licenses/
|
5
|
+
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
7
|
+
|
8
|
+
1. Definitions.
|
9
|
+
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
12
|
+
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
14
|
+
the copyright owner that is granting the License.
|
15
|
+
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
17
|
+
other entities that control, are controlled by, or are under common
|
18
|
+
control with that entity. For the purposes of this definition,
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
20
|
+
direction or management of such entity, whether by contract or
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
23
|
+
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
25
|
+
exercising permissions granted by this License.
|
26
|
+
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
28
|
+
including but not limited to software source code, documentation
|
29
|
+
source, and configuration files.
|
30
|
+
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
32
|
+
transformation or translation of a Source form, including but
|
33
|
+
not limited to compiled object code, generated documentation,
|
34
|
+
and conversions to other media types.
|
35
|
+
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
37
|
+
Object form, made available under the License, as indicated by a
|
38
|
+
copyright notice that is included in or attached to the work
|
39
|
+
(an example is provided in the Appendix below).
|
40
|
+
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
47
|
+
the Work and Derivative Works thereof.
|
48
|
+
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
50
|
+
the original version of the Work and any modifications or additions
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
62
|
+
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
65
|
+
subsequently incorporated within the Work.
|
66
|
+
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
73
|
+
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
79
|
+
where such license applies only to those patent claims licensable
|
80
|
+
by such Contributor that are necessarily infringed by their
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
83
|
+
institute patent litigation against any entity (including a
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
86
|
+
or contributory patent infringement, then any patent licenses
|
87
|
+
granted to You under this License for that Work shall terminate
|
88
|
+
as of the date such litigation is filed.
|
89
|
+
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
92
|
+
modifications, and in Source or Object form, provided that You
|
93
|
+
meet the following conditions:
|
94
|
+
|
95
|
+
(a) You must give any other recipients of the Work or
|
96
|
+
Derivative Works a copy of this License; and
|
97
|
+
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
99
|
+
stating that You changed the files; and
|
100
|
+
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
103
|
+
attribution notices from the Source form of the Work,
|
104
|
+
excluding those notices that do not pertain to any part of
|
105
|
+
the Derivative Works; and
|
106
|
+
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
109
|
+
include a readable copy of the attribution notices contained
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
112
|
+
of the following places: within a NOTICE text file distributed
|
113
|
+
as part of the Derivative Works; within the Source form or
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
115
|
+
within a display generated by the Derivative Works, if and
|
116
|
+
wherever such third-party notices normally appear. The contents
|
117
|
+
of the NOTICE file are for informational purposes only and
|
118
|
+
do not modify the License. You may add Your own attribution
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
121
|
+
that such additional attribution notices cannot be construed
|
122
|
+
as modifying the License.
|
123
|
+
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
125
|
+
may provide additional or different license terms and conditions
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
129
|
+
the conditions stated in this License.
|
130
|
+
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
134
|
+
this License, without any additional terms or conditions.
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
136
|
+
the terms of any separate license agreement you may have executed
|
137
|
+
with Licensor regarding such Contributions.
|
138
|
+
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
141
|
+
except as required for reasonable and customary use in describing the
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
143
|
+
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
153
|
+
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
159
|
+
incidental, or consequential damages of any character arising as a
|
160
|
+
result of this License or out of the use or inability to use the
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
163
|
+
other commercial damages or losses), even if such Contributor
|
164
|
+
has been advised of the possibility of such damages.
|
165
|
+
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
169
|
+
or other liability obligations and/or rights consistent with this
|
170
|
+
License. However, in accepting such obligations, You may act only
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
175
|
+
of your accepting any such warranty or additional liability.
|
176
|
+
|
177
|
+
END OF TERMS AND CONDITIONS
|
data/{MANIFEST → MANIFEST.md}
RENAMED
data/README-Docker.md
ADDED
@@ -0,0 +1,140 @@
|
|
1
|
+
# Docker Testing Environment for Oracle Model Generator
|
2
|
+
|
3
|
+
This directory contains a complete Docker setup for testing the oracle-model-generator Ruby library with Oracle database connectivity.
|
4
|
+
|
5
|
+
## Files Created
|
6
|
+
|
7
|
+
### Docker Configuration
|
8
|
+
- `Dockerfile` - Production-ready Docker image with Oracle connectivity
|
9
|
+
- `docker-compose.yml` - Complete testing environment with Oracle XE database
|
10
|
+
- `.dockerignore` - Optimizes Docker build context
|
11
|
+
|
12
|
+
### Testing Files
|
13
|
+
- `test/test_oracle_model_generator_docker.rb` - Docker-optimized test suite
|
14
|
+
- `DOCKER.md` - Detailed documentation and troubleshooting guide
|
15
|
+
|
16
|
+
## Quick Start
|
17
|
+
|
18
|
+
### Option 1: Full Testing Environment (with Oracle Database)
|
19
|
+
|
20
|
+
1. **Start the complete environment:**
|
21
|
+
```bash
|
22
|
+
docker-compose up -d
|
23
|
+
```
|
24
|
+
|
25
|
+
2. **Wait for Oracle database to be ready:**
|
26
|
+
```bash
|
27
|
+
docker-compose logs -f oracle-db
|
28
|
+
# Wait for "DATABASE IS READY TO USE!" message
|
29
|
+
```
|
30
|
+
|
31
|
+
3. **Run tests:**
|
32
|
+
```bash
|
33
|
+
docker-compose exec app ruby test/test_oracle_model_generator_docker.rb
|
34
|
+
```
|
35
|
+
|
36
|
+
4. **Interactive shell for development:**
|
37
|
+
```bash
|
38
|
+
docker-compose exec app bash
|
39
|
+
```
|
40
|
+
|
41
|
+
### Option 2: Build and Test Application Only
|
42
|
+
|
43
|
+
1. **Build the image:**
|
44
|
+
```bash
|
45
|
+
docker build -t oracle-model-generator .
|
46
|
+
```
|
47
|
+
|
48
|
+
2. **Run with external database:**
|
49
|
+
```bash
|
50
|
+
docker run -e ORACLE_HOST=your-db-host \
|
51
|
+
-e ORACLE_PORT=1521 \
|
52
|
+
-e ORACLE_SID=your-sid \
|
53
|
+
-e ORACLE_USER=your-user \
|
54
|
+
-e ORACLE_PASSWORD=your-password \
|
55
|
+
oracle-model-generator
|
56
|
+
```
|
57
|
+
|
58
|
+
## Environment Variables
|
59
|
+
|
60
|
+
The Docker environment supports these variables for database connection:
|
61
|
+
|
62
|
+
- `ORACLE_HOST` - Database hostname (default: oracle-db)
|
63
|
+
- `ORACLE_PORT` - Database port (default: 1521)
|
64
|
+
- `ORACLE_SID` - Database SID (default: XE)
|
65
|
+
- `ORACLE_USER` - Database username (default: hr)
|
66
|
+
- `ORACLE_PASSWORD` - Database password (default: oracle)
|
67
|
+
|
68
|
+
## What's Included
|
69
|
+
|
70
|
+
### Oracle Instant Client 19.13
|
71
|
+
- Full Oracle connectivity libraries
|
72
|
+
- Properly configured environment variables
|
73
|
+
- Native compilation support for ruby-oci8
|
74
|
+
|
75
|
+
### Ruby Environment
|
76
|
+
- Ruby 3.1 with bundler
|
77
|
+
- All project dependencies installed
|
78
|
+
- Optimized for Oracle development
|
79
|
+
|
80
|
+
### Test Database (via docker-compose)
|
81
|
+
- Oracle Express Edition 21c
|
82
|
+
- Pre-configured HR sample schema
|
83
|
+
- Ready-to-use test data
|
84
|
+
|
85
|
+
## Development Workflow
|
86
|
+
|
87
|
+
1. **Make code changes** in your local workspace
|
88
|
+
2. **Rebuild the image:** `docker-compose build app`
|
89
|
+
3. **Run tests:** `docker-compose exec app ruby test/test_oracle_model_generator_docker.rb`
|
90
|
+
4. **Debug interactively:** `docker-compose exec app bash`
|
91
|
+
|
92
|
+
## Troubleshooting
|
93
|
+
|
94
|
+
### Common Issues
|
95
|
+
|
96
|
+
1. **ruby-oci8 compilation errors:**
|
97
|
+
- Ensure Oracle Instant Client is properly installed
|
98
|
+
- Check environment variables are set correctly
|
99
|
+
- Verify build-essential package is installed
|
100
|
+
|
101
|
+
2. **Database connection failures:**
|
102
|
+
- Wait for Oracle container to fully initialize
|
103
|
+
- Check network connectivity between containers
|
104
|
+
- Verify database credentials
|
105
|
+
|
106
|
+
3. **Permission issues:**
|
107
|
+
- Ensure Docker has necessary permissions
|
108
|
+
- Check file ownership in mounted volumes
|
109
|
+
|
110
|
+
### Debugging Commands
|
111
|
+
|
112
|
+
```bash
|
113
|
+
# Check Oracle client installation
|
114
|
+
docker-compose exec app ls -la /opt/oracle/instantclient_19_13/
|
115
|
+
|
116
|
+
# Test database connectivity
|
117
|
+
docker-compose exec app sqlplus hr/oracle@oracle-db:1521/XE
|
118
|
+
|
119
|
+
# Check environment variables
|
120
|
+
docker-compose exec app env | grep ORACLE
|
121
|
+
|
122
|
+
# View bundler gem installation
|
123
|
+
docker-compose exec app bundle list
|
124
|
+
```
|
125
|
+
|
126
|
+
## Performance Notes
|
127
|
+
|
128
|
+
- Initial build takes 10-15 minutes (Oracle client compilation)
|
129
|
+
- Subsequent builds use Docker layer caching
|
130
|
+
- Oracle database initialization takes 2-3 minutes
|
131
|
+
- Consider using volumes for persistent development
|
132
|
+
|
133
|
+
## Security Considerations
|
134
|
+
|
135
|
+
- Default passwords are for development only
|
136
|
+
- Use Docker secrets for production deployments
|
137
|
+
- Limit network exposure in production environments
|
138
|
+
- Regular security updates for base images
|
139
|
+
|
140
|
+
For detailed information, see `DOCKER.md`.
|