first commit

This commit is contained in:
RubyOn 2025-04-16 23:15:08 +09:00
commit 74f134c71a
153 changed files with 11803 additions and 0 deletions

3
.devcontainer/Dockerfile Normal file
View File

@ -0,0 +1,3 @@
# Make sure RUBY_VERSION matches the Ruby version in .ruby-version
ARG RUBY_VERSION=3.4.2
FROM ghcr.io/rails/devcontainer/images/ruby:$RUBY_VERSION

View File

@ -0,0 +1,27 @@
name: "farmitry_hvac"
services:
rails-app:
build:
context: ..
dockerfile: .devcontainer/Dockerfile
volumes:
- ../..:/workspaces:cached
# Overrides default command so things don't shut down after the process ends.
command: sleep infinity
# 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.)
depends_on:
- selenium
selenium:
image: selenium/standalone-chromium
restart: unless-stopped

View File

@ -0,0 +1,36 @@
// For format details, see https://containers.dev/implementors/json_reference/.
// For config options, see the README at: https://github.com/devcontainers/templates/tree/main/src/ruby
{
"name": "farmitry_hvac",
"dockerComposeFile": "compose.yaml",
"service": "rails-app",
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
"ghcr.io/devcontainers/features/github-cli:1": {},
"ghcr.io/rails/devcontainer/features/activestorage": {},
"ghcr.io/devcontainers/features/node:1": {},
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {},
"ghcr.io/rails/devcontainer/features/sqlite3": {}
},
"containerEnv": {
"CAPYBARA_SERVER_PORT": "45678",
"SELENIUM_HOST": "selenium",
"KAMAL_REGISTRY_PASSWORD": "$KAMAL_REGISTRY_PASSWORD"
},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [3000],
// Configure tool-specific properties.
// "customizations": {},
// Uncomment to connect as root instead. More info: https://containers.dev/implementors/json_reference/#remoteUser.
// "remoteUser": "root",
// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "bin/setup --skip-server"
}

51
.dockerignore Normal file
View File

@ -0,0 +1,51 @@
# See https://docs.docker.com/engine/reference/builder/#dockerignore-file for more about ignoring files.
# Ignore git directory.
/.git/
/.gitignore
# Ignore bundler config.
/.bundle
# Ignore all environment files.
/.env*
# 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
# Ignore CI service files.
/.github
# Ignore Kamal files.
/config/deploy*.yml
/.kamal
# Ignore development files
/.devcontainer
# Ignore Docker-related files
/.dockerignore
/Dockerfile*

9
.erb_lint.yml Normal file
View File

@ -0,0 +1,9 @@
# .erb_lint.yml
linters:
RuboCop:
enabled: true
rubocop_config: .rubocop.yml
SpaceInHtmlTag:
enabled: false
RequireInputAutocomplete:
enabled: false

9
.gitattributes vendored Normal file
View File

@ -0,0 +1,9 @@
# See https://git-scm.com/docs/gitattributes for more about git attribute files.
# Mark the database schema as having been generated.
db/schema.rb linguist-generated
# 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

12
.github/dependabot.yml vendored Normal file
View File

@ -0,0 +1,12 @@
version: 2
updates:
- package-ecosystem: bundler
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10

74
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,74 @@
name: CI
on:
pull_request:
push:
branches: [ main ]
jobs:
scan_ruby:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: .ruby-version
bundler-cache: true
- name: Scan for common Rails security vulnerabilities using static analysis
run: bin/brakeman --no-pager
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: .ruby-version
bundler-cache: true
- name: Lint code for consistent style
run: bin/rubocop -f github
test:
runs-on: ubuntu-latest
# services:
# redis:
# image: redis
# ports:
# - 6379:6379
# options: --health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- name: Install packages
run: sudo apt-get update && sudo apt-get install --no-install-recommends -y build-essential git libyaml-dev node-gyp pkg-config python-is-python3 google-chrome-stable
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: .ruby-version
bundler-cache: true
- name: Run tests
env:
RAILS_ENV: test
# REDIS_URL: redis://localhost:6379/0
run: bin/rails db:test:prepare test test:system
- name: Keep screenshots from failed system tests
uses: actions/upload-artifact@v4
if: failure()
with:
name: screenshots
path: ${{ github.workspace }}/tmp/screenshots
if-no-files-found: ignore

39
.gitignore vendored Normal file
View File

