cli: add, and apply standardrb / rubocop
This commit is contained in:
parent
52297a2556
commit
42b197b58d
11 changed files with 56 additions and 3 deletions
34
twenty-cli/.rubocop.yml
Normal file
34
twenty-cli/.rubocop.yml
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
##
|
||||||
|
# Plugins
|
||||||
|
require:
|
||||||
|
- standard
|
||||||
|
|
||||||
|
##
|
||||||
|
# Defaults: standard-rb
|
||||||
|
inherit_gem:
|
||||||
|
standard: config/base.yml
|
||||||
|
|
||||||
|
##
|
||||||
|
# All cops
|
||||||
|
AllCops:
|
||||||
|
TargetRubyVersion: 3.2
|
||||||
|
Include:
|
||||||
|
- lib/*.rb
|
||||||
|
- lib/**/*.rb
|
||||||
|
- test/*_test.rb
|
||||||
|
|
||||||
|
##
|
||||||
|
# Enabled
|
||||||
|
Style/FrozenStringLiteralComment:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
|
##
|
||||||
|
# Disabled
|
||||||
|
Layout/ArgumentAlignment:
|
||||||
|
Enabled: false
|
||||||
|
Layout/MultilineMethodCallIndentation:
|
||||||
|
Enabled: false
|
||||||
|
Layout/EmptyLineBetweenDefs:
|
||||||
|
Enabled: false
|
||||||
|
Style/TrivialAccessors:
|
||||||
|
Enabled: false
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Twenty
|
module Twenty
|
||||||
require "json"
|
require "json"
|
||||||
require "twenty-backend"
|
require "twenty-backend"
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require "cmd"
|
require "cmd"
|
||||||
|
|
||||||
class Twenty::Command < Cmd
|
class Twenty::Command < Cmd
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Twenty::Command::Connect < Twenty::Command
|
class Twenty::Command::Connect < Twenty::Command
|
||||||
set_banner usage: "twenty connect [OPTIONS]",
|
set_banner usage: "twenty connect [OPTIONS]",
|
||||||
description: "Connect a project to twenty"
|
description: "Connect a project to twenty"
|
||||||
|
@ -13,7 +15,7 @@ class Twenty::Command::Connect < Twenty::Command
|
||||||
def run_command(options)
|
def run_command(options)
|
||||||
Twenty::Project.new(
|
Twenty::Project.new(
|
||||||
name: File.basename(Dir.getwd),
|
name: File.basename(Dir.getwd),
|
||||||
path: Dir.getwd,
|
path: Dir.getwd
|
||||||
).save!
|
).save!
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Twenty::Command::Console < Twenty::Command
|
class Twenty::Command::Console < Twenty::Command
|
||||||
set_banner usage: "twenty console [OPTIONS]",
|
set_banner usage: "twenty console [OPTIONS]",
|
||||||
description: "Start the twenty developer console"
|
description: "Start the twenty developer console"
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Twenty::Command::Disconnect < Twenty::Command
|
class Twenty::Command::Disconnect < Twenty::Command
|
||||||
set_banner usage: "twenty disconnect [OPTIONS]",
|
set_banner usage: "twenty disconnect [OPTIONS]",
|
||||||
description: "Disconnect a project from twenty"
|
description: "Disconnect a project from twenty"
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Twenty::Command::Down < Twenty::Command
|
class Twenty::Command::Down < Twenty::Command
|
||||||
set_banner usage: "twenty down [OPTIONS]",
|
set_banner usage: "twenty down [OPTIONS]",
|
||||||
description: "Stop the twenty web server"
|
description: "Stop the twenty web server"
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Twenty::Command::Migrate < Twenty::Command
|
class Twenty::Command::Migrate < Twenty::Command
|
||||||
set_banner usage: "twenty migrate [OPTIONS]",
|
set_banner usage: "twenty migrate [OPTIONS]",
|
||||||
description: "Migrate the database"
|
description: "Migrate the database"
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Twenty::Command::PendingMigrationMixin
|
module Twenty::Command::PendingMigrationMixin
|
||||||
def run_command(...)
|
def run_command(...)
|
||||||
if pending_migrations?
|
if pending_migrations?
|
||||||
|
@ -8,6 +10,7 @@ module Twenty::Command::PendingMigrationMixin
|
||||||
super(...)
|
super(...)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def pending_migrations?
|
def pending_migrations?
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Twenty::Command::Up < Twenty::Command
|
class Twenty::Command::Up < Twenty::Command
|
||||||
set_banner usage: "twenty up [OPTIONS]",
|
set_banner usage: "twenty up [OPTIONS]",
|
||||||
description: "Start the twenty web server"
|
description: "Start the twenty web server"
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
def spawn(exec, *argv)
|
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), *argv
|
Process.spawn(File.join(libexec_dir, exec), *)
|
||||||
end
|
end
|
||||||
|
|
||||||
def wait(pid)
|
def wait(pid)
|
||||||
|
|
Loading…
Reference in a new issue