Drop 'twenty-' prefix from toplevel directories

The directories twenty-{server,client,cli} have been renamed to
not include 'twenty-'. The gems are still published with the twenty-
prefix, otherwise a collision is impossible to avoid. This commit makes
it slightly easier to generalize twenty.
This commit is contained in:
0x1eef 2024-04-21 20:08:29 -03:00
parent f51c9c281d
commit 2e8cf6e333
132 changed files with 56 additions and 59 deletions

2
.gitmodules vendored
View file

@ -1,3 +1,3 @@
[submodule "twenty-client/src/css/vendor/tail.css"] [submodule "twenty-client/src/css/vendor/tail.css"]
path = twenty-client/src/css/vendor/tail.css path = client/src/css/vendor/tail.css
url = https://github.com/0x1eef/tail.css url = https://github.com/0x1eef/tail.css

View file

@ -1,6 +1,6 @@
source "https://rubygems.org" source "https://rubygems.org"
gemspec gemspec
gem "twenty-cli", path: "./twenty-cli" gem "twenty-cli", path: "./cli"
gem "twenty-server", path: "./twenty-server" gem "twenty-server", path: "./server"
gem "twenty-client", path: "./twenty-client" gem "twenty-client", path: "./client"
gem "listen" gem "listen"

View file

@ -4,7 +4,7 @@
# sub-directory / sub-package (cli, client, server). # sub-directory / sub-package (cli, client, server).
set -e set -e
wrkdir=$(pwd) wrkdir=$(pwd)
subdir=". twenty-cli twenty-client twenty-server" subdir=". cli client server"
for dir in ${subdir}; do for dir in ${subdir}; do
cd ${dir} cd ${dir}
bundle install bundle install

View file

@ -2,7 +2,7 @@
# frozen_string_literal: true # frozen_string_literal: true
libdir = File.join(__dir__, "..", "lib") libdir = File.join(__dir__, "..", "lib")
require File.join(libdir, "twenty-cli", "libexec") require File.join(libdir, "twenty", "cli", "libexec")
case ARGV[0] case ARGV[0]
when "up" when "up"

View file

@ -9,12 +9,13 @@ Gem::Specification.new do |gem|
gem.licenses = ["0BSD"] gem.licenses = ["0BSD"]
gem.files = [ gem.files = [
*Dir.glob(File.join(__dir__, "lib", "*.rb")), *Dir.glob(File.join(__dir__, "lib", "*.rb")),
*Dir.glob(File.join(__dir__, "lib", "twenty-cli", "**", "*.rb")), *Dir.glob(File.join(__dir__, "lib", "twenty", "*.rb")),
*Dir.glob(File.join(__dir__, "lib", "twenty", "cli", "**", "*.rb")),
*Dir.glob(File.join(__dir__, "libexec", "**", "*")), *Dir.glob(File.join(__dir__, "libexec", "**", "*")),
*Dir.glob(File.join(__dir__, "bin", "*")) *Dir.glob(File.join(__dir__, "bin", "*"))
].select { File.file?(_1) } ].select { File.file?(_1) }
gem.require_paths = ["lib"] gem.require_paths = ["lib"]
gem.summary = "twenty: CLI component" gem.summary = "Command-line interface"
gem.description = gem.summary gem.description = gem.summary
gem.executables = ["twenty"] gem.executables = ["twenty"]
gem.add_runtime_dependency "cmd.rb", "~> 0.5" gem.add_runtime_dependency "cmd.rb", "~> 0.5"

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true # frozen_string_literal: true
Gem::Specification.new do |gem| Gem::Specification.new do |gem|
gem.name = "twenty-cli" gem.name = "<%= parent %>-cli"
gem.authors = ["0x1eef"] gem.authors = ["0x1eef"]
gem.email = ["0x1eef@protonmail.com"] gem.email = ["0x1eef@protonmail.com"]
gem.homepage = "https://github.com/0x1eef/twenty#readme" gem.homepage = "https://github.com/0x1eef/twenty#readme"
@ -9,14 +9,15 @@ Gem::Specification.new do |gem|
gem.licenses = ["0BSD"] gem.licenses = ["0BSD"]
gem.files = [ gem.files = [
*Dir.glob(File.join(__dir__, "lib", "*.rb")), *Dir.glob(File.join(__dir__, "lib", "*.rb")),
*Dir.glob(File.join(__dir__, "lib", "twenty-cli", "**", "*.rb")), *Dir.glob(File.join(__dir__, "lib", "twenty", "*.rb")),
*Dir.glob(File.join(__dir__, "lib", "twenty", "cli", "**", "*.rb")),
*Dir.glob(File.join(__dir__, "libexec", "**", "*")), *Dir.glob(File.join(__dir__, "libexec", "**", "*")),
*Dir.glob(File.join(__dir__, "bin", "*")) *Dir.glob(File.join(__dir__, "bin", "*"))
].select { File.file?(_1) } ].select { File.file?(_1) }
gem.require_paths = ["lib"] gem.require_paths = ["lib"]
gem.summary = "twenty: CLI component" gem.summary = "Command-line interface"
gem.description = gem.summary gem.description = gem.summary
gem.executables = ["twenty"] gem.executables = ["<%= parent %>"]
gem.add_runtime_dependency "cmd.rb", "~> 0.5" gem.add_runtime_dependency "cmd.rb", "~> 0.5"
gem.add_runtime_dependency "paint", "~> 2.3" gem.add_runtime_dependency "paint", "~> 2.3"
gem.add_development_dependency "test-unit", "~> 3.5.7" gem.add_development_dependency "test-unit", "~> 3.5.7"

8
cli/lib/twenty/cli.rb Normal file
View file

@ -0,0 +1,8 @@
# frozen_string_literal: true
module Twenty
require "json"
require "twenty/server"
require "twenty/client"
require_relative "cli/command"
end

View file

@ -4,8 +4,8 @@ module Twenty::Command::SQLiteMixin
def run_command(options) def run_command(options)
path = options.database || Twenty.default_database path = options.database || Twenty.default_database
Twenty.establish_connection(path:) Twenty.establish_connection(path:)
require "twenty-server/migration" require "twenty/server/migration"
require "twenty-server/model" require "twenty/server/model"
super(options) super(options)
end end
end end

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true # frozen_string_literal: true
def spawn(exec, *) def spawn(exec, *)
libexec_dir = File.realpath(File.join(__dir__, "..", "..", "libexec", "twenty")) libexec_dir = File.realpath(File.join(__dir__, "..", "..", "..", "libexec", "twenty"))
Process.spawn(File.join(libexec_dir, exec), *) Process.spawn(File.join(libexec_dir, exec), *)
end end

View file

@ -2,7 +2,7 @@
# frozen_string_literal: true # frozen_string_literal: true
libdir = File.expand_path File.join(__dir__, "..", "..", "lib") libdir = File.expand_path File.join(__dir__, "..", "..", "lib")
require File.join(libdir, "twenty-cli") require File.join(libdir, "twenty", "cli")
## ##
# main # main

View file

@ -12,7 +12,7 @@ Gem::Specification.new do |gem|
.flat_map { Dir.glob(_1.chomp) } .flat_map { Dir.glob(_1.chomp) }
.select { File.file?(_1) } .select { File.file?(_1) }
gem.require_paths = ["lib"] gem.require_paths = ["lib"]
gem.summary = "twenty: client-side component" gem.summary = "HTTP client"
gem.description = gem.summary gem.description = gem.summary
gem.add_development_dependency "nanoc", "~> 4.12" gem.add_development_dependency "nanoc", "~> 4.12"
gem.add_development_dependency "sass", "~> 3.7" gem.add_development_dependency "sass", "~> 3.7"

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true # frozen_string_literal: true
Gem::Specification.new do |gem| Gem::Specification.new do |gem|
gem.name = "twenty-client" gem.name = "<%= parent %>-client"
gem.authors = ["0x1eef"] gem.authors = ["0x1eef"]
gem.email = ["0x1eef@protonmail.com"] gem.email = ["0x1eef@protonmail.com"]
gem.homepage = "https://github.com/0x1eef/twenty#readme" gem.homepage = "https://github.com/0x1eef/twenty#readme"
@ -12,7 +12,7 @@ Gem::Specification.new do |gem|
.flat_map { Dir.glob(_1.chomp) } .flat_map { Dir.glob(_1.chomp) }
.select { File.file?(_1) } .select { File.file?(_1) }
gem.require_paths = ["lib"] gem.require_paths = ["lib"]
gem.summary = "twenty: client-side component" gem.summary = "HTTP client"
gem.description = gem.summary gem.description = gem.summary
gem.add_development_dependency "nanoc", "~> 4.12" gem.add_development_dependency "nanoc", "~> 4.12"
gem.add_development_dependency "sass", "~> 3.7" gem.add_development_dependency "sass", "~> 3.7"

View file

@ -2,6 +2,6 @@
module Twenty module Twenty
def self.build def self.build
File.expand_path File.join(__dir__, "..", "build") File.expand_path File.join(__dir__, "..", "..", "build")
end end
end end

View file

Before

Width:  |  Height:  |  Size: 989 B

After

Width:  |  Height:  |  Size: 989 B

View file

@ -2,8 +2,8 @@ class Builder
ROOTDIR = Dir.getwd ROOTDIR = Dir.getwd
STAGEDIR = File.join(ROOTDIR, "stage") STAGEDIR = File.join(ROOTDIR, "stage")
PKGDIR = File.join(ROOTDIR, "pkgs") PKGDIR = File.join(ROOTDIR, "pkgs")
PARENT = "twenty.rb" PARENT = File.basename File.realpath(File.join(__dir__, "..", ".."))
CHILDREN = %w[twenty-cli twenty-server twenty-client] CHILDREN = %w[cli server client]
include FileUtils include FileUtils
def self.call(...) def self.call(...)
@ -16,7 +16,7 @@ class GemSpec < Builder
def call(version) def call(version)
[PARENT, *CHILDREN].each do |node| [PARENT, *CHILDREN].each do |node|
path = find_path(node) path = find_path(node)
spec = ERB.new(File.binread(path)).result_with_hash({version:}) spec = ERB.new(File.binread(path)).result_with_hash({parent: PARENT, version:})
File.binwrite File.join(File.dirname(path), "#{node}.gemspec"), spec File.binwrite File.join(File.dirname(path), "#{node}.gemspec"), spec
end end
end end

View file

@ -1,6 +1,6 @@
namespace :nanoc do namespace :nanoc do
require "bundler/setup" require "bundler/setup"
workdir = File.realpath File.join(__dir__, "..", "..", "twenty-client") workdir = File.realpath File.join(__dir__, "..", "..", "client")
desc "Clean the build/ directory" desc "Clean the build/ directory"
task :clean do task :clean do

View file

@ -3,9 +3,9 @@
namespace :rubocop do namespace :rubocop do
root = File.realpath File.join(__dir__, "..", "..") root = File.realpath File.join(__dir__, "..", "..")
gems = [ gems = [
File.join(root, "twenty-cli"), File.join(root, "cli"),
File.join(root, "twenty-server"), File.join(root, "server"),
File.join(root, "twenty-client") File.join(root, "client")
] ]
desc "Copy '.rubocop.yml' into place" desc "Copy '.rubocop.yml' into place"

View file

@ -5,15 +5,15 @@ namespace :schema do
task :'regen:server' do task :'regen:server' do
Dir.chdir(workdir) do Dir.chdir(workdir) do
require "twenty-server" require "server"
schema = File.join(Dir.getwd, "share", "twenty-server", "schema.graphql") schema = File.join(Dir.getwd, "share", "server", "schema.graphql")
mkdir_p File.dirname(schema) mkdir_p File.dirname(schema)
File.binwrite schema, Twenty::GraphQL::Schema.to_definition File.binwrite schema, Twenty::GraphQL::Schema.to_definition
end end
end end
task :'regen:client' do task :'regen:client' do
Dir.chdir(File.join(workdir, "twenty-client")) do Dir.chdir(File.join(workdir, "client")) do
sh "npm exec graphql-codegen" sh "npm exec graphql-codegen"
end end
end end

View file

@ -1,7 +1,7 @@
desc "Run server" desc "Run server"
task :server, [:protocol] do |_, args| task :server, [:protocol] do |_, args|
require 'rbconfig' require 'rbconfig'
cli = [RbConfig.ruby, "-rbundler/setup", "twenty-cli/bin/twenty", "up"] cli = [RbConfig.ruby, "-rbundler/setup", "cli/bin/twenty", "up"]
h = args.to_h h = args.to_h
if h[:protocol] == "unix" if h[:protocol] == "unix"
Process.wait spawn(*cli, "--unix", "/tmp/twenty.freebsd.local") Process.wait spawn(*cli, "--unix", "/tmp/twenty.freebsd.local")

View file

@ -3,7 +3,7 @@
module Twenty module Twenty
require "fileutils" require "fileutils"
require "sequel" require "sequel"
require_relative "twenty-server/path" require_relative "server/path"
## ##
# @return [String] # @return [String]
@ -32,6 +32,6 @@ module Twenty
end end
FileUtils.touch(default_database) FileUtils.touch(default_database)
require_relative "twenty-server/graphql" require_relative "server/graphql"
require_relative "twenty-server/rack" require_relative "server/rack"
end end

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