Feat: Update fourier to use system tuist whenever possible (#3950)

This commit is contained in:
Luis Padron 2022-01-06 03:10:27 -05:00 committed by GitHub
parent d9c0d31598
commit 722206ebac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 22 additions and 21 deletions

View File

@ -1,4 +1,3 @@
#!/bin/bash
./fourier lint swift
./fourier lint ruby
./fourier lint all

View File

@ -46,9 +46,9 @@ module Fourier
desc "encrypt", "Encrypt content in the repository"
subcommand "encrypt", Commands::Encrypt
desc "focus TARGET", "Generate Tuist's project focusing on the target TARGET"
def focus(target = nil)
Services::Focus.call(target: target)
desc "focus TARGETS", "Generate Tuist's project focusing on the target TARGET"
def focus(*targets)
Services::Focus.call(targets: targets)
end
desc "tuist", "Runs Tuist"

View File

@ -8,7 +8,6 @@ module Fourier
def call
dependencies = ["dependencies", "fetch"]
Utilities::System.tuist(*dependencies)
Utilities::System.tuist("build", "--generate")
end
end

View File

@ -3,10 +3,10 @@
module Fourier
module Services
class Focus < Base
attr_reader :target
attr_reader :targets
def initialize(target:)
@target = target
def initialize(targets:)
@targets = targets
end
def call
@ -16,8 +16,7 @@ module Fourier
cache_warm = ["cache", "warm", "--dependencies-only"]
Utilities::System.tuist(*cache_warm)
focus = ["focus"]
focus << "#{target}" if target != nil
focus = ["focus"] + targets
Utilities::System.tuist(*focus)
end
end

View File

@ -8,7 +8,6 @@ module Fourier
def call
dependencies = ["dependencies", "fetch"]
Utilities::System.tuist(*dependencies)
Utilities::System.tuist("test")
Dir.chdir(Constants::TUIST_DIRECTORY) do
Utilities::System.system("swift", "test")

View File

@ -12,7 +12,7 @@ module Fourier
def call
Utilities::SwiftPackageManager.build_product("ProjectAutomation")
Utilities::SwiftPackageManager.build_product("ProjectDescription")
Utilities::System.tuist(*arguments)
Utilities::System.tuist(*arguments, from_source: true)
end
end
end

View File

@ -9,12 +9,17 @@ module Fourier
Kernel.system(*args) || exit(1)
end
def self.tuist(*args)
Dir.chdir(Constants::TUIST_DIRECTORY) do
self.system("swift", "build")
@tuist = ".build/debug/tuist"
self.system(@tuist, *args)
def self.tuist(*args, **kwargs)
@tuist = "/usr/local/bin/tuist"
if kwargs[:from_source] || !File.exist?(@tuist)
Dir.chdir(Constants::TUIST_DIRECTORY) do
self.system("swift", "build")
@tuist = ".build/debug/tuist"
end
end
self.system(@tuist, *args)
end
def self.fixturegen(*args)

View File

@ -13,13 +13,13 @@ module Fourier
Utilities::System
.expects(:tuist)
.with("dependencies", "fetch")
target = "TuistSupport"
targets = ["TuistSupport", "TuistSupportTests"]
Utilities::System
.expects(:tuist)
.with("focus", target)
.with("focus", *targets)
# Then
Services::Focus.call(target: target)
Services::Focus.call(targets: targets)
end
end
end