@ -0,0 +1,39 @@
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
#
# Temporary files generated by your text editor or operating system
# belong in git's global ignore instead:
# `$XDG_CONFIG_HOME/git/ignore` or `~/.config/git/ignore`
# Ignore bundler config.
/.bundle
# Ignore all environment files.
/.env*
# 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
/app/assets/builds/*
!/app/assets/builds/.keep
/node_modules

8
.idea/.gitignore vendored Normal file
View File

@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

345
.idea/farmitry_hvac.iml Normal file
View File

@ -0,0 +1,345 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="RUBY_MODULE" version="4">
<component name="FacetManager">
<facet type="RailsFacetType" name="Ruby on Rails">
<configuration>
<RAILS_FACET_CONFIG_ID NAME="RAILS_FACET_SUPPORT_REMOVED" VALUE="false" />
<RAILS_FACET_CONFIG_ID NAME="RAILS_TESTS_SOURCES_PATCHED" VALUE="true" />
<RAILS_FACET_CONFIG_ID NAME="RAILS_FACET_APPLICATION_ROOT" VALUE="$MODULE_DIR$" />
</configuration>
</facet>
</component>
<component name="ModuleRunConfigurationManager">
<shared />
</component>
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/features" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/.bundle" />
<excludeFolder url="file://$MODULE_DIR$/components" />
<excludeFolder url="file://$MODULE_DIR$/log" />
<excludeFolder url="file://$MODULE_DIR$/public/packs" />
<excludeFolder url="file://$MODULE_DIR$/public/system" />
<excludeFolder url="file://$MODULE_DIR$/tmp" />
<excludeFolder url="file://$MODULE_DIR$/vendor/bundle" />
<excludeFolder url="file://$MODULE_DIR$/vendor/cache" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" scope="PROVIDED" name="actioncable (v8.0.2, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="actionmailbox (v8.0.2, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="actionmailer (v8.0.2, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="actionpack (v8.0.2, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="actiontext (v8.0.2, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="actionview (v8.0.2, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="activejob (v8.0.2, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="activemodel (v8.0.2, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="activerecord (v8.0.2, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="activestorage (v8.0.2, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="activesupport (v8.0.2, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="addressable (v2.8.7, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="amazing_print (v1.7.2, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="ast (v2.4.3, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="base64 (v0.2.0, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="bcrypt_pbkdf (v1.1.1, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="benchmark (v0.4.0, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="better_html (v2.1.1, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="bigdecimal (v3.1.9, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="bindex (v0.8.1, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="bootsnap (v1.18.4, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="brakeman (v7.0.2, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="builder (v3.3.0, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="bundler (v2.6.6, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="capybara (v3.40.0, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="concurrent-ruby (v1.3.5, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="connection_pool (v2.5.0, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="crass (v1.0.6, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="cssbundling-rails (v1.4.3, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="date (v3.4.1, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="debug (v1.10.0, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="digest-crc (v0.7.0, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="dotenv (v3.1.8, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="drb (v2.2.1, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="ed25519 (v1.3.0, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="erb_lint (v0.9.0, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="erubi (v1.13.1, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="et-orbi (v1.2.11, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="foreman (v0.88.1, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="fugit (v1.11.1, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="globalid (v1.2.1, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="i18n (v1.14.7, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="io-console (v0.8.0, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="irb (v1.15.2, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="jbuilder (v2.13.0, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="jsbundling-rails (v1.3.1, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="json (v2.10.2, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="kamal (v2.5.3, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="language_server-protocol (v3.17.0.4, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="lint_roller (v1.1.0, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="logger (v1.7.0, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="loofah (v2.24.0, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="mail (v2.8.1, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="marcel (v1.0.4, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="matrix (v0.4.2, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="mini_mime (v1.1.5, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="minitest (v5.25.5, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="msgpack (v1.8.0, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="net-imap (v0.5.6, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="net-pop (v0.1.2, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="net-protocol (v0.2.2, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="net-scp (v4.1.0, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="net-sftp (v4.0.0, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="net-smtp (v0.5.1, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="net-ssh (v7.3.0, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="nio4r (v2.7.4, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="nokogiri (v1.18.7, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="ostruct (v0.6.1, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="parallel (v1.27.0, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="parser (v3.3.8.0, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="pp (v0.6.2, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="prettyprint (v0.2.0, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="prism (v1.4.0, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="propshaft (v1.1.0, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="psych (v5.2.3, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="public_suffix (v6.0.1, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="puma (v6.6.0, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="raabro (v1.4.0, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="racc (v1.8.1, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rack (v3.1.13, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rack-session (v2.1.0, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rack-test (v2.2.0, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rackup (v2.2.1, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rails (v8.0.2, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rails-dom-testing (v2.2.0, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rails-html-sanitizer (v1.6.2, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="railties (v8.0.2, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rainbow (v3.1.1, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rake (v13.2.1, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rdoc (v6.13.1, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="regexp_parser (v2.10.0, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="reline (v0.6.1, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rexml (v3.4.1, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rmodbus (v2.1.3, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rubocop (v1.75.2, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rubocop-ast (v1.44.1, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rubocop-performance (v1.25.0, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rubocop-rails (v2.31.0, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rubocop-rails-omakase (v1.1.0, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="ruby-progressbar (v1.13.0, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rubyzip (v2.4.1, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="securerandom (v0.4.1, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="selenium-webdriver (v4.31.0, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="smart_properties (v1.17.0, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="solid_cable (v3.0.7, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="solid_cache (v1.0.7, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="solid_queue (v1.1.4, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="sqlite3 (v2.6.0, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="sshkit (v1.24.0, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="stimulus-rails (v1.3.4, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="stringio (v3.1.6, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="thor (v1.3.2, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="thruster (v0.1.12, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="timeout (v0.4.3, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="turbo-rails (v2.0.13, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="tzinfo (v2.0.6, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="unicode-display_width (v3.1.4, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="unicode-emoji (v4.0.4, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="uri (v1.0.3, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="useragent (v0.16.11, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="web-console (v4.2.1, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="websocket (v1.2.11, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="websocket-driver (v0.7.7, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="websocket-extensions (v0.1.5, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="xpath (v3.2.0, rbenv: 3.4.2) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="zeitwerk (v2.7.2, rbenv: 3.4.2) [gem]" level="application" />
</component>
<component name="RModuleSettingsStorage">
<LOAD_PATH number="0" />
<I18N_FOLDERS number="1" string0="$MODULE_DIR$/config/locales" />
</component>
<component name="RailsGeneratorsCache">
<option name="generators">
<list>
<option value="active_record:application_record" />
<option value="active_record:multi_db" />
<option value="application_record" />
<option value="authentication" />
<option value="benchmark" />
<option value="channel" />
<option value="controller" />
<option value="erb:authentication" />
<option value="generator" />
<option value="helper" />
<option value="integration_test" />
<option value="jbuilder" />
<option value="job" />
<option value="mailbox" />
<option value="mailer" />
<option value="migration" />
<option value="model" />
<option value="resource" />
<option value="scaffold" />
<option value="scaffold_controller" />
<option value="script" />
<option value="solid_cable:install" />
<option value="solid_cable:update" />
<option value="solid_cache:install" />
<option value="solid_queue:install" />
<option value="stimulus" />
<option value="system_test" />
<option value="task" />
<option value="test_unit:authentication" />
<option value="test_unit:channel" />
<option value="test_unit:generator" />
<option value="test_unit:install" />
<option value="test_unit:mailbox" />
<option value="test_unit:plugin" />
</list>
</option>
<option name="myGenerators">
<list>
<option value="active_record:application_record" />
<option value="active_record:multi_db" />
<option value="application_record" />
<option value="authentication" />
<option value="benchmark" />
<option value="channel" />
<option value="controller" />
<option value="erb:authentication" />
<option value="generator" />
<option value="helper" />
<option value="integration_test" />
<option value="jbuilder" />
<option value="job" />
<option value="mailbox" />
<option value="mailer" />
<option value="migration" />
<option value="model" />
<option value="resource" />
<option value="scaffold" />
<option value="scaffold_controller" />
<option value="script" />
<option value="solid_cable:install" />
<option value="solid_cable:update" />
<option value="solid_cache:install" />
<option value="solid_queue:install" />
<option value="stimulus" />
<option value="system_test" />
<option value="task" />
<option value="test_unit:authentication" />
<option value="test_unit:channel" />
<option value="test_unit:generator" />
<option value="test_unit:install" />
<option value="test_unit:mailbox" />
<option value="test_unit:plugin" />
</list>
</option>
</component>
<component name="RailsPaths" isManagedAutomatically="true">
<entry key="app">
<value>file://$MODULE_DIR$/app</value>
</entry>
<entry key="app/assets">
<value>file://$MODULE_DIR$/app/assets</value>
</entry>
<entry key="app/channels">
<value>file://$MODULE_DIR$/app/channels</value>
</entry>
<entry key="app/controllers">
<value>file://$MODULE_DIR$/app/controllers</value>
</entry>
<entry key="app/helpers">
<value>file://$MODULE_DIR$/app/helpers</value>
</entry>
<entry key="app/mailers">
<value>file://$MODULE_DIR$/app/mailers</value>
</entry>
<entry key="app/models">
<value>file://$MODULE_DIR$/app/models</value>
</entry>
<entry key="app/views">
<value>file://$MODULE_DIR$/app/views</value>
</entry>
<entry key="config">
<value>file://$MODULE_DIR$/config</value>
</entry>
<entry key="config/cable">
<value>file://$MODULE_DIR$/config/cable.yml</value>
</entry>
<entry key="config/cache">
<value>file://$MODULE_DIR$/config/cache.yml</value>
</entry>
<entry key="config/database">
<value>file://$MODULE_DIR$/config/database.yml</value>
</entry>
<entry key="config/environment">
<value>file://$MODULE_DIR$/config/environment.rb</value>
</entry>
<entry key="config/environments">
<value>file://$MODULE_DIR$/config/environments</value>
</entry>
<entry key="config/initializers">
<value>file://$MODULE_DIR$/config/initializers</value>
</entry>
<entry key="config/locales">
<value>file://$MODULE_DIR$/config/locales</value>
</entry>
<entry key="config/routes">
<value>file://$MODULE_DIR$/config/routes</value>
</entry>
<entry key="config/routes.rb">
<value>file://$MODULE_DIR$/config/routes.rb</value>
</entry>
<entry key="config/solid_cache">
<value>file://$MODULE_DIR$/config/solid_cache.yml</value>
</entry>
<entry key="db">
<value>file://$MODULE_DIR$/db</value>
</entry>
<entry key="db/migrate">
<value>file://$MODULE_DIR$/db/migrate</value>
</entry>
<entry key="db/seeds.rb">
<value>file://$MODULE_DIR$/db/seeds.rb</value>
</entry>
<entry key="lib">
<value>file://$MODULE_DIR$/lib</value>
</entry>
<entry key="lib/assets">
<value>file://$MODULE_DIR$/lib/assets</value>
</entry>
<entry key="lib/tasks">
<value>file://$MODULE_DIR$/lib/tasks</value>
</entry>
<entry key="lib/templates">
<value>file://$MODULE_DIR$/lib/templates</value>
</entry>
<entry key="log">
<value>file://$MODULE_DIR$/log/development.log</value>
</entry>
<entry key="public">
<value>file://$MODULE_DIR$/public</value>
</entry>
<entry key="public/javascripts">
<value>file://$MODULE_DIR$/public/javascripts</value>
</entry>
<entry key="public/stylesheets">
<value>file://$MODULE_DIR$/public/stylesheets</value>
</entry>
<entry key="test/mailers/previews">
<value>file://$MODULE_DIR$/test/mailers/previews</value>
<value>file://$MODULE_DIR$/test/mailers/previews</value>
</entry>
<entry key="tmp">
<value>file://$MODULE_DIR$/tmp</value>
</entry>
<entry key="vendor">
<value>file://$MODULE_DIR$/vendor</value>
</entry>
<entry key="vendor/assets">
<value>file://$MODULE_DIR$/vendor/assets</value>
</entry>
</component>
</module>

4
.idea/misc.xml Normal file
View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="rbenv: 3.4.2" project-jdk-type="RUBY_SDK" />
</project>

8
.idea/modules.xml Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/farmitry_hvac.iml" filepath="$PROJECT_DIR$/.idea/farmitry_hvac.iml" />
</modules>
</component>
</project>

6
.idea/vcs.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

View File

@ -0,0 +1,3 @@
#!/bin/sh
echo "Docker set up on $KAMAL_HOSTS..."

View File

@ -0,0 +1,3 @@
#!/bin/sh
echo "Booted app version $KAMAL_VERSION on $KAMAL_HOSTS..."

14
.kamal/hooks/post-deploy.sample Executable file
View File

@ -0,0 +1,14 @@
#!/bin/sh
# A sample post-deploy hook
#
# These environment variables are available:
# KAMAL_RECORDED_AT
# KAMAL_PERFORMER
# KAMAL_VERSION
# KAMAL_HOSTS
# KAMAL_ROLE (if set)
# KAMAL_DESTINATION (if set)
# KAMAL_RUNTIME
echo "$KAMAL_PERFORMER deployed $KAMAL_VERSION to $KAMAL_DESTINATION in $KAMAL_RUNTIME seconds"

View File

@ -0,0 +1,3 @@
#!/bin/sh
echo "Rebooted kamal-proxy on $KAMAL_HOSTS"

View File

@ -0,0 +1,3 @@
#!/bin/sh
echo "Booting app version $KAMAL_VERSION on $KAMAL_HOSTS..."

51
.kamal/hooks/pre-build.sample Executable file
View File

@ -0,0 +1,51 @@
#!/bin/sh
# A sample pre-build hook
#
# Checks:
# 1. We have a clean checkout
# 2. A remote is configured
# 3. The branch has been pushed to the remote
# 4. The version we are deploying matches the remote
#
# These environment variables are available:
# KAMAL_RECORDED_AT
# KAMAL_PERFORMER
# KAMAL_VERSION
# KAMAL_HOSTS
# KAMAL_ROLE (if set)
# KAMAL_DESTINATION (if set)
if [ -n "$(git status --porcelain)" ]; then
echo "Git checkout is not clean, aborting..." >&2
git status --porcelain >&2
exit 1
fi
first_remote=$(git remote)
if [ -z "$first_remote" ]; then
echo "No git remote set, aborting..." >&2
exit 1
fi
current_branch=$(git branch --show-current)
if [ -z "$current_branch" ]; then
echo "Not on a git branch, aborting..." >&2
exit 1
fi
remote_head=$(git ls-remote $first_remote --tags $current_branch | cut -f1)
if [ -z "$remote_head" ]; then
echo "Branch not pushed to remote, aborting..." >&2
exit 1
fi
if [ "$KAMAL_VERSION" != "$remote_head" ]; then
echo "Version ($KAMAL_VERSION) does not match remote HEAD ($remote_head), aborting..." >&2
exit 1
fi
exit 0

47
.kamal/hooks/pre-connect.sample Executable file
View File

@ -0,0 +1,47 @@
#!/usr/bin/env ruby
# A sample pre-connect check
#
# Warms DNS before connecting to hosts in parallel
#
# These environment variables are available:
# KAMAL_RECORDED_AT
# KAMAL_PERFORMER
# KAMAL_VERSION
# KAMAL_HOSTS
# KAMAL_ROLE (if set)
# KAMAL_DESTINATION (if set)
# KAMAL_RUNTIME
hosts = ENV["KAMAL_HOSTS"].split(",")
results = nil
max = 3
elapsed = Benchmark.realtime do
results = hosts.map do |host|
Thread.new do
tries = 1
begin
Socket.getaddrinfo(host, 0, Socket::AF_UNSPEC, Socket::SOCK_STREAM, nil, Socket::AI_CANONNAME)
rescue SocketError
if tries < max
puts "Retrying DNS warmup: #{host}"
tries += 1
sleep rand
retry
else
puts "DNS warmup failed: #{host}"
host
end
end
tries
end
end.map(&:value)
end
retries = results.sum - hosts.size
nopes = results.count { |r| r == max }
puts "Prewarmed %d DNS lookups in %.2f sec: %d retries, %d failures" % [ hosts.size, elapsed, retries, nopes ]

109
.kamal/hooks/pre-deploy.sample Executable file
View File

@ -0,0 +1,109 @@
#!/usr/bin/env ruby
# A sample pre-deploy hook
#
# Checks the Github status of the build, waiting for a pending build to complete for up to 720 seconds.
#
# Fails unless the combined status is "success"
#
# These environment variables are available:
# KAMAL_RECORDED_AT
# KAMAL_PERFORMER
# KAMAL_VERSION
# KAMAL_HOSTS
# KAMAL_COMMAND
# KAMAL_SUBCOMMAND
# KAMAL_ROLE (if set)
# KAMAL_DESTINATION (if set)
# Only check the build status for production deployments
if ENV["KAMAL_COMMAND"] == "rollback" || ENV["KAMAL_DESTINATION"] != "production"
exit 0
end
require "bundler/inline"
# true = install gems so this is fast on repeat invocations
gemfile(true, quiet: true) do
source "https://rubygems.org"
gem "octokit"
gem "faraday-retry"
end
MAX_ATTEMPTS = 72
ATTEMPTS_GAP = 10
def exit_with_error(message)
$stderr.puts message
exit 1
end
class GithubStatusChecks
attr_reader :remote_url, :git_sha, :github_client, :combined_status
def initialize
@remote_url = `git config --get remote.origin.url`.strip.delete_prefix("https://github.com/")
@git_sha = `git rev-parse HEAD`.strip
@github_client = Octokit::Client.new(access_token: ENV["GITHUB_TOKEN"])
refresh!
end
def refresh!
@combined_status = github_client.combined_status(remote_url, git_sha)
end
def state
combined_status[:state]
end
def first_status_url
first_status = combined_status[:statuses].find { |status| status[:state] == state }
first_status && first_status[:target_url]
end
def complete_count
combined_status[:statuses].count { |status| status[:state] != "pending"}
end
def total_count
combined_status[:statuses].count
end
def current_status
if total_count > 0
"Completed #{complete_count}/#{total_count} checks, see #{first_status_url} ..."
else
"Build not started..."
end
end
end
$stdout.sync = true
puts "Checking build status..."
attempts = 0
checks = GithubStatusChecks.new
begin
loop do
case checks.state
when "success"
puts "Checks passed, see #{checks.first_status_url}"
exit 0
when "failure"
exit_with_error "Checks failed, see #{checks.first_status_url}"
when "pending"
attempts += 1
end
exit_with_error "Checks are still pending, gave up after #{MAX_ATTEMPTS * ATTEMPTS_GAP} seconds" if attempts == MAX_ATTEMPTS
puts checks.current_status
sleep(ATTEMPTS_GAP)
checks.refresh!
end
rescue Octokit::NotFound
exit_with_error "Build status could not be found"
end

View File

@ -0,0 +1,3 @@
#!/bin/sh
echo "Rebooting kamal-proxy on $KAMAL_HOSTS..."

17
.kamal/secrets Normal file
View File

@ -0,0 +1,17 @@
# Secrets defined here are available for reference under registry/password, env/secret, builder/secrets,
# and accessories/*/env/secret in config/deploy.yml. All secrets should be pulled from either
# password manager, ENV, or a file. DO NOT ENTER RAW CREDENTIALS HERE! This file needs to be safe for git.
# Example of extracting secrets from 1password (or another compatible pw manager)
# SECRETS=$(kamal secrets fetch --adapter 1password --account your-account --from Vault/Item KAMAL_REGISTRY_PASSWORD RAILS_MASTER_KEY)
# KAMAL_REGISTRY_PASSWORD=$(kamal secrets extract KAMAL_REGISTRY_PASSWORD ${SECRETS})
# RAILS_MASTER_KEY=$(kamal secrets extract RAILS_MASTER_KEY ${SECRETS})
# Use a GITHUB_TOKEN if private repositories are needed for the image
# GITHUB_TOKEN=$(gh config get -h github.com oauth_token)
# Grab the registry password from ENV
KAMAL_REGISTRY_PASSWORD=$KAMAL_REGISTRY_PASSWORD
# Improve security by using a password manager. Never check config/master.key into git!
RAILS_MASTER_KEY=$(cat config/master.key)

1
.node-version Normal file
View File

@ -0,0 +1 @@
23.10.0

32
.rubocop.yml Normal file
View File

@ -0,0 +1,32 @@
# Omakase Ruby styling for Rails
inherit_gem: { rubocop-rails-omakase: rubocop.yml }
# Overwrite or add rules to create your own house style
#
# # Use `[a, [b, c]]` not `[ a, [ b, c ] ]`
# Layout/SpaceInsideArrayLiteralBrackets:
# Enabled: false
inherit_from:
- ./.rubocop_bundler.yml
- ./.rubocop_gemspec.yml
- ./.rubocop_layout.yml
- ./.rubocop_lint.yml
- ./.rubocop_metrics.yml
- ./.rubocop_migration.yml
- ./.rubocop_naming.yml
- ./.rubocop_performance.yml
- ./.rubocop_rails.yml
- ./.rubocop_security.yml
- ./.rubocop_style.yml
AllCops:
Exclude:
- 'test/**/*'
- 'db/seeds.rb'
require:
- .rubocop_custom_layout_space_inside_percent_literal_brackets
Layout/SpaceInsidePercentLiteralBrackets:
Enabled: true

89
.rubocop_bundler.yml Normal file
View File

@ -0,0 +1,89 @@
# Department 'Bundler' (7): 수정
Bundler/DuplicatedGem:
Description: Checks for duplicate gem entries in Gemfile.
Enabled: false
Severity: warning
VersionAdded: '0.46'
VersionChanged: '1.40'
Include:
- "**/*.gemfile"
- "**/Gemfile"
- "**/gems.rb"
Bundler/DuplicatedGroup:
Description: Checks for duplicate group entries in Gemfile.
Enabled: true
Severity: warning
VersionAdded: '1.56'
Include:
- "**/*.gemfile"
- "**/Gemfile"
- "**/gems.rb"
Bundler/GemComment:
Description: Add a comment describing each gem.
Enabled: false
VersionAdded: '0.59'
VersionChanged: '0.85'
Include:
- "**/*.gemfile"
- "**/Gemfile"
- "**/gems.rb"
IgnoredGems: []
OnlyFor: []
Bundler/GemFilename:
Description: Enforces the filename for managing gems.
Enabled: false
VersionAdded: '1.20'
EnforcedStyle: Gemfile
SupportedStyles:
- Gemfile
- gems.rb
Include:
- "**/Gemfile"
- "**/gems.rb"
- "**/Gemfile.lock"
- "**/gems.locked"
Bundler/GemVersion:
Description: Requires or forbids specifying gem versions.
Enabled: false
VersionAdded: '1.14'
EnforcedStyle: required
SupportedStyles:
- required
- forbidden
Include:
- "**/*.gemfile"
- "**/Gemfile"
- "**/gems.rb"
AllowedGems: []
# Supports --autocorrect
Bundler/InsecureProtocolSource:
Description: The source `:gemcutter`, `:rubygems` and `:rubyforge` are deprecated
because HTTP requests are insecure. Please change your source to 'https://rubygems.org'
if possible, or 'http://rubygems.org' if not.
Enabled: false
Severity: warning
VersionAdded: '0.50'
VersionChanged: '1.40'
AllowHttpProtocol: true
Include:
- "**/*.gemfile"
- "**/Gemfile"
- "**/gems.rb"
# Supports --autocorrect
Bundler/OrderedGems:
Description: Gems within groups in the Gemfile should be alphabetically sorted.
Enabled: true
VersionAdded: '0.46'
VersionChanged: '0.47'
TreatCommentsAsGroupSeparators: true
ConsiderPunctuation: false
Include:
- "**/*.gemfile"
- "**/Gemfile"
- "**/gems.rb"

View File

