add ruby-related files
This commit is contained in:
parent
b60d2beff4
commit
071a4e9059
10 changed files with 270 additions and 0 deletions
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
build/
|
||||
tmp/
|
||||
node_modules/
|
||||
*.log
|
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
[submodule "TheQuran"]
|
||||
path = TheQuran
|
||||
url = https://github.com/reflectedlight/quran-pull.git
|
26
.rubocop.yml
Normal file
26
.rubocop.yml
Normal file
|
@ -0,0 +1,26 @@
|
|||
##
|
||||
# Defaults
|
||||
AllCops:
|
||||
TargetRubyVersion: 3.1
|
||||
|
||||
##
|
||||
# Plugins
|
||||
require:
|
||||
- standard
|
||||
|
||||
##
|
||||
# Defaults: standard-rb
|
||||
inherit_gem:
|
||||
standard: config/base.yml
|
||||
|
||||
##
|
||||
# Extra cops
|
||||
Style/FrozenStringLiteralComment:
|
||||
Enabled: true
|
||||
|
||||
##
|
||||
# Disabled cops (lib-specific)
|
||||
Layout/MultilineMethodCallIndentation:
|
||||
Enabled: false
|
||||
Style/TrivialAccessors:
|
||||
Enabled: false
|
8
Gemfile
Normal file
8
Gemfile
Normal file
|
@ -0,0 +1,8 @@
|
|||
source 'https://rubygems.org'
|
||||
gem 'nanoc', '~> 4.12'
|
||||
gem 'nanoc-live', '~> 1.0'
|
||||
gem 'rainpress', '~> 1.0'
|
||||
gem 'sass'
|
||||
gem 'standardrb'
|
||||
gem "ryo.rb"
|
||||
gem "paint"
|
142
Gemfile.lock
Normal file
142
Gemfile.lock
Normal file
|
@ -0,0 +1,142 @@
|
|||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
addressable (2.8.1)
|
||||
public_suffix (>= 2.0.2, < 6.0)
|
||||
adsf (1.4.6)
|
||||
rack (>= 1.0.0, < 3.0.0)
|
||||
adsf-live (1.4.6)
|
||||
adsf (~> 1.3)
|
||||
em-websocket (~> 0.5)
|
||||
eventmachine (~> 1.2)
|
||||
listen (~> 3.0)
|
||||
rack-livereload (~> 0.3)
|
||||
ast (2.4.2)
|
||||
colored (1.2)
|
||||
concurrent-ruby (1.1.10)
|
||||
cri (2.15.11)
|
||||
ddmetrics (1.0.1)
|
||||
ddplugin (1.0.3)
|
||||
diff-lcs (1.5.0)
|
||||
em-websocket (0.5.3)
|
||||
eventmachine (>= 0.12.9)
|
||||
http_parser.rb (~> 0)
|
||||
eventmachine (1.2.7)
|
||||
ffi (1.15.5)
|
||||
hamster (3.0.0)
|
||||
concurrent-ruby (~> 1.0)
|
||||
http_parser.rb (0.8.0)
|
||||
json (2.6.2)
|
||||
json_schema (0.21.0)
|
||||
listen (3.7.1)
|
||||
rb-fsevent (~> 0.10, >= 0.10.3)
|
||||
rb-inotify (~> 0.9, >= 0.9.10)
|
||||
memo_wise (1.7.0)
|
||||
nanoc (4.12.9)
|
||||
addressable (~> 2.5)
|
||||
colored (~> 1.2)
|
||||
nanoc-checking (~> 1.0, >= 1.0.2)
|
||||
nanoc-cli (= 4.12.9)
|
||||
nanoc-core (= 4.12.9)
|
||||
nanoc-deploying (~> 1.0)
|
||||
parallel (~> 1.12)
|
||||
tty-command (~> 0.8)
|
||||
tty-which (~> 0.4)
|
||||
nanoc-checking (1.0.2)
|
||||
nanoc-cli (~> 4.12, >= 4.12.4)
|
||||
nanoc-core (~> 4.12, >= 4.12.4)
|
||||
nanoc-cli (4.12.9)
|
||||
cri (~> 2.15)
|
||||
diff-lcs (~> 1.3)
|
||||
nanoc-core (= 4.12.9)
|
||||
zeitwerk (~> 2.1)
|
||||
nanoc-core (4.12.9)
|
||||
concurrent-ruby (~> 1.1)
|
||||
ddmetrics (~> 1.0)
|
||||
ddplugin (~> 1.0)
|
||||
hamster (~> 3.0)
|
||||
json_schema (~> 0.19)
|
||||
memo_wise (~> 1.5)
|
||||
psych (~> 4.0)
|
||||
slow_enumerator_tools (~> 1.0)
|
||||
tty-platform (~> 0.2)
|
||||
zeitwerk (~> 2.1)
|
||||
nanoc-deploying (1.0.2)
|
||||
nanoc-checking (~> 1.0)
|
||||
nanoc-cli (~> 4.11, >= 4.11.15)
|
||||
nanoc-core (~> 4.11, >= 4.11.15)
|
||||
nanoc-live (1.0.0)
|
||||
adsf-live (~> 1.4)
|
||||
listen (~> 3.0)
|
||||
nanoc-cli (~> 4.11, >= 4.11.14)
|
||||
nanoc-core (~> 4.11, >= 4.11.14)
|
||||
paint (2.3.0)
|
||||
parallel (1.22.1)
|
||||
parser (3.1.2.1)
|
||||
ast (~> 2.4.1)
|
||||
pastel (0.8.0)
|
||||
tty-color (~> 0.5)
|
||||
psych (4.0.6)
|
||||
stringio
|
||||
public_suffix (5.0.0)
|
||||
rack (2.2.4)
|
||||
rack-livereload (0.3.17)
|
||||
rack
|
||||
rainbow (3.1.1)
|
||||
rainpress (1.0.1)
|
||||
rb-fsevent (0.11.2)
|
||||
rb-inotify (0.10.1)
|
||||
ffi (~> 1.0)
|
||||
regexp_parser (2.6.0)
|
||||
rexml (3.2.5)
|
||||
rubocop (1.35.1)
|
||||
json (~> 2.3)
|
||||
parallel (~> 1.10)
|
||||
parser (>= 3.1.2.1)
|
||||
rainbow (>= 2.2.2, < 4.0)
|
||||
regexp_parser (>= 1.8, < 3.0)
|
||||
rexml (>= 3.2.5, < 4.0)
|
||||
rubocop-ast (>= 1.20.1, < 2.0)
|
||||
ruby-progressbar (~> 1.7)
|
||||
unicode-display_width (>= 1.4.0, < 3.0)
|
||||
rubocop-ast (1.23.0)
|
||||
parser (>= 3.1.1.0)
|
||||
rubocop-performance (1.14.3)
|
||||
rubocop (>= 1.7.0, < 2.0)
|
||||
rubocop-ast (>= 0.4.0)
|
||||
ruby-progressbar (1.11.0)
|
||||
ryo.rb (0.2.1)
|
||||
sass (3.7.4)
|
||||
sass-listen (~> 4.0.0)
|
||||
sass-listen (4.0.0)
|
||||
rb-fsevent (~> 0.9, >= 0.9.4)
|
||||
rb-inotify (~> 0.9, >= 0.9.7)
|
||||
slow_enumerator_tools (1.1.0)
|
||||
standard (1.16.1)
|
||||
rubocop (= 1.35.1)
|
||||
rubocop-performance (= 1.14.3)
|
||||
standardrb (1.0.1)
|
||||
standard
|
||||
stringio (3.0.2)
|
||||
tty-color (0.6.0)
|
||||
tty-command (0.10.1)
|
||||
pastel (~> 0.8)
|
||||
tty-platform (0.3.0)
|
||||
tty-which (0.5.0)
|
||||
unicode-display_width (2.3.0)
|
||||
zeitwerk (2.6.1)
|
||||
|
||||
PLATFORMS
|
||||
x86_64-freebsd-13
|
||||
|
||||
DEPENDENCIES
|
||||
nanoc (~> 4.12)
|
||||
nanoc-live (~> 1.0)
|
||||
paint
|
||||
rainpress (~> 1.0)
|
||||
ryo.rb
|
||||
sass
|
||||
standardrb
|
||||
|
||||
BUNDLED WITH
|
||||
2.3.7
|
17
Rakefile.rb
Normal file
17
Rakefile.rb
Normal file
|
@ -0,0 +1,17 @@
|
|||
require "bundler/setup"
|
||||
require_relative "lib/tasks"
|
||||
include Tasks
|
||||
|
||||
namespace :nanoc do
|
||||
task :compile do
|
||||
sh "nanoc co"
|
||||
end
|
||||
end
|
||||
|
||||
namespace :deploy do
|
||||
task local: ["nanoc:compile"] do
|
||||
Deploy::Local.call
|
||||
end
|
||||
end
|
||||
|
||||
task default: "deploy:local"
|
18
lib/rake/cmd.rb
Normal file
18
lib/rake/cmd.rb
Normal file
|
@ -0,0 +1,18 @@
|
|||
module Cmd
|
||||
def cmd(cmd, *args, silent: false)
|
||||
print " -> #{cmd}: " unless silent
|
||||
_, result = Process.wait2 Process.spawn(
|
||||
[cmd, cmd],
|
||||
*args,
|
||||
STDERR=>File::NULL,
|
||||
STDOUT=>File::NULL
|
||||
)
|
||||
case
|
||||
when result.success?
|
||||
print Paint["OK", :green, :bold], "\n" unless silent
|
||||
else
|
||||
print Paint["ERROR", :red, :bold], "\n" unless silent
|
||||
exit result.exitstatus
|
||||
end
|
||||
end
|
||||
end
|
5
lib/tasks.rb
Normal file
5
lib/tasks.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Tasks
|
||||
require_relative "tasks/deploy"
|
||||
end
|
3
lib/tasks/deploy.rb
Normal file
3
lib/tasks/deploy.rb
Normal file
|
@ -0,0 +1,3 @@
|
|||
module Tasks::Deploy
|
||||
require_relative "deploy/local"
|
||||
end
|
44
lib/tasks/deploy/local.rb
Normal file
44
lib/tasks/deploy/local.rb
Normal file
|
@ -0,0 +1,44 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class Tasks::Deploy::Local
|
||||
require "ryo"
|
||||
require "yaml"
|
||||
require "paint"
|
||||
|
||||
def self.call(...)
|
||||
new(...).call
|
||||
end
|
||||
|
||||
def call
|
||||
src, dest = settings.src, settings.dest
|
||||
user, group = settings.user, settings.group
|
||||
doas "root", "/bin/cp", "-r", src, dest
|
||||
doas "root", "/usr/sbin/chown", "-R", [user, group].join(":"), dest
|
||||
doas "root", "/bin/chmod", "-R", "go-rwx", dest
|
||||
end
|
||||
|
||||
def to_proc
|
||||
proc { call }
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def nanoc
|
||||
@nanoc ||= Ryo.from(YAML.load_file("./nanoc.yaml"))
|
||||
end
|
||||
|
||||
def settings
|
||||
nanoc.deploy.local
|
||||
end
|
||||
|
||||
def doas(user, *cmd)
|
||||
print " " * 2, "-> ", File.basename(cmd[0]), ": "
|
||||
_, status = Process.wait2 spawn("doas", "-u", user, *cmd)
|
||||
if status.success?
|
||||
print Paint["OK", :green, :bold], "\n"
|
||||
else
|
||||
print Paint["ERROR", :red, :bold], "\n"
|
||||
exit!
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue