Skip to content

Commit

Permalink
Merge pull request #12 from danger/ci_2
Browse files Browse the repository at this point in the history
Add a travis.yml
  • Loading branch information
orta authored Aug 26, 2017
2 parents 1576e33 + 2e7a27d commit 3043dd7
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 18 deletions.
10 changes: 10 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
language: objective-c
osx_image: xcode9

install:
- node -v
- npm install -g danger

script:
- swift build
- danger process ./.build/debug/danger-swift
8 changes: 1 addition & 7 deletions Dangerfile.swift
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
import Danger

print("Evaluating Dangerfile")

let danger = Danger()

print("Modified:")
for file in danger.git.modifiedFiles {
print(" - " + file)
}

warn("Warning: bad stuff")
fail("Failure: bad stuff happened")
markdown("## Markdown for GitHub")
message("Just verifying this continues to work.")
6 changes: 3 additions & 3 deletions Sources/Danger/Danger.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ struct Violation: Codable {
private final class DangerRunner {
static let shared = DangerRunner()

let dsl: DSL
let dsl: DangerDSL
var results = Results()

private init() {
Expand All @@ -39,7 +39,7 @@ private final class DangerRunner {

do {
let decoder = JSONDecoder()
dsl = try decoder.decode(DSL.self, from: dslJSONContents)
dsl = try decoder.decode(DangerDSL.self, from: dslJSONContents)

} catch let error {
print("Failed to parse JSON:")
Expand All @@ -52,7 +52,7 @@ private final class DangerRunner {
}

public func Danger() -> DangerDSL {
return DangerRunner.shared.dsl.danger
return DangerRunner.shared.dsl
}


Expand Down
6 changes: 1 addition & 5 deletions Sources/Danger/DangerDSL.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ import Foundation
// http://benscheirman.com/2017/06/ultimate-guide-to-json-parsing-with-swift-4/
// http://danger.systems/js/reference.html

struct DSL: Decodable {
let danger: DangerDSL
}

public struct DangerDSL: Decodable {
public let git: Git
public let github: GitHub
Expand Down Expand Up @@ -86,7 +82,7 @@ public struct GitHubPR: Decodable {
public let user: GitHubUser

/// The user who is assigned to the pull request
public let assignee: GitHubUser
public let assignee: GitHubUser?

/// The users who are assigned to the pull request
public let assignees: [GitHubUser]
Expand Down
3 changes: 0 additions & 3 deletions fixtures/eidolon_609.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"danger": {
"git": {
"modified_files": [
".travis.yml",
Expand Down Expand Up @@ -1899,6 +1898,4 @@
},
"utils": {}
}
},
"status": "OK"
}

0 comments on commit 3043dd7

Please sign in to comment.