activeadmin_mitosis_editor 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG.md +17 -0
- data/CLAUDE.md +118 -0
- data/Gemfile +3 -0
- data/LICENSE +21 -0
- data/README.md +126 -0
- data/RELEASE.md +80 -0
- data/Rakefile +2 -0
- data/activeadmin_mitosis_editor.gemspec +17 -0
- data/app/views/inputs/mitosis_editor_input/_dependencies.html.erb +9 -0
- data/app/views/inputs/mitosis_editor_input/_form.html.erb +52 -0
- data/bin/console +5 -0
- data/bin/setup +14 -0
- data/demo/.dockerignore +51 -0
- data/demo/.gitattributes +9 -0
- data/demo/.gitignore +37 -0
- data/demo/.kamal/hooks/docker-setup.sample +3 -0
- data/demo/.kamal/hooks/post-app-boot.sample +3 -0
- data/demo/.kamal/hooks/post-deploy.sample +14 -0
- data/demo/.kamal/hooks/post-proxy-reboot.sample +3 -0
- data/demo/.kamal/hooks/pre-app-boot.sample +3 -0
- data/demo/.kamal/hooks/pre-build.sample +51 -0
- data/demo/.kamal/hooks/pre-connect.sample +47 -0
- data/demo/.kamal/hooks/pre-deploy.sample +122 -0
- data/demo/.kamal/hooks/pre-proxy-reboot.sample +3 -0
- data/demo/.kamal/secrets +20 -0
- data/demo/.rubocop.yml +8 -0
- data/demo/.ruby-version +1 -0
- data/demo/Dockerfile +76 -0
- data/demo/Gemfile +78 -0
- data/demo/Procfile.dev +2 -0
- data/demo/README.md +24 -0
- data/demo/Rakefile +6 -0
- data/demo/app/admin/articles.rb +12 -0
- data/demo/app/admin/dashboard.rb +17 -0
- data/demo/app/admin/pages.rb +12 -0
- data/demo/app/admin/posts.rb +12 -0
- data/demo/app/assets/builds/.keep +0 -0
- data/demo/app/assets/builds/active_admin.css +3852 -0
- data/demo/app/assets/images/.keep +0 -0
- data/demo/app/assets/stylesheets/active_admin.css +3 -0
- data/demo/app/assets/stylesheets/application.css +1 -0
- data/demo/app/assets/stylesheets/mitosis-editor.css +1 -0
- data/demo/app/assets/stylesheets/theme-dark.css +1 -0
- data/demo/app/assets/stylesheets/theme-light.css +1 -0
- data/demo/app/controllers/application_controller.rb +7 -0
- data/demo/app/controllers/articles_controller.rb +7 -0
- data/demo/app/controllers/concerns/.keep +0 -0
- data/demo/app/helpers/application_helper.rb +2 -0
- data/demo/app/helpers/articles_helper.rb +2 -0
- data/demo/app/javascript/application.js +3 -0
- data/demo/app/javascript/controllers/application.js +9 -0
- data/demo/app/javascript/controllers/hello_controller.js +7 -0
- data/demo/app/javascript/controllers/index.js +4 -0
- data/demo/app/jobs/application_job.rb +7 -0
- data/demo/app/mailers/application_mailer.rb +4 -0
- data/demo/app/models/application_record.rb +3 -0
- data/demo/app/models/article.rb +5 -0
- data/demo/app/models/concerns/.keep +0 -0
- data/demo/app/models/page.rb +5 -0
- data/demo/app/models/post.rb +5 -0
- data/demo/app/views/articles/_article.html.erb +12 -0
- data/demo/app/views/articles/_article.json.jbuilder +2 -0
- data/demo/app/views/articles/_form.html.erb +27 -0
- data/demo/app/views/articles/edit.html.erb +12 -0
- data/demo/app/views/articles/index.html.erb +16 -0
- data/demo/app/views/articles/index.json.jbuilder +1 -0
- data/demo/app/views/articles/new.html.erb +11 -0
- data/demo/app/views/articles/show.html.erb +10 -0
- data/demo/app/views/articles/show.json.jbuilder +1 -0
- data/demo/app/views/inputs/mitosis_editor_input/_dependencies.html.erb +17 -0
- data/demo/app/views/layouts/application.html.erb +29 -0
- data/demo/app/views/layouts/mailer.html.erb +13 -0
- data/demo/app/views/layouts/mailer.text.erb +1 -0
- data/demo/app/views/pwa/manifest.json.erb +22 -0
- data/demo/app/views/pwa/service-worker.js +26 -0
- data/demo/bin/brakeman +7 -0
- data/demo/bin/bundler-audit +6 -0
- data/demo/bin/ci +6 -0
- data/demo/bin/dev +8 -0
- data/demo/bin/docker-entrypoint +8 -0
- data/demo/bin/importmap +4 -0
- data/demo/bin/jobs +6 -0
- data/demo/bin/kamal +27 -0
- data/demo/bin/rails +4 -0
- data/demo/bin/rake +4 -0
- data/demo/bin/rubocop +8 -0
- data/demo/bin/setup +35 -0
- data/demo/bin/thrust +5 -0
- data/demo/config/application.rb +27 -0
- data/demo/config/boot.rb +4 -0
- data/demo/config/bundler-audit.yml +5 -0
- data/demo/config/cable.yml +17 -0
- data/demo/config/cache.yml +16 -0
- data/demo/config/ci.rb +23 -0
- data/demo/config/credentials.yml.enc +1 -0
- data/demo/config/database.yml +41 -0
- data/demo/config/deploy.yml +120 -0
- data/demo/config/environment.rb +21 -0
- data/demo/config/environments/development.rb +78 -0
- data/demo/config/environments/production.rb +90 -0
- data/demo/config/environments/test.rb +53 -0
- data/demo/config/importmap.rb +7 -0
- data/demo/config/initializers/active_admin.rb +275 -0
- data/demo/config/initializers/activeadmin_mitosis_editor.rb +19 -0
- data/demo/config/initializers/assets.rb +7 -0
- data/demo/config/initializers/content_security_policy.rb +29 -0
- data/demo/config/initializers/filter_parameter_logging.rb +8 -0
- data/demo/config/initializers/inflections.rb +16 -0
- data/demo/config/locales/en.yml +31 -0
- data/demo/config/puma.rb +42 -0
- data/demo/config/queue.yml +18 -0
- data/demo/config/recurring.yml +15 -0
- data/demo/config/routes.rb +16 -0
- data/demo/config/storage.yml +27 -0
- data/demo/config.ru +6 -0
- data/demo/db/cable_schema.rb +11 -0
- data/demo/db/cache_schema.rb +12 -0
- data/demo/db/migrate/20260215110410_create_active_admin_comments.rb +16 -0
- data/demo/db/migrate/20260215110416_create_articles.rb +10 -0
- data/demo/db/migrate/20260216124916_create_posts.rb +10 -0
- data/demo/db/migrate/20260216124919_create_pages.rb +10 -0
- data/demo/db/queue_schema.rb +129 -0
- data/demo/db/schema.rb +48 -0
- data/demo/db/seeds.rb +9 -0
- data/demo/lib/tasks/.keep +0 -0
- data/demo/log/.keep +0 -0
- data/demo/package-lock.json +1260 -0
- data/demo/package.json +13 -0
- data/demo/public/400.html +135 -0
- data/demo/public/404.html +135 -0
- data/demo/public/406-unsupported-browser.html +135 -0
- data/demo/public/422.html +135 -0
- data/demo/public/500.html +135 -0
- data/demo/public/icon.png +0 -0
- data/demo/public/icon.svg +3 -0
- data/demo/public/robots.txt +1 -0
- data/demo/script/.keep +0 -0
- data/demo/spec/rails_helper.rb +72 -0
- data/demo/spec/spec_helper.rb +94 -0
- data/demo/spec/system/admin_articles_spec.rb +22 -0
- data/demo/spec/system/mitosis_editor_prism_spec.rb +34 -0
- data/demo/spec/system/mitosis_editor_theme_spec.rb +63 -0
- data/demo/storage/.keep +0 -0
- data/demo/tailwind-active_admin.config.js +17 -0
- data/demo/tmp/.keep +0 -0
- data/demo/tmp/storage/.keep +0 -0
- data/demo/vendor/.keep +0 -0
- data/demo/vendor/javascript/.keep +0 -0
- data/docs/plans/2026-02-15-mitosis-editor-gem-design.md +70 -0
- data/docs/plans/2026-02-15-mitosis-editor-gem-implementation.md +407 -0
- data/lib/activeadmin_mitosis_editor/inputs/mitosis_editor_input.rb +29 -0
- data/lib/activeadmin_mitosis_editor/railtie.rb +7 -0
- data/lib/activeadmin_mitosis_editor/version.rb +3 -0
- data/lib/activeadmin_mitosis_editor.rb +13 -0
- data/lib/generators/mitosis_editor/styles_generator.rb +23 -0
- data/lib/generators/mitosis_editor/templates/_dependencies.html.erb +17 -0
- data/lib/generators/mitosis_editor/views_generator.rb +14 -0
- data/preview.png +0 -0
- data/script/bump-version +78 -0
- data/vendor/assets/javascripts/mitosis-editor.js +61 -0
- data/vendor/assets/stylesheets/mitosis-editor.css +1 -0
- data/vendor/assets/stylesheets/theme-dark.min.css +1 -0
- data/vendor/assets/stylesheets/theme-light.min.css +1 -0
- metadata +248 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
# A sample pre-connect check
|
|
4
|
+
#
|
|
5
|
+
# Warms DNS before connecting to hosts in parallel
|
|
6
|
+
#
|
|
7
|
+
# These environment variables are available:
|
|
8
|
+
# KAMAL_RECORDED_AT
|
|
9
|
+
# KAMAL_PERFORMER
|
|
10
|
+
# KAMAL_VERSION
|
|
11
|
+
# KAMAL_HOSTS
|
|
12
|
+
# KAMAL_ROLES (if set)
|
|
13
|
+
# KAMAL_DESTINATION (if set)
|
|
14
|
+
# KAMAL_RUNTIME
|
|
15
|
+
|
|
16
|
+
hosts = ENV["KAMAL_HOSTS"].split(",")
|
|
17
|
+
results = nil
|
|
18
|
+
max = 3
|
|
19
|
+
|
|
20
|
+
elapsed = Benchmark.realtime do
|
|
21
|
+
results = hosts.map do |host|
|
|
22
|
+
Thread.new do
|
|
23
|
+
tries = 1
|
|
24
|
+
|
|
25
|
+
begin
|
|
26
|
+
Socket.getaddrinfo(host, 0, Socket::AF_UNSPEC, Socket::SOCK_STREAM, nil, Socket::AI_CANONNAME)
|
|
27
|
+
rescue SocketError
|
|
28
|
+
if tries < max
|
|
29
|
+
puts "Retrying DNS warmup: #{host}"
|
|
30
|
+
tries += 1
|
|
31
|
+
sleep rand
|
|
32
|
+
retry
|
|
33
|
+
else
|
|
34
|
+
puts "DNS warmup failed: #{host}"
|
|
35
|
+
host
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
tries
|
|
40
|
+
end
|
|
41
|
+
end.map(&:value)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
retries = results.sum - hosts.size
|
|
45
|
+
nopes = results.count { |r| r == max }
|
|
46
|
+
|
|
47
|
+
puts "Prewarmed %d DNS lookups in %.2f sec: %d retries, %d failures" % [ hosts.size, elapsed, retries, nopes ]
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
# A sample pre-deploy hook
|
|
4
|
+
#
|
|
5
|
+
# Checks the Github status of the build, waiting for a pending build to complete for up to 720 seconds.
|
|
6
|
+
#
|
|
7
|
+
# Fails unless the combined status is "success"
|
|
8
|
+
#
|
|
9
|
+
# These environment variables are available:
|
|
10
|
+
# KAMAL_RECORDED_AT
|
|
11
|
+
# KAMAL_PERFORMER
|
|
12
|
+
# KAMAL_VERSION
|
|
13
|
+
# KAMAL_HOSTS
|
|
14
|
+
# KAMAL_COMMAND
|
|
15
|
+
# KAMAL_SUBCOMMAND
|
|
16
|
+
# KAMAL_ROLES (if set)
|
|
17
|
+
# KAMAL_DESTINATION (if set)
|
|
18
|
+
|
|
19
|
+
# Only check the build status for production deployments
|
|
20
|
+
if ENV["KAMAL_COMMAND"] == "rollback" || ENV["KAMAL_DESTINATION"] != "production"
|
|
21
|
+
exit 0
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
require "bundler/inline"
|
|
25
|
+
|
|
26
|
+
# true = install gems so this is fast on repeat invocations
|
|
27
|
+
gemfile(true, quiet: true) do
|
|
28
|
+
source "https://rubygems.org"
|
|
29
|
+
|
|
30
|
+
gem "octokit"
|
|
31
|
+
gem "faraday-retry"
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
MAX_ATTEMPTS = 72
|
|
35
|
+
ATTEMPTS_GAP = 10
|
|
36
|
+
|
|
37
|
+
def exit_with_error(message)
|
|
38
|
+
$stderr.puts message
|
|
39
|
+
exit 1
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
class GithubStatusChecks
|
|
43
|
+
attr_reader :remote_url, :git_sha, :github_client, :combined_status
|
|
44
|
+
|
|
45
|
+
def initialize
|
|
46
|
+
@remote_url = github_repo_from_remote_url
|
|
47
|
+
@git_sha = `git rev-parse HEAD`.strip
|
|
48
|
+
@github_client = Octokit::Client.new(access_token: ENV["GITHUB_TOKEN"])
|
|
49
|
+
refresh!
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def refresh!
|
|
53
|
+
@combined_status = github_client.combined_status(remote_url, git_sha)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def state
|
|
57
|
+
combined_status[:state]
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def first_status_url
|
|
61
|
+
first_status = combined_status[:statuses].find { |status| status[:state] == state }
|
|
62
|
+
first_status && first_status[:target_url]
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def complete_count
|
|
66
|
+
combined_status[:statuses].count { |status| status[:state] != "pending"}
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def total_count
|
|
70
|
+
combined_status[:statuses].count
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def current_status
|
|
74
|
+
if total_count > 0
|
|
75
|
+
"Completed #{complete_count}/#{total_count} checks, see #{first_status_url} ..."
|
|
76
|
+
else
|
|
77
|
+
"Build not started..."
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
private
|
|
82
|
+
def github_repo_from_remote_url
|
|
83
|
+
url = `git config --get remote.origin.url`.strip.delete_suffix(".git")
|
|
84
|
+
if url.start_with?("https://github.com/")
|
|
85
|
+
url.delete_prefix("https://github.com/")
|
|
86
|
+
elsif url.start_with?("git@github.com:")
|
|
87
|
+
url.delete_prefix("git@github.com:")
|
|
88
|
+
else
|
|
89
|
+
url
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
$stdout.sync = true
|
|
96
|
+
|
|
97
|
+
begin
|
|
98
|
+
puts "Checking build status..."
|
|
99
|
+
|
|
100
|
+
attempts = 0
|
|
101
|
+
checks = GithubStatusChecks.new
|
|
102
|
+
|
|
103
|
+
loop do
|
|
104
|
+
case checks.state
|
|
105
|
+
when "success"
|
|
106
|
+
puts "Checks passed, see #{checks.first_status_url}"
|
|
107
|
+
exit 0
|
|
108
|
+
when "failure"
|
|
109
|
+
exit_with_error "Checks failed, see #{checks.first_status_url}"
|
|
110
|
+
when "pending"
|
|
111
|
+
attempts += 1
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
exit_with_error "Checks are still pending, gave up after #{MAX_ATTEMPTS * ATTEMPTS_GAP} seconds" if attempts == MAX_ATTEMPTS
|
|
115
|
+
|
|
116
|
+
puts checks.current_status
|
|
117
|
+
sleep(ATTEMPTS_GAP)
|
|
118
|
+
checks.refresh!
|
|
119
|
+
end
|
|
120
|
+
rescue Octokit::NotFound
|
|
121
|
+
exit_with_error "Build status could not be found"
|
|
122
|
+
end
|
data/demo/.kamal/secrets
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Secrets defined here are available for reference under registry/password, env/secret, builder/secrets,
|
|
2
|
+
# and accessories/*/env/secret in config/deploy.yml. All secrets should be pulled from either
|
|
3
|
+
# password manager, ENV, or a file. DO NOT ENTER RAW CREDENTIALS HERE! This file needs to be safe for git.
|
|
4
|
+
|
|
5
|
+
# Example of extracting secrets from 1password (or another compatible pw manager)
|
|
6
|
+
# SECRETS=$(kamal secrets fetch --adapter 1password --account your-account --from Vault/Item KAMAL_REGISTRY_PASSWORD RAILS_MASTER_KEY)
|
|
7
|
+
# KAMAL_REGISTRY_PASSWORD=$(kamal secrets extract KAMAL_REGISTRY_PASSWORD ${SECRETS})
|
|
8
|
+
# RAILS_MASTER_KEY=$(kamal secrets extract RAILS_MASTER_KEY ${SECRETS})
|
|
9
|
+
|
|
10
|
+
# Example of extracting secrets from Rails credentials
|
|
11
|
+
# KAMAL_REGISTRY_PASSWORD=$(rails credentials:fetch kamal.registry_password)
|
|
12
|
+
|
|
13
|
+
# Use a GITHUB_TOKEN if private repositories are needed for the image
|
|
14
|
+
# GITHUB_TOKEN=$(gh config get -h github.com oauth_token)
|
|
15
|
+
|
|
16
|
+
# Grab the registry password from ENV
|
|
17
|
+
# KAMAL_REGISTRY_PASSWORD=$KAMAL_REGISTRY_PASSWORD
|
|
18
|
+
|
|
19
|
+
# Improve security by using a password manager. Never check config/master.key into git!
|
|
20
|
+
RAILS_MASTER_KEY=$(cat config/master.key)
|
data/demo/.rubocop.yml
ADDED
data/demo/.ruby-version
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ruby-3.3.5
|
data/demo/Dockerfile
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# syntax=docker/dockerfile:1
|
|
2
|
+
# check=error=true
|
|
3
|
+
|
|
4
|
+
# This Dockerfile is designed for production, not development. Use with Kamal or build'n'run by hand:
|
|
5
|
+
# docker build -t demo .
|
|
6
|
+
# docker run -d -p 80:80 -e RAILS_MASTER_KEY=<value from config/master.key> --name demo demo
|
|
7
|
+
|
|
8
|
+
# For a containerized dev environment, see Dev Containers: https://guides.rubyonrails.org/getting_started_with_devcontainer.html
|
|
9
|
+
|
|
10
|
+
# Make sure RUBY_VERSION matches the Ruby version in .ruby-version
|
|
11
|
+
ARG RUBY_VERSION=3.3.5
|
|
12
|
+
FROM docker.io/library/ruby:$RUBY_VERSION-slim AS base
|
|
13
|
+
|
|
14
|
+
# Rails app lives here
|
|
15
|
+
WORKDIR /rails
|
|
16
|
+
|
|
17
|
+
# Install base packages
|
|
18
|
+
RUN apt-get update -qq && \
|
|
19
|
+
apt-get install --no-install-recommends -y curl libjemalloc2 libvips sqlite3 && \
|
|
20
|
+
ln -s /usr/lib/$(uname -m)-linux-gnu/libjemalloc.so.2 /usr/local/lib/libjemalloc.so && \
|
|
21
|
+
rm -rf /var/lib/apt/lists /var/cache/apt/archives
|
|
22
|
+
|
|
23
|
+
# Set production environment variables and enable jemalloc for reduced memory usage and latency.
|
|
24
|
+
ENV RAILS_ENV="production" \
|
|
25
|
+
BUNDLE_DEPLOYMENT="1" \
|
|
26
|
+
BUNDLE_PATH="/usr/local/bundle" \
|
|
27
|
+
BUNDLE_WITHOUT="development" \
|
|
28
|
+
LD_PRELOAD="/usr/local/lib/libjemalloc.so"
|
|
29
|
+
|
|
30
|
+
# Throw-away build stage to reduce size of final image
|
|
31
|
+
FROM base AS build
|
|
32
|
+
|
|
33
|
+
# Install packages needed to build gems
|
|
34
|
+
RUN apt-get update -qq && \
|
|
35
|
+
apt-get install --no-install-recommends -y build-essential git libyaml-dev pkg-config && \
|
|
36
|
+
rm -rf /var/lib/apt/lists /var/cache/apt/archives
|
|
37
|
+
|
|
38
|
+
# Install application gems
|
|
39
|
+
COPY Gemfile Gemfile.lock vendor ./
|
|
40
|
+
|
|
41
|
+
RUN bundle install && \
|
|
42
|
+
rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git && \
|
|
43
|
+
# -j 1 disable parallel compilation to avoid a QEMU bug: https://github.com/rails/bootsnap/issues/495
|
|
44
|
+
bundle exec bootsnap precompile -j 1 --gemfile
|
|
45
|
+
|
|
46
|
+
# Copy application code
|
|
47
|
+
COPY . .
|
|
48
|
+
|
|
49
|
+
# Precompile bootsnap code for faster boot times.
|
|
50
|
+
# -j 1 disable parallel compilation to avoid a QEMU bug: https://github.com/rails/bootsnap/issues/495
|
|
51
|
+
RUN bundle exec bootsnap precompile -j 1 app/ lib/
|
|
52
|
+
|
|
53
|
+
# Precompiling assets for production without requiring secret RAILS_MASTER_KEY
|
|
54
|
+
RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
# Final stage for app image
|
|
60
|
+
FROM base
|
|
61
|
+
|
|
62
|
+
# Run and own only the runtime files as a non-root user for security
|
|
63
|
+
RUN groupadd --system --gid 1000 rails && \
|
|
64
|
+
useradd rails --uid 1000 --gid 1000 --create-home --shell /bin/bash
|
|
65
|
+
USER 1000:1000
|
|
66
|
+
|
|
67
|
+
# Copy built artifacts: gems, application
|
|
68
|
+
COPY --chown=rails:rails --from=build "${BUNDLE_PATH}" "${BUNDLE_PATH}"
|
|
69
|
+
COPY --chown=rails:rails --from=build /rails /rails
|
|
70
|
+
|
|
71
|
+
# Entrypoint prepares the database.
|
|
72
|
+
ENTRYPOINT ["/rails/bin/docker-entrypoint"]
|
|
73
|
+
|
|
74
|
+
# Start server via Thruster by default, this can be overwritten at runtime
|
|
75
|
+
EXPOSE 80
|
|
76
|
+
CMD ["./bin/thrust", "./bin/rails", "server"]
|
data/demo/Gemfile
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
source "https://rubygems.org"
|
|
2
|
+
|
|
3
|
+
# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
|
|
4
|
+
gem "rails", "~> 8.1.1"
|
|
5
|
+
# Use Propshaft for asset pipeline
|
|
6
|
+
gem "propshaft"
|
|
7
|
+
# Use Tailwind CSS via cssbundling-rails [https://github.com/rails/cssbundling-rails]
|
|
8
|
+
gem "cssbundling-rails"
|
|
9
|
+
|
|
10
|
+
# Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails]
|
|
11
|
+
gem "importmap-rails"
|
|
12
|
+
# Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev]
|
|
13
|
+
gem "turbo-rails"
|
|
14
|
+
# Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev]
|
|
15
|
+
gem "stimulus-rails"
|
|
16
|
+
|
|
17
|
+
# ActiveAdmin and dependencies
|
|
18
|
+
gem "activeadmin", "~> 4.0.0.beta21"
|
|
19
|
+
gem "inherited_resources", github: "activeadmin/inherited_resources"
|
|
20
|
+
|
|
21
|
+
# Local gem for mitosis editor
|
|
22
|
+
gem "activeadmin_mitosis_editor", path: "../"
|
|
23
|
+
# Use sqlite3 as the database for Active Record
|
|
24
|
+
gem "sqlite3", ">= 2.1"
|
|
25
|
+
# Use the Puma web server [https://github.com/puma/puma]
|
|
26
|
+
gem "puma", ">= 5.0"
|
|
27
|
+
# Build JSON APIs with ease [https://github.com/rails/jbuilder]
|
|
28
|
+
gem "jbuilder"
|
|
29
|
+
|
|
30
|
+
# Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword]
|
|
31
|
+
# gem "bcrypt", "~> 3.1.7"
|
|
32
|
+
|
|
33
|
+
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
|
|
34
|
+
gem "tzinfo-data", platforms: %i[ windows jruby ]
|
|
35
|
+
|
|
36
|
+
# Use the database-backed adapters for Rails.cache, Active Job, and Action Cable
|
|
37
|
+
gem "solid_cache"
|
|
38
|
+
gem "solid_queue"
|
|
39
|
+
gem "solid_cable"
|
|
40
|
+
|
|
41
|
+
# Reduces boot times through caching; required in config/boot.rb
|
|
42
|
+
gem "bootsnap", require: false
|
|
43
|
+
|
|
44
|
+
# Deploy this application anywhere as a Docker container [https://kamal-deploy.org]
|
|
45
|
+
gem "kamal", require: false
|
|
46
|
+
|
|
47
|
+
# Add HTTP asset caching/compression and X-Sendfile acceleration to Puma [https://github.com/basecamp/thruster/]
|
|
48
|
+
gem "thruster", require: false
|
|
49
|
+
|
|
50
|
+
# Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images]
|
|
51
|
+
gem "image_processing", "~> 1.2"
|
|
52
|
+
|
|
53
|
+
group :development, :test do
|
|
54
|
+
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
|
|
55
|
+
gem "debug", platforms: %i[ mri windows ], require: "debug/prelude"
|
|
56
|
+
|
|
57
|
+
# Audits gems for known security defects (use config/bundler-audit.yml to ignore issues)
|
|
58
|
+
gem "bundler-audit", require: false
|
|
59
|
+
|
|
60
|
+
# Static analysis for security vulnerabilities [https://brakemanscanner.org/]
|
|
61
|
+
gem "brakeman", require: false
|
|
62
|
+
|
|
63
|
+
# Omakase Ruby styling [https://github.com/rails/rubocop-rails-omakase/]
|
|
64
|
+
gem "rubocop-rails-omakase", require: false
|
|
65
|
+
|
|
66
|
+
gem "rspec-rails"
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
group :development do
|
|
70
|
+
# Use console on exceptions pages [https://github.com/rails/web-console]
|
|
71
|
+
gem "web-console"
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
group :test do
|
|
75
|
+
# Use system testing [https://guides.rubyonrails.org/testing.html#system-testing]
|
|
76
|
+
gem "capybara"
|
|
77
|
+
gem "selenium-webdriver"
|
|
78
|
+
end
|
data/demo/Procfile.dev
ADDED
data/demo/README.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# README
|
|
2
|
+
|
|
3
|
+
This README would normally document whatever steps are necessary to get the
|
|
4
|
+
application up and running.
|
|
5
|
+
|
|
6
|
+
Things you may want to cover:
|
|
7
|
+
|
|
8
|
+
* Ruby version
|
|
9
|
+
|
|
10
|
+
* System dependencies
|
|
11
|
+
|
|
12
|
+
* Configuration
|
|
13
|
+
|
|
14
|
+
* Database creation
|
|
15
|
+
|
|
16
|
+
* Database initialization
|
|
17
|
+
|
|
18
|
+
* How to run the test suite
|
|
19
|
+
|
|
20
|
+
* Services (job queues, cache servers, search engines, etc.)
|
|
21
|
+
|
|
22
|
+
* Deployment instructions
|
|
23
|
+
|
|
24
|
+
* ...
|
data/demo/Rakefile
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
ActiveAdmin.register Article do
|
|
2
|
+
permit_params :title, :body
|
|
3
|
+
|
|
4
|
+
form do |f|
|
|
5
|
+
f.inputs do
|
|
6
|
+
f.input :title
|
|
7
|
+
f.input :body, as: :mitosis_editor,
|
|
8
|
+
editor_options: { theme: "dark", height: "400px", placeholder: "Write your article in markdown..." }
|
|
9
|
+
end
|
|
10
|
+
f.actions
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
ActiveAdmin.register_page "Dashboard" do
|
|
4
|
+
menu priority: 1, label: proc { I18n.t("active_admin.dashboard") }
|
|
5
|
+
|
|
6
|
+
content title: proc { I18n.t("active_admin.dashboard") } do
|
|
7
|
+
div class: "px-4 py-16 md:py-32 text-center m-auto max-w-3xl" do
|
|
8
|
+
h2 "Welcome to ActiveAdmin", class: "text-base font-semibold leading-7 text-indigo-600 dark:text-indigo-500"
|
|
9
|
+
para "This is the default page", class: "mt-2 text-3xl sm:text-4xl font-bold text-gray-900 dark:text-gray-200"
|
|
10
|
+
para class: "mt-6 text-xl leading-8 text-gray-700 dark:text-gray-400" do
|
|
11
|
+
text_node "To update the content, edit the"
|
|
12
|
+
strong "app/admin/dashboard.rb"
|
|
13
|
+
text_node "file to get started."
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
File without changes
|