Skip to content

Commit

Permalink
Merge pull request #91 from KristofferC/kc/06
Browse files Browse the repository at this point in the history
drop 0.5 support
  • Loading branch information
KristofferC authored Oct 25, 2017
2 parents c05346d + 8d7605e commit eed56ac
Show file tree
Hide file tree
Showing 23 changed files with 33 additions and 36 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
language: julia
julia:
- 0.5
- 0.6
- nightly
notifications:
Expand Down
3 changes: 1 addition & 2 deletions REQUIRE
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
julia 0.5
julia 0.6

Compat 0.17
JSON
HttpServer
MbedTLS
Expand Down
2 changes: 0 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
environment:
matrix:
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.5/julia-0.5-latest-win32.exe"
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.5/julia-0.5-latest-win64.exe"
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.6/julia-0.6-latest-win32.exe"
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.6/julia-0.6-latest-win64.exe"
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe"
Expand Down
6 changes: 3 additions & 3 deletions src/activity/events.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# WebhookEvent Type #
#####################

type WebhookEvent
mutable struct WebhookEvent
kind::String
payload::Dict
repository::Repo
Expand Down Expand Up @@ -61,7 +61,7 @@ end
# EventListener #
#################

immutable EventListener
struct EventListener
server::HttpServer.Server
function EventListener(handle; auth::Authorization = AnonymousAuth(),
secret = nothing, events = nothing,
Expand Down Expand Up @@ -138,7 +138,7 @@ const COMMENT_EVENTS = ["commit_comment",
"issues",
"issue_comment"]

immutable CommentListener
struct CommentListener
listener::EventListener
function CommentListener(handle, trigger::Regex;
auth::Authorization = AnonymousAuth(),
Expand Down
2 changes: 1 addition & 1 deletion src/apps/apps.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
type App <: GitHubType
mutable struct App <: GitHubType
id::Nullable{Int}
owner::Nullable{Owner}
name::Nullable{String}
Expand Down
2 changes: 1 addition & 1 deletion src/apps/installations.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
type Installation <: GitHubType
mutable struct Installation <: GitHubType
id::Nullable{Int}
end

Expand Down
2 changes: 1 addition & 1 deletion src/gists/gist.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
type Gist <: GitHubType
mutable struct Gist <: GitHubType
url::Nullable{HttpCommon.URI}
forks_url::Nullable{HttpCommon.URI}
commits_url::Nullable{HttpCommon.URI}
Expand Down
2 changes: 1 addition & 1 deletion src/issues/comments.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Comment Type #
################

type Comment <: GitHubType
mutable struct Comment <: GitHubType
body::Nullable{String}
path::Nullable{String}
diff_hunk::Nullable{String}
Expand Down
2 changes: 1 addition & 1 deletion src/issues/issues.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Issue type #
##############

type Issue <: GitHubType
mutable struct Issue <: GitHubType
id::Nullable{Int}
number::Nullable{Int}
comments::Nullable{Int}
Expand Down
2 changes: 1 addition & 1 deletion src/issues/pull_requests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# PullRequest Type #
####################

type PullRequest <: GitHubType
mutable struct PullRequest <: GitHubType
base::Nullable{Branch}
head::Nullable{Branch}
number::Nullable{Int}
Expand Down
2 changes: 1 addition & 1 deletion src/issues/reviews.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
type Review <: GitHubType
mutable struct Review <: GitHubType
pr::Nullable{PullRequest}
id::Nullable{Int}
user::Nullable{Owner}
Expand Down
2 changes: 1 addition & 1 deletion src/owners/owners.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Owner Type #
##############

type Owner <: GitHubType
mutable struct Owner <: GitHubType
typ::Nullable{String}
email::Nullable{String}
name::Nullable{String}
Expand Down
2 changes: 1 addition & 1 deletion src/owners/teams.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
type Team <: GitHubType
mutable struct Team <: GitHubType
name::Nullable{String}
description::Nullable{String}
privacy::Nullable{String}
Expand Down
2 changes: 1 addition & 1 deletion src/repositories/branches.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Branch Type #
###############

type Branch <: GitHubType
mutable struct Branch <: GitHubType
name::Nullable{String}
label::Nullable{String}
ref::Nullable{String}
Expand Down
2 changes: 1 addition & 1 deletion src/repositories/commits.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Commit Type #
###############

type Commit <: GitHubType
mutable struct Commit <: GitHubType
sha::Nullable{String}
message::Nullable{String}
author::Nullable{Owner}
Expand Down
2 changes: 1 addition & 1 deletion src/repositories/contents.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Content Type #
################

type Content <: GitHubType
mutable struct Content <: GitHubType
typ::Nullable{String}
filename::Nullable{String}
name::Nullable{String}
Expand Down
2 changes: 1 addition & 1 deletion src/repositories/repositories.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Repo Type #
#############

type Repo <: GitHubType
mutable struct Repo <: GitHubType
name::Nullable{String}
full_name::Nullable{String}
description::Nullable{String}
Expand Down
2 changes: 1 addition & 1 deletion src/repositories/statuses.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Status type #
###############

type Status <: GitHubType
mutable struct Status <: GitHubType
id::Nullable{Int}
total_count::Nullable{Int}
state::Nullable{String}
Expand Down
2 changes: 1 addition & 1 deletion src/repositories/webhooks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Webhook type #
################

type Webhook <: GitHubType
mutable struct Webhook <: GitHubType
id::Nullable{Int}
url::Nullable{HttpCommon.URI}
test_url::Nullable{HttpCommon.URI}
Expand Down
14 changes: 7 additions & 7 deletions src/utils/GitHubType.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function Base.:(==)(a::GitHubType, b::GitHubType)
return false
end

for field in fieldnames(a)
for field in fieldnames(typeof(a))
aval, bval = getfield(a, field), getfield(b, field)
if isnull(aval) == isnull(bval)
if !(isnull(aval)) && get(aval) != get(bval)
Expand All @@ -46,7 +46,7 @@ name(g::GitHubType) = get(namefield(g))
# Converting JSON Dicts to GitHubTypes #
########################################

function extract_nullable{T}(data::Dict, key, ::Type{T})
function extract_nullable(data::Dict, key, ::Type{T}) where {T}
if haskey(data, key)
val = data[key]
if !(isa(val, Void))
Expand All @@ -61,7 +61,7 @@ function extract_nullable{T}(data::Dict, key, ::Type{T})
return Nullable{T}()
end

prune_github_value{T}(val, ::Type{T}) = T(val)
prune_github_value(val, ::Type{T}) where {T} = T(val)
prune_github_value(val::AbstractString, ::Type{Dates.DateTime}) = Dates.DateTime(chopz(val))

# ISO 8601 allows for a trailing 'Z' to indicate that the given time is UTC.
Expand All @@ -79,7 +79,7 @@ end
# dictionary into the type `G` with the expectation that the fieldnames of
# `G` are keys of `data`, and the corresponding values can be converted to the
# given field types.
@generated function json2github{G<:GitHubType}(::Type{G}, data::Dict)
@generated function json2github(::Type{G}, data::Dict) where {G<:GitHubType}
types = G.types
fields = fieldnames(G)
args = Vector{Expr}(length(fields))
Expand All @@ -102,7 +102,7 @@ github2json(v::Vector) = [github2json(i) for i in v]

function github2json(g::GitHubType)
results = Dict()
for field in fieldnames(g)
for field in fieldnames(typeof(g))
val = getfield(g, field)
if !(isnull(val))
key = field == :typ ? "type" : string(field)
Expand All @@ -112,7 +112,7 @@ function github2json(g::GitHubType)
return results
end

function github2json{K}(data::Dict{K})
function github2json(data::Dict{K}) where {K}
results = Dict{K,Any}()
for (key, val) in data
results[key] = github2json(val)
Expand All @@ -126,7 +126,7 @@ end

function Base.show(io::IO, g::GitHubType)
print(io, "$(typeof(g)) (all fields are Nullable):")
for field in fieldnames(g)
for field in fieldnames(typeof(g))
val = getfield(g, field)
if !(isnull(val))
gotval = get(val)
Expand Down
8 changes: 4 additions & 4 deletions src/utils/auth.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
# Authorization Types #
#######################

@compat abstract type Authorization end
abstract type Authorization end

immutable OAuth2 <: Authorization
struct OAuth2 <: Authorization
token::String
end

immutable AnonymousAuth <: Authorization end
struct AnonymousAuth <: Authorization end

immutable JWTAuth <: Authorization
struct JWTAuth <: Authorization
JWT::String
end

Expand Down
4 changes: 2 additions & 2 deletions src/utils/requests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
Represents the API to interact with, either an actual GitHub instance,
or a mock API for testing purposes
"""
@compat abstract type GitHubAPI end
abstract type GitHubAPI end

immutable GitHubWebAPI <: GitHubAPI
struct GitHubWebAPI <: GitHubAPI
endpoint::HttpCommon.URI
end

Expand Down
1 change: 1 addition & 0 deletions test/ghtype_tests.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import JSON
using GitHub, GitHub.name, GitHub.Branch
import HttpCommon
using Base.Test

# This file tests various GitHubType constructors. To test for proper Nullable
Expand Down

0 comments on commit eed56ac

Please sign in to comment.