{"id":13684460,"url":"https://github.com/el-hoshino/DangerSwiftHammer","last_synced_at":"2025-04-30T21:30:36.475Z","repository":{"id":46056816,"uuid":"278798834","full_name":"el-hoshino/DangerSwiftHammer","owner":"el-hoshino","description":"\"Everything can be fixed with a hammer.\" - Jeremy Clarkson","archived":false,"fork":false,"pushed_at":"2021-11-17T07:07:06.000Z","size":38,"stargazers_count":4,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-08T21:17:20.485Z","etag":null,"topics":["danger","danger-plugin","danger-swift"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/el-hoshino.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-07-11T05:57:48.000Z","updated_at":"2022-09-16T09:34:54.000Z","dependencies_parsed_at":"2022-08-24T14:37:27.910Z","dependency_job_id":null,"html_url":"https://github.com/el-hoshino/DangerSwiftHammer","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/el-hoshino%2FDangerSwiftHammer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/el-hoshino%2FDangerSwiftHammer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/el-hoshino%2FDangerSwiftHammer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/el-hoshino%2FDangerSwiftHammer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/el-hoshino","download_url":"https://codeload.github.com/el-hoshino/DangerSwiftHammer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224224788,"owners_count":17276428,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["danger","danger-plugin","danger-swift"],"created_at":"2024-08-02T14:00:33.814Z","updated_at":"2024-11-12T05:32:14.046Z","avatar_url":"https://github.com/el-hoshino.png","language":"Swift","funding_links":[],"categories":["Plugins"],"sub_categories":["Swift (danger-swift)"],"readme":"# DangerSwiftHammer\n\nHandy properties and methods for Danger-Swift!\n\n*Currently this package only have 2 methods, one to get patch text for a file, and one to get additions and deletions lines for a file.\n\n## Install DangerSwiftHammer\n\n### Marathon\n\n- Add this to your `Dangerfile.swift`\n\n```swift\nimport DangerSwiftHammer // package: https://github.com/el-hoshino/DangerSwiftHammer.git\n```\n\n- Run `danger-swift edit` from project directory and it should resolve the dependencies automatically.\n\n- (Recommended) Cache the `~/.danger-swift` folder\n\n## Usage\n\n```swift\nlet danger = Danger()\ndanger.hammer.//...\n```\n\n### Get patch text for file\n\n```swift\nlet danger = Danger()\n//...\n\nlet file = pathToFile\nlet patch = danger.hammer.diffPatch(for: file)\n/*\n index 4888aaa..4c293b9 100644\n --- a/Package.swift\n +++ b/Package.swift\n @@ -1,4 +1,4 @@\n -// swift-tools-version:5.2\n +// swift-tools-version:5.1\n  // The swift-tools-version declares the minimum version of Swift required to build this package.\n  \n  import PackageDescription\n @@ -14,13 +14,14 @@ let package = Package(\n      dependencies: [\n          // Dependencies declare other packages that this package depends on.\n          // .package(url: /* package url */, from: \"1.0.0\"),\n +        .package(url: \"https://github.com/danger/swift.git\", from: \"3.0.0\"),\n      ],\n      targets: [\n          // Targets are the basic building blocks of a package. A target can define a module or a test suite.\n          // Targets can depend on other targets in this package, and on products in packages which this package depends on.\n          .target(\n              name: \"DangerSwiftHammer\",\n -            dependencies: []),\n +            dependencies: [\"Danger\"]),\n          .testTarget(\n              name: \"DangerSwiftHammerTests\",\n              dependencies: [\"DangerSwiftHammer\"]),\n */\n// Do something with your patch\n```\n\n### Get additions and deletions lines for file\n\n```swift\nlet danger = Danger()\n//...\n\nlet file = pathToFile\nlet lines = danger.hammer.diffLines(in: file)\nlet additions = lines.additions\n/*\n [\n     #\"-// swift-tools-version:5.2\"#,\n     #\"-            dependencies: []),\"#,\n ],\n */\nlet deletions = lines.deletions\n/*\n [\n     #\"+// swift-tools-version:5.1\"#,\n     #\"+        .package(url: \"https://github.com/danger/swift.git\", from: \"3.0.0\"),\"#,\n     #\"+            dependencies: [\"Danger\"]),\"#,\n ]\n */\n// Do something with your additions and deletions\n```\n\n## Having suggestions?\n\n[Open an issue!](https://github.com/el-hoshino/DangerSwiftHammer/issues/new)\n\n## Why is this package called \"DangerSwiftHammer\"?\n\n\"Everything can be fixed with a hammer.\" - Jeremy Clarkson\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fel-hoshino%2FDangerSwiftHammer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fel-hoshino%2FDangerSwiftHammer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fel-hoshino%2FDangerSwiftHammer/lists"}