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
|
||||
require "json"
|
||||
require "twenty-backend"
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "cmd"
|
||||
|
||||
class Twenty::Command < Cmd
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class Twenty::Command::Connect < Twenty::Command
|
||||
set_banner usage: "twenty connect [OPTIONS]",
|
||||
description: "Connect a project to twenty"
|
||||
|
@ -13,7 +15,7 @@ class Twenty::Command::Connect < Twenty::Command
|
|||
def run_command(options)
|
||||
Twenty::Project.new(
|
||||
name: File.basename(Dir.getwd),
|
||||
path: Dir.getwd,
|
||||
path: Dir.getwd
|
||||
).save!
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class Twenty::Command::Console < Twenty::Command
|
||||
set_banner usage: "twenty console [OPTIONS]",
|
||||
description: "Start the twenty developer console"
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class Twenty::Command::Disconnect < Twenty::Command
|
||||
set_banner usage: "twenty disconnect [OPTIONS]",
|
||||
description: "Disconnect a project from twenty"
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class Twenty::Command::Down < Twenty::Command
|
||||
set_banner usage: "twenty down [OPTIONS]",
|
||||
description: "Stop the twenty web server"
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class Twenty::Command::Migrate < Twenty::Command
|
||||
set_banner usage: "twenty migrate [OPTIONS]",
|
||||
description: "Migrate the database"
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Twenty::Command::PendingMigrationMixin
|
||||
def run_command(...)
|
||||
if pending_migrations?
|
||||
|
@ -8,6 +10,7 @@ module Twenty::Command::PendingMigrationMixin
|
|||
super(...)
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def pending_migrations?
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class Twenty::Command::Up < Twenty::Command
|
||||
set_banner usage: "twenty up [OPTIONS]",
|
||||
description: "Start the twenty web server"
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
def spawn(exec, *argv)
|
||||
def spawn(exec, *)
|
||||
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
|
||||
|
||||
def wait(pid)
|
||||
|
|
Loading…
Reference in a new issue