first commit

This commit is contained in:
stef
2024-02-10 15:56:20 +01:00
commit 3a059172eb
102 changed files with 2258 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
src/autogen/app/tmp/
src/autogen/app/log/

17
Dockerfile Normal file
View File

@@ -0,0 +1,17 @@
FROM ruby:slim as base
WORKDIR /usr/src
RUN apt update &&\
apt install --yes git curl build-essential whois
RUN curl -sL https://deb.nodesource.com/setup_current.x | bash - &&\
apt-get update && \
apt-get install --yes --no-install-recommends nodejs &&\
npm install -g yarn \
apt-get clean
RUN gem install rails
# RUN gem install rails
CMD ["bash"]

215
README.MD Normal file
View File

@@ -0,0 +1,215 @@
# REf
https://www.simplethread.com/how-to-create-a-new-rails-7-app-with-tailwind/
https://blog.saeloun.com/2021/11/17/rails-7-added-css-app-generator/
docker compose up -d
docker compose exec -ti autogen bash
gem install rails
gem update --system 3.5.6
rails new autogen --skip-active-record --skip-bundle --css bulma
cd autogen/
Add to Gemfile :
bundle add mongoid
change config/mongoid.yaml
```yaml
development:
# Configure available database clients. (required)
clients:
# Defines the default client. (required)
default:
# Mongoid can connect to a URI accepted by the driver:
uri: mongodb://railszen:railszen@mongo:27017/railszen
# Otherwise define the parameters separately.
# This defines the name of the default database that Mongoid can connect to.
# (required).
# database: autodeploy_development
# Provides the hosts the default client can connect to. Must be an array
# of host:port pairs. (required)
# hosts:
# - localhost:27017
options:
# Note that all options listed below are Ruby driver client options (the mongo gem).
# Please refer to the driver documentation of the version of the mongo gem you are using
# for the most up-to-date list of options.
#
# Change the default write concern. (default = { w: 1 })
# write:
# w: 1
# Change the default read preference. Valid options for mode are: :secondary,
# :secondary_preferred, :primary, :primary_preferred, :nearest
# (default: primary)
# read:
# mode: :secondary_preferred
# tag_sets:
# - use: web
# The name of the user for authentication.
# user: 'user'
# The password of the user for authentication.
# password: 'password'
# The user's database roles.
# roles:
# - 'dbOwner'
# Change the default authentication mechanism. Valid options are: :scram,
# :mongodb_cr, :mongodb_x509, and :plain. Note that all authentication
# mechanisms require username and password, with the exception of :mongodb_x509.
# Default on mongoDB 3.0 is :scram, default on 2.4 and 2.6 is :plain.
# auth_mech: :scram
# The database or source to authenticate the user against.
# (default: the database specified above or admin)
# auth_source: admin
# Force a the driver cluster to behave in a certain manner instead of auto-
# discovering. Can be one of: :direct, :replica_set, :sharded. Set to :direct
# when connecting to hidden members of a replica set.
# connect: :direct
# Changes the default time in seconds the server monitors refresh their status
# via hello commands. (default: 10)
# heartbeat_frequency: 10
# The time in seconds for selecting servers for a near read preference. (default: 0.015)
# local_threshold: 0.015
# The timeout in seconds for selecting a server for an operation. (default: 30)
# server_selection_timeout: 30
# The maximum number of connections in the connection pool. (default: 5)
# max_pool_size: 5
# The minimum number of connections in the connection pool. (default: 1)
# min_pool_size: 1
# The time to wait, in seconds, in the connection pool for a connection
# to be checked in before timing out. (default: 5)
# wait_queue_timeout: 5
# The time to wait to establish a connection before timing out, in seconds.
# (default: 10)
# connect_timeout: 10
# How long to wait for a response for each operation sent to the
# server. This timeout should be set to a value larger than the
# processing time for the longest operation that will be executed
# by the application. Note that this is a client-side timeout;
# the server may continue executing an operation after the client
# aborts it with the SocketTimeout exception.
# (default: nil, meaning no timeout)
# socket_timeout: 5
# The name of the replica set to connect to. Servers provided as seeds that do
# not belong to this replica set will be ignored.
# replica_set: name
# Whether to connect to the servers via ssl. (default: false)
# ssl: true
# The certificate file used to identify the connection against MongoDB.
# ssl_cert: /path/to/my.cert
# The private keyfile used to identify the connection against MongoDB.
# Note that even if the key is stored in the same file as the certificate,
# both need to be explicitly specified.
# ssl_key: /path/to/my.key
# A passphrase for the private key.
# ssl_key_pass_phrase: password
# Whether to do peer certification validation. (default: true)
# ssl_verify: true
# The file containing concatenated certificate authority certificates
# used to validate certs passed from the other end of the connection.
# ssl_ca_cert: /path/to/ca.cert
# Whether to truncate long log lines. (default: true)
# truncate_logs: true
# Configure Mongoid specific options. (optional)
options:
# Application name that is printed to the mongodb logs upon establishing
# a connection in server versions >= 3.4. Note that the name cannot
# exceed 128 bytes. It is also used as the database name if the
# database name is not explicitly defined. (default: nil)
# app_name: MyApplicationName
# Mark belongs_to associations as required by default, so that saving a
# model with a missing belongs_to association will trigger a validation
# error. (default: true)
# belongs_to_required_by_default: true
# Raise an exception when a field is redefined. (default: false)
# duplicate_fields_exception: false
# Include the root model name in json serialization. (default: false)
# include_root_in_json: false
# Include the _type field in serialization. (default: false)
# include_type_for_serialization: false
# Whether to join nested persistence contexts for atomic operations
# to parent contexts by default. (default: false)
# join_contexts: false
# Set the Mongoid and Ruby driver log levels when Mongoid is not using
# Ruby on Rails logger instance. (default: :info)
# log_level: :info
# Preload all models in development, needed when models use
# inheritance. (default: false)
# preload_models: false
# Raise an error when performing a #find and the document is not found.
# (default: true)
raise_not_found_error: false
# Raise an error when defining a scope with the same name as an
# existing method. (default: false)
# scope_overwrite_exception: false
# Use ActiveSupport's time zone in time operations instead of
# the Ruby default time zone. See the time zone section below for
# further information. (default: true)
# use_activesupport_time_zone: true
# Return stored times as UTC. See the time zone section below for
# further information. Most applications should not use this option.
# (default: false)
# use_utc: false
# (Deprecated) In MongoDB 4.0 and earlier, set whether to create
# indexes in the background by default. (default: false)
# background_indexing: false
test:
clients:
default:
uri: mongodb://railszen:railszen@mongo:27017/railszen
# database: autodeploy_test
# hosts:
# - localhost:27017
options:
read:
mode: :primary
max_pool_size: 1
```
bin/rails g mongoid:config
edit config/database.yml and update database info
config/application.rb add config.hosts << "autoinstall.msi.stef.lan"
bundle add hotwire-livereload --group development
./bin/rails generate controller Public index --no-helper --no-controller-specs
bin/rails g scaffold Script name:string stage:string lang:string content:text lock:boolean description:text
bin/rails g scaffold Site name:string domain:string gateway:string nameserver:string network:string netmask:string
bin/rails s -b 0.0.0.0

31
docker-compose.yml Normal file
View File

@@ -0,0 +1,31 @@
services:
autogen:
container_name: autogen
hostname: autogen
build: .
restart: always
labels:
- "traefik.enable=true"
- "traefik.docker.network=traefik"
- "traefik.http.routers.autoinstall.entrypoints=websecure"
- "traefik.http.routers.autoinstall.tls=true"
- "traefik.http.routers.autoinstall.rule=Host(`autoinstall.msi.stef.lan`)"
- "traefik.http.services.autoinstall.loadbalancer.server.port=3000"
stdin_open: true
tty: true
ports:
- 4000:3000
networks:
- traefik
- databases
volumes:
- ./src:/usr/src
networks:
traefik:
name: traefik
external: true
databases:
name: databases
external: true

