-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 5dbf44e
Showing
11 changed files
with
499 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.DS_Store | ||
.build | ||
.swiftpm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
disabled_rules: | ||
- let_var_whitespace | ||
- conditional_returns_on_newline | ||
- todo | ||
- reduce_boolean | ||
|
||
opt_in_rules: | ||
- identifier_name | ||
- attributes | ||
- force_unwrapping | ||
- sorted_imports | ||
- block_based_kvo | ||
- class_delegate_protocol | ||
- closing_brace | ||
- closure_parameter_position | ||
- colon | ||
- comma | ||
- compiler_protocol_init | ||
- control_statement | ||
- custom_rules | ||
- cyclomatic_complexity | ||
- deployment_target | ||
- discarded_notification_center_observer | ||
- discouraged_direct_init | ||
- duplicate_enum_cases | ||
- duplicate_imports | ||
- dynamic_inline | ||
- empty_enum_arguments | ||
- empty_parameters | ||
- empty_parentheses_with_trailing_closure | ||
- file_length | ||
- for_where | ||
- force_cast | ||
- force_try | ||
- function_body_length | ||
- function_parameter_count | ||
- generic_type_name | ||
- implicit_getter | ||
- inert_defer | ||
- is_disjoint | ||
- large_tuple | ||
- leading_whitespace | ||
- legacy_cggeometry_functions | ||
- legacy_constant | ||
- legacy_constructor | ||
- legacy_hashing | ||
- legacy_nsgeometry_functions | ||
- line_length | ||
- mark | ||
- multiple_closures_with_trailing_closure | ||
- nesting | ||
- no_fallthrough_only | ||
- no_space_in_method_call | ||
- notification_center_detachment | ||
- nsobject_prefer_isequal | ||
- opening_brace | ||
- operator_whitespace | ||
- orphaned_doc_comment | ||
- private_over_fileprivate | ||
- private_unit_test | ||
- protocol_property_accessors_order | ||
- redundant_discardable_let | ||
- redundant_objc_attribute | ||
- redundant_optional_initialization | ||
- redundant_set_access_control | ||
- redundant_string_enum_value | ||
- redundant_void_return | ||
- return_arrow_whitespace | ||
- shorthand_operator | ||
- statement_position | ||
- superfluous_disable_command | ||
- switch_case_alignment | ||
- syntactic_sugar | ||
- trailing_comma | ||
- trailing_newline | ||
- trailing_semicolon | ||
- trailing_whitespace | ||
- type_body_length | ||
- type_name | ||
- unneeded_break_in_switch | ||
- unused_capture_list | ||
- unused_closure_parameter | ||
- unused_control_flow_label | ||
- unused_enumerated | ||
- unused_optional_binding | ||
- unused_setter_value | ||
- valid_ibinspectable | ||
- vertical_parameter_alignment | ||
- vertical_whitespace | ||
- void_return | ||
- weak_delegate | ||
- xctfail_message | ||
- explicit_init | ||
|
||
included: | ||
- Sources | ||
|
||
large_tuple: | ||
warning: 3 | ||
|
||
nesting: | ||
type_level: 2 | ||
|
||
identifier_name: | ||
min_length: 1 | ||
|
||
vertical_whitespace: | ||
max_empty_lines: 1 | ||
|
||
line_length: 120 | ||
function_parameter_count: 5 | ||
|
||
type_name: | ||
max_length: 42 # Increase for testspec | ||
|
||
mark: | ||
severity: error | ||
|
||
cyclomatic_complexity: 12 | ||
|
||
reporter: "xcode" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.PHONY: debug | ||
debug: | ||
@swiftlint --strict --quiet | ||
@swift build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
{ | ||
"object": { | ||
"pins": [ | ||
{ | ||
"package": "AEXML", | ||
"repositoryURL": "https://github.com/tadija/AEXML.git", | ||
"state": { | ||
"branch": null, | ||
"revision": "38f7d00b23ecd891e1ee656fa6aeebd6ba04ecc3", | ||
"version": "4.6.1" | ||
} | ||
}, | ||
{ | ||
"package": "Files", | ||
"repositoryURL": "https://github.com/JohnSundell/Files", | ||
"state": { | ||
"branch": null, | ||
"revision": "d273b5b7025d386feef79ef6bad7de762e106eaf", | ||
"version": "4.2.0" | ||
} | ||
}, | ||
{ | ||
"package": "PathKit", | ||
"repositoryURL": "https://github.com/kylef/PathKit.git", | ||
"state": { | ||
"branch": null, | ||
"revision": "3bfd2737b700b9a36565a8c94f4ad2b050a5e574", | ||
"version": "1.0.1" | ||
} | ||
}, | ||
{ | ||
"package": "Rainbow", | ||
"repositoryURL": "https://github.com/onevcat/Rainbow", | ||
"state": { | ||
"branch": null, | ||
"revision": "e0dada9cd44e3fa7ec3b867e49a8ddbf543e3df3", | ||
"version": "4.0.1" | ||
} | ||
}, | ||
{ | ||
"package": "Spectre", | ||
"repositoryURL": "https://github.com/kylef/Spectre.git", | ||
"state": { | ||
"branch": null, | ||
"revision": "26cc5e9ae0947092c7139ef7ba612e34646086c7", | ||
"version": "0.10.1" | ||
} | ||
}, | ||
{ | ||
"package": "swift-argument-parser", | ||
"repositoryURL": "https://github.com/apple/swift-argument-parser", | ||
"state": { | ||
"branch": null, | ||
"revision": "e394bf350e38cb100b6bc4172834770ede1b7232", | ||
"version": "1.0.3" | ||
} | ||
}, | ||
{ | ||
"package": "XcodeProj", | ||
"repositoryURL": "https://github.com/tuist/xcodeproj", | ||
"state": { | ||
"branch": null, | ||
"revision": "c75c3acc25460195cfd203a04dde165395bf00e0", | ||
"version": "8.7.1" | ||
} | ||
} | ||
] | ||
}, | ||
"version": 1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// swift-tools-version:5.3 | ||
// The swift-tools-version declares the minimum version of Swift required to build this package. | ||
|
||
import PackageDescription | ||
|
||
let package = Package( | ||
name: "Bee", | ||
platforms: [.macOS(.v11)], | ||
products: [ | ||
.executable(name: "bee", targets: ["Bee"]) | ||
], | ||
dependencies: [ | ||
.package(url: "https://github.com/apple/swift-argument-parser", from: "1.0.1"), | ||
.package(url: "https://github.com/onevcat/Rainbow", from: "4.0.1"), | ||
.package(url: "https://github.com/JohnSundell/Files", from: "4.2.0"), | ||
.package(name: "XcodeProj", url: "https://github.com/tuist/xcodeproj", from: "8.5.0") | ||
], | ||
targets: [ | ||
.target(name: "Bee", dependencies: [ | ||
.product(name: "ArgumentParser", package: "swift-argument-parser"), | ||
"Rainbow", | ||
"Files", | ||
"XcodeProj" | ||
]) | ||
] | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# 🐝 Bee | ||
|
||
<a href="https://www.apple.com/ru/swift/"><img src="https://img.shields.io/badge/Swift-red?logo=swift&logoColor=white" /></a> | ||
<a href="https://github.com/yonaskolb/Mint"><img src="https://img.shields.io/badge/Mint-darkgreen?logo=leaflet&logoColor=white" /></a> | ||
<a href="https://twitter.com/swiftyfinch"><img src="https://img.shields.io/badge/@swiftyfinch-blue?logo=twitter&logoColor=white" /></a> | ||
<br> | ||
Draw Xcode targets and dependencies tree. | ||
|
||
<img width="350" src="https://user-images.githubusercontent.com/64660122/153039580-ba67f318-928c-4398-b522-a37a24f50017.png"> | ||
|
||
``` | ||
OVERVIEW: 🐝 Bee | ||
USAGE: bee [--path <path>] [--root <root>] [--contains <contains> ...] [--exclude <exclude> ...] [--depth <depth>] | ||
OPTIONS: | ||
-p, --path <path> Project path. | ||
-r, --root <root> Select tree root. | ||
-c, --contains <contains> Sequence of searching words. | ||
-e, --exclude <exclude> Sequence of words for exclude. | ||
-d, --depth <depth> Tree depth. | ||
--version Show the version. | ||
-h, --help Show help information. | ||
``` | ||
|
||
## Quick start with <a href="https://github.com/yonaskolb/Mint">Mint</a> 🌱 | ||
|
||
```bash | ||
brew install mint | ||
mint install swiftyfinch/bee | ||
|
||
# Now on Mint 0.17.0 you'll need to add ~/.mint/bin to your $PATH | ||
# For example, add this to your ~/.zshrc file and relaunch terminal | ||
export PATH=$HOME/.mint/bin:$PATH | ||
``` | ||
Watch 🎬 [installation demo](https://github.com/swiftyfinch/Rugby/discussions/71)<br> | ||
It's from my another project, but the idea is the pretty same. | ||
|
||
### Author | ||
|
||
Vyacheslav Khorkov\ | ||
Twitter: [@SwiftyFinch](https://twitter.com/swiftyfinch)\ | ||
Blog: [swiftyfinch.github.io](https://swiftyfinch.github.io/en)\ | ||
Feel free to contact me 📮 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// | ||
// Graph.swift | ||
// Bee | ||
// | ||
// Created by Vyacheslav Khorkov on 07.02.2022. | ||
// Copyright © 2022 Vyacheslav Khorkov. All rights reserved. | ||
// | ||
|
||
import Rainbow | ||
|
||
final class Graph { | ||
private let content: [String: [String]] | ||
private let keys: [String] | ||
private let arrowsColor: UInt32 | ||
private let colors: [UInt32] | ||
private let inMiddle: String | ||
private let leaf: String | ||
private let pipe: String | ||
|
||
init(content: [String: [String]]) { | ||
self.content = content | ||
self.keys = content.keys.sorted { $0.localizedCompare($1) == .orderedAscending } | ||
self.arrowsColor = 0xA3A300 | ||
self.colors = [0xA3A300, 0x964B00] | ||
self.pipe = "┃" | ||
self.inMiddle = "┣━" | ||
self.leaf = "┗━" | ||
} | ||
|
||
func draw(name: String?, | ||
depth: Int = 0, | ||
last: Bool = false, | ||
maxDepth: Int? = nil, | ||
prefix: String = "") { | ||
if let maxDepth = maxDepth, depth >= maxDepth + 1 { return } | ||
|
||
let dependencies: [String] | ||
if let name = name { | ||
dependencies = content[name] ?? [] | ||
} else { | ||
dependencies = Array(keys) | ||
} | ||
|
||
let label = name ?? "." | ||
let arrow = (depth == 0) ? "" : (last ? "\(leaf) " : "\(inMiddle) ") | ||
let color = colors[depth % colors.count] | ||
let output = "\(label) (\(dependencies.count))".hex(depth == 0 ? arrowsColor : color) | ||
print((prefix + arrow).hex(arrowsColor) + output) | ||
|
||
for (index, dependency) in dependencies.enumerated() { | ||
var prefix = prefix | ||
if depth > 0 { prefix += last ? " " : "\(pipe) " } | ||
draw(name: dependency, | ||
depth: depth + 1, | ||
last: index + 1 == dependencies.count, | ||
maxDepth: maxDepth, | ||
prefix: prefix) | ||
} | ||
} | ||
} |
Oops, something went wrong.