Skip to content

Commit

Permalink
fix(ruby): tweak generation
Browse files Browse the repository at this point in the history
  • Loading branch information
dsinghvi committed Nov 12, 2024
1 parent a6b7511 commit d5c9560
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 16 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/publish-ruby-sdk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
on:
push:
branches:
- dsinghvi/ruby-tweaks

jobs:
ruby-sdk:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-node@v3
with:
node-version: 18
cache: "yarn"

- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: fernapi
password: ${{ secrets.FERN_API_DOCKERHUB_PASSWORD }}

- name: Install
run: yarn install

- name: Build CLI
working-directory: ./generators/ruby/sdk
run: yarn dist:cli

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
file: ./generators/ruby/sdk/Dockerfile
platforms: linux/amd64,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=min
push: true
labels: version=0.9.0-rc0
tags: fernapi/fern-ruby-sdk:0.9.0-rc0
31 changes: 17 additions & 14 deletions generators/ruby/codegen/src/ast/Module_.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,21 +52,24 @@ export class Module_ extends AstNode {
let moduleWrappedItem: Module_ | Class_ | T = child;
let moduleBreadcrumbs: string[] = [locationGenerator.rootModule];
if (path) {
if (!locationGenerator.shouldFlattenModules) {
moduleBreadcrumbs = moduleBreadcrumbs.concat(locationGenerator.getModulePathFromTypeName(path));
const classWrapper = locationGenerator.getClassPathFromTypeName(path);

if (classWrapper !== undefined && includeFilename) {
moduleWrappedItem = new Class_({
classReference: new ClassReference({ name: classWrapper }),
includeInitializer: false,
children: child
});
}
} else {
moduleBreadcrumbs = locationGenerator.getModuleBreadcrumbs({ path, includeFilename, isType });
}
moduleBreadcrumbs = locationGenerator.getModuleBreadcrumbs({ path, includeFilename, isType });
}
// if (path) {
// if (!locationGenerator.shouldFlattenModules) {
// moduleBreadcrumbs = moduleBreadcrumbs.concat(locationGenerator.getModulePathFromTypeName(path));
// const classWrapper = locationGenerator.getClassPathFromTypeName(path);

// if (classWrapper !== undefined && includeFilename) {
// moduleWrappedItem = new Class_({
// classReference: new ClassReference({ name: classWrapper }),
// includeInitializer: false,
// children: child
// });
// }
// } else {
// moduleBreadcrumbs = locationGenerator.getModuleBreadcrumbs({ path, includeFilename, isType });
// }
// }

moduleBreadcrumbs.reverse().forEach(
(mod) =>
Expand Down
4 changes: 2 additions & 2 deletions generators/ruby/sdk/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# syntax = edrevo/dockerfile-plus
INCLUDE+ packages/generators/docker/Dockerfile.base

COPY generators/ruby/sdk/dist /dist

# Install Ruby and Rubocop for formatting
RUN apk update && apk add --no-cache build-base ruby ruby-dev && gem install rubocop

COPY generators/ruby/sdk/dist /dist

ENTRYPOINT ["node", "/dist/cli.cjs", "ruby-sdk"]

0 comments on commit d5c9560

Please sign in to comment.