Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions configureWorkspace/config-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export type Platform = 'Go' |
'ASP.NET Core' |
'Node.js' |
'Python' |
'Ruby' |
'Other';

/**
Expand Down Expand Up @@ -43,6 +44,7 @@ export async function quickPickPlatform(): Promise<Platform> {
'ASP.NET Core',
'Node.js',
'Python',
'Ruby',
'Other'
];

Expand Down
43 changes: 43 additions & 0 deletions configureWorkspace/configure.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,26 @@ CMD ["python3", "-m", "${serviceName}"]
# Using miniconda (make sure to replace 'myenv' w/ your environment name):
#RUN conda env create -f environment.yml
#CMD /bin/bash -c "source activate myenv && python3 -m ${serviceName}"
`;

case 'ruby':

return `
FROM ruby:2.5-slim

LABEL Name=${serviceName} Version=${version}
EXPOSE ${port}

# throw errors if Gemfile has been modified since Gemfile.lock
RUN bundle config --global frozen 1

WORKDIR /app
COPY . /app

COPY Gemfile Gemfile.lock ./
RUN bundle install

CMD ["ruby", "${serviceName}.rb"]
`;

case 'java':
Expand Down Expand Up @@ -245,6 +265,16 @@ services:
case 'python':
return `version: '2.1'

services:
${serviceName}:
image: ${serviceName}
build: .
ports:
- ${port}:${port}`;

case 'ruby':
return `version: '2.1'

services:
${serviceName}:
image: ${serviceName}
Expand Down Expand Up @@ -338,6 +368,19 @@ services:
case 'python':
return `version: '2.1'

services:
${serviceName}:
image: ${serviceName}
build:
context: .
dockerfile: Dockerfile
ports:
- ${port}:${port}
`;

case 'ruby':
return `version: '2.1'

services:
${serviceName}:
image: ${serviceName}
Expand Down
17 changes: 17 additions & 0 deletions test/configure.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,23 @@ suite("configure (Add Docker files to Workspace)", function (this: Suite): void
});
});

// Ruby

suite("Ruby", () => {
testInEmptyFolder("Ruby", async () => {
await testConfigureDocker('Ruby', undefined /*port*/);

let projectFiles = await getFilesInProject();
assertEx.unorderedArraysEqual(projectFiles, ['Dockerfile', 'docker-compose.debug.yml', 'docker-compose.yml', '.dockerignore'], "The set of files in the project folder after configure was run is not correct.");

assertFileContains('Dockerfile', 'FROM ruby:2.5-slim');
assertFileContains('Dockerfile', 'LABEL Name=testoutput Version=0.0.1');
assertFileContains('Dockerfile', 'COPY Gemfile Gemfile.lock ./');
assertFileContains('Dockerfile', 'RUN bundle install');
assertFileContains('Dockerfile', 'CMD ["ruby", "testoutput.rb"]');
});
});

//

});