37
src/autogen/.dockerignore Normal file
View File

@@ -0,0 +1,37 @@
# See https://docs.docker.com/engine/reference/builder/#dockerignore-file for more about ignoring files.
# Ignore git directory.
/.git/
# Ignore bundler config.
/.bundle
# Ignore all environment files (except templates).
/.env*
!/.env*.erb
# Ignore all default key files.
/config/master.key
/config/credentials/*.key
# Ignore all logfiles and tempfiles.
/log/*
/tmp/*
!/log/.keep
!/tmp/.keep
# Ignore pidfiles, but keep the directory.
/tmp/pids/*
!/tmp/pids/.keep
# Ignore storage (uploaded files in development and any SQLite databases).
/storage/*
!/storage/.keep
/tmp/storage/*
!/tmp/storage/.keep
# Ignore assets.
/node_modules/
/app/assets/builds/*
!/app/assets/builds/.keep
/public/assets

7
src/autogen/.gitattributes vendored Normal file
View File

@@ -0,0 +1,7 @@
# See https://git-scm.com/docs/gitattributes for more about git attribute files.
# Mark any vendored files as having been vendored.
vendor/* linguist-vendored
config/credentials/*.yml.enc diff=rails_credentials
config/credentials.yml.enc diff=rails_credentials

35
src/autogen/.gitignore vendored Normal file
View File

@@ -0,0 +1,35 @@
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
#
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile '~/.gitignore_global'
# Ignore bundler config.
/.bundle
# Ignore all environment files (except templates).
/.env*
!/.env*.erb
# Ignore all logfiles and tempfiles.
/log/*
/tmp/*
!/log/.keep
!/tmp/.keep
# Ignore pidfiles, but keep the directory.
/tmp/pids/*
!/tmp/pids/
!/tmp/pids/.keep
# Ignore storage (uploaded files in development and any SQLite databases).
/storage/*
!/storage/.keep
/tmp/storage/*
!/tmp/storage/
!/tmp/storage/.keep
/public/assets
# Ignore master key for decrypting credentials and more.
/config/master.key

View File

@@ -0,0 +1 @@
21.6.1

View File

@@ -0,0 +1 @@
ruby-3.3.0

75
src/autogen/Dockerfile Normal file
View File

@@ -0,0 +1,75 @@
# syntax = docker/dockerfile:1
# Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile
ARG RUBY_VERSION=3.3.0
FROM registry.docker.com/library/ruby:$RUBY_VERSION-slim as base
# Rails app lives here
WORKDIR /rails
# Set production environment
ENV RAILS_ENV="production" \
BUNDLE_DEPLOYMENT="1" \
BUNDLE_PATH="/usr/local/bundle" \
BUNDLE_WITHOUT="development"
# Throw-away build stage to reduce size of final image
FROM base as build
# Install packages needed to build gems and node modules
RUN apt-get update -qq && \
apt-get install --no-install-recommends -y build-essential curl git node-gyp pkg-config python-is-python3
# Install JavaScript dependencies
ARG NODE_VERSION=21.6.1
ARG YARN_VERSION=1.22.21
ENV PATH=/usr/local/node/bin:$PATH
RUN curl -sL https://github.com/nodenv/node-build/archive/master.tar.gz | tar xz -C /tmp/ && \
/tmp/node-build-master/bin/node-build "${NODE_VERSION}" /usr/local/node && \
npm install -g yarn@$YARN_VERSION && \
rm -rf /tmp/node-build-master
# Install application gems
COPY Gemfile Gemfile.lock ./
RUN bundle install && \
rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git && \
bundle exec bootsnap precompile --gemfile
# Install node modules
COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile
# Copy application code
COPY . .
# Precompile bootsnap code for faster boot times
RUN bundle exec bootsnap precompile app/ lib/
# Precompiling assets for production without requiring secret RAILS_MASTER_KEY
RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile
# Final stage for app image
FROM base
# Install packages needed for deployment
RUN apt-get update -qq && \
apt-get install --no-install-recommends -y curl && \
rm -rf /var/lib/apt/lists /var/cache/apt/archives
# Copy built artifacts: gems, application
COPY --from=build /usr/local/bundle /usr/local/bundle
COPY --from=build /rails /rails
# Run and own only the runtime files as a non-root user for security
RUN useradd rails --create-home --shell /bin/bash && \
chown -R rails:rails log tmp
USER rails:rails
# Entrypoint prepares the database.
ENTRYPOINT ["/rails/bin/docker-entrypoint"]
# Start the server by default, this can be overwritten at runtime
EXPOSE 3000
CMD ["./bin/rails", "server"]

70
src/autogen/Gemfile Normal file
View File

@@ -0,0 +1,70 @@
source "https://rubygems.org"
ruby "3.3.0"
# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
gem "rails", "~> 7.1.3"
# The original asset pipeline for Rails [https://github.com/rails/sprockets-rails]
gem "sprockets-rails"
# Use the Puma web server [https://github.com/puma/puma]
gem "puma", ">= 5.0"
# Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails]
gem "importmap-rails"
# Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev]
gem "turbo-rails"
# Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev]
gem "stimulus-rails"
# Bundle and process CSS [https://github.com/rails/cssbundling-rails]
gem "cssbundling-rails"
# Build JSON APIs with ease [https://github.com/rails/jbuilder]
gem "jbuilder"
# Use Redis adapter to run Action Cable in production
# gem "redis", ">= 4.0.1"
# Use Kredis to get higher-level data types in Redis [https://github.com/rails/kredis]
# gem "kredis"
# Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword]
# gem "bcrypt", "~> 3.1.7"
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem "tzinfo-data", platforms: %i[ windows jruby ]
# Reduces boot times through caching; required in config/boot.rb
gem "bootsnap", require: false
group :development, :test do
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
gem "debug", platforms: %i[ mri windows ]
end
group :development do
# Use console on exceptions pages [https://github.com/rails/web-console]
gem "web-console"
# Add speed badges [https://github.com/MiniProfiler/rack-mini-profiler]
# gem "rack-mini-profiler"
# Speed up commands on slow machines / big apps [https://github.com/rails/spring]
# gem "spring"
end
group :test do
# Use system testing [https://guides.rubyonrails.org/testing.html#system-testing]
gem "capybara"
gem "selenium-webdriver"
end
gem "mongoid", "~> 8.1"
gem "bulma-rails", "~> 0.9.4"
gem "jquery-rails", "~> 4.6"

295
src/autogen/Gemfile.lock Normal file
View File

@@ -0,0 +1,295 @@
GEM
remote: https://rubygems.org/
specs:
actioncable (7.1.3)
actionpack (= 7.1.3)
activesupport (= 7.1.3)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
zeitwerk (~> 2.6)
actionmailbox (7.1.3)
actionpack (= 7.1.3)
activejob (= 7.1.3)
activerecord (= 7.1.3)
activestorage (= 7.1.3)
activesupport (= 7.1.3)
mail (>= 2.7.1)
net-imap
net-pop
net-smtp
actionmailer (7.1.3)
actionpack (= 7.1.3)
actionview (= 7.1.3)
activejob (= 7.1.3)
activesupport (= 7.1.3)
mail (~> 2.5, >= 2.5.4)
net-imap
net-pop
net-smtp
rails-dom-testing (~> 2.2)
actionpack (7.1.3)
actionview (= 7.1.3)
activesupport (= 7.1.3)
nokogiri (>= 1.8.5)
racc
rack (>= 2.2.4)
rack-session (>= 1.0.1)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
actiontext (7.1.3)
actionpack (= 7.1.3)
activerecord (= 7.1.3)
activestorage (= 7.1.3)
activesupport (= 7.1.3)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
actionview (7.1.3)
activesupport (= 7.1.3)
builder (~> 3.1)
erubi (~> 1.11)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
activejob (7.1.3)
activesupport (= 7.1.3)
globalid (>= 0.3.6)
activemodel (7.1.3)
activesupport (= 7.1.3)
activerecord (7.1.3)
activemodel (= 7.1.3)
activesupport (= 7.1.3)
timeout (>= 0.4.0)
activestorage (7.1.3)
actionpack (= 7.1.3)
activejob (= 7.1.3)
activerecord (= 7.1.3)
activesupport (= 7.1.3)
marcel (~> 1.0)
activesupport (7.1.3)
base64
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
minitest (>= 5.1)
mutex_m
tzinfo (~> 2.0)
addressable (2.8.6)
public_suffix (>= 2.0.2, < 6.0)
base64 (0.2.0)
bigdecimal (3.1.6)
bindex (0.8.1)
bootsnap (1.18.3)
msgpack (~> 1.2)
bson (4.15.0)
builder (3.2.4)
bulma-rails (0.9.4)
sassc (~> 2.0)
capybara (3.40.0)
addressable
matrix
mini_mime (>= 0.1.3)
nokogiri (~> 1.11)
rack (>= 1.6.0)
rack-test (>= 0.6.3)
regexp_parser (>= 1.5, < 3.0)
xpath (~> 3.2)
concurrent-ruby (1.2.3)
connection_pool (2.4.1)
crass (1.0.6)
cssbundling-rails (1.4.0)
railties (>= 6.0.0)
date (3.3.4)
debug (1.9.1)
irb (~> 1.10)
reline (>= 0.3.8)
drb (2.2.0)
ruby2_keywords
erubi (1.12.0)
ffi (1.16.3)
globalid (1.2.1)
activesupport (>= 6.1)
i18n (1.14.1)
concurrent-ruby (~> 1.0)
importmap-rails (2.0.1)
actionpack (>= 6.0.0)
activesupport (>= 6.0.0)
railties (>= 6.0.0)
io-console (0.7.2)
irb (1.11.2)
rdoc
reline (>= 0.4.2)
jbuilder (2.11.5)
actionview (>= 5.0.0)
activesupport (>= 5.0.0)
jquery-rails (4.6.0)
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
loofah (2.22.0)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
mail (2.8.1)
mini_mime (>= 0.1.1)
net-imap
net-pop
net-smtp
marcel (1.0.2)
matrix (0.4.2)
mini_mime (1.1.5)
minitest (5.22.2)
mongo (2.19.3)
bson (>= 4.14.1, < 5.0.0)
mongoid (8.1.4)
activemodel (>= 5.1, < 7.2, != 7.0.0)
concurrent-ruby (>= 1.0.5, < 2.0)
mongo (>= 2.18.0, < 3.0.0)
ruby2_keywords (~> 0.0.5)
msgpack (1.7.2)
mutex_m (0.2.0)
net-imap (0.4.10)
date
net-protocol
net-pop (0.1.2)
net-protocol
net-protocol (0.2.2)
timeout
net-smtp (0.4.0.1)
net-protocol
nio4r (2.7.0)
nokogiri (1.16.2-aarch64-linux)
racc (~> 1.4)
nokogiri (1.16.2-arm-linux)
racc (~> 1.4)
nokogiri (1.16.2-arm64-darwin)
racc (~> 1.4)
nokogiri (1.16.2-x86-linux)
racc (~> 1.4)
nokogiri (1.16.2-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.16.2-x86_64-linux)
racc (~> 1.4)
psych (5.1.2)
stringio
public_suffix (5.0.4)
puma (6.4.2)
nio4r (~> 2.0)
racc (1.7.3)
rack (3.0.9)
rack-session (2.0.0)
rack (>= 3.0.0)
rack-test (2.1.0)
rack (>= 1.3)
rackup (2.1.0)
rack (>= 3)
webrick (~> 1.8)
rails (7.1.3)
actioncable (= 7.1.3)
actionmailbox (= 7.1.3)
actionmailer (= 7.1.3)
actionpack (= 7.1.3)
actiontext (= 7.1.3)
actionview (= 7.1.3)
activejob (= 7.1.3)
activemodel (= 7.1.3)
activerecord (= 7.1.3)
activestorage (= 7.1.3)
activesupport (= 7.1.3)
bundler (>= 1.15.0)
railties (= 7.1.3)
rails-dom-testing (2.2.0)
activesupport (>= 5.0.0)
minitest
nokogiri (>= 1.6)
rails-html-sanitizer (1.6.0)
loofah (~> 2.21)
nokogiri (~> 1.14)
railties (7.1.3)
actionpack (= 7.1.3)
activesupport (= 7.1.3)
irb
rackup (>= 1.0.0)
rake (>= 12.2)
thor (~> 1.0, >= 1.2.2)
zeitwerk (~> 2.6)
rake (13.1.0)
rdoc (6.6.2)
psych (>= 4.0.0)
regexp_parser (2.9.0)
reline (0.4.2)
io-console (~> 0.5)
rexml (3.2.6)
ruby2_keywords (0.0.5)
rubyzip (2.3.2)
sassc (2.4.0)
ffi (~> 1.9)
selenium-webdriver (4.17.0)
base64 (~> 0.2)
rexml (~> 3.2, >= 3.2.5)
rubyzip (>= 1.2.2, < 3.0)
websocket (~> 1.0)
sprockets (4.2.1)
concurrent-ruby (~> 1.0)
rack (>= 2.2.4, < 4)
sprockets-rails (3.4.2)
actionpack (>= 5.2)
activesupport (>= 5.2)
sprockets (>= 3.0.0)
stimulus-rails (1.3.3)
railties (>= 6.0.0)
stringio (3.1.0)
thor (1.3.0)
timeout (0.4.1)
turbo-rails (2.0.2)
actionpack (>= 6.0.0)
activejob (>= 6.0.0)
railties (>= 6.0.0)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
web-console (4.2.1)
actionview (>= 6.0.0)
activemodel (>= 6.0.0)
bindex (>= 0.4.0)
railties (>= 6.0.0)
webrick (1.8.1)
websocket (1.2.10)
websocket-driver (0.7.6)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
xpath (3.2.0)
nokogiri (~> 1.8)
zeitwerk (2.6.13)
PLATFORMS
aarch64-linux
arm-linux
arm64-darwin
x86-linux
x86_64-darwin
x86_64-linux
DEPENDENCIES
bootsnap
bulma-rails (~> 0.9.4)
capybara
cssbundling-rails
debug
importmap-rails
jbuilder
jquery-rails (~> 4.6)
mongoid (~> 8.1)
puma (>= 5.0)
rails (~> 7.1.3)
selenium-webdriver
sprockets-rails
stimulus-rails
turbo-rails
tzinfo-data
web-console
RUBY VERSION
ruby 3.3.0p0
BUNDLED WITH
2.5.3

24
src/autogen/README.md Normal file
View File

@@ -0,0 +1,24 @@
# README
This README would normally document whatever steps are necessary to get the
application up and running.
Things you may want to cover:
* Ruby version
* System dependencies
* Configuration
* Database creation
* Database initialization
* How to run the test suite
* Services (job queues, cache servers, search engines, etc.)
* Deployment instructions
* ...

6
src/autogen/Rakefile Normal file
View File

@@ -0,0 +1,6 @@
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require_relative "config/application"
Rails.application.load_tasks

View File

@@ -0,0 +1,3 @@
//= link_tree ../images .png
//= link_directory ../stylesheets .css
//= link_tree ../javascript .js

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@@ -0,0 +1,7 @@
$( document ).ready(function() {
$('.toggleable').next().hide();
$(document).on("click",".toggleable", function(){
$(this).toggleClass("is-active");
$(this).next().toggle();
});
})

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,17 @@
/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS (and SCSS, if configured) file within this directory, lib/assets/stylesheets, or any plugin's
* vendor/assets/stylesheets directory can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
* compiled file so the styles you add here take precedence over styles defined in any other CSS
* files in this directory. Styles in this file should be added after the last require_* statement.
* It is generally better to create a new file per style scope.
*
*= require_tree .
*= require_self
# @import "bulma";
*/

View File

@@ -0,0 +1 @@
@import "bulma";

View File

@@ -0,0 +1,4 @@
module ApplicationCable
class Channel < ActionCable::Channel::Base
end
end

View File

@@ -0,0 +1,4 @@
module ApplicationCable
class Connection < ActionCable::Connection::Base
end
end

View File

@@ -0,0 +1,2 @@
class ApplicationController < ActionController::Base
end

View File

@@ -0,0 +1,4 @@
class HomeController < ApplicationController
def index
end
end

View File

@@ -0,0 +1,70 @@
class ScriptsController < ApplicationController
before_action :set_script, only: %i[ show edit update destroy ]
# GET /scripts or /scripts.json
def index
@scripts = Script.all
end
# GET /scripts/1 or /scripts/1.json
def show
end
# GET /scripts/new
def new
@script = Script.new
end
# GET /scripts/1/edit
def edit
end
# POST /scripts or /scripts.json
def create
@script = Script.new(script_params)
respond_to do |format|
if @script.save
format.html { redirect_to script_url(@script), notice: "Script was successfully created." }
format.json { render :show, status: :created, location: @script }
else
format.html { render :new, status: :unprocessable_entity }
format.json { render json: @script.errors, status: :unprocessable_entity }
end
end
end
# PATCH/PUT /scripts/1 or /scripts/1.json
def update
respond_to do |format|
if @script.update(script_params)
format.html { redirect_to script_url(@script), notice: "Script was successfully updated." }
format.json { render :show, status: :ok, location: @script }
else
format.html { render :edit, status: :unprocessable_entity }
format.json { render json: @script.errors, status: :unprocessable_entity }
end
end
end
# DELETE /scripts/1 or /scripts/1.json
def destroy
@script.destroy!
respond_to do |format|
format.html { redirect_to scripts_url, notice: "Script was successfully destroyed." }
format.json { head :no_content }
end
end
private
# Use callbacks to share common setup or constraints between actions.
def set_script
@script = Script.find(params[:id])
end
# Only allow a list of trusted parameters through.
def script_params
params.require(:script).permit(:name, :stage, :lang, :content, :lock, :description)
end
end

View File

@@ -0,0 +1,2 @@
module ApplicationHelper
end

View File

@@ -0,0 +1,2 @@
module HomeHelper
end

View File

@@ -0,0 +1,2 @@
module ScriptsHelper
end

View File

@@ -0,0 +1,7 @@
class ApplicationJob < ActiveJob::Base
# Automatically retry jobs that encountered a deadlock
# retry_on ActiveRecord::Deadlocked
# Most jobs are safe to ignore if the underlying records are no longer available
# discard_on ActiveJob::DeserializationError
end

View File

@@ -0,0 +1,4 @@
class ApplicationMailer < ActionMailer::Base
default from: "from@example.com"
layout "mailer"
end

View File

View File

@@ -0,0 +1,10 @@
class Script
include Mongoid::Document
include Mongoid::Timestamps
field :name, type: String
field :stage, type: String
field :lang, type: String
field :content, type: String
field :lock, type: Mongoid::Boolean
field :description, type: String
end

View File

@@ -0,0 +1,7 @@
<div class="container is-widescreen">
<div class="notification is-primary">
<h1>Home#index</h1>
</div>
<p>Find me in app/views/home/index.html.erb</p>
</div>

View File

@@ -0,0 +1,31 @@
<!DOCTYPE html>
<html>
<head>
<title>Autogen</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<%= csrf_meta_tags %>
<%= csp_meta_tag %>
<%= stylesheet_link_tag "application", "data-turbo-track": "reload" %>
<%= javascript_include_tag "jquery-3.7.1.min" %>
</head>
<body>
<div class="container is-fluid">
<%= render "partials/top-menu" %>
<div class="columns">
<div class="column is-one-fifth">
<%= render "partials/left-menu" %>
</div>
<div class="column auto">
<div class="container is-fluid">
<%= yield %>
</div>
</div>
</div>
</div>
<%= javascript_include_tag "init" %>
</body>
</html>

View File

@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style>
/* Email styles need to be inline */
</style>
</head>
<body>
<%= yield %>
</body>
</html>

View File

@@ -0,0 +1 @@
<%= yield %>

View File

@@ -0,0 +1,40 @@
<aside class="menu">
<p class="menu-label">Tutorial</p>
<ul class="menu-list">
<li>
<a class="has-background-info toggleable">
Configurations
</a>
<ul>
<li><a href="/scripts">Scripts</a></li>
<li><a href="/templates">Templates</a></li>
<li><a href="/sites">Templates</a></li>
<li><a href="/accounts">Accounts</a></li>
</ul>
</li>
<li>
<a class="has-background-info toggleable">
Hosts
</a>
<ul>
<li><a href="/host1">host1</a></li>
</ul>
</li>
<li><a>Data Structures</a></li>
<li><a>Web Tech</a></li>
<li><a>Machine Learning</a></li>
</ul>
<p class="menu-label">Courses</p>
<ul class="menu-list">
<li><a>Java</a></li>
<li><a>Python</a></li>
<li><a>C++</a></li>
</ul>
<ul class="menu-list">
<li><a>About us</a></li>
<li><a>Careers</a></li>
</ul>
</aside>

View File

@@ -0,0 +1,60 @@
<nav class="navbar" role="navigation" aria-label="main navigation">
<div class="navbar-brand">
<a class="navbar-item" href="https://wiki.zen6.info/fr/documentation/ZenInstall">
<%= image_tag "installerlogo.png", size: '112x28' %>
</a>
<a role="button" class="navbar-burger" aria-label="menu" aria-expanded="false" data-target="navbarBasicExample">
<span aria-hidden="true"></span>
<span aria-hidden="true"></span>
<span aria-hidden="true"></span>
</a>
</div>
<div id="navbarBasicExample" class="navbar-menu">
<div class="navbar-start">
<a class="navbar-item">
Home
</a>
<a class="navbar-item">
Documentation
</a>
<div class="navbar-item has-dropdown is-hoverable">
<a class="navbar-link">
More
</a>
<div class="navbar-dropdown">
<a class="navbar-item">
About
</a>
<a class="navbar-item">
Jobs
</a>
<a class="navbar-item">
Contact
</a>
<hr class="navbar-divider">
<a class="navbar-item">
Report an issue
</a>
</div>
</div>
</div>
<div class="navbar-end">
<div class="navbar-item">
<div class="buttons">
<a class="button is-primary">
<strong>Sign up</strong>
</a>
<a class="button is-light">
Log in
</a>
</div>
</div>
</div>
</div>
</nav>

View File

@@ -0,0 +1,47 @@
<%= form_with(model: script) do |form| %>
<% if script.errors.any? %>
<div style="color: red">
<h2><%= pluralize(script.errors.count, "error") %> prohibited this script from being saved:</h2>
<ul>
<% script.errors.each do |error| %>
<li><%= error.full_message %></li>
<% end %>
</ul>
</div>
<% end %>
<div>
<%= form.label :name, style: "display: block" %>
<%= form.text_field :name %>
</div>
<div>
<%= form.label :stage, style: "display: block" %>
<%= form.text_field :stage %>
</div>
<div>
<%= form.label :lang, style: "display: block" %>
<%= form.text_field :lang %>
</div>
<div>
<%= form.label :content, style: "display: block" %>
<%= form.text_area :content %>
</div>
<div>
<%= form.label :lock, style: "display: block" %>
<%= form.check_box :lock %>
</div>
<div>
<%= form.label :description, style: "display: block" %>
<%= form.text_area :description %>
</div>
<div>
<%= form.submit %>
</div>
<% end %>

View File

@@ -0,0 +1,32 @@
<div id="<%= dom_id script %>">
<p>
<strong>Name:</strong>
<%= script.name %>
</p>
<p>
<strong>Stage:</strong>
<%= script.stage %>
</p>
<p>
<strong>Lang:</strong>
<%= script.lang %>
</p>
<p>
<strong>Content:</strong>
<%= script.content %>
</p>
<p>
<strong>Lock:</strong>
<%= script.lock %>
</p>
<p>
<strong>Description:</strong>
<%= script.description %>
</p>
</div>

View File

@@ -0,0 +1,2 @@
json.extract! script, :id, :name, :stage, :lang, :content, :lock, :description, :created_at, :updated_at
json.url script_url(script, format: :json)

View File

@@ -0,0 +1,10 @@
<h1>Editing script</h1>
<%= render "form", script: @script %>
<br>
<div>
<%= link_to "Show this script", @script %> |
<%= link_to "Back to scripts", scripts_path %>
</div>

View File

@@ -0,0 +1,14 @@
<p style="color: green"><%= notice %></p>
<h1>Scripts</h1>
<div id="scripts">
<% @scripts.each do |script| %>
<%= render script %>
<p>
<%= link_to "Show this script", script %>
</p>
<% end %>
</div>
<%= link_to "New script", new_script_path %>

View File

@@ -0,0 +1 @@
json.array! @scripts, partial: "scripts/script", as: :script

View File

@@ -0,0 +1,9 @@
<h1>New script</h1>
<%= render "form", script: @script %>
<br>
<div>
<%= link_to "Back to scripts", scripts_path %>
</div>

View File

@@ -0,0 +1,10 @@
<p style="color: green"><%= notice %></p>
<%= render @script %>
<div>
<%= link_to "Edit this script", edit_script_path(@script) %> |
<%= link_to "Back to scripts", scripts_path %>
<%= button_to "Destroy this script", @script, method: :delete %>
</div>

View File

@@ -0,0 +1 @@
json.partial! "scripts/script", script: @script

View File

@@ -0,0 +1,3 @@
#!/bin/bash -e
exec "${@}"

4
src/autogen/bin/rails Executable file
View File

@@ -0,0 +1,4 @@
#!/usr/bin/env ruby
APP_PATH = File.expand_path("../config/application", __dir__)
require_relative "../config/boot"
require "rails/commands"

4
src/autogen/bin/rake Executable file
View File

@@ -0,0 +1,4 @@
#!/usr/bin/env ruby
require_relative "../config/boot"
require "rake"
Rake.application.run

28
src/autogen/bin/setup Executable file
View File

@@ -0,0 +1,28 @@
#!/usr/bin/env ruby
require "fileutils"
# path to your application root.
APP_ROOT = File.expand_path("..", __dir__)
def system!(*args)
system(*args, exception: true)
end
FileUtils.chdir APP_ROOT do
# This script is a way to set up or update your development environment automatically.
# This script is idempotent, so that you can run it at any time and get an expectable outcome.
# Add necessary setup steps to this file.
puts "== Installing dependencies =="
system! "gem install bundler --conservative"
system("bundle check") || system!("bundle install")
# Install JavaScript dependencies
system("yarn check --check-files") || system!("yarn install")
puts "\n== Removing old logs and tempfiles =="
system! "bin/rails log:clear tmp:clear"
puts "\n== Restarting application server =="
system! "bin/rails restart"
end

6
src/autogen/config.ru Normal file
View File

@@ -0,0 +1,6 @@
# This file is used by Rack-based servers to start the application.
require_relative "config/environment"
run Rails.application
Rails.application.load_server

View File

@@ -0,0 +1,40 @@
require_relative "boot"
require "rails"
# Pick the frameworks you want:
require "active_model/railtie"
require "active_job/railtie"
# require "active_record/railtie"
# require "active_storage/engine"
require "action_controller/railtie"
require "action_mailer/railtie"
# require "action_mailbox/engine"
# require "action_text/engine"
require "action_view/railtie"
require "action_cable/engine"
require "rails/test_unit/railtie"
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module Autogen
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 7.1
# Please, add to the `ignore` list any other `lib` subdirectories that do
# not contain `.rb` files, or that should not be reloaded or eager loaded.
# Common ones are `templates`, `generators`, or `middleware`, for example.
config.autoload_lib(ignore: %w(assets tasks))
# Configuration for the application, engines, and railties goes here.
#
# These settings can be overridden in specific environments using the files
# in config/environments, which are processed later.
#
# config.time_zone = "Central Time (US & Canada)"
# config.eager_load_paths << Rails.root.join("extras")
config.hosts << "autoinstall.msi.stef.lan"
end
end

View File

@@ -0,0 +1,4 @@
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
require "bundler/setup" # Set up gems listed in the Gemfile.
require "bootsnap/setup" # Speed up boot time by caching expensive operations.

View File

@@ -0,0 +1,10 @@
development:
adapter: async
test:
adapter: test
production:
adapter: redis
url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
channel_prefix: autogen_production

View File

@@ -0,0 +1 @@
Pu7UsIECoqYcIGNuzbxA0Jk148K5ixxvy/CcBUOKWjcHhLKnkZesYbIkPQ+/tBlu+2vYtVivpCLEieCSPNyFG5eRErgXuZUGjm4bajzfflR2rrujd54F3+rPGCo8aFD7PIUEeK7IGgVIfwtOIPfbOoul/5eXthbqkfT8Jx6AmwbizhnPacSL2zsBNoSquTEwE4LXFg7zT4UQXBE8WRrCsJkTRJHV6/2oOJl0fxeJIVgoU5DIG47m7haEjR4Me7l5HPZUFpnQktZ3xKypMBA6DaMg8IAP4KQfmlZ9WXNdpb6p8yhuF4ssow3j8U7fQM7DddRG8plLQv6BKu9BIdASw8vi85cD3dm2CbMozC2coTzYfL68vp31OcogCW7ZMWlg1NZKq1V3YeZowbsAiaD3KtzU9z9b--S3olxmjIJNRe1fsE--UHStYIhSHH/X1a39+VSxqg==

View File

@@ -0,0 +1,5 @@
# Load the Rails application.
require_relative "application"
# Initialize the Rails application.
Rails.application.initialize!

View File

@@ -0,0 +1,67 @@
require "active_support/core_ext/integer/time"
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded any time
# it changes. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.enable_reloading = true
# Do not eager load code on boot.
config.eager_load = false
# Show full error reports.
config.consider_all_requests_local = true
# Enable server timing
config.server_timing = true
# Enable/disable caching. By default caching is disabled.
# Run rails dev:cache to toggle caching.
if Rails.root.join("tmp/caching-dev.txt").exist?
config.action_controller.perform_caching = true
config.action_controller.enable_fragment_cache_logging = true
config.cache_store = :memory_store
config.public_file_server.headers = {
"Cache-Control" => "public, max-age=#{2.days.to_i}"
}
else
config.action_controller.perform_caching = false
config.cache_store = :null_store
end
# Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = false
config.action_mailer.perform_caching = false
# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log
# Raise exceptions for disallowed deprecations.
config.active_support.disallowed_deprecation = :raise
# Tell Active Support which deprecation messages to disallow.
config.active_support.disallowed_deprecation_warnings = []
# Highlight code that enqueued background job in logs.
config.active_job.verbose_enqueue_logs = true
# Suppress logger output for asset requests.
config.assets.quiet = true
# Raises error for missing translations.
# config.i18n.raise_on_missing_translations = true
# Annotate rendered view with file names.
# config.action_view.annotate_rendered_view_with_filenames = true
# Uncomment if you wish to allow Action Cable access from any origin.
# config.action_cable.disable_request_forgery_protection = true
# Raise error when a before_action's only/except options reference missing actions
config.action_controller.raise_on_missing_callback_actions = true
end

View File

@@ -0,0 +1,91 @@
require "active_support/core_ext/integer/time"
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.enable_reloading = false
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web servers
# and those relying on copy on write to perform better.
# Rake tasks automatically ignore this option for performance.
config.eager_load = true
# Full error reports are disabled and caching is turned on.
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Ensures that a master key has been made available in ENV["RAILS_MASTER_KEY"], config/master.key, or an environment
# key such as config/credentials/production.key. This key is used to decrypt credentials (and other encrypted files).
# config.require_master_key = true
# Disable serving static files from `public/`, relying on NGINX/Apache to do so instead.
# config.public_file_server.enabled = false
# Compress CSS using a preprocessor.
# config.assets.css_compressor = :sass
# Do not fall back to assets pipeline if a precompiled asset is missed.
config.assets.compile = false
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
# config.asset_host = "http://assets.example.com"
# Specifies the header that your server uses for sending files.
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache
# config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX
# Mount Action Cable outside main process or domain.
# config.action_cable.mount_path = nil
# config.action_cable.url = "wss://example.com/cable"
# config.action_cable.allowed_request_origins = [ "http://example.com", /http:\/\/example.*/ ]
# Assume all access to the app is happening through a SSL-terminating reverse proxy.
# Can be used together with config.force_ssl for Strict-Transport-Security and secure cookies.
# config.assume_ssl = true
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
config.force_ssl = true
# Log to STDOUT by default
config.logger = ActiveSupport::Logger.new(STDOUT)
.tap { |logger| logger.formatter = ::Logger::Formatter.new }
.then { |logger| ActiveSupport::TaggedLogging.new(logger) }
# Prepend all log lines with the following tags.
config.log_tags = [ :request_id ]
# "info" includes generic and useful information about system operation, but avoids logging too much
# information to avoid inadvertent exposure of personally identifiable information (PII). If you
# want to log everything, set the level to "debug".
config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "info")
# Use a different cache store in production.
# config.cache_store = :mem_cache_store
# Use a real queuing backend for Active Job (and separate queues per environment).
# config.active_job.queue_adapter = :resque
# config.active_job.queue_name_prefix = "autogen_production"
config.action_mailer.perform_caching = false
# Ignore bad email addresses and do not raise email delivery errors.
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
# config.action_mailer.raise_delivery_errors = false
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation cannot be found).
config.i18n.fallbacks = true
# Don't log any deprecations.
config.active_support.report_deprecations = false
# Enable DNS rebinding protection and other `Host` header attacks.
# config.hosts = [
# "example.com", # Allow requests from example.com
# /.*\.example\.com/ # Allow requests from subdomains like `www.example.com`
# ]
# Skip DNS rebinding protection for the default health check endpoint.
# config.host_authorization = { exclude: ->(request) { request.path == "/up" } }
end

View File

@@ -0,0 +1,61 @@
require "active_support/core_ext/integer/time"
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data there!
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# While tests run files are not watched, reloading is not necessary.
config.enable_reloading = false
# Eager loading loads your entire application. When running a single test locally,
# this is usually not necessary, and can slow down your test suite. However, it's
# recommended that you enable it in continuous integration systems to ensure eager
# loading is working properly before deploying your code.
config.eager_load = ENV["CI"].present?
# Configure public file server for tests with Cache-Control for performance.
config.public_file_server.enabled = true
config.public_file_server.headers = {
"Cache-Control" => "public, max-age=#{1.hour.to_i}"
}
# Show full error reports and disable caching.
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
config.cache_store = :null_store
# Render exception templates for rescuable exceptions and raise for other exceptions.
config.action_dispatch.show_exceptions = :rescuable
# Disable request forgery protection in test environment.
config.action_controller.allow_forgery_protection = false
config.action_mailer.perform_caching = false
# Tell Action Mailer not to deliver emails to the real world.
# The :test delivery method accumulates sent emails in the
# ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :test
# Print deprecation notices to the stderr.
config.active_support.deprecation = :stderr
# Raise exceptions for disallowed deprecations.
config.active_support.disallowed_deprecation = :raise
# Tell Active Support which deprecation messages to disallow.
config.active_support.disallowed_deprecation_warnings = []
# Raises error for missing translations.
# config.i18n.raise_on_missing_translations = true
# Annotate rendered view with file names.
# config.action_view.annotate_rendered_view_with_filenames = true
# Raise error when a before_action's only/except options reference missing actions
config.action_controller.raise_on_missing_callback_actions = true
end

View File

@@ -0,0 +1,12 @@
# Be sure to restart your server when you modify this file.
# Version of your assets, change this if you want to expire all your assets.
Rails.application.config.assets.version = "1.0"
# Add additional assets to the asset load path.
# Rails.application.config.assets.paths << Emoji.images_path
# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in the app/assets
# folder are already added.
# Rails.application.config.assets.precompile += %w( admin.js admin.css )

View File

@@ -0,0 +1,25 @@
# Be sure to restart your server when you modify this file.
# Define an application-wide content security policy.
# See the Securing Rails Applications Guide for more information:
# https://guides.rubyonrails.org/security.html#content-security-policy-header
# Rails.application.configure do
# config.content_security_policy do |policy|
# policy.default_src :self, :https
# policy.font_src :self, :https, :data
# policy.img_src :self, :https, :data
# policy.object_src :none
# policy.script_src :self, :https
# policy.style_src :self, :https
# # Specify URI for violation reports
# # policy.report_uri "/csp-violation-report-endpoint"
# end
#
# # Generate session nonces for permitted importmap, inline scripts, and inline styles.
# config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
# config.content_security_policy_nonce_directives = %w(script-src style-src)
#
# # Report violations without enforcing the policy.
# # config.content_security_policy_report_only = true
# end

View File

@@ -0,0 +1,8 @@
# Be sure to restart your server when you modify this file.
# Configure parameters to be partially matched (e.g. passw matches password) and filtered from the log file.
# Use this to limit dissemination of sensitive information.
# See the ActiveSupport::ParameterFilter documentation for supported notations and behaviors.
Rails.application.config.filter_parameters += [
:passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn
]

View File

@@ -0,0 +1,16 @@
# Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format. Inflections
# are locale specific, and you may define rules for as many different
# locales as you wish. All of these examples are active by default:
# ActiveSupport::Inflector.inflections(:en) do |inflect|
# inflect.plural /^(ox)$/i, "\\1en"
# inflect.singular /^(ox)en/i, "\\1"
# inflect.irregular "person", "people"
# inflect.uncountable %w( fish sheep )
# end
# These inflection rules are supported but not enabled by default:
# ActiveSupport::Inflector.inflections(:en) do |inflect|
# inflect.acronym "RESTful"
# end

View File

@@ -0,0 +1,13 @@
# Be sure to restart your server when you modify this file.
# Define an application-wide HTTP permissions policy. For further
# information see: https://developers.google.com/web/updates/2018/06/feature-policy
# Rails.application.config.permissions_policy do |policy|
# policy.camera :none
# policy.gyroscope :none
# policy.microphone :none
# policy.usb :none
# policy.fullscreen :self
# policy.payment :self, "https://secure.example.com"
# end

View File

@@ -0,0 +1,31 @@
# Files in the config/locales directory are used for internationalization and
# are automatically loaded by Rails. If you want to use locales other than
# English, add the necessary files in this directory.
#
# To use the locales, use `I18n.t`:
#
# I18n.t "hello"
#
# In views, this is aliased to just `t`:
#
# <%= t("hello") %>
#
# To use a different locale, set it with `I18n.locale`:
#
# I18n.locale = :es
#
# This would use the information in config/locales/es.yml.
#
# To learn more about the API, please read the Rails Internationalization guide
# at https://guides.rubyonrails.org/i18n.html.
#
# Be aware that YAML interprets the following case-insensitive strings as
# booleans: `true`, `false`, `on`, `off`, `yes`, `no`. Therefore, these strings
# must be quoted to be interpreted as strings. For example:
#
# en:
# "yes": yup
# enabled: "ON"
en:
hello: "Hello world"

View File

@@ -0,0 +1,185 @@
development:
# Configure available database clients. (required)
clients:
# Defines the default client. (required)
default:
# Mongoid can connect to a URI accepted by the driver:
uri: mongodb://railszen:railszen@mongo:27017/railszen
# Otherwise define the parameters separately.
# This defines the name of the default database that Mongoid can connect to.
# (required).
# database: autodeploy_development
# Provides the hosts the default client can connect to. Must be an array
# of host:port pairs. (required)
# hosts:
# - localhost:27017
options:
# Note that all options listed below are Ruby driver client options (the mongo gem).
# Please refer to the driver documentation of the version of the mongo gem you are using
# for the most up-to-date list of options.
#
# Change the default write concern. (default = { w: 1 })
# write:
# w: 1
# Change the default read preference. Valid options for mode are: :secondary,
# :secondary_preferred, :primary, :primary_preferred, :nearest
# (default: primary)
# read:
# mode: :secondary_preferred
# tag_sets:
# - use: web
# The name of the user for authentication.
# user: 'user'
# The password of the user for authentication.
# password: 'password'
# The user's database roles.
# roles:
# - 'dbOwner'
# Change the default authentication mechanism. Valid options are: :scram,
# :mongodb_cr, :mongodb_x509, and :plain. Note that all authentication
# mechanisms require username and password, with the exception of :mongodb_x509.
# Default on mongoDB 3.0 is :scram, default on 2.4 and 2.6 is :plain.
# auth_mech: :scram
# The database or source to authenticate the user against.
# (default: the database specified above or admin)
# auth_source: admin
# Force a the driver cluster to behave in a certain manner instead of auto-
# discovering. Can be one of: :direct, :replica_set, :sharded. Set to :direct
# when connecting to hidden members of a replica set.
# connect: :direct
# Changes the default time in seconds the server monitors refresh their status
# via hello commands. (default: 10)
# heartbeat_frequency: 10
# The time in seconds for selecting servers for a near read preference. (default: 0.015)
# local_threshold: 0.015
# The timeout in seconds for selecting a server for an operation. (default: 30)
# server_selection_timeout: 30
# The maximum number of connections in the connection pool. (default: 5)
# max_pool_size: 5
# The minimum number of connections in the connection pool. (default: 1)
# min_pool_size: 1
# The time to wait, in seconds, in the connection pool for a connection
# to be checked in before timing out. (default: 5)
# wait_queue_timeout: 5
# The time to wait to establish a connection before timing out, in seconds.
# (default: 10)
# connect_timeout: 10
# How long to wait for a response for each operation sent to the
# server. This timeout should be set to a value larger than the
# processing time for the longest operation that will be executed
# by the application. Note that this is a client-side timeout;
# the server may continue executing an operation after the client
# aborts it with the SocketTimeout exception.
# (default: nil, meaning no timeout)
# socket_timeout: 5
# The name of the replica set to connect to. Servers provided as seeds that do
# not belong to this replica set will be ignored.
# replica_set: name
# Whether to connect to the servers via ssl. (default: false)
# ssl: true
# The certificate file used to identify the connection against MongoDB.
# ssl_cert: /path/to/my.cert
# The private keyfile used to identify the connection against MongoDB.
# Note that even if the key is stored in the same file as the certificate,
# both need to be explicitly specified.
# ssl_key: /path/to/my.key
# A passphrase for the private key.
# ssl_key_pass_phrase: password
# Whether to do peer certification validation. (default: true)
# ssl_verify: true
# The file containing concatenated certificate authority certificates
# used to validate certs passed from the other end of the connection.
# ssl_ca_cert: /path/to/ca.cert
# Whether to truncate long log lines. (default: true)
# truncate_logs: true
# Configure Mongoid specific options. (optional)
options:
# Application name that is printed to the mongodb logs upon establishing
# a connection in server versions >= 3.4. Note that the name cannot
# exceed 128 bytes. It is also used as the database name if the
# database name is not explicitly defined. (default: nil)
# app_name: MyApplicationName
# Mark belongs_to associations as required by default, so that saving a
# model with a missing belongs_to association will trigger a validation
# error. (default: true)
# belongs_to_required_by_default: true
# Raise an exception when a field is redefined. (default: false)
# duplicate_fields_exception: false
# Include the root model name in json serialization. (default: false)
# include_root_in_json: false
# Include the _type field in serialization. (default: false)
# include_type_for_serialization: false
# Whether to join nested persistence contexts for atomic operations
# to parent contexts by default. (default: false)
# join_contexts: false
# Set the Mongoid and Ruby driver log levels when Mongoid is not using
# Ruby on Rails logger instance. (default: :info)
# log_level: :info
# Preload all models in development, needed when models use
# inheritance. (default: false)
# preload_models: false
# Raise an error when performing a #find and the document is not found.
# (default: true)
raise_not_found_error: false
# Raise an error when defining a scope with the same name as an
# existing method. (default: false)
# scope_overwrite_exception: false
# Use ActiveSupport's time zone in time operations instead of
# the Ruby default time zone. See the time zone section below for
# further information. (default: true)
# use_activesupport_time_zone: true
# Return stored times as UTC. See the time zone section below for
# further information. Most applications should not use this option.
# (default: false)
# use_utc: false
# (Deprecated) In MongoDB 4.0 and earlier, set whether to create
# indexes in the background by default. (default: false)
# background_indexing: false
test:
clients:
default:
uri: mongodb://railszen:railszen@mongo:27017/railszen
# database: autodeploy_test
# hosts:
# - localhost:27017
options:
read:
mode: :primary
max_pool_size: 1

View File

@@ -0,0 +1,35 @@
# This configuration file will be evaluated by Puma. The top-level methods that
# are invoked here are part of Puma's configuration DSL. For more information
# about methods provided by the DSL, see https://puma.io/puma/Puma/DSL.html.
# Puma can serve each request in a thread from an internal thread pool.
# The `threads` method setting takes two numbers: a minimum and maximum.
# Any libraries that use thread pools should be configured to match
# the maximum value specified for Puma. Default is set to 5 threads for minimum
# and maximum; this matches the default thread size of Active Record.
max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count }
threads min_threads_count, max_threads_count
# Specifies that the worker count should equal the number of processors in production.
if ENV["RAILS_ENV"] == "production"
require "concurrent-ruby"
worker_count = Integer(ENV.fetch("WEB_CONCURRENCY") { Concurrent.physical_processor_count })
workers worker_count if worker_count > 1
end
# Specifies the `worker_timeout` threshold that Puma will use to wait before
# terminating a worker in development environments.
worker_timeout 3600 if ENV.fetch("RAILS_ENV", "development") == "development"
# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
port ENV.fetch("PORT") { 3000 }
# Specifies the `environment` that Puma will run in.
environment ENV.fetch("RAILS_ENV") { "development" }
# Specifies the `pidfile` that Puma will use.
pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" }
# Allow puma to be restarted by `bin/rails restart` command.
plugin :tmp_restart

View File

@@ -0,0 +1,12 @@
Rails.application.routes.draw do
resources :scripts
root 'home#index'
# Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html
# Reveal health status on /up that returns 200 if the app boots with no exceptions, otherwise 500.
# Can be used by load balancers and uptime monitors to verify that the app is live.
get "up" => "rails/health#show", as: :rails_health_check
# Defines the root path route ("/")
# root "posts#index"
end

View File

View File

0
src/autogen/log/.keep Normal file
View File

View File

@@ -0,0 +1,67 @@
<!DOCTYPE html>
<html>
<head>
<title>The page you were looking for doesn't exist (404)</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<style>
.rails-default-error-page {
background-color: #EFEFEF;
color: #2E2F30;
text-align: center;
font-family: arial, sans-serif;
margin: 0;
}
.rails-default-error-page div.dialog {
width: 95%;
max-width: 33em;
margin: 4em auto 0;
}
.rails-default-error-page div.dialog > div {
border: 1px solid #CCC;
border-right-color: #999;
border-left-color: #999;
border-bottom-color: #BBB;
border-top: #B00100 solid 4px;
border-top-left-radius: 9px;
border-top-right-radius: 9px;
background-color: white;
padding: 7px 12% 0;
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
}
.rails-default-error-page h1 {
font-size: 100%;
color: #730E15;
line-height: 1.5em;
}
.rails-default-error-page div.dialog > p {
margin: 0 0 1em;
padding: 1em;
background-color: #F7F7F7;
border: 1px solid #CCC;
border-right-color: #999;
border-left-color: #999;
border-bottom-color: #999;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
border-top-color: #DADADA;
color: #666;
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
}
</style>
</head>
<body class="rails-default-error-page">
<!-- This file lives in public/404.html -->
<div class="dialog">
<div>
<h1>The page you were looking for doesn't exist.</h1>
<p>You may have mistyped the address or the page may have moved.</p>
</div>
<p>If you are the application owner check the logs for more information.</p>
</div>
</body>
</html>

View File

@@ -0,0 +1,67 @@
<!DOCTYPE html>
<html>
<head>
<title>The change you wanted was rejected (422)</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<style>
.rails-default-error-page {
background-color: #EFEFEF;
color: #2E2F30;
text-align: center;
font-family: arial, sans-serif;
margin: 0;
}
.rails-default-error-page div.dialog {
width: 95%;
max-width: 33em;
margin: 4em auto 0;
}
.rails-default-error-page div.dialog > div {
border: 1px solid #CCC;
border-right-color: #999;
border-left-color: #999;
border-bottom-color: #BBB;
border-top: #B00100 solid 4px;
border-top-left-radius: 9px;
border-top-right-radius: 9px;
background-color: white;
padding: 7px 12% 0;
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
}
.rails-default-error-page h1 {
font-size: 100%;
color: #730E15;
line-height: 1.5em;
}
.rails-default-error-page div.dialog > p {
margin: 0 0 1em;
padding: 1em;
background-color: #F7F7F7;
border: 1px solid #CCC;
border-right-color: #999;
border-left-color: #999;
border-bottom-color: #999;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
border-top-color: #DADADA;
color: #666;
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
}
</style>
</head>
<body class="rails-default-error-page">
<!-- This file lives in public/422.html -->
<div class="dialog">
<div>
<h1>The change you wanted was rejected.</h1>
<p>Maybe you tried to change something you didn't have access to.</p>
</div>
<p>If you are the application owner check the logs for more information.</p>
</div>
</body>
</html>

View File

@@ -0,0 +1,66 @@
<!DOCTYPE html>
<html>
<head>
<title>We're sorry, but something went wrong (500)</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<style>
.rails-default-error-page {
background-color: #EFEFEF;
color: #2E2F30;
text-align: center;
font-family: arial, sans-serif;
margin: 0;
}
.rails-default-error-page div.dialog {
width: 95%;
max-width: 33em;
margin: 4em auto 0;
}
.rails-default-error-page div.dialog > div {
border: 1px solid #CCC;
border-right-color: #999;
border-left-color: #999;
border-bottom-color: #BBB;
border-top: #B00100 solid 4px;
border-top-left-radius: 9px;
border-top-right-radius: 9px;
background-color: white;
padding: 7px 12% 0;
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
}
.rails-default-error-page h1 {
font-size: 100%;
color: #730E15;
line-height: 1.5em;
}
.rails-default-error-page div.dialog > p {
margin: 0 0 1em;
padding: 1em;
background-color: #F7F7F7;
border: 1px solid #CCC;
border-right-color: #999;
border-left-color: #999;
border-bottom-color: #999;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
border-top-color: #DADADA;
color: #666;
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
}
</style>
</head>
<body class="rails-default-error-page">
<!-- This file lives in public/500.html -->
<div class="dialog">
<div>
<h1>We're sorry, but something went wrong.</h1>
</div>
<p>If you are the application owner check the logs for more information.</p>
</div>
</body>
</html>

View File

View File

View File

@@ -0,0 +1 @@
# See https://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file

View File

View File

@@ -0,0 +1,5 @@
require "test_helper"
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
driven_by :selenium, using: :chrome, screen_size: [1400, 1400]
end

View File

@@ -0,0 +1,13 @@
require "test_helper"
module ApplicationCable
class ConnectionTest < ActionCable::Connection::TestCase
# test "connects with cookies" do
# cookies.signed[:user_id] = 42
#
# connect
#
# assert_equal connection.user_id, "42"
# end
end
end

View File

View File

@@ -0,0 +1,8 @@
require "test_helper"
class HomeControllerTest < ActionDispatch::IntegrationTest
test "should get index" do
get home_index_url
assert_response :success
end
end

View File

@@ -0,0 +1,48 @@
require "test_helper"
class ScriptsControllerTest < ActionDispatch::IntegrationTest
setup do
@script = scripts(:one)
end
test "should get index" do
get scripts_url
assert_response :success
end
test "should get new" do
get new_script_url
assert_response :success
end
test "should create script" do
assert_difference("Script.count") do
post scripts_url, params: { script: { content: @script.content, description: @script.description, lang: @script.lang, lock: @script.lock, name: @script.name, stage: @script.stage } }
end
assert_redirected_to script_url(Script.last)
end
test "should show script" do
get script_url(@script)
assert_response :success
end
test "should get edit" do
get edit_script_url(@script)
assert_response :success
end
test "should update script" do
patch script_url(@script), params: { script: { content: @script.content, description: @script.description, lang: @script.lang, lock: @script.lock, name: @script.name, stage: @script.stage } }
assert_redirected_to script_url(@script)
end
test "should destroy script" do
assert_difference("Script.count", -1) do
delete script_url(@script)
end
assert_redirected_to scripts_url
end
end

0
src/autogen/test/fixtures/files/.keep vendored Normal file
View File

17
src/autogen/test/fixtures/scripts.yml vendored Normal file
View File

@@ -0,0 +1,17 @@
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
name: MyString
stage: MyString
lang: MyString
content: MyText
lock: false
description: MyText
two:
name: MyString
stage: MyString
lang: MyString
content: MyText
lock: false
description: MyText

View File

View File

View File

View File

View File

@@ -0,0 +1,7 @@
require "test_helper"
class ScriptTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end

View File

View File

@@ -0,0 +1,51 @@
require "application_system_test_case"
class ScriptsTest < ApplicationSystemTestCase
setup do
@script = scripts(:one)
end
test "visiting the index" do
visit scripts_url
assert_selector "h1", text: "Scripts"
end
test "should create script" do
visit scripts_url
click_on "New script"
fill_in "Content", with: @script.content
fill_in "Description", with: @script.description
fill_in "Lang", with: @script.lang
check "Lock" if @script.lock
fill_in "Name", with: @script.name
fill_in "Stage", with: @script.stage
click_on "Create Script"
assert_text "Script was successfully created"
click_on "Back"
end
test "should update Script" do
visit script_url(@script)
click_on "Edit this script", match: :first
fill_in "Content", with: @script.content
fill_in "Description", with: @script.description
fill_in "Lang", with: @script.lang
check "Lock" if @script.lock
fill_in "Name", with: @script.name
fill_in "Stage", with: @script.stage
click_on "Update Script"
assert_text "Script was successfully updated"
click_on "Back"
end
test "should destroy Script" do
visit script_url(@script)
click_on "Destroy this script", match: :first
assert_text "Script was successfully destroyed"
end
end

View File

@@ -0,0 +1,12 @@
ENV["RAILS_ENV"] ||= "test"
require_relative "../config/environment"
require "rails/test_help"
module ActiveSupport
class TestCase
# Run tests in parallel with specified workers
parallelize(workers: :number_of_processors)
# Add more helper methods to be used by all tests here...
end
end

0
src/autogen/tmp/.keep Normal file
View File

View File

Some files were not shown because too many files have changed in this diff Show More