@ -0,0 +1,22 @@
module RuboCop
module Cop
module Layout
class SpaceInsidePercentLiteralBrackets < Base
MSG = 'Use spaces inside `%w[ first second ]`.'
def on_array(node)
return unless node.percent_literal? && node.loc.expression.source =~ /^%w\[(.+)\]$/
space_inside = node.loc.expression.source =~ /\[%s+/
add_offense(node, message: MSG) unless space_inside
end
def autocorrect(node)
lambda do |corrector|
corrector.replace(node.loc.expression, node.loc.expression.source.gsub('%w[', '%w[ ').gsub(']', ' ]'))
end
end
end
end
end
end

102
.rubocop_gemspec.yml Normal file
View File

@ -0,0 +1,102 @@
# Department 'Gemspec' (9): 미수정
# Supports --autocorrect
Gemspec/AddRuntimeDependency:
Description: Prefer `add_dependency` over `add_runtime_dependency`.
StyleGuide: "#add_dependency_vs_add_runtime_dependency"
Reference: https://github.com/rubygems/rubygems/issues/7799#issuecomment-2192720316
Enabled: false
VersionAdded: '1.65'
Include:
- "**/*.gemspec"
Gemspec/DependencyVersion:
Description: Requires or forbids specifying gem dependency versions.
Enabled: false
VersionAdded: '1.29'
EnforcedStyle: required
SupportedStyles:
- required
- forbidden
Include:
- "**/*.gemspec"
AllowedGems: []
# Supports --autocorrect
Gemspec/DeprecatedAttributeAssignment:
Description: Checks that deprecated attribute assignments are not set in a gemspec
file.
Enabled: false
Severity: warning
VersionAdded: '1.30'
VersionChanged: '1.40'
Include:
- "**/*.gemspec"
Gemspec/DevelopmentDependencies:
Description: Checks that development dependencies are specified in Gemfile rather
than gemspec.
Enabled: false
VersionAdded: '1.44'
EnforcedStyle: Gemfile
SupportedStyles:
- Gemfile
- gems.rb
- gemspec
AllowedGems: []
Include:
- "**/*.gemspec"
- "**/Gemfile"
- "**/gems.rb"
Gemspec/DuplicatedAssignment:
Description: An attribute assignment method calls should be listed only once in a
gemspec.
Enabled: false
Severity: warning
VersionAdded: '0.52'
VersionChanged: '1.40'
Include:
- "**/*.gemspec"
# Supports --autocorrect
Gemspec/OrderedDependencies:
Description: Dependencies in the gemspec should be alphabetically sorted.
Enabled: false
VersionAdded: '0.51'
TreatCommentsAsGroupSeparators: true
ConsiderPunctuation: false
Include:
- "**/*.gemspec"
# Supports --autocorrect
Gemspec/RequireMFA:
Description: Checks that the gemspec has metadata to require Multi-Factor Authentication
from RubyGems.
Enabled: false
Severity: warning
VersionAdded: '1.23'
VersionChanged: '1.40'
Reference:
- https://guides.rubygems.org/mfa-requirement-opt-in/
Include:
- "**/*.gemspec"
Gemspec/RequiredRubyVersion:
Description: Checks that `required_ruby_version` of gemspec is specified and equal
to `TargetRubyVersion` of .rubocop.yml.
Enabled: false
Severity: warning
VersionAdded: '0.52'
VersionChanged: '1.40'
Include:
- "**/*.gemspec"
Gemspec/RubyVersionGlobalsUsage:
Description: Checks usage of RUBY_VERSION in gemspec.
StyleGuide: "#no-ruby-version-in-the-gemspec"
Enabled: false
Severity: warning
VersionAdded: '0.72'
VersionChanged: '1.40'
Include:
- "**/*.gemspec"

1009
.rubocop_layout.yml Normal file

File diff suppressed because it is too large Load Diff

1079
.rubocop_lint.yml Normal file

File diff suppressed because it is too large Load Diff

103
.rubocop_metrics.yml Normal file
View File

@ -0,0 +1,103 @@
# Department 'Metrics' (10): 미수정
Metrics/AbcSize:
Description: A calculated magnitude based on number of assignments, branches, and
conditions.
Reference:
- http://c2.com/cgi/wiki?AbcMetric
- https://en.wikipedia.org/wiki/ABC_Software_Metric
Enabled: false
VersionAdded: '0.27'
VersionChanged: '1.5'
AllowedMethods: []
AllowedPatterns: []
CountRepeatedAttributes: true
Max: 17
Metrics/BlockLength:
Description: Avoid long blocks with many lines.
Enabled: false
VersionAdded: '0.44'
VersionChanged: '1.5'
CountComments: false
Max: 25
CountAsOne: []
AllowedMethods:
- refine
AllowedPatterns: []
Exclude:
- "/Users/rubyon/Desktop/liaf-rails/**/*.gemspec"
Metrics/BlockNesting:
Description: Avoid excessive block nesting.
StyleGuide: "#three-is-the-number-thou-shalt-count"
Enabled: false
VersionAdded: '0.25'
VersionChanged: '1.65'
CountBlocks: false
CountModifierForms: false
Max: 3
Metrics/ClassLength:
Description: Avoid classes longer than 100 lines of code.
Enabled: false
VersionAdded: '0.25'
VersionChanged: '0.87'
CountComments: false
Max: 100
CountAsOne: []
Metrics/CollectionLiteralLength:
Description: Checks for `Array` or `Hash` literals with many entries.
Enabled: false
VersionAdded: '1.47'
LengthThreshold: 250
Metrics/CyclomaticComplexity:
Description: A complexity metric that is strongly correlated to the number of test
cases needed to validate a method.
Enabled: false
VersionAdded: '0.25'
VersionChanged: '0.81'
AllowedMethods: []
AllowedPatterns: []
Max: 7
Metrics/MethodLength:
Description: Avoid methods longer than 10 lines of code.
StyleGuide: "#short-methods"
Enabled: false
VersionAdded: '0.25'
VersionChanged: '1.5'
CountComments: false
Max: 10
CountAsOne: []
AllowedMethods: []
AllowedPatterns: []
Metrics/ModuleLength:
Description: Avoid modules longer than 100 lines of code.
Enabled: false
VersionAdded: '0.31'
VersionChanged: '0.87'
CountComments: false
Max: 100
CountAsOne: []
Metrics/ParameterLists:
Description: Avoid parameter lists longer than three or four parameters.
StyleGuide: "#too-many-params"
Enabled: false
VersionAdded: '0.25'
VersionChanged: '1.5'
Max: 5
CountKeywordArgs: true
MaxOptionalParameters: 3
Metrics/PerceivedComplexity:
Description: A complexity metric geared towards measuring complexity for a human reader.
Enabled: false
VersionAdded: '0.25'
VersionChanged: '0.81'
AllowedMethods: []
AllowedPatterns: []
Max: 8

7
.rubocop_migration.yml Normal file
View File

@ -0,0 +1,7 @@
# Department 'Migration' (1): 수정
# Supports --autocorrect
Migration/DepartmentName:
Description: Check that cop names in rubocop:disable (etc) comments are given with
department name.
Enabled: true
VersionAdded: '0.75'

414
.rubocop_minitest.yml Normal file
View File

@ -0,0 +1,414 @@
# Department 'Minitest' (55): 미수정
# Supports --autocorrect
Minitest/AssertEmpty:
Description: This cop enforces the test to use `assert_empty` instead of using `assert(object.empty?)`.
StyleGuide: https://minitest.rubystyle.guide#assert-empty
Enabled: false
VersionAdded: '0.2'
# Supports --autocorrect
Minitest/AssertEmptyLiteral:
Description: This cop enforces the test to use `assert_empty` instead of using `assert_equal([],
object)`.
Enabled: false
VersionAdded: '0.5'
VersionChanged: '0.11'
# Supports --autocorrect
Minitest/AssertEqual:
Description: This cop enforces the test to use `assert_equal` instead of using `assert(expected
== actual)`.
StyleGuide: https://minitest.rubystyle.guide#assert-equal-arguments-order
Enabled: false
VersionAdded: '0.4'
# Supports --autocorrect
Minitest/AssertInDelta:
Description: This cop enforces the test to use `assert_in_delta` instead of using
`assert_equal` to compare floats.
StyleGuide: https://minitest.rubystyle.guide/#assert-in-delta
Enabled: false
VersionAdded: '0.10'
# Supports --autocorrect
Minitest/AssertIncludes:
Description: This cop enforces the test to use `assert_includes` instead of using
`assert(collection.include?(object))`.
StyleGuide: https://minitest.rubystyle.guide#assert-includes
Enabled: false
VersionAdded: '0.2'
# Supports --autocorrect
Minitest/AssertInstanceOf:
Description: This cop enforces the test to use `assert_instance_of(Class, object)`
over `assert(object.instance_of?(Class))`
StyleGuide: https://minitest.rubystyle.guide#assert-instance-of
Enabled: false
VersionAdded: '0.4'
# Supports --autocorrect
Minitest/AssertKindOf:
Description: This cop enforces the test to use `assert_kind_of(Class, object)` over
`assert(object.kind_of?(Class))`
StyleGuide: https://github.com/rubocop/minitest-style-guide#assert-kind-of
Enabled: false
VersionAdded: '0.10'
VersionChanged: '0.34'
# Supports --autocorrect
Minitest/AssertMatch:
Description: This cop enforces the test to use `assert_match` instead of using `assert(matcher.match(object))`.
StyleGuide: https://minitest.rubystyle.guide#assert-match
Enabled: false
VersionAdded: '0.6'
# Supports --autocorrect
Minitest/AssertNil:
Description: This cop enforces the test to use `assert_nil` instead of using `assert_equal(nil,
something)` or `assert(something.nil?)`.
StyleGuide: https://minitest.rubystyle.guide#assert-nil
Enabled: false
VersionAdded: '0.1'
# Supports --autocorrect
Minitest/AssertOperator:
Description: This cop enforces the use of `assert_operator(expected, :<, actual)`
over `assert(expected < actual)`.
StyleGuide: https://minitest.rubystyle.guide#assert-operator
Enabled: false
VersionAdded: '0.32'
Minitest/AssertOutput:
Description: This cop checks for opportunities to use `assert_output`.
StyleGuide: https://minitest.rubystyle.guide/#assert-output
Enabled: false
VersionAdded: '0.10'
# Supports --autocorrect
Minitest/AssertPathExists:
Description: This cop enforces the test to use `assert_path_exists` instead of using
`assert(File.exist?(path))`.
StyleGuide: https://minitest.rubystyle.guide/#assert-path-exists
Enabled: false
VersionAdded: '0.10'
# Supports --autocorrect
Minitest/AssertPredicate:
Description: This cop enforces the test to use `assert_predicate` instead of using
`assert(obj.a_predicate_method?)`.
StyleGuide: https://minitest.rubystyle.guide/#assert-predicate
Enabled: false
VersionAdded: '0.18'
Minitest/AssertRaisesCompoundBody:
Description: This cop enforces the block body of `assert_raises { ... }` to be reduced
to only the raising code.
Enabled: false
VersionAdded: '0.21'
Minitest/AssertRaisesWithRegexpArgument:
Description: This cop enforces checks for regular expression literals passed to `assert_raises`.
Enabled: false
Severity: warning
VersionAdded: '0.22'
VersionChanged: '0.26'
# Supports --autocorrect
Minitest/AssertRespondTo:
Description: This cop enforces the test to use `assert_respond_to(object, :do_something)`
over `assert(object.respond_to?(:do_something))`.
StyleGuide: https://minitest.rubystyle.guide#assert-responds-to-method
Enabled: false
VersionAdded: '0.3'
# Supports --autocorrect
Minitest/AssertSame:
Description: Enforces the use of `assert_same(expected, actual)` over `assert(expected.equal?(actual))`.
StyleGuide: https://minitest.rubystyle.guide#assert-same
Enabled: false
VersionAdded: '0.26'
# Supports --autocorrect
Minitest/AssertSilent:
Description: This cop enforces the test to use `assert_silent { ... }` instead of
using `assert_output('', '') { ... }`.
StyleGuide: https://github.com/rubocop/minitest-style-guide#assert-silent
Enabled: false
VersionAdded: '0.10'
# Supports --autocorrect
Minitest/AssertTruthy:
Description: This cop enforces the test to use `assert(actual)` instead of using `assert_equal(true,
actual)`.
StyleGuide: https://minitest.rubystyle.guide#assert-truthy
Enabled: false
Safe: false
VersionAdded: '0.2'
VersionChanged: '0.27'
Minitest/AssertWithExpectedArgument:
Description: This cop tries to detect when a user accidentally used `assert` when
they meant to use `assert_equal`.
Enabled: false
Severity: warning
Safe: false
VersionAdded: '0.11'
VersionChanged: '0.26'
Minitest/AssertionInLifecycleHook:
Description: This cop checks for usage of assertions in lifecycle hooks.
Enabled: false
VersionAdded: '0.10'
Minitest/DuplicateTestRun:
Description: This cop detects duplicate test runs caused by one test class inheriting
from another.
StyleGuide: https://minitest.rubystyle.guide/#subclassing-test-cases
Enabled: false
VersionAdded: '0.19'
# Supports --autocorrect
Minitest/EmptyLineBeforeAssertionMethods:
Description: Add empty line before assertion methods.
Enabled: false
VersionAdded: '0.23'
# Supports --autocorrect
Minitest/Focus:
Description: Checks for focused tests.
Enabled: false
AutoCorrect: contextual
VersionAdded: '0.35'
# Supports --autocorrect
Minitest/GlobalExpectations:
Description: This cop checks for deprecated global expectations.
StyleGuide: https://minitest.rubystyle.guide#global-expectations
Enabled: false
Severity: warning
EnforcedStyle: any
Include:
- "**/test/**/*"
- "**/*_test.rb"
- "**/spec/**/*"
- "**/*_spec.rb"
SupportedStyles:
- _
- any
- expect
- value
VersionAdded: '0.7'
VersionChanged: '0.26'
# Supports --autocorrect
Minitest/LifecycleHooksOrder:
Description: Checks that lifecycle hooks are declared in the order in which they will
be executed.
StyleGuide: https://minitest.rubystyle.guide/#hooks-ordering
Enabled: false
VersionAdded: '0.28'
# Supports --autocorrect
Minitest/LiteralAsActualArgument:
Description: This cop enforces correct order of `expected` and `actual` arguments
for `assert_equal`.
StyleGuide: https://minitest.rubystyle.guide/#assert-equal-arguments-order
Enabled: false
VersionAdded: '0.10'
Minitest/MultipleAssertions:
Description: This cop checks if test cases contain too many assertion calls.
Enabled: false
VersionAdded: '0.10'
Max: 3
Minitest/NoAssertions:
Description: This cop checks for at least one assertion (or flunk) in tests.
Enabled: false
VersionAdded: '0.12'
Minitest/NoTestCases:
Description: Checks if test class contains any test cases.
Enabled: false
VersionAdded: '0.30'
Minitest/NonExecutableTestMethod:
Description: Checks uses of test methods outside test class.
Enabled: false
Severity: warning
VersionAdded: '0.34'
Minitest/NonPublicTestMethod:
Description: Detects non `public` (marked as `private` or `protected`) test methods.
Enabled: false
Severity: warning
VersionAdded: '0.27'
# Supports --autocorrect
Minitest/RedundantMessageArgument:
Description: Detects redundant message argument in assertion methods.
Enabled: false
VersionAdded: '0.34'
# Supports --autocorrect
Minitest/RefuteEmpty:
Description: This cop enforces to use `refute_empty` instead of using `refute(object.empty?)`.
StyleGuide: https://minitest.rubystyle.guide#refute-empty
Enabled: false
VersionAdded: '0.3'
# Supports --autocorrect
Minitest/RefuteEqual:
Description: Check if your test uses `refute_equal` instead of `assert(expected !=
object)` or `assert(! expected == object))`.
StyleGuide: https://minitest.rubystyle.guide#refute-equal
Enabled: false
VersionAdded: '0.3'
# Supports --autocorrect
Minitest/RefuteFalse:
Description: Check if your test uses `refute(actual)` instead of `assert_equal(false,
actual)`.
StyleGuide: https://minitest.rubystyle.guide#refute-false
Enabled: false
Safe: false
VersionAdded: '0.3'
VersionChanged: '0.27'
# Supports --autocorrect
Minitest/RefuteInDelta:
Description: This cop enforces the test to use `refute_in_delta` instead of using
`refute_equal` to compare floats.
StyleGuide: https://minitest.rubystyle.guide/#refute-in-delta
Enabled: false
VersionAdded: '0.10'
# Supports --autocorrect
Minitest/RefuteIncludes:
Description: This cop enforces the test to use `refute_includes` instead of using
`refute(collection.include?(object))`.
StyleGuide: https://minitest.rubystyle.guide#refute-includes
Enabled: false
VersionAdded: '0.3'
# Supports --autocorrect
Minitest/RefuteInstanceOf:
Description: This cop enforces the test to use `refute_instance_of(Class, object)`
over `refute(object.instance_of?(Class))`.
StyleGuide: https://minitest.rubystyle.guide#refute-instance-of
Enabled: false
VersionAdded: '0.4'
# Supports --autocorrect
Minitest/RefuteKindOf:
Description: This cop enforces the test to use `refute_kind_of(Class, object)` over
`refute(object.kind_of?(Class))`.
StyleGuide: https://github.com/rubocop/minitest-style-guide#refute-kind-of
Enabled: false
VersionAdded: '0.10'
VersionChanged: '0.34'
# Supports --autocorrect
Minitest/RefuteMatch:
Description: This cop enforces the test to use `refute_match` instead of using `refute(matcher.match(object))`.
StyleGuide: https://minitest.rubystyle.guide#refute-match
Enabled: false
VersionAdded: '0.6'
# Supports --autocorrect
Minitest/RefuteNil:
Description: This cop enforces the test to use `refute_nil` instead of using `refute_equal(nil,
something)` or `refute(something.nil?)`.
StyleGuide: https://minitest.rubystyle.guide#refute-nil
Enabled: false
VersionAdded: '0.2'
# Supports --autocorrect
Minitest/RefuteOperator:
Description: This cop enforces the use of `refute_operator(expected, :<, actual)`
over `refute(expected < actual)`.
StyleGuide: https://minitest.rubystyle.guide#refute-operator
Enabled: false
VersionAdded: '0.32'
# Supports --autocorrect
Minitest/RefutePathExists:
Description: This cop enforces the test to use `refute_path_exists` instead of using
`refute(File.exist?(path))`.
StyleGuide: https://minitest.rubystyle.guide/#refute-path-exists
Enabled: false
VersionAdded: '0.10'
# Supports --autocorrect
Minitest/RefutePredicate:
Description: This cop enforces the test to use `refute_predicate` instead of using
`refute(obj.a_predicate_method?)`.
StyleGuide: https://minitest.rubystyle.guide/#refute-predicate
Enabled: false
VersionAdded: '0.18'
# Supports --autocorrect
Minitest/RefuteRespondTo:
Description: This cop enforces the test to use `refute_respond_to(object, :do_something)`
over `refute(object.respond_to?(:do_something))`.
StyleGuide: https://minitest.rubystyle.guide#refute-respond-to
Enabled: false
VersionAdded: '0.4'
# Supports --autocorrect
Minitest/RefuteSame:
Description: Enforces the use of `refute_same(expected, actual)` over `refute(expected.equal?(actual))`.
StyleGuide: https://minitest.rubystyle.guide#refute-same
Enabled: false
VersionAdded: '0.26'
# Supports --autocorrect
Minitest/ReturnInTestMethod:
Description: Enforces the use of `skip` instead of `return` in test methods.
StyleGuide: https://minitest.rubystyle.guide/#skipping-runnable-methods
Enabled: false
VersionAdded: '0.31'
Minitest/SkipEnsure:
Description: Checks that `ensure` call even if `skip`.
Enabled: false
Severity: warning
VersionAdded: '0.20'
VersionChanged: '0.26'
Minitest/SkipWithoutReason:
Description: Checks for skipped tests missing the skipping reason.
Enabled: false
VersionAdded: '0.24'
Minitest/TestFileName:
Description: Checks if test file names start with `test_` or end with `_test.rb`.
StyleGuide: https://minitest.rubystyle.guide/#file-naming
Enabled: false
VersionAdded: '0.26'
# Supports --autocorrect
Minitest/TestMethodName:
Description: This cop enforces that test method names start with `test_` prefix.
Enabled: false
VersionAdded: '0.10'
Minitest/UnreachableAssertion:
Description: This cop checks for an `assert_raises` block containing any unreachable
assertions.
Enabled: false
Severity: warning
VersionAdded: '0.14'
VersionChanged: '0.26'
Minitest/UnspecifiedException:
Description: This cop checks for a specified error in `assert_raises`.
StyleGuide: https://minitest.rubystyle.guide#unspecified-exception
Enabled: false
VersionAdded: '0.10'
Minitest/UselessAssertion:
Description: Detects useless assertions (assertions that either always pass or always
fail).
Enabled: false
VersionAdded: '0.26'

286
.rubocop_naming.yml Normal file
View File

@ -0,0 +1,286 @@
# Department 'Naming' (18): 수정
Naming/AccessorMethodName:
Description: Check the naming of accessor methods for get_/set_.
StyleGuide: "#accessor_mutator_method_names"
Enabled: true
VersionAdded: '0.50'
Naming/AsciiIdentifiers:
Description: Use only ascii symbols in identifiers and constants.
StyleGuide: "#english-identifiers"
Enabled: true
VersionAdded: '0.50'
VersionChanged: '0.87'
AsciiConstants: true
# Supports --autocorrect
Naming/BinaryOperatorParameterName:
Description: When defining binary operators, name the argument other.
StyleGuide: "#other-arg"
Enabled: true
VersionAdded: '0.50'
VersionChanged: '1.2'
# Supports --autocorrect
Naming/BlockForwarding:
Description: Use anonymous block forwarding.
StyleGuide: "#block-forwarding"
Enabled: true
VersionAdded: '1.24'
EnforcedStyle: anonymous
SupportedStyles:
- anonymous
- explicit
BlockForwardingName: block
Naming/BlockParameterName:
Description: Checks for block parameter names that contain capital letters, end in
numbers, or do not meet a minimal length.
Enabled: true
VersionAdded: '0.53'
VersionChanged: '0.77'
MinNameLength: 1
AllowNamesEndingInNumbers: true
AllowedNames: []
ForbiddenNames: []
Naming/ClassAndModuleCamelCase:
Description: Use CamelCase for classes and modules.
StyleGuide: "#camelcase-classes"
Enabled: true
VersionAdded: '0.50'
VersionChanged: '0.85'
AllowedNames:
- module_parent
Naming/ConstantName:
Description: Constants should use SCREAMING_SNAKE_CASE.
StyleGuide: "#screaming-snake-case"
Enabled: true
VersionAdded: '0.50'
Naming/FileName:
Description: Use snake_case for source file names.
StyleGuide: "#snake-case-files"
Enabled: true
VersionAdded: '0.50'
VersionChanged: '1.23'
Exclude:
- "/Users/rubyon/Desktop/liaf-rails/Rakefile.rb"
ExpectMatchingDefinition: false
CheckDefinitionPathHierarchy: true
CheckDefinitionPathHierarchyRoots:
- lib
- spec
- test
- src
Regex:
IgnoreExecutableScripts: true
AllowedAcronyms:
- CLI
- DSL
- ACL
- API
- ASCII
- CPU
- CSS
- DNS
- EOF
- GUID
- HTML
- HTTP
- HTTPS
- ID
- IP
- JSON
- LHS
- QPS
- RAM
- RHS
- RPC
- SLA
- SMTP
- SQL
- SSH
- TCP
- TLS
- TTL
- UDP
- UI
- UID
- UUID
- URI
- URL
- UTF8
- VM
- XML
- XMPP
- XSRF
- XSS
# Supports --autocorrect
Naming/HeredocDelimiterCase:
Description: Use configured case for heredoc delimiters.
StyleGuide: "#heredoc-delimiters"
Enabled: true
VersionAdded: '0.50'
VersionChanged: '1.2'
EnforcedStyle: uppercase
SupportedStyles:
- lowercase
- uppercase
Naming/HeredocDelimiterNaming:
Description: Use descriptive heredoc delimiters.
StyleGuide: "#heredoc-delimiters"
Enabled: true
VersionAdded: '0.50'
ForbiddenDelimiters:
- !ruby/regexp /(^|\s)(EO[A-Z]{1}|END)(\s|$)/i
# Supports --autocorrect
Naming/InclusiveLanguage:
Description: Recommend the use of inclusive language instead of problematic terms.
Enabled: false
VersionAdded: '1.18'
VersionChanged: '1.49'
CheckIdentifiers: true
CheckConstants: true
CheckVariables: true
CheckStrings: false
CheckSymbols: true
CheckComments: true
CheckFilepaths: true
FlaggedTerms:
whitelist:
Regex: !ruby/regexp /white[-_\s]?list/
Suggestions:
- allowlist
- permit
blacklist:
Regex: !ruby/regexp /black[-_\s]?list/
Suggestions:
- denylist
- block
slave:
WholeWord: true
Suggestions:
- replica
- secondary
- follower
# Supports --autocorrect
Naming/MemoizedInstanceVariableName:
Description: Memoized method name should match memo instance variable name.
Enabled: true
VersionAdded: '0.53'
VersionChanged: '1.2'
EnforcedStyleForLeadingUnderscores: disallowed
SupportedStylesForLeadingUnderscores:
- disallowed
- required
- optional
Safe: false
Naming/MethodName:
Description: Use the configured style when naming methods.
StyleGuide: "#snake-case-symbols-methods-vars"
Enabled: true
VersionAdded: '0.50'
EnforcedStyle: snake_case
SupportedStyles:
- snake_case
- camelCase
AllowedPatterns: []
Naming/MethodParameterName:
Description: Checks for method parameter names that contain capital letters, end in
numbers, or do not meet a minimal length.
Enabled: true
VersionAdded: '0.53'
VersionChanged: '0.77'
MinNameLength: 3
AllowNamesEndingInNumbers: true
AllowedNames:
- as
- at
- by
- cc
- db
- id
- if
- in
- io
- ip
- of
- 'on'
- os
- pp
- to
ForbiddenNames: []
Naming/PredicateName:
Description: Check the names of predicate methods.
StyleGuide: "#bool-methods-qmark"
Enabled: false
VersionAdded: '0.50'
VersionChanged: '0.77'
NamePrefix:
- is_
- has_
- have_
ForbiddenPrefixes:
- is_
- has_
- have_
AllowedMethods:
- is_a?
MethodDefinitionMacros:
- define_method
- define_singleton_method
Exclude:
- "/Users/rubyon/Desktop/liaf-rails/spec/**/*"
# Supports --autocorrect
Naming/RescuedExceptionsVariableName:
Description: Use consistent rescued exceptions variables naming.
Enabled: true
VersionAdded: '0.67'
VersionChanged: '0.68'
PreferredName: e
Naming/VariableName:
Description: Use the configured style when naming variables.
StyleGuide: "#snake-case-symbols-methods-vars"
Enabled: true
VersionAdded: '0.50'
VersionChanged: '1.8'
EnforcedStyle: snake_case
SupportedStyles:
- snake_case
- camelCase
AllowedIdentifiers: []
AllowedPatterns: []
Naming/VariableNumber:
Description: Use the configured style when numbering symbols, methods and variables.
StyleGuide: "#snake-case-symbols-methods-vars-with-numbers"
Enabled: true
VersionAdded: '0.50'
VersionChanged: '1.4'
EnforcedStyle: normalcase
SupportedStyles:
- snake_case
- normalcase
- non_integer
CheckMethodNames: true
CheckSymbols: true
AllowedIdentifiers:
- capture3
- iso8601
- rfc1123_date
- rfc822
- rfc2822
- rfc3339
- x86_64
AllowedPatterns: []

377
.rubocop_performance.yml Normal file
View File

@ -0,0 +1,377 @@
# Department 'Performance' (50): 미수정
# Supports --autocorrect
Performance/AncestorsInclude:
Description: Use `A <= B` instead of `A.ancestors.include?(B)`.
Reference: https://github.com/fastruby/fast-ruby#ancestorsinclude-vs--code
Enabled: false
Safe: false
VersionAdded: '1.7'
# Supports --autocorrect
Performance/ArraySemiInfiniteRangeSlice:
Description: Identifies places where slicing arrays with semi-infinite ranges can
be replaced by `Array#take` and `Array#drop`.
Enabled: false
Safe: false
VersionAdded: '1.9'
# Supports --autocorrect
Performance/BigDecimalWithNumericArgument:
Description: Convert numeric literal to string and pass it to `BigDecimal`.
Enabled: false
VersionAdded: '1.7'
# Supports --autocorrect
Performance/BindCall:
Description: Use `bind_call(obj, args, ...)` instead of `bind(obj).call(args, ...)`.
Enabled: false
VersionAdded: '1.6'
# Supports --autocorrect
Performance/BlockGivenWithExplicitBlock:
Description: Check block argument explicitly instead of using `block_given?`.
Enabled: false
VersionAdded: '1.9'
# Supports --autocorrect
Performance/Caller:
Description: Use `caller(n..n)` instead of `caller`.
Enabled: false
VersionAdded: '0.49'
VersionChanged: '1.9'
# Supports --autocorrect
Performance/CaseWhenSplat:
Description: Reordering `when` conditions with a splat to the end of the `when` branches
can improve performance.
Enabled: false
SafeAutoCorrect: false
VersionAdded: '0.34'
VersionChanged: '1.13'
# Supports --autocorrect
Performance/Casecmp:
Description: Use `casecmp` rather than `downcase ==`, `upcase ==`, `== downcase`,
or `== upcase`..
Reference: https://github.com/fastruby/fast-ruby#stringcasecmp-vs--stringcasecmp-vs-stringdowncase---code
Enabled: false
Safe: false
VersionAdded: '0.36'
VersionChanged: '1.21'
Performance/ChainArrayAllocation:
Description: Instead of chaining array methods that allocate new arrays, mutate an
existing array.
Reference: https://twitter.com/schneems/status/1034123879978029057
Enabled: false
VersionAdded: '0.59'
Performance/CollectionLiteralInLoop:
Description: Extract Array and Hash literals outside of loops into local variables
or constants.
Enabled: false
VersionAdded: '1.8'
MinSize: 1
# Supports --autocorrect
Performance/CompareWithBlock:
Description: Use `sort_by(&:foo)` instead of `sort { |a, b| a.foo <=> b.foo }`.
Enabled: false
VersionAdded: '0.46'
# Supports --autocorrect
Performance/ConcurrentMonotonicTime:
Description: Use `Process.clock_gettime(Process::CLOCK_MONOTONIC)` instead of `Concurrent.monotonic_time`.
Reference: https://github.com/rails/rails/pull/43502
Enabled: false
VersionAdded: '1.12'
# Supports --autocorrect
Performance/ConstantRegexp:
Description: Finds regular expressions with dynamic components that are all constants.
Enabled: false
VersionAdded: '1.9'
VersionChanged: '1.10'
# Supports --autocorrect
Performance/Count:
Description: Use `count` instead of `{select,find_all,filter,reject}...{size,count,length}`.
SafeAutoCorrect: false
Enabled: false
VersionAdded: '0.31'
VersionChanged: '1.8'
# Supports --autocorrect
Performance/DeletePrefix:
Description: Use `delete_prefix` instead of `gsub`.
Enabled: false
Safe: false
SafeMultiline: true
VersionAdded: '1.6'
VersionChanged: '1.11'
# Supports --autocorrect
Performance/DeleteSuffix:
Description: Use `delete_suffix` instead of `gsub`.
Enabled: false
Safe: false
SafeMultiline: true
VersionAdded: '1.6'
VersionChanged: '1.11'
# Supports --autocorrect
Performance/Detect:
Description: Use `detect` instead of `select.first`, `find_all.first`, `filter.first`,
`select.last`, `find_all.last`, and `filter.last`.
Reference: https://github.com/fastruby/fast-ruby#enumerabledetect-vs-enumerableselectfirst-code
SafeAutoCorrect: false
Enabled: false
VersionAdded: '0.30'
VersionChanged: '1.8'
# Supports --autocorrect
Performance/DoubleStartEndWith:
Description: Use `str.{start,end}_with?(x, ..., y, ...)` instead of `str.{start,end}_with?(x,
...) || str.{start,end}_with?(y, ...)`.
Enabled: false
VersionAdded: '0.36'
VersionChanged: '0.48'
IncludeActiveSupportAliases: false
# Supports --autocorrect
Performance/EndWith:
Description: Use `end_with?` instead of a regex match anchored to the end of a string.
Reference: https://github.com/fastruby/fast-ruby#stringmatch-vs-stringmatch-vs-stringstart_withstringend_with-code-start-code-end
SafeAutoCorrect: false
Enabled: false
SafeMultiline: true
VersionAdded: '0.36'
VersionChanged: '1.10'
Performance/FixedSize:
Description: Do not compute the size of statically sized objects except in constants.
Enabled: false
VersionAdded: '0.35'
# Supports --autocorrect
Performance/FlatMap:
Description: Use `Enumerable#flat_map` instead of `Enumerable#map...Array#flatten(1)`
or `Enumerable#collect..Array#flatten(1)`.
Reference: https://github.com/fastruby/fast-ruby#enumerablemaparrayflatten-vs-enumerableflat_map-code
Enabled: true
VersionAdded: '0.30'
EnabledForFlattenWithoutParams: false
# Supports --autocorrect
Performance/InefficientHashSearch:
Description: Use `key?` or `value?` instead of `keys.include?` or `values.include?`.
Reference: https://github.com/fastruby/fast-ruby#hashkey-instead-of-hashkeysinclude-code
Enabled: false
VersionAdded: '0.56'
Safe: false
# Supports --autocorrect
Performance/IoReadlines:
Description: Use `IO.each_line` (`IO#each_line`) instead of `IO.readlines` (`IO#readlines`).
Reference: https://docs.gitlab.com/ee/development/performance.html#reading-from-files-and-other-data-sources
Enabled: false
VersionAdded: '1.7'
# Supports --autocorrect
Performance/MapCompact:
Description: Use `filter_map` instead of `collection.map(&:do_something).compact`.
Enabled: false
SafeAutoCorrect: false
VersionAdded: '1.11'
Performance/MapMethodChain:
Description: Checks if the `map` method is used in a chain.
Enabled: false
Safe: false
VersionAdded: '1.19'
Performance/MethodObjectAsBlock:
Description: Use block explicitly instead of block-passing a method object.
Reference: https://github.com/fastruby/fast-ruby#normal-way-to-apply-method-vs-method-code
Enabled: false
VersionAdded: '1.9'
Performance/OpenStruct:
Description: Use `Struct` instead of `OpenStruct`.
Enabled: false
VersionAdded: '0.61'
Safe: false
# Supports --autocorrect
Performance/RangeInclude:
Description: Use `Range#cover?` instead of `Range#include?` (or `Range#member?`).
Reference: https://github.com/fastruby/fast-ruby#cover-vs-include-code
Enabled: false
VersionAdded: '0.36'
VersionChanged: '1.7'
Safe: false
# Supports --autocorrect
Performance/RedundantBlockCall:
Description: Use `yield` instead of `block.call`.
Reference: https://github.com/fastruby/fast-ruby#proccall-and-block-arguments-vs-yieldcode
Enabled: false
VersionAdded: '0.36'
# Supports --autocorrect
Performance/RedundantEqualityComparisonBlock:
Description: Checks for uses `Enumerable#all?`, `Enumerable#any?`, `Enumerable#one?`,
or `Enumerable#none?` are compared with `===` or similar methods in block.
Reference: https://github.com/rails/rails/pull/41363
Enabled: false
Safe: false
AllowRegexpMatch: true
VersionAdded: '1.10'
# Supports --autocorrect
Performance/RedundantMatch:
Description: Use `=~` instead of `String#match` or `Regexp#match` in a context where
the returned `MatchData` is not needed.
Enabled: false
VersionAdded: '0.36'
# Supports --autocorrect
Performance/RedundantMerge:
Description: Use Hash#[]=, rather than Hash#merge! with a single key-value pair.
Reference: https://github.com/fastruby/fast-ruby#hashmerge-vs-hash-code
Enabled: false
Safe: false
VersionAdded: '0.36'
VersionChanged: '1.11'
MaxKeyValuePairs: 2
# Supports --autocorrect
Performance/RedundantSortBlock:
Description: Use `sort` instead of `sort { |a, b| a <=> b }`.
Enabled: false
VersionAdded: '1.7'
# Supports --autocorrect
Performance/RedundantSplitRegexpArgument:
Description: Identifies places where `split` argument can be replaced from a deterministic
regexp to a string.
Enabled: false
VersionAdded: '1.10'
# Supports --autocorrect
Performance/RedundantStringChars:
Description: Checks for redundant `String#chars`.
Enabled: false
VersionAdded: '1.7'
# Supports --autocorrect
Performance/RegexpMatch:
Description: Use `match?` instead of `Regexp#match`, `String#match`, `Symbol#match`,
`Regexp#===`, or `=~` when `MatchData` is not used.
Reference: https://github.com/fastruby/fast-ruby#regexp-vs-regexpmatch-vs-regexpmatch-vs-stringmatch-vs-string-vs-stringmatch-code-
Enabled: false
VersionAdded: '0.47'
# Supports --autocorrect
Performance/ReverseEach:
Description: Use `reverse_each` instead of `reverse.each`.
Reference: https://github.com/fastruby/fast-ruby#enumerablereverseeach-vs-enumerablereverse_each-code
Enabled: false
VersionAdded: '0.30'
# Supports --autocorrect
Performance/ReverseFirst:
Description: Use `last(n).reverse` instead of `reverse.first(n)`.
Enabled: false
VersionAdded: '1.7'
Performance/SelectMap:
Description: Use `filter_map` instead of `ary.select(&:foo).map(&:bar)`.
Enabled: false
VersionAdded: '1.11'
# Supports --autocorrect
Performance/Size:
Description: Use `size` instead of `count` for counting the number of elements in
`Array` and `Hash`.
Reference: https://github.com/fastruby/fast-ruby#arraylength-vs-arraysize-vs-arraycount-code
Enabled: false
VersionAdded: '0.30'
# Supports --autocorrect
Performance/SortReverse:
Description: Use `sort.reverse` instead of `sort { |a, b| b <=> a }`.
Enabled: false
VersionAdded: '1.7'
# Supports --autocorrect
Performance/Squeeze:
Description: Use `squeeze('a')` instead of `gsub(/a+/, 'a')`.
Reference: https://github.com/fastruby/fast-ruby#remove-extra-spaces-or-other-contiguous-characters-code
Enabled: false
VersionAdded: '1.7'
# Supports --autocorrect
Performance/StartWith:
Description: Use `start_with?` instead of a regex match anchored to the beginning
of a string.
Reference: https://github.com/fastruby/fast-ruby#stringmatch-vs-stringmatch-vs-stringstart_withstringend_with-code-start-code-end
SafeAutoCorrect: false
Enabled: false
SafeMultiline: true
VersionAdded: '0.36'
VersionChanged: '1.10'
# Supports --autocorrect
Performance/StringIdentifierArgument:
Description: Use symbol identifier argument instead of string identifier argument.
Enabled: false
VersionAdded: '1.13'
# Supports --autocorrect
Performance/StringInclude:
Description: Use `String#include?` instead of a regex match with literal-only pattern.
Enabled: false
SafeAutoCorrect: false
VersionAdded: '1.7'
VersionChanged: '1.12'
# Supports --autocorrect
Performance/StringReplacement:
Description: Use `tr` instead of `gsub` when you are replacing the same number of
characters. Use `delete` instead of `gsub` when you are deleting characters.
Reference: https://github.com/fastruby/fast-ruby#stringgsub-vs-stringtr-code
Enabled: false
VersionAdded: '0.33'
# Supports --autocorrect
Performance/Sum:
Description: Use `sum` instead of a custom array summation.
SafeAutoCorrect: false
Reference: https://blog.bigbinary.com/2016/11/02/ruby-2-4-introduces-enumerable-sum.html
Enabled: false
VersionAdded: '1.8'
VersionChanged: '1.13'
OnlySumOrWithInitialValue: false
# Supports --autocorrect
Performance/TimesMap:
Description: Checks for .times.map calls.
Enabled: false
SafeAutoCorrect: false
VersionAdded: '0.36'
VersionChanged: '1.13'
# Supports --autocorrect
Performance/UnfreezeString:
Description: Use unary plus to get an unfrozen string literal.
Enabled: true
SafeAutoCorrect: false
VersionAdded: '0.50'
VersionChanged: '1.9'
# Supports --autocorrect
Performance/UriDefaultParser:
Description: Use `URI::DEFAULT_PARSER` instead of `URI::Parser.new`.
Enabled: false
VersionAdded: '0.50'

1215
.rubocop_rails.yml Normal file

File diff suppressed because it is too large Load Diff

55
.rubocop_security.yml Normal file
View File

@ -0,0 +1,55 @@
# Department 'Security' (7): 수정
Security/CompoundHash:
Description: When overwriting Object#hash to combine values, prefer delegating to
Array#hash over writing a custom implementation.
Enabled: true
Safe: false
VersionAdded: '1.28'
VersionChanged: '1.51'
Security/Eval:
Description: The use of eval represents a serious security risk.
Enabled: true
VersionAdded: '0.47'
# Supports --autocorrect
Security/IoMethods:
Description: Checks for the first argument to `IO.read`, `IO.binread`, `IO.write`,
`IO.binwrite`, `IO.foreach`, and `IO.readlines`.
Enabled: true
Safe: false
VersionAdded: '1.22'
# Supports --autocorrect
Security/JSONLoad:
Description: Prefer usage of `JSON.parse` over `JSON.load` due to potential security
issues. See reference for more information.
Reference: https://ruby-doc.org/stdlib-2.7.0/libdoc/json/rdoc/JSON.html#method-i-load
Enabled: true
VersionAdded: '0.43'
VersionChanged: '1.22'
SafeAutoCorrect: false
Security/MarshalLoad:
Description: Avoid using of `Marshal.load` or `Marshal.restore` due to potential security
issues. See reference for more information.
Reference: https://ruby-doc.org/core-2.7.0/Marshal.html#module-Marshal-label-Security+considerations
Enabled: true
VersionAdded: '0.47'
Security/Open:
Description: The use of `Kernel#open` and `URI.open` represent a serious security
risk.
Enabled: true
VersionAdded: '0.53'
VersionChanged: '1.0'
Safe: false
# Supports --autocorrect
Security/YAMLLoad:
Description: Prefer usage of `YAML.safe_load` over `YAML.load` due to potential security
issues. See reference for more information.
Reference: https://ruby-doc.org/stdlib-2.7.0/libdoc/yaml/rdoc/YAML.html#module-YAML-label-Security
Enabled: true
VersionAdded: '0.47'
SafeAutoCorrect: false

2540
.rubocop_style.yml Normal file

File diff suppressed because it is too large Load Diff

1
.ruby-version Normal file
View File

@ -0,0 +1 @@
3.4.2

86
Dockerfile Normal file
View File

@ -0,0 +1,86 @@
# syntax=docker/dockerfile:1
# check=error=true
# This Dockerfile is designed for production, not development. Use with Kamal or build'n'run by hand:
# docker build -t farmitry_hvac .
# docker run -d -p 80:80 -e RAILS_MASTER_KEY=<value from config/master.key> --name farmitry_hvac farmitry_hvac
# For a containerized dev environment, see Dev Containers: https://guides.rubyonrails.org/getting_started_with_devcontainer.html
# Make sure RUBY_VERSION matches the Ruby version in .ruby-version
ARG RUBY_VERSION=3.4.2
FROM docker.io/library/ruby:$RUBY_VERSION-slim AS base
# Rails app lives here
WORKDIR /rails
# Install base packages
RUN apt-get update -qq && \
apt-get install --no-install-recommends -y curl libjemalloc2 libvips sqlite3 && \
rm -rf /var/lib/apt/lists /var/cache/apt/archives
# 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 git libyaml-dev node-gyp pkg-config python-is-python3 && \
rm -rf /var/lib/apt/lists /var/cache/apt/archives
# Install JavaScript dependencies
ARG NODE_VERSION=23.10.0
ARG YARN_VERSION=1.22.22
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 --immutable
# 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
RUN rm -rf node_modules
# Final stage for app image
FROM base
# Copy built artifacts: gems, application
COPY --from=build "${BUNDLE_PATH}" "${BUNDLE_PATH}"
COPY --from=build /rails /rails
# Run and own only the runtime files as a non-root user for security
RUN groupadd --system --gid 1000 rails && \
useradd rails --uid 1000 --gid 1000 --create-home --shell /bin/bash && \
chown -R rails:rails db log storage tmp
USER 1000:1000
# Entrypoint prepares the database.
ENTRYPOINT ["/rails/bin/docker-entrypoint"]
# Start server via Thruster by default, this can be overwritten at runtime
EXPOSE 80
CMD ["./bin/thrust", "./bin/rails", "server"]

72
Gemfile Normal file
View File

@ -0,0 +1,72 @@
source "https://rubygems.org"
# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
gem "rails", "~> 8.0.2"
# The modern asset pipeline for Rails [https://github.com/rails/propshaft]
gem "propshaft"
# Use sqlite3 as the database for Active Record
gem "sqlite3", ">= 2.1"
# Use the Puma web server [https://github.com/puma/puma]
gem "puma", ">= 5.0"
# Bundle and transpile JavaScript [https://github.com/rails/jsbundling-rails]
gem "jsbundling-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 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 ]
# Use the database-backed adapters for Rails.cache, Active Job, and Action Cable
gem "solid_cable"
gem "solid_cache"
gem "solid_queue"
# Reduces boot times through caching; required in config/boot.rb
gem "bootsnap", require: false
# Deploy this application anywhere as a Docker container [https://kamal-deploy.org]
gem "kamal", require: false
# Add HTTP asset caching/compression and X-Sendfile acceleration to Puma [https://github.com/basecamp/thruster/]
gem "thruster", require: false
# Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images]
# gem "image_processing", "~> 1.2"
group :development, :test do
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
gem "debug", platforms: %i[ mri windows ], require: "debug/prelude"
# Static analysis for security vulnerabilities [https://brakemanscanner.org/]
gem "brakeman", require: false
# Omakase Ruby styling [https://github.com/rails/rubocop-rails-omakase/]
gem "rubocop-rails-omakase", require: false
gem "amazing_print", require: false
gem "erb_lint", require: false
end
group :development do
# Use console on exceptions pages [https://github.com/rails/web-console]
gem "web-console"
gem "foreman"
end
group :test do
# Use system testing [https://guides.rubyonrails.org/testing.html#system-testing]
gem "capybara"
gem "selenium-webdriver"
end
gem "rmodbus"

414
Gemfile.lock Normal file
View File

@ -0,0 +1,414 @@
GEM
remote: https://rubygems.org/
specs:
actioncable (8.0.2)
actionpack (= 8.0.2)
activesupport (= 8.0.2)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
zeitwerk (~> 2.6)
actionmailbox (8.0.2)
actionpack (= 8.0.2)
activejob (= 8.0.2)
activerecord (= 8.0.2)
activestorage (= 8.0.2)
activesupport (= 8.0.2)
mail (>= 2.8.0)
actionmailer (8.0.2)
actionpack (= 8.0.2)
actionview (= 8.0.2)
activejob (= 8.0.2)
activesupport (= 8.0.2)
mail (>= 2.8.0)
rails-dom-testing (~> 2.2)
actionpack (8.0.2)
actionview (= 8.0.2)
activesupport (= 8.0.2)
nokogiri (>= 1.8.5)
rack (>= 2.2.4)
rack-session (>= 1.0.1)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
useragent (~> 0.16)
actiontext (8.0.2)
actionpack (= 8.0.2)
activerecord (= 8.0.2)
activestorage (= 8.0.2)
activesupport (= 8.0.2)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
actionview (8.0.2)
activesupport (= 8.0.2)
builder (~> 3.1)
erubi (~> 1.11)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
activejob (8.0.2)
activesupport (= 8.0.2)
globalid (>= 0.3.6)
activemodel (8.0.2)
activesupport (= 8.0.2)
activerecord (8.0.2)
activemodel (= 8.0.2)
activesupport (= 8.0.2)
timeout (>= 0.4.0)
activestorage (8.0.2)
actionpack (= 8.0.2)
activejob (= 8.0.2)
activerecord (= 8.0.2)
activesupport (= 8.0.2)
marcel (~> 1.0)
activesupport (8.0.2)
base64
benchmark (>= 0.3)
bigdecimal
concurrent-ruby (~> 1.0, >= 1.3.1)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
logger (>= 1.4.2)
minitest (>= 5.1)
securerandom (>= 0.3)
tzinfo (~> 2.0, >= 2.0.5)
uri (>= 0.13.1)
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
amazing_print (1.7.2)
ast (2.4.3)
base64 (0.2.0)
bcrypt_pbkdf (1.1.1)
benchmark (0.4.0)
better_html (2.1.1)
actionview (>= 6.0)
activesupport (>= 6.0)
ast (~> 2.0)
erubi (~> 1.4)
parser (>= 2.4)
smart_properties
bigdecimal (3.1.9)
bindex (0.8.1)
bootsnap (1.18.4)
msgpack (~> 1.2)
brakeman (7.0.2)
racc
builder (3.3.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.3.5)
connection_pool (2.5.0)
crass (1.0.6)
cssbundling-rails (1.4.3)
railties (>= 6.0.0)
date (3.4.1)
debug (1.10.0)
irb (~> 1.10)
reline (>= 0.3.8)
digest-crc (0.7.0)
rake (>= 12.0.0, < 14.0.0)
dotenv (3.1.8)
drb (2.2.1)
ed25519 (1.3.0)
erb_lint (0.9.0)
activesupport
better_html (>= 2.0.1)
parser (>= 2.7.1.4)
rainbow
rubocop (>= 1)
smart_properties
erubi (1.13.1)
et-orbi (1.2.11)
tzinfo
foreman (0.88.1)
fugit (1.11.1)
et-orbi (~> 1, >= 1.2.11)
raabro (~> 1.4)
globalid (1.2.1)
activesupport (>= 6.1)
i18n (1.14.7)
concurrent-ruby (~> 1.0)
io-console (0.8.0)
irb (1.15.2)
pp (>= 0.6.0)
rdoc (>= 4.0.0)
reline (>= 0.4.2)
jbuilder (2.13.0)
actionview (>= 5.0.0)
activesupport (>= 5.0.0)
jsbundling-rails (1.3.1)
railties (>= 6.0.0)
json (2.10.2)
kamal (2.5.3)
activesupport (>= 7.0)
base64 (~> 0.2)
bcrypt_pbkdf (~> 1.0)
concurrent-ruby (~> 1.2)
dotenv (~> 3.1)
ed25519 (~> 1.2)
net-ssh (~> 7.3)
sshkit (>= 1.23.0, < 2.0)
thor (~> 1.3)
zeitwerk (>= 2.6.18, < 3.0)
language_server-protocol (3.17.0.4)
lint_roller (1.1.0)
logger (1.7.0)
loofah (2.24.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.4)
matrix (0.4.2)
mini_mime (1.1.5)
minitest (5.25.5)
msgpack (1.8.0)
net-imap (0.5.6)
date
net-protocol
net-pop (0.1.2)
net-protocol
net-protocol (0.2.2)
timeout
net-scp (4.1.0)
net-ssh (>= 2.6.5, < 8.0.0)
net-sftp (4.0.0)
net-ssh (>= 5.0.0, < 8.0.0)
net-smtp (0.5.1)
net-protocol
net-ssh (7.3.0)
nio4r (2.7.4)
nokogiri (1.18.7-aarch64-linux-gnu)
racc (~> 1.4)
nokogiri (1.18.7-aarch64-linux-musl)
racc (~> 1.4)
nokogiri (1.18.7-arm-linux-gnu)
racc (~> 1.4)
nokogiri (1.18.7-arm-linux-musl)
racc (~> 1.4)
nokogiri (1.18.7-arm64-darwin)
racc (~> 1.4)
nokogiri (1.18.7-x86_64-linux-gnu)
racc (~> 1.4)
nokogiri (1.18.7-x86_64-linux-musl)
racc (~> 1.4)
ostruct (0.6.1)
parallel (1.27.0)
parser (3.3.8.0)
ast (~> 2.4.1)
racc
pp (0.6.2)
prettyprint
prettyprint (0.2.0)
prism (1.4.0)
propshaft (1.1.0)
actionpack (>= 7.0.0)
activesupport (>= 7.0.0)
rack
railties (>= 7.0.0)
psych (5.2.3)
date
stringio
public_suffix (6.0.1)
puma (6.6.0)
nio4r (~> 2.0)
raabro (1.4.0)
racc (1.8.1)
rack (3.1.13)
rack-session (2.1.0)
base64 (>= 0.1.0)
rack (>= 3.0.0)
rack-test (2.2.0)
rack (>= 1.3)
rackup (2.2.1)
rack (>= 3)
rails (8.0.2)
actioncable (= 8.0.2)
actionmailbox (= 8.0.2)
actionmailer (= 8.0.2)
actionpack (= 8.0.2)
actiontext (= 8.0.2)
actionview (= 8.0.2)
activejob (= 8.0.2)
activemodel (= 8.0.2)
activerecord (= 8.0.2)
activestorage (= 8.0.2)
activesupport (= 8.0.2)
bundler (>= 1.15.0)
railties (= 8.0.2)
rails-dom-testing (2.2.0)
activesupport (>= 5.0.0)
minitest
nokogiri (>= 1.6)
rails-html-sanitizer (1.6.2)
loofah (~> 2.21)
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
railties (8.0.2)
actionpack (= 8.0.2)
activesupport (= 8.0.2)
irb (~> 1.13)
rackup (>= 1.0.0)
rake (>= 12.2)
thor (~> 1.0, >= 1.2.2)
zeitwerk (~> 2.6)
rainbow (3.1.1)
rake (13.2.1)
rdoc (6.13.1)
psych (>= 4.0.0)
regexp_parser (2.10.0)
reline (0.6.1)
io-console (~> 0.5)
rexml (3.4.1)
rmodbus (2.1.3)
digest-crc (~> 0.1)
rubocop (1.75.2)
json (~> 2.3)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.1.0)
parallel (~> 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 2.9.3, < 3.0)
rubocop-ast (>= 1.44.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 4.0)
rubocop-ast (1.44.1)
parser (>= 3.3.7.2)
prism (~> 1.4)
rubocop-performance (1.25.0)
lint_roller (~> 1.1)
rubocop (>= 1.75.0, < 2.0)
rubocop-ast (>= 1.38.0, < 2.0)
rubocop-rails (2.31.0)
activesupport (>= 4.2.0)
lint_roller (~> 1.1)
rack (>= 1.1)
rubocop (>= 1.75.0, < 2.0)
rubocop-ast (>= 1.38.0, < 2.0)
rubocop-rails-omakase (1.1.0)
rubocop (>= 1.72)
rubocop-performance (>= 1.24)
rubocop-rails (>= 2.30)
ruby-progressbar (1.13.0)
rubyzip (2.4.1)
securerandom (0.4.1)
selenium-webdriver (4.31.0)
base64 (~> 0.2)
logger (~> 1.4)
rexml (~> 3.2, >= 3.2.5)
rubyzip (>= 1.2.2, < 3.0)
websocket (~> 1.0)
smart_properties (1.17.0)
solid_cable (3.0.7)
actioncable (>= 7.2)
activejob (>= 7.2)
activerecord (>= 7.2)
railties (>= 7.2)
solid_cache (1.0.7)
activejob (>= 7.2)
activerecord (>= 7.2)
railties (>= 7.2)
solid_queue (1.1.4)
activejob (>= 7.1)
activerecord (>= 7.1)
concurrent-ruby (>= 1.3.1)
fugit (~> 1.11.0)
railties (>= 7.1)
thor (~> 1.3.1)
sqlite3 (2.6.0-aarch64-linux-gnu)
sqlite3 (2.6.0-aarch64-linux-musl)
sqlite3 (2.6.0-arm-linux-gnu)
sqlite3 (2.6.0-arm-linux-musl)
sqlite3 (2.6.0-arm64-darwin)
sqlite3 (2.6.0-x86_64-linux-gnu)
sqlite3 (2.6.0-x86_64-linux-musl)
sshkit (1.24.0)
base64
logger
net-scp (>= 1.1.2)
net-sftp (>= 2.1.2)
net-ssh (>= 2.8.0)
ostruct
stimulus-rails (1.3.4)
railties (>= 6.0.0)
stringio (3.1.6)
thor (1.3.2)
thruster (0.1.12)
thruster (0.1.12-aarch64-linux)
thruster (0.1.12-arm64-darwin)
thruster (0.1.12-x86_64-linux)
timeout (0.4.3)
turbo-rails (2.0.13)
actionpack (>= 7.1.0)
railties (>= 7.1.0)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (3.1.4)
unicode-emoji (~> 4.0, >= 4.0.4)
unicode-emoji (4.0.4)
uri (1.0.3)
useragent (0.16.11)
web-console (4.2.1)
actionview (>= 6.0.0)
activemodel (>= 6.0.0)
bindex (>= 0.4.0)
railties (>= 6.0.0)
websocket (1.2.11)
websocket-driver (0.7.7)
base64
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
xpath (3.2.0)
nokogiri (~> 1.8)
zeitwerk (2.7.2)
PLATFORMS
aarch64-linux
aarch64-linux-gnu
aarch64-linux-musl
arm-linux-gnu
arm-linux-musl
arm64-darwin-24
x86_64-linux
x86_64-linux-gnu
x86_64-linux-musl
DEPENDENCIES
amazing_print
bootsnap
brakeman
capybara
cssbundling-rails
debug
erb_lint
foreman
jbuilder
jsbundling-rails
kamal
propshaft
puma (>= 5.0)
rails (~> 8.0.2)
rmodbus
rubocop-rails-omakase
selenium-webdriver
solid_cable
solid_cache
solid_queue
sqlite3 (>= 2.1)
stimulus-rails
thruster
turbo-rails
tzinfo-data
web-console
BUNDLED WITH
2.6.6

3
Procfile.dev Normal file
View File

@ -0,0 +1,3 @@
web: env RUBY_DEBUG_OPEN=true bin/rails server -b 0.0.0.0
js: yarn build --watch
css: yarn build:css --watch

24
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
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

0
app/assets/builds/.keep Normal file
View File

0
app/assets/images/.keep Normal file
View File

View File

@ -0,0 +1,184 @@
@import "tailwindcss";
@theme {
--color-default: rgb(226, 232, 240);
--color-defaultSlate: rgb(100, 116, 139);
--color-defaultSlateDark: rgb(71, 85, 105);
--color-primary: rgb(66, 165, 245);
--color-notice: rgb(19, 198, 154);
--color-warning: rgb(255, 202, 40);
--color-accept: rgb(121, 134, 203);
--color-danger: rgb(239, 83, 80);
--color-tableBorder: rgb(203, 213, 225);
--base-font-size: 0.85rem;
--text-xs: calc(var(--base-font-size) * 0.75);
--text-xs--line-height: calc(1 / var(--text-xs));
--text-sm: calc(var(--base-font-size) * 0.875);
--text-sm--line-height: calc(1.25 / var(--text-sm));
--text-base: calc(var(--base-font-size) * 1);
--text-base--line-height: calc(1.5 / var(--text-base));
--text-lg: calc(var(--base-font-size) * 1.125);
--text-lg--line-height: calc(1.75 / var(--text-lg));
--text-xl: calc(var(--base-font-size) * 1.25);
--text-xl--line-height: calc(1.75 / var(--text-xl));
--text-2xl: calc(var(--base-font-size) * 1.5);
--text-2xl--line-height: calc(2 / var(--text-2xl));
--text-3xl: calc(var(--base-font-size) * 1.875);
--text-3xl--line-height: calc(2.25 / var(--text-3xl));
--text-4xl: calc(var(--base-font-size) * 2.25);
--text-4xl--line-height: calc(2.5 / var(--text-4xl));
--text-5xl: calc(var(--base-font-size) * 3);
--text-5xl--line-height: 1;
--text-6xl: calc(var(--base-font-size) * 3.75);
--text-6xl--line-height: 1;
--text-7xl: calc(var(--base-font-size) * 4.5);
--text-7xl--line-height: 1;
--text-8xl: calc(var(--base-font-size) * 6);
--text-8xl--line-height: 1;
--text-9xl: calc(var(--base-font-size) * 8);
--text-9xl--line-height: 1;
}
@layer base {
body {
@apply text-sm text-defaultSlateDark
}
hr {
@apply border-tableBorder
}
a.disabled {
@apply pointer-events-none cursor-not-allowed opacity-50
}
.disabled {
@apply pointer-events-none cursor-not-allowed opacity-50
}
.btn {
@apply justify-center rounded-xs bg-defaultSlate px-2 py-0.5 text-sm font-semibold leading-6 text-white
shadow-xs hover:opacity-80 cursor-pointer
}
.card {
@apply bg-white border border-tableBorder rounded-xs shadow-xs
}
/*Form*/
.label-style {
@apply block my-1 font-bold text-defaultSlateDark
}
.select-style {
@apply block w-full h-8 px-3 py-1.5 border border-defaultSlate/50 rounded-xs
}
.input-style {
@apply block w-full h-8 px-3 py-1.5 border border-defaultSlate/50 rounded-xs
}
.textarea-style {
@apply block w-full pl-4 flex-1 py-1.5 ring-1 ring-inset ring-defaultSlate/50 rounded-xs
}
}
@layer utilities {
.page-title {
@apply text-xl font-bold;
}
.search-title {
@apply text-base font-bold;
}
.form-title {
@apply text-center text-3xl font-bold tracking-tight text-defaultSlateDark
}
.field {
@apply w-full
}
.btn-edit {
@apply inline-flex items-center rounded-xs px-2.5 py-1.5 text-sm font-semibold hover:opacity-75 disabled:cursor-not-allowed disabled:opacity-30 disabled:hover:bg-white
}
/*Menu*/
.menu-group {
@apply py-2 px-4
}
.menu-group-title {
@apply py-1 text-sm text-defaultSlateDark font-medium
}
.menu-group-items {
@apply p-1
}
.menu-group-items-title {
@apply text-base font-bold
}
.copyright {
@apply text-defaultSlateDark text-center
}
/*Pagy*/
.pagy {
@apply flex items-center justify-center space-x-1 font-semibold text-sm text-defaultSlate;
}
.pagy a:not(.gap) {
@apply block rounded-xs px-2 py-1 border border-defaultSlate/50;
}
.pagy a:not(.gap):hover {
@apply bg-slate-300
}
.pagy a:not(.gap):not([href]) {
@apply text-defaultSlate/50 border border-defaultSlate/25 cursor-default
}
.pagy a:not(.gap).current {
@apply text-white bg-defaultSlate
}
.pagy a.gap {
@apply inline-block my-auto
}
.pagy label {
@apply inline-block whitespace-nowrap bg-default rounded-xs px-3 py-0.5
}
.pagy label input {
@apply bg-default border-none rounded-xs
}
/*Base Table*/
.base-table {
@apply min-w-full divide-y divide-tableBorder whitespace-nowrap
}
.base-table th {
@apply bg-default px-2 py-2 text-left font-semibold text-defaultSlateDark lg:table-cell
}
.base-table td {
@apply border-t border-tableBorder px-2 py-1 text-defaultSlate lg:table-cell whitespace-nowrap
}
}
@media (min-width: 640px) {
.page-title {
@apply text-3xl font-bold;
}
.search-title {
@apply text-lg font-bold;
}
}

View File

@ -0,0 +1,4 @@
class ApplicationController < ActionController::Base
# Only allow modern browsers supporting webp images, web push, badges, import maps, CSS nesting, and CSS :has.
allow_browser versions: :modern
end

View File

View File

@ -0,0 +1,26 @@
class ModbusController < ApplicationController
def index
@schedule = Schedule.all
end
def schedule_edit
@schedule = Schedule.all
end
def schedule_edit_update
error_hours = []
params[:schedule].each do |id, attributes|
schedule = Schedule.find_by(id: id)
unless schedule.update(temperature: attributes[:temperature])
error_hours << "#{schedule.hour}"
end
end
if error_hours.any?
redirect_to modbus_index_path, alert: "#{error_hours.join(', ')}의 온도 업데이트에 실패하였습니다."
else
redirect_to modbus_index_path, notice: "스케줄이 성공적으로 업데이트되었습니다."
end
end
end

View File

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

View File

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

View File

@ -0,0 +1,3 @@
// Entry point for the build script in your package.json
import "@hotwired/turbo-rails"
import "./controllers"

View File

@ -0,0 +1,9 @@
import { Application } from "@hotwired/stimulus"
const application = Application.start()
// Configure Stimulus development experience
application.debug = false
window.Stimulus = application
export { application }

View File

@ -0,0 +1,7 @@
import { Controller } from "@hotwired/stimulus"
export default class extends Controller {
connect() {
this.element.textContent = "Hello World!"
}
}

View File

@ -0,0 +1,8 @@
// This file is auto-generated by ./bin/rails stimulus:manifest:update
// Run that command whenever you add a new controller or create them with
// ./bin/rails generate stimulus controllerName
import { application } from "./application"
import HelloController from "./hello_controller"
application.register("hello", HelloController)

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

@ -0,0 +1,3 @@
class ApplicationRecord < ActiveRecord::Base
primary_abstract_class
end

View File

6
app/models/schedule.rb Normal file
View File

@ -0,0 +1,6 @@
class Schedule < ApplicationRecord
validates :temperature,
presence: true,
numericality: true,
format: { with: /\A\d+(\.\d)?\z/ }
end

View File

@ -0,0 +1,8 @@
# Modbus::Service.new(plc_id: 1, type: "bit_coil", start_address: 0, end_address: 15).execute
module Modbus
module Commands
def bit_coil(slave)
read_bit(slave, :read_coils)
end
end
end

View File

@ -0,0 +1,8 @@
# Modbus::Service.new(plc_id: 1, type: "bit_input", start_address: 0, end_address: 15).execute
module Modbus
module Commands
def bit_input(slave)
read_bit(slave, :discrete_inputs)
end
end
end

View File

@ -0,0 +1,8 @@
# Modbus::Service.new(plc_id: 1, type: "word_holding_float32", start_address: 0, end_address: 15).execute
module Modbus
module Commands
def word_holding_float32(slave)
read_float(slave, :holding_registers)
end
end
end

View File

@ -0,0 +1,8 @@
# Modbus::Service.new(plc_id: 1, type: "word_holding_int16", start_address: 16, end_address: 31).execute
module Modbus
module Commands
def word_holding_int16(slave)
read_int(slave, 16, :holding_registers)
end
end
end

View File

@ -0,0 +1,8 @@
# Modbus::Service.new(plc_id: 1, type: "word_input_float32", start_address: 0, end_address: 15).execute
module Modbus
module Commands
def word_input_float32(slave)
read_float(slave, :input_registers)
end
end
end

View File

@ -0,0 +1,8 @@
# Modbus::Service.new(plc_id: 1, type: "word_input_int16", start_address: 0, end_address: 15).execute
module Modbus
module Commands
def word_input_int16(slave)
read_int(slave, 16, :input_registers)
end
end
end

View File

@ -0,0 +1,8 @@
# Modbus::Service.new(plc_id: 1, type: "write_bit", start_address: 0, value: 1).execute
module Modbus
module Commands
def write_bit(slave)
write_coil(slave)
end
end
end

View File

@ -0,0 +1,8 @@
# Modbus::Service.new(plc_id: 1, type: "write_bit_toggle", start_address: 0).execute
module Modbus
module Commands
def write_bit_toggle(slave)
write_toggle_coil(slave)
end
end
end

View File

@ -0,0 +1,8 @@
# Modbus::Service.new(plc_id: 1, type: "float32", start_address: 0, value: 123.45).execute
module Modbus
module Commands
def write_float32(slave)
write_float(slave)
end
end
end

View File

@ -0,0 +1,8 @@
# Modbus::Service.new(plc_id: 1, type: "int16", start_address: 0, value: 123).execute
module Modbus
module Commands
def write_int16(slave)
write_int(slave, 16)
end
end
end

View File

@ -0,0 +1,93 @@
# app/lib/modbus/operations.rb
module Modbus
module Operations
# write method
def write_toggle_coil(slave)
with_timeout do
target_value = slave.read_coils(@start_address, 1).first == 0 ? 1 : 0
slave.coils[@start_address] = (target_value == 1)
loop do
break if slave.read_coils(@start_address, 1).first == target_value
sleep 0.1
end
end
end
def write_coil(slave)
with_timeout do
slave.coils[@start_address] = @value
loop do
break if slave.read_coils(@start_address, 1).first == @value
sleep 0.1
end
end
end
def write_int(slave, bits)
with_timeout do
regs = slave.holding_registers
if bits == 16
value = @value.present? ? @value.to_i : 123
regs[@start_address] = value
end
end
end
def write_float(slave)
with_timeout do
regs = slave.holding_registers
value = @value.present? ? @value.to_f : 123.45
regs[@start_address], regs[@start_address + 1] = [ value ].pack("f").unpack("v*")
end
end
# read method
def read_bit(slave, type)
with_timeout do
value = case type
when :read_coils
slave.read_coils(@start_address, @end_address - @start_address + 1)
when :discrete_inputs
slave.discrete_inputs[@start_address..@end_address]
else
# type code here
end
Rails.logger.info "[#{Time.current}] Read Bit (#{type}): #{value}"
value
end
end
def read_int(slave, bits, type)
with_timeout do
result = slave.send(type)
values = (@start_address..@end_address).map { |i| result[i] }
Rails.logger.info "[#{Time.current}] Read Float#{bits} (#{type}): #{values}"
values
end
end
def read_float(slave, type)
with_timeout do
result = slave.send(type)
values = []
(@start_address..@end_address).step(2) do |i|
raw = [ result[i], result[i + 1] ]
packed = raw.pack("v*")
float = packed.unpack("f")[0].round(2)
values << float
end
Rails.logger.info "[#{Time.current}] Read Float32 (#{type}): #{values.inspect}"
values
end
end
def with_timeout
seconds = ENV.fetch("OPERATION_TIME_OUT", 1).to_i
Timeout.timeout(seconds) do
yield
end
rescue Timeout::Error
Rails.logger.error "[#{Time.current}] TimeOut (#{seconds}s)"
end
end
end

View File

@ -0,0 +1,46 @@
module Modbus
class PollingService
class << self
def start
return if @thread&.alive?
@thread = Thread.new do
puts "[#{Time.current}] Modbus polling service 시작됨"
last_logged_hour = nil
loop do
begin
now = Time.now
current_hour = now.hour
if current_hour != last_logged_hour && now.min == 0
schedule = Schedule.find_by(hour: current_hour)
Modbus::Service.new(
type: "write_int16",
start_address: 2,
end_address: 2,
value: schedule.temperature * 10
).execute
puts "[Schedule] #{current_hour}:00 -> Target temp: #{schedule.temperature}°C"
last_logged_hour = current_hour
end
rescue StandardError => e
error_message = "[#{Time.current}] 오류: #{e.message}"
puts error_message
ensure
sleep 0.1
end
end
end
end
def stop
if @thread
@thread.exit
@thread = nil
puts "[#{Time.now}] Modbus polling service 중지됨"
end
end
end
end
end

View File

@ -0,0 +1,38 @@
require_relative "operations"
Dir[File.join(__dir__.to_s, "commands", "**", "*.rb")].each do |file|
load file
end
class Modbus::Service
include Modbus::Operations
include Modbus::Commands
def initialize(type:, start_address:, end_address: nil, value: nil)
@type = type
@start_address = start_address.to_i
@end_address = end_address&.to_i
@value = value
@slave_id = 1
@plc_host = "rubyon.co.kr"
@plc_port = 502
end
def execute
ModBus::TCPClient.new(@plc_host, @plc_port) do |client|
client.with_slave(@slave_id) do |slave|
method_name = @type.strip
# Commands 모듈에 정의된 메서드만 허용
if Modbus::Commands.instance_methods(false).include?(method_name.to_sym)
return send(method_name, slave)
else
available_commands = Modbus::Commands.instance_methods(false).sort.map(&:to_s)
command_list = available_commands.join("\r\n")
raise ArgumentError, "지원되지 않는 type: #{@type}\r\n사용 가능한 명령어 목록:\r\n#{command_list}"
end
end
end
rescue => e
Rails.logger.error "[#{Time.current}] Service 오류: #{e.message}"
end
end

View File

@ -0,0 +1,30 @@
<!DOCTYPE html>
<html>
<head>
<title><%= content_for(:title) || "Farmitry Hvac" %></title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="mobile-web-app-capable" content="yes">
<%= csrf_meta_tags %>
<%= csp_meta_tag %>
<%= yield :head %>
<%# Enable PWA manifest for installable apps (make sure to enable in config/routes.rb too!) %>
<%#= tag.link rel: "manifest", href: pwa_manifest_path(format: :json) %>
<link rel="icon" href="/icon.png" type="image/png">
<link rel="icon" href="/icon.svg" type="image/svg+xml">
<link rel="apple-touch-icon" href="/icon.png">
<%# Includes all stylesheet files in app/assets/stylesheets %>
<%= stylesheet_link_tag :app, "data-turbo-track": "reload" %>
<%= javascript_include_tag "application", "data-turbo-track": "reload", type: "module" %>
</head>
<body>
<main class="m-4">
<%= yield %>
</main>
</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,18 @@
<% if flash[:notice] %>
<div class="mb-4 rounded bg-green-100 px-4 py-2 text-green-800 border border-green-300">
<%= flash[:notice] %>
</div>
<% elsif flash[:alert] %>
<div class="mb-4 rounded bg-red-100 px-4 py-2 text-red-800 border border-red-300">
<%= flash[:alert] %>
</div>
<% end %>
<% @schedule.each do |s| %>
<div class="flex justify-items-center gap-x-2">
<div><%= s.hour %>시</div>
<div><%= s.temperature %> °C</div>
</div>
<% end %>
<%= link_to "수정", "/modbus/schedule_edit", class: "btn btn-primary" %>

View File

@ -0,0 +1,14 @@
<%= form_with url: "/modbus/schedule_edit_update", method: :post do %>
<% @schedule.each do |s| %>
<div class="flex justify-items-center gap-x-2 pb-2">
<div><%= s.hour %>시</div>
<div>
<%= text_field_tag "schedule[#{s.id}][temperature]", s.temperature, class: "border px-2 py-1 rounded" %> °C
</div>
</div>
<% end %>
<div class="pt-4">
<%= submit_tag "업데이트", class: "bg-blue-500 text-white px-4 py-2 rounded" %>
</div>
<% end %>

View File

@ -0,0 +1,22 @@
{
"name": "FarmitryHvac",
"icons": [
{
"src": "/icon.png",
"type": "image/png",
"sizes": "512x512"
},
{
"src": "/icon.png",
"type": "image/png",
"sizes": "512x512",
"purpose": "maskable"
}
],
"start_url": "/",
"display": "standalone",
"scope": "/",
"description": "FarmitryHvac.",
"theme_color": "red",
"background_color": "red"
}

View File

@ -0,0 +1,26 @@
// Add a service worker for processing Web Push notifications:
//
// self.addEventListener("push", async (event) => {
// const { title, options } = await event.data.json()
// event.waitUntil(self.registration.showNotification(title, options))
// })
//
// self.addEventListener("notificationclick", function(event) {
// event.notification.close()
// event.waitUntil(
// clients.matchAll({ type: "window" }).then((clientList) => {
// for (let i = 0; i < clientList.length; i++) {
// let client = clientList[i]
// let clientPath = (new URL(client.url)).pathname
//
// if (clientPath == event.notification.data.path && "focus" in client) {
// return client.focus()
// }
// }
//
// if (clients.openWindow) {
// return clients.openWindow(event.notification.data.path)
// }
// })
// )
// })

7
bin/brakeman Executable file
View File

@ -0,0 +1,7 @@
#!/usr/bin/env ruby
require "rubygems"
require "bundler/setup"
ARGV.unshift("--ensure-latest")
load Gem.bin_path("brakeman", "brakeman")

109
bin/bundle Executable file
View File

@ -0,0 +1,109 @@
#!/usr/bin/env ruby
# frozen_string_literal: true
#
# This file was generated by Bundler.
#
# The application 'bundle' is installed as part of a gem, and
# this file is here to facilitate running it.
#
require "rubygems"
m = Module.new do
module_function
def invoked_as_script?
File.expand_path($0) == File.expand_path(__FILE__)
end
def env_var_version
ENV["BUNDLER_VERSION"]
end
def cli_arg_version
return unless invoked_as_script? # don't want to hijack other binstubs
return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
bundler_version = nil
update_index = nil
ARGV.each_with_index do |a, i|
if update_index && update_index.succ == i && a.match?(Gem::Version::ANCHORED_VERSION_PATTERN)
bundler_version = a
end
next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
bundler_version = $1
update_index = i
end
bundler_version
end
def gemfile
gemfile = ENV["BUNDLE_GEMFILE"]
return gemfile if gemfile && !gemfile.empty?
File.expand_path("../Gemfile", __dir__)
end
def lockfile
lockfile =
case File.basename(gemfile)
when "gems.rb" then gemfile.sub(/\.rb$/, ".locked")
else "#{gemfile}.lock"
end
File.expand_path(lockfile)
end
def lockfile_version
return unless File.file?(lockfile)
lockfile_contents = File.read(lockfile)
return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
Regexp.last_match(1)
end
def bundler_requirement
@bundler_requirement ||=
env_var_version ||
cli_arg_version ||
bundler_requirement_for(lockfile_version)
end
def bundler_requirement_for(version)
return "#{Gem::Requirement.default}.a" unless version
bundler_gem_version = Gem::Version.new(version)
bundler_gem_version.approximate_recommendation
end
def load_bundler!
ENV["BUNDLE_GEMFILE"] ||= gemfile
activate_bundler
end
def activate_bundler
gem_error = activation_error_handling do
gem "bundler", bundler_requirement
end
return if gem_error.nil?
require_error = activation_error_handling do
require "bundler/version"
end
return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`"
exit 42
end
def activation_error_handling
yield
nil
rescue StandardError, LoadError => e
e
end
end
m.load_bundler!
if m.invoked_as_script?
load Gem.bin_path("bundler", "bundle")
end

11
bin/dev Executable file
View File

@ -0,0 +1,11 @@
#!/usr/bin/env sh
if gem list --no-installed --exact --silent foreman; then
echo "Installing foreman..."
gem install foreman
fi
# Default to port 3000 if not specified
export PORT="${PORT:-3000}"
exec foreman start -f Procfile.dev --env /dev/null "$@"

14
bin/docker-entrypoint Executable file
View File

@ -0,0 +1,14 @@
#!/bin/bash -e
# Enable jemalloc for reduced memory usage and latency.
if [ -z "${LD_PRELOAD+x}" ]; then
LD_PRELOAD=$(find /usr/lib -name libjemalloc.so.2 -print -quit)
export LD_PRELOAD
fi
# If running the rails server then create or migrate existing database
if [ "${@: -2:1}" == "./bin/rails" ] && [ "${@: -1:1}" == "server" ]; then
./bin/rails db:prepare
fi
exec "${@}"

6
bin/jobs Executable file
View File

@ -0,0 +1,6 @@
#!/usr/bin/env ruby
require_relative "../config/environment"
require "solid_queue/cli"
SolidQueue::Cli.start(ARGV)

27
bin/kamal Executable file
View File

@ -0,0 +1,27 @@
#!/usr/bin/env ruby
# frozen_string_literal: true
#
# This file was generated by Bundler.
#
# The application 'kamal' is installed as part of a gem, and
# this file is here to facilitate running it.
#
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
bundle_binstub = File.expand_path("bundle", __dir__)
if File.file?(bundle_binstub)
if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
load(bundle_binstub)
else
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
end
end
require "rubygems"
require "bundler/setup"
load Gem.bin_path("kamal", "kamal")

4
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
bin/rake Executable file
View File

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

8
bin/rubocop Executable file
View File

@ -0,0 +1,8 @@
#!/usr/bin/env ruby
require "rubygems"
require "bundler/setup"
# explicit rubocop config increases performance slightly while avoiding config confusion.
ARGV.unshift("--config", File.expand_path("../.rubocop.yml", __dir__))
load Gem.bin_path("rubocop", "rubocop")

37
bin/setup Executable file
View File

@ -0,0 +1,37 @@
#!/usr/bin/env ruby
require "fileutils"
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("bundle check") || system!("bundle install")
# Install JavaScript dependencies
system("yarn install --check-files")
# puts "\n== Copying sample files =="
# unless File.exist?("config/database.yml")
# FileUtils.cp "config/database.yml.sample", "config/database.yml"
# end
puts "\n== Preparing database =="
system! "bin/rails db:prepare"
puts "\n== Removing old logs and tempfiles =="
system! "bin/rails log:clear tmp:clear"
unless ARGV.include?("--skip-server")
puts "\n== Starting development server =="
STDOUT.flush # flush the output before exec(2) so that it displays
exec "bin/dev"
end
end

5
bin/thrust Executable file
View File

@ -0,0 +1,5 @@
#!/usr/bin/env ruby
require "rubygems"
require "bundler/setup"
load Gem.bin_path("thruster", "thrust")

6
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

32
config/application.rb Normal file
View File

@ -0,0 +1,32 @@
require_relative "boot"
require "rails/all"
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module FarmitryHvac
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 8.0
# 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")
end
end

4
config/boot.rb Normal file
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.

17
config/cable.yml Normal file
View File

@ -0,0 +1,17 @@
# Async adapter only works within the same process, so for manually triggering cable updates from a console,
# and seeing results in the browser, you must do so from the web console (running inside the dev process),
# not a terminal started via bin/rails console! Add "console" to any action or any ERB template view
# to make the web console appear.
development:
adapter: async
test:
adapter: test
production:
adapter: solid_cable
connects_to:
database:
writing: cable
polling_interval: 0.1.seconds
message_retention: 1.day

16
config/cache.yml Normal file
View File

@ -0,0 +1,16 @@
default: &default
store_options:
# Cap age of oldest cache entry to fulfill retention policies
# max_age: <%= 60.days.to_i %>
max_size: <%= 256.megabytes %>
namespace: <%= Rails.env %>
development:
<<: *default
test:
<<: *default
production:
database: cache
<<: *default

View File

@ -0,0 +1 @@
q/SQgIn041lS6kROinLX4LDzShUnhVLEEZXRd+m62OlFkZrpoYn0lBFKLU9qxiaFbPXJfjf/rZmPEc5ISP6h3uQsPTuHHo8vV1b97icyQOQ+tmTHgojU5ZDgATaCnJ45hkpQrtatEGv8TRCE/VjG0ZosrD8IZQC8Jc79kcweR4X5oUvO92ICuf2tNhDjo4Wiy7yP24MsonlyGDI08q9DTVEmSPUIX4i0d8poFmB62lo/ypLh84G6QygzioPaxvGFVpB/IZHyohrsreihYA1N550zYzhTJAdiqu06ilUcMxVyjTQzluVnSyySk35K15EF5uXjqcCbYWMZR1MBnViuuVyw/hLUqbhNkK4HV4riH8xCu2BrOMInih8pnlyeiWHxsIU8327FuMvU4l4fYyBUwVFbfIRI8PMtcs4hjps5QKX3fk4FOkpwMZBu79aLyVPZOH6OMzzxDWwZhtltPTxaJkUCeBF9JLq+POkMhBsL1d0Svh7JTmC7fpck--2nzgLvheNvjVN3LY--ehCeDg/81bdfRRyzs+HOhA==

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