-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
36 changed files
with
729 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# [Choice] Ruby version (use -bullseye variants on local arm64/Apple Silicon): 3, 3.0, 2, 2.7, 2.6, 3-bullseye, 3.0-bullseye, 2-bullseye, 2.7-bullseye, 2.6-bullseye, 3-buster, 3.0-buster, 2-buster, 2.7-buster, 2.6-buster | ||
ARG VARIANT=2-bullseye | ||
FROM mcr.microsoft.com/vscode/devcontainers/ruby:0-${VARIANT} | ||
|
||
# Install Rails | ||
RUN gem install rails webdrivers | ||
|
||
# Default value to allow debug server to serve content over GitHub Codespace's port forwarding service | ||
# The value is a comma-separated list of allowed domains | ||
ENV RAILS_DEVELOPMENT_HOSTS=".githubpreview.dev" | ||
|
||
# [Choice] Node.js version: lts/*, 16, 14, 12, 10 | ||
ARG NODE_VERSION="lts/*" | ||
RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1" | ||
|
||
# [Optional] Uncomment this section to install additional OS packages. | ||
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ | ||
# && apt-get -y install --no-install-recommends <your-package-list-here> | ||
|
||
# [Optional] Uncomment this line to install additional gems. | ||
# RUN gem install <your-gem-names-here> | ||
|
||
# [Optional] Uncomment this line to install global node packages. | ||
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1 | ||
|
||
RUN apt-get update | ||
RUN apt-get install -y imagemagick | ||
|
||
WORKDIR /usr/local | ||
ARG REDMINE_VERSION=master | ||
RUN git clone https://github.com/redmine/redmine.git -b ${REDMINE_VERSION} | ||
WORKDIR /usr/local/redmine | ||
COPY .devcontainer/database.yml /usr/local/redmine/config/database.yml | ||
|
||
RUN rm -rf .git | ||
RUN echo "gem 'ruby-debug-ide'" >> Gemfile | ||
RUN echo "gem 'debase'" >> Gemfile | ||
RUN echo "gem 'rufo'" >> Gemfile | ||
ENV DB=sqlite3 | ||
RUN bundle install | ||
RUN bundle exec rake db:migrate | ||
RUN bundle exec rake db:migrate RAILS_ENV=test | ||
RUN bundle exec rake test:scm:setup:all | ||
COPY .devcontainer/launch.json /usr/local/redmine/.vscode/launch.json | ||
RUN chown -R vscode . | ||
|
||
COPY .devcontainer/post-create.sh /post-create.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
CREATE USER vscode CREATEDB; | ||
CREATE DATABASE vscode WITH OWNER vscode; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# SQLite version 3.x | ||
# gem install sqlite3 | ||
# | ||
# Ensure the SQLite 3 gem is defined in your Gemfile | ||
# gem 'sqlite3' | ||
# | ||
sqlite3: &sqlite3 | ||
adapter: sqlite3 | ||
pool: 5 | ||
timeout: 5000 | ||
database: db/redmine.sqlite3 | ||
|
||
sqlite3_test: &sqlite3_test | ||
<<: *<%= 'sqlite3' %> | ||
database: db/redmine.sqlite3_test | ||
|
||
mysql: &mysql | ||
adapter: mysql2 | ||
encoding: utf8 | ||
database: <%= ENV['DB_NAME'] || 'redmine' %> | ||
username: <%= ENV['DB_USERNAME'] || 'root' %> | ||
password: <%= ENV['DB_PASSWORD'] || 'root' %> | ||
host: <%= ENV['DB_HOST'] || 'mysql' %> | ||
port: <%= ENV['DB_PORT'] || 3306 %> | ||
|
||
mysql_test: &mysql_test | ||
<<: *<%= 'mysql' %> | ||
database: redmine_test | ||
|
||
postgres: &postgres | ||
adapter: postgresql | ||
encoding: utf8 | ||
database: <%= ENV['DB_NAME'] || 'redmine' %> | ||
username: <%= ENV['DB_USERNAME'] || 'postgres' %> | ||
password: <%= ENV['DB_PASSWORD'] || 'postgres' %> | ||
host: <%= ENV['DB_HOST'] || 'postgres' %> | ||
port: <%= ENV['DB_PORT'] || 5432 %> | ||
|
||
postgres_test: &postgres_test | ||
<<: *<%= 'postgres' %> | ||
database: redmine_test | ||
|
||
|
||
development: | ||
<<: *<%= ENV['DB'] || 'sqlite3' %> | ||
|
||
|
||
# Warning: The database defined as "test" will be erased and | ||
# re-generated from your development database when you run "rake". | ||
# Do not set this db to the same as development or production. | ||
test: | ||
<<: *<%= "#{ENV['DB']}_test" || 'sqlite3_test' %> | ||
|
||
|
||
production: | ||
<<: *<%= ENV['DB'] || 'sqlite3' %> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: | ||
// https://github.com/microsoft/vscode-dev-containers/tree/v0.202.5/containers/ruby-rails-postgres | ||
// Update the VARIANT arg in docker-compose.yml to pick a Ruby version | ||
{ | ||
"name": "Ruby on Rails & Postgres", | ||
"dockerComposeFile": "docker-compose.yml", | ||
"service": "app", | ||
|
||
"workspaceFolder": "/usr/local/redmine", | ||
|
||
// Set *default* container specific settings.json values on container create. | ||
"settings": { | ||
"sqltools.connections": [ | ||
{ | ||
"name": "Rails Development Database", | ||
"driver": "PostgreSQL", | ||
"previewLimit": 50, | ||
"server": "localhost", | ||
"port": 5432, | ||
|
||
// update this to match config/database.yml | ||
"database": "app_development", | ||
"username": "vscode" | ||
}, | ||
{ | ||
"name": "Rails Test Database", | ||
"driver": "PostgreSQL", | ||
"previewLimit": 50, | ||
"server": "localhost", | ||
"port": 5432, | ||
|
||
// update this to match config/database.yml | ||
"database": "app_test", | ||
"username": "vscode" | ||
} | ||
] | ||
}, | ||
|
||
// Add the IDs of extensions you want installed when the container is created. | ||
"extensions": [ | ||
"rebornix.Ruby", | ||
"mtxr.sqltools", | ||
"mtxr.sqltools-driver-pg", | ||
"craigmaslowski.erb", | ||
"hridoy.rails-snippets", | ||
"misogi.ruby-rubocop", | ||
"jnbt.vscode-rufo", | ||
"donjayamanne.git-extension-pack" | ||
], | ||
|
||
// Use 'forwardPorts' to make a list of ports inside the container available locally. | ||
// "forwardPorts": [3000, 5432], | ||
|
||
// Use 'postCreateCommand' to run commands after the container is created. | ||
"postCreateCommand": "sh -x /post-create.sh", | ||
|
||
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. | ||
"remoteUser": "vscode", | ||
"features": { | ||
// "git": "latest" | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
version: '3' | ||
|
||
services: | ||
app: | ||
build: | ||
context: .. | ||
dockerfile: .devcontainer/Dockerfile | ||
args: | ||
# Update 'VARIANT' to pick a version of Ruby: 3, 3.0, 2, 2.7, 2.6 | ||
# Append -bullseye or -buster to pin to an OS version. | ||
# Use -bullseye variants on local arm64/Apple Silicon. | ||
VARIANT: "3.0" | ||
# Optional Node.js version to install | ||
NODE_VERSION: "lts/*" | ||
REDMINE_VERSION: "5.0-stable" | ||
|
||
volumes: | ||
- ..:/usr/local/redmine/plugins/redmine_code_review:cached | ||
|
||
# Overrides default command so things don't shut down after the process ends. | ||
command: sleep infinity | ||
|
||
# Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function. | ||
# network_mode: service:postgres | ||
# Uncomment the next line to use a non-root user for all processes. | ||
# user: vscode | ||
|
||
# Use "forwardPorts" in **devcontainer.json** to forward an app port locally. | ||
# (Adding the "ports" property to this file will not forward from a Codespace.) | ||
|
||
postgres: | ||
image: postgres:latest | ||
restart: unless-stopped | ||
volumes: | ||
- postgres-data:/var/lib/postgresql/data | ||
- ./create-db-user.sql:/docker-entrypoint-initdb.d/create-db-user.sql | ||
environment: | ||
POSTGRES_USER: postgres | ||
POSTGRES_DB: redmine | ||
POSTGRES_PASSWORD: postgres | ||
# Add "forwardPorts": ["5432"] to **devcontainer.json** to forward PostgreSQL locally. | ||
# (Adding the "ports" property to this file will not forward from a Codespace.) | ||
|
||
mysql: | ||
image: mysql:latest | ||
restart: unless-stopped | ||
volumes: | ||
- mysql-data:/var/lib/mysql | ||
# network_mode: service:postgres | ||
command: mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci | ||
environment: | ||
MYSQL_ROOT_PASSWORD: root | ||
MYSQL_USER: redmine | ||
MYSQL_DB: redmine | ||
MYSQL_PASSWORD: remine | ||
volumes: | ||
postgres-data: null | ||
mysql-data: null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
|
||
|
||
{ | ||
"name": "Rails server", | ||
"type": "Ruby", | ||
"request": "launch", | ||
"program": "${workspaceRoot}/bin/rails", | ||
"useBundler": true, | ||
"args": [ | ||
"server" | ||
] | ||
}, | ||
{ | ||
"name": "Rails server(postgres)", | ||
"type": "Ruby", | ||
"request": "launch", | ||
"program": "${workspaceRoot}/bin/rails", | ||
"useBundler": true, | ||
"args": [ | ||
"server" | ||
], | ||
"env":{ | ||
"DB": "postgres" | ||
} | ||
}, | ||
{ | ||
"name": "Rails server(mysql)", | ||
"type": "Ruby", | ||
"request": "launch", | ||
"program": "${workspaceRoot}/bin/rails", | ||
"useBundler": true, | ||
"args": [ | ||
"server" | ||
], | ||
"env":{ | ||
"DB": "mysql" | ||
} | ||
}, | ||
{ | ||
"name": "Plugin Test", | ||
"type": "Ruby", | ||
"request": "launch", | ||
"program": "${workspaceRoot}/bin/rake", | ||
"useBundler": true, | ||
"args": [ | ||
"redmine:plugins:test" | ||
], | ||
"env":{ | ||
"RAILS_ENV": "test" | ||
} | ||
}, | ||
{ | ||
"name": "Plugin Test(postgres)", | ||
"type": "Ruby", | ||
"request": "launch", | ||
"program": "${workspaceRoot}/bin/rake", | ||
"useBundler": true, | ||
"args": [ | ||
"redmine:plugins:test" | ||
], | ||
"env":{ | ||
"RAILS_ENV": "test", | ||
"DB": "postgres" | ||
} | ||
}, | ||
{ | ||
"name": "Plugin Test(mysql)", | ||
"type": "Ruby", | ||
"request": "launch", | ||
"program": "${workspaceRoot}/bin/rake", | ||
"useBundler": true, | ||
"args": [ | ||
"redmine:plugins:test" | ||
], | ||
"env":{ | ||
"RAILS_ENV": "test", | ||
"DB": "mysql" | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/sh | ||
cd /usr/local/redmine | ||
|
||
cp plugins/redmine_code_review/Gemfile_for_test plugins/redmine_code_review/Gemfile | ||
bundle install | ||
|
||
initdb() { | ||
bundle exec rake db:create | ||
bundle exec rake db:migrate | ||
bundle exec rake redmine:plugins:migrate | ||
|
||
bundle exec rake db:drop RAILS_ENV=test | ||
bundle exec rake db:create RAILS_ENV=test | ||
bundle exec rake db:migrate RAILS_ENV=test | ||
bundle exec rake redmine:plugins:migrate RAILS_ENV=test | ||
} | ||
|
||
export DB=sqlite3 | ||
|
||
initdb | ||
|
||
export DB=postgres | ||
|
||
initdb | ||
|
||
export DB=mysql | ||
|
||
initdb |
Oops, something went wrong.