зеркало из
https://github.com/rs-pro/activeadmin-quill_editor.git
synced 2026-08-28 15:36:17 +03:00
test: Update build setup
Этот коммит содержится в:
2
.env
2
.env
@@ -1,2 +0,0 @@
|
||||
UID=1000
|
||||
GID=1000
|
||||
@@ -4,14 +4,12 @@ inherit_from:
|
||||
|
||||
plugins:
|
||||
- rubocop-capybara
|
||||
- rubocop-packaging
|
||||
- rubocop-performance
|
||||
- rubocop-rails
|
||||
- rubocop-rspec
|
||||
- rubocop-rspec_rails
|
||||
|
||||
require:
|
||||
- rubocop-packaging
|
||||
|
||||
AllCops:
|
||||
Exclude:
|
||||
- bin/*
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
ruby 3.4.2
|
||||
35
Gemfile
35
Gemfile
@@ -3,27 +3,32 @@
|
||||
source 'https://rubygems.org'
|
||||
|
||||
if ENV['DEVEL'] == '1'
|
||||
# for Docker dev
|
||||
rails_ver = ENV.fetch('RAILS_VERSION')
|
||||
gem 'rails', rails_ver
|
||||
|
||||
gem 'activeadmin', ENV.fetch('ACTIVEADMIN_VERSION')
|
||||
gem 'activeadmin_quill_editor', path: './'
|
||||
gem 'appraisal', '~> 2.4'
|
||||
|
||||
if rails_ver.start_with?('7.0')
|
||||
gem 'concurrent-ruby', '1.3.4'
|
||||
gem 'sqlite3', '~> 1.4'
|
||||
else
|
||||
gem 'sqlite3'
|
||||
end
|
||||
else
|
||||
gemspec
|
||||
|
||||
gem 'sqlite3'
|
||||
end
|
||||
|
||||
ruby_ver = ENV.fetch('RUBY_VERSION', '')
|
||||
rails_ver = ENV.fetch('RAILS_VERSION', '')
|
||||
activeadmin_ver = ENV.fetch('ACTIVEADMIN_VERSION', '')
|
||||
|
||||
rails = rails_ver.empty? ? ['rails'] : ['rails', "~> #{rails_ver}"]
|
||||
gem(*rails)
|
||||
|
||||
activeadmin = activeadmin_ver.empty? ? ['activeadmin'] : ['activeadmin', "~> #{activeadmin_ver}"]
|
||||
gem(*activeadmin)
|
||||
|
||||
ruby32 = Gem::Version.new(ruby_ver) >= Gem::Version.new('3.2')
|
||||
rails72 = Gem::Version.new(rails_ver) >= Gem::Version.new('7.2')
|
||||
sqlite3 = ruby32 || rails72 ? ['sqlite3'] : ['sqlite3', '~> 1.4']
|
||||
gem(*sqlite3)
|
||||
|
||||
# NOTE: to avoid error: uninitialized constant ActiveSupport::LoggerThreadSafeLevel::Logger
|
||||
gem 'concurrent-ruby', '1.3.4'
|
||||
|
||||
# Misc
|
||||
gem 'bigdecimal'
|
||||
gem 'csv'
|
||||
gem 'mutex_m'
|
||||
gem 'puma'
|
||||
gem 'sassc'
|
||||
|
||||
56
Makefile
56
Makefile
@@ -1,38 +1,36 @@
|
||||
include extra/.env
|
||||
|
||||
help:
|
||||
@echo "Main targets: up / down / console / shell"
|
||||
@echo "Main targets: build / specs / up / server / specs / shell"
|
||||
|
||||
# Docker commands
|
||||
down:
|
||||
docker compose down
|
||||
# System commands
|
||||
|
||||
up:
|
||||
docker compose up
|
||||
build:
|
||||
@rm -f Gemfile.lock spec/dummy/db/*.sqlite3
|
||||
@docker compose -f extra/docker-compose.yml build
|
||||
|
||||
attach:
|
||||
docker compose attach app
|
||||
db_reset:
|
||||
@docker compose -f extra/docker-compose.yml run --rm app bin/rails db:reset db:test:prepare
|
||||
|
||||
up_attach:
|
||||
docker compose up -d && docker compose attach app
|
||||
|
||||
cleanup:
|
||||
docker container rm -f activeadmin_quill_editor_app && docker image rm -f activeadmin_quill_editor-app
|
||||
|
||||
# Rails specific commands
|
||||
console:
|
||||
docker compose exec -e "PAGER=more" app bin/rails console
|
||||
|
||||
routes:
|
||||
docker compose exec app bin/rails routes
|
||||
|
||||
specs:
|
||||
docker compose exec app bin/rspec --fail-fast
|
||||
|
||||
# Other commands
|
||||
bundle:
|
||||
docker compose exec app bundle
|
||||
up: build db_reset
|
||||
@docker compose -f extra/docker-compose.yml up
|
||||
|
||||
shell:
|
||||
docker compose exec -e "PAGER=more" app bash
|
||||
@docker compose -f extra/docker-compose.yml exec app bash
|
||||
|
||||
down:
|
||||
@docker compose -f extra/docker-compose.yml down --volumes --rmi local --remove-orphans
|
||||
|
||||
# App commands
|
||||
|
||||
console:
|
||||
@docker compose -f extra/docker-compose.yml exec app bin/rails console
|
||||
|
||||
lint:
|
||||
docker compose exec app bin/rubocop
|
||||
@docker compose -f extra/docker-compose.yml exec app bin/rubocop
|
||||
|
||||
server:
|
||||
@docker compose -f extra/docker-compose.yml exec app bin/rails server -b 0.0.0.0 -p ${SERVER_PORT}
|
||||
|
||||
specs:
|
||||
@docker compose -f extra/docker-compose.yml exec app bin/rspec --fail-fast
|
||||
|
||||
45
README.md
45
README.md
@@ -117,50 +117,7 @@ Some methods are provided for advanced use cases:
|
||||
|
||||
Project created by [Mattia Roccoberton](http://blocknot.es), thanks also to the good guys that opened issues and pull requests from time to time.
|
||||
|
||||
There 3 ways to interact with this project:
|
||||
|
||||
1) Using Docker:
|
||||
|
||||
```sh
|
||||
# Run rails server on the dummy app (=> http://localhost:3000 to access to ActiveAdmin):
|
||||
make up
|
||||
# Enter in a Rails console (with the dummy app started):
|
||||
make console
|
||||
# Enter in a shell (with the dummy app started):
|
||||
make shell
|
||||
# Run the linter on the project (with the dummy app started):
|
||||
make lint
|
||||
# Run the test suite (with the dummy app started):
|
||||
make specs
|
||||
# Remove container and image:
|
||||
make cleanup
|
||||
# To try different versions of Ruby/Rails/ActiveAdmin edit docker-compose.yml
|
||||
# For more commands please check the Makefile
|
||||
```
|
||||
|
||||
2) Using Appraisal:
|
||||
|
||||
```sh
|
||||
export RAILS_ENV=development
|
||||
# Install dependencies
|
||||
bin/appraisal
|
||||
# Run server (or any command)
|
||||
bin/appraisal rails s
|
||||
# Or with specific versions
|
||||
bin/appraisal rails71-activeadmin rails s
|
||||
```
|
||||
|
||||
3) With a local setup:
|
||||
|
||||
```sh
|
||||
# Dev setup (set the required envs)
|
||||
source extra/dev_setup.sh
|
||||
# Install dependencies
|
||||
bundle
|
||||
# Run server (or any command)
|
||||
bin/rails s
|
||||
# To try different versions of Rails/ActiveAdmin edit extra/dev_setup.sh
|
||||
```
|
||||
For development information please check [this document](extra/development.md).
|
||||
|
||||
## Do you like it? Star it!
|
||||
|
||||
|
||||
11
Rakefile
11
Rakefile
@@ -1,5 +1,16 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
begin
|
||||
require 'bundler/setup'
|
||||
rescue LoadError
|
||||
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
||||
end
|
||||
|
||||
APP_RAKEFILE = File.expand_path("spec/dummy/Rakefile", __dir__)
|
||||
load 'rails/tasks/engine.rake'
|
||||
|
||||
load 'rails/tasks/statistics.rake'
|
||||
|
||||
require 'bundler/gem_tasks'
|
||||
|
||||
begin
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# This command will automatically be run when you run "rails" with Rails gems
|
||||
# installed from the root of your application.
|
||||
|
||||
ENV['RAILS_ENV'] ||= 'test'
|
||||
ENV['RAILS_ENV'] ||= 'development'
|
||||
|
||||
ENGINE_ROOT = File.expand_path('..', __dir__)
|
||||
ENGINE_PATH = File.expand_path('../lib/activeadmin/quill_editor/engine', __dir__)
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
services:
|
||||
app:
|
||||
container_name: 'activeadmin_quill_editor_app'
|
||||
build:
|
||||
context: .
|
||||
dockerfile: ./extra/Dockerfile
|
||||
# dockerfile: ./extra/Dockerfile_alpine
|
||||
args:
|
||||
# Debian-based Ruby image:
|
||||
RUBY_IMAGE: ruby:3.4-slim
|
||||
UID: ${UID}
|
||||
environment:
|
||||
ACTIVEADMIN_VERSION: ~> 3.3
|
||||
RAILS_VERSION: ~> 8.0
|
||||
user: "${UID}:${GID}"
|
||||
ports:
|
||||
- '3000:3000'
|
||||
working_dir: '/app'
|
||||
volumes:
|
||||
- '.:/app'
|
||||
stdin_open: true
|
||||
tty: true
|
||||
entrypoint:
|
||||
- /bin/sh
|
||||
- ./extra/entrypoint.sh
|
||||
3
extra/.bashrc
Обычный файл
3
extra/.bashrc
Обычный файл
@@ -0,0 +1,3 @@
|
||||
alias ls='ls --color'
|
||||
alias ll='ls -l'
|
||||
alias la='ls -la'
|
||||
7
extra/.env
Обычный файл
7
extra/.env
Обычный файл
@@ -0,0 +1,7 @@
|
||||
COMPOSE_PROJECT_NAME=activeadmin_quill_editor
|
||||
|
||||
BUNDLER_VERSION=2.5.23
|
||||
SERVER_PORT=4000
|
||||
|
||||
UID=1000
|
||||
GID=1000
|
||||
@@ -1,21 +1,31 @@
|
||||
ARG RUBY_IMAGE=ruby:3
|
||||
FROM ${RUBY_IMAGE}
|
||||
|
||||
ARG UID
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
ENV DEVEL=1
|
||||
ENV LANG=C.UTF-8
|
||||
ENV RAILS_ENV=development
|
||||
|
||||
RUN apt-get update -qq
|
||||
RUN DEBIAN_FRONTEND=noninteractive apt-get install -yqq --no-install-recommends build-essential chromium libyaml-dev nano
|
||||
RUN apt-get install -yqq --no-install-recommends build-essential chromium less libyaml-dev nano netcat-traditional pkg-config
|
||||
|
||||
RUN gem install bundler
|
||||
ARG BUNDLER_VERSION
|
||||
RUN gem install bundler -v ${BUNDLER_VERSION}
|
||||
RUN echo 'gem: --no-document' > /etc/gemrc
|
||||
|
||||
RUN useradd -u ${UID} --shell /bin/bash app
|
||||
RUN mkdir -p /home/app && chown -R app:app /home/app
|
||||
RUN chown -R app /usr/local/bundle
|
||||
ARG UID
|
||||
RUN useradd -u $UID --shell /bin/bash app
|
||||
|
||||
USER ${UID}
|
||||
RUN mkdir -p /home/app && chown -R app:app /home/app
|
||||
|
||||
ARG RAILS_VERSION
|
||||
ENV RAILS_VERSION=$RAILS_VERSION
|
||||
|
||||
ARG ACTIVEADMIN_VERSION
|
||||
ENV ACTIVEADMIN_VERSION=$ACTIVEADMIN_VERSION
|
||||
|
||||
WORKDIR /app
|
||||
COPY . /app
|
||||
RUN bundle install
|
||||
RUN mkdir -p /app/spec/dummy/db && chown -R app:app /app/spec/dummy/db /usr/local/bundle
|
||||
|
||||
RUN ln -s /app/extra/.bashrc /home/app/.bashrc
|
||||
|
||||
6
extra/Dockerfile.dockerignore
Обычный файл
6
extra/Dockerfile.dockerignore
Обычный файл
@@ -0,0 +1,6 @@
|
||||
# Ignore everything but the required files for bundle install
|
||||
/**/*
|
||||
|
||||
!/*.gemspec
|
||||
!/Gemfile
|
||||
!/lib
|
||||
@@ -1,18 +0,0 @@
|
||||
FROM ruby:3.3-alpine
|
||||
|
||||
ARG UID
|
||||
|
||||
ENV DEVEL=1
|
||||
ENV LANG=C.UTF-8
|
||||
ENV RAILS_ENV=development
|
||||
|
||||
RUN apk update && apk add --no-cache build-base chromium tzdata yaml-dev
|
||||
|
||||
RUN gem install bundler
|
||||
RUN echo 'gem: --no-document' > /etc/gemrc
|
||||
|
||||
RUN adduser -u ${UID} -D app
|
||||
RUN mkdir -p /home/app && chown -R app:app /home/app
|
||||
RUN chown -R app /usr/local/bundle
|
||||
|
||||
COPY . /app
|
||||
@@ -1,21 +0,0 @@
|
||||
# Development
|
||||
|
||||
Overcommit can be used to ensure that Conventional commits are good.
|
||||
|
||||
## Releases
|
||||
|
||||
```sh
|
||||
# Update version.rb with the new version
|
||||
# Update the gemfiles:
|
||||
bin/appraisal
|
||||
```
|
||||
|
||||
## Testing
|
||||
|
||||
```sh
|
||||
# Running specs using a specific configuration:
|
||||
bin/appraisal rails60-activeadmin22 rspec
|
||||
# Using latest activeadmin version:
|
||||
bin/appraisal rails60-activeadmin rspec
|
||||
# See gemfiles for more configurations
|
||||
```
|
||||
39
extra/development.md
Обычный файл
39
extra/development.md
Обычный файл
@@ -0,0 +1,39 @@
|
||||
## Development
|
||||
|
||||
Overcommit can be used to ensure that Conventional commits are good.
|
||||
|
||||
### Dev setup
|
||||
|
||||
There 2 ways to interact with this project:
|
||||
|
||||
1) Using Docker:
|
||||
|
||||
```sh
|
||||
# Run rails server on the dummy app (=> http://localhost:3000 to access to ActiveAdmin):
|
||||
make up
|
||||
# Enter in a Rails console (with the dummy app started):
|
||||
make console
|
||||
# Enter in a shell (with the dummy app started):
|
||||
make shell
|
||||
# Run the linter on the project (with the dummy app started):
|
||||
make lint
|
||||
# Run the test suite (with the dummy app started):
|
||||
make specs
|
||||
# Remove container and image:
|
||||
make cleanup
|
||||
# To try different versions of Ruby/Rails/ActiveAdmin:
|
||||
RUBY=3.2 RAILS=7.1.0 ACTIVEADMIN=3.2.0 make up
|
||||
# For more commands please check the Makefile
|
||||
```
|
||||
|
||||
2) With a local setup:
|
||||
|
||||
```sh
|
||||
# Dev setup (set the required envs):
|
||||
source extra/dev_setup.sh
|
||||
# Install dependencies:
|
||||
bundle update
|
||||
# Run server (or any command):
|
||||
bin/rails s
|
||||
# To try different versions of Rails/ActiveAdmin edit extra/dev_setup.sh
|
||||
```
|
||||
19
extra/docker-compose.yml
Обычный файл
19
extra/docker-compose.yml
Обычный файл
@@ -0,0 +1,19 @@
|
||||
services:
|
||||
app:
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: extra/Dockerfile
|
||||
args:
|
||||
ACTIVEADMIN_VERSION: ${ACTIVEADMIN:-}
|
||||
BUNDLER_VERSION: ${BUNDLER_VERSION}
|
||||
RAILS_VERSION: ${RAILS:-}
|
||||
RUBY_IMAGE: ruby:${RUBY:-3.4}-slim
|
||||
UID: ${UID}
|
||||
user: ${UID}:${GID}
|
||||
ports:
|
||||
- ${SERVER_PORT}:${SERVER_PORT}
|
||||
working_dir: /app
|
||||
volumes:
|
||||
- ..:/app
|
||||
stdin_open: true
|
||||
tty: true
|
||||
@@ -1,8 +0,0 @@
|
||||
echo "> Install dependencies"
|
||||
rm -f Gemfile.lock && bundle install
|
||||
|
||||
echo "> Run pending migrations"
|
||||
cd spec/dummy && bundle exec rails db:migrate
|
||||
|
||||
echo "> Start Rails server"
|
||||
cd /app && rm -f spec/dummy/tmp/pids/server.pid && bundle exec rails s -b 0.0.0.0
|
||||
@@ -10,7 +10,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[8.0].define(version: 2018_06_07_053739) do
|
||||
ActiveRecord::Schema.define(version: 2018_06_07_053739) do
|
||||
create_table "active_admin_comments", force: :cascade do |t|
|
||||
t.string "namespace"
|
||||
t.text "body"
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
puts 'Seeds:'
|
||||
|
||||
puts 'Tags...'
|
||||
(11..16).each do |i|
|
||||
Tag.find_or_create_by!(name: "Tag #{i}")
|
||||
end
|
||||
|
||||
puts 'Authors...'
|
||||
(11..20).each do |i|
|
||||
age = 21 + 3 * (i - 10)
|
||||
attrs = { name: "Author #{i}", age: age, email: "some@email#{i}.com" }
|
||||
@@ -16,7 +12,6 @@ puts 'Authors...'
|
||||
end
|
||||
end
|
||||
|
||||
puts 'Posts...'
|
||||
authors = Author.pluck(:id)
|
||||
tags = Tag.where.not(name: 'A test tag').pluck(:id)
|
||||
(11..40).each do |i|
|
||||
@@ -38,4 +33,4 @@ end
|
||||
Author.find_or_create_by!(name: 'A test author', email: 'aaa@bbb.ccc', age: 30)
|
||||
Tag.find_or_create_by!(name: 'A test tag')
|
||||
|
||||
puts 'done.'
|
||||
puts '> Seeds: done.'
|
||||
|
||||
Ссылка в новой задаче
Block a user