Skip to content

Commit 9630ea3

Browse files
authored
Merge pull request rsim#278 from yahonda/add-contributing-md
Add CONTRIBUTING.md and trim README
2 parents d096dd5 + a9779fe commit 9630ea3

2 files changed

Lines changed: 148 additions & 32 deletions

File tree

CONTRIBUTING.md

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
# Contributing to ruby-plsql
2+
3+
Thanks for your interest in contributing! This document covers how to
4+
report issues, open pull requests, and run the test suite locally.
5+
6+
## Reporting issues
7+
8+
File issues at https://github.com/rsim/ruby-plsql/issues. Please
9+
include:
10+
11+
- ruby-plsql version (or commit SHA if you're on a branch)
12+
- Oracle Database version
13+
- Ruby engine and version (MRI / JRuby)
14+
- A minimal reproduction — runnable code, expected vs. actual behavior
15+
16+
## Submitting pull requests
17+
18+
1. Fork the repository and create a topic branch off `master`.
19+
2. Make your change. Include a regression test whenever practical.
20+
3. Run the full spec suite (see below) and RuboCop.
21+
4. Open a pull request against `rsim/ruby-plsql:master` describing
22+
what changed and why.
23+
24+
## Development with devcontainer
25+
26+
The repository ships with a devcontainer configuration that provides a
27+
complete development environment with Oracle Database and all required
28+
dependencies pre-configured. It supports both x64 and ARM64 hosts, and
29+
is the recommended way to work on ruby-plsql.
30+
31+
### Prerequisites
32+
33+
- [Docker](https://www.docker.com/get-started) installed and running
34+
- [VS Code](https://code.visualstudio.com/) with the
35+
[Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers)
36+
37+
### Getting started
38+
39+
1. Clone the repository:
40+
```sh
41+
git clone https://github.com/rsim/ruby-plsql.git
42+
cd ruby-plsql
43+
```
44+
2. Open the project in VS Code:
45+
```sh
46+
code .
47+
```
48+
3. When prompted, click "Reopen in Container" — or from the Command
49+
Palette (`Ctrl+Shift+P` / `Cmd+Shift+P`) run
50+
"Dev Containers: Reopen in Container".
51+
4. VS Code builds and starts the environment automatically. This
52+
includes Ruby 4.0, Oracle Database Free (latest), Oracle Instant
53+
Client (latest 23.x), and all gems from `bundle install`.
54+
55+
### What's included
56+
57+
- **Ruby**: 4.0
58+
- **Oracle Database**: Free (latest)
59+
- **Oracle Instant Client**: latest 23.x
60+
- **Database configuration**:
61+
- Port `1521` is forwarded from the container
62+
- Service name: `FREEPDB1`
63+
- System password: `Oracle18`
64+
- TNS configuration in `ci/network/admin`
65+
- Test users (`hr`, `arunit`) are provisioned automatically via
66+
`ci/setup_accounts.sh`
67+
68+
## Running the test suite
69+
70+
Inside the devcontainer:
71+
72+
```sh
73+
bundle exec rake spec # full suite
74+
bundle exec rspec spec/path/to/file_spec.rb # single file
75+
bundle exec rspec spec/path/to/file_spec.rb:42 # single example
76+
```
77+
78+
### Reproducing a specific run
79+
80+
Specs run in randomized order. The seed is printed at the start of the
81+
run, e.g.:
82+
83+
```
84+
==> Randomized with seed 12345 (reproduce: bundle exec rspec --seed 12345)
85+
```
86+
87+
To reproduce that exact run:
88+
89+
```sh
90+
bundle exec rspec --seed 12345
91+
```
92+
93+
If a failure looks order-dependent, narrow it down to the minimal
94+
failing pair with `--bisect`:
95+
96+
```sh
97+
bundle exec rspec --seed 12345 --bisect
98+
```
99+
100+
The seed line is also visible in CI job logs, including partial logs
101+
when a run hangs and is cancelled.
102+
103+
## Running RuboCop
104+
105+
```sh
106+
BUNDLE_ONLY=rubocop bundle install
107+
BUNDLE_ONLY=rubocop bundle exec rubocop --parallel
108+
```
109+
110+
These are the same commands CI runs (`.github/workflows/rubocop.yml`).
111+
112+
## Manual setup (without devcontainer)
113+
114+
If you prefer to develop against an existing Oracle Database, review
115+
`spec/spec_helper.rb` for the default schema/user names and database
116+
names (override via environment variables as needed).
117+
118+
### Prepare the database
119+
120+
Use any reachable Oracle Database and create the test schemas:
121+
122+
```sql
123+
CREATE USER hr IDENTIFIED BY hr;
124+
GRANT unlimited tablespace, create session, create table,
125+
create sequence, create procedure, create type,
126+
create view, create synonym TO hr;
127+
128+
CREATE USER arunit IDENTIFIED BY arunit;
129+
GRANT create session TO arunit;
130+
```
131+
132+
The CI helper `ci/setup_accounts.sh` performs the equivalent setup
133+
against `${DATABASE_NAME}` using `${DATABASE_SYS_PASSWORD}`.
134+
135+
### Prepare dependencies
136+
137+
```sh
138+
gem install bundler
139+
bundle install
140+
```
141+
142+
### Run the suite
143+
144+
```sh
145+
bundle exec rake spec
146+
```

README.md

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -180,31 +180,7 @@ Make sure you use correct version of Oracle client for database you're connectin
180180
TESTS
181181
-----
182182

183-
Review `spec/spec_helper.rb` to see default schema/user names and database names (use environment variables to override defaults)
184-
185-
##### Prepare database
186-
187-
In an Oracle Database create the following schemas for test purposes.
188-
189-
SQL> CREATE USER hr IDENTIFIED BY hr;
190-
SQL> GRANT unlimited tablespace, create session, create table, create sequence, create procedure, create type, create view, create synonym TO hr;
191-
192-
SQL> CREATE USER arunit IDENTIFIED BY arunit;
193-
SQL> GRANT create session TO arunit;
194-
195-
##### Prepare dependencies
196-
197-
* Install bundler with
198-
199-
gem install bundler
200-
201-
* Install necessary gems with
202-
203-
bundle install
204-
205-
##### Run tests
206-
207-
rake spec
183+
See [CONTRIBUTING.md](CONTRIBUTING.md) for how to set up a development environment and run the spec suite.
208184

209185
LINKS
210186
-----
@@ -216,13 +192,7 @@ LINKS
216192
CONTRIBUTORS
217193
------------
218194

219-
* Raimonds Simanovskis
220-
* Edgars Beigarts
221-
* Oleh Mykytyuk
222-
* Wiehann Matthysen
223-
* Dayle Larson
224-
* Yasuo Honda
225-
* Yavor Nikolov
195+
Thanks to everyone who has contributed to ruby-plsql over the years. The up-to-date list is maintained on GitHub: https://github.com/rsim/ruby-plsql/graphs/contributors
226196

227197
LICENSE
228198
-------

0 commit comments

Comments
 (0)