Skip to content

Commit

Permalink
Merge pull request #144 from tkelman/nopkgdir
Browse files Browse the repository at this point in the history
Use dirname(@__FILE__) instead of Pkg.dir
  • Loading branch information
randyzwitch authored Jul 31, 2016
2 parents 6e0dae2 + 564ae0c commit 6a93e48
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 13 deletions.
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ os:
notifications:
email: false
julia:
- release
- 0.4
- 0.5
- nightly
before_install:
- if [[ -a .git/shallow ]]; then git fetch --unshallow; fi
script:
- julia -e 'Pkg.init(); Pkg.add("RDatasets"); Pkg.clone(pwd()); Pkg.test("Vega")'
- julia -e 'Pkg.init(); Pkg.clone(pwd()); Pkg.test("Vega")'
1 change: 1 addition & 0 deletions REQUIRE
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ ColorBrewer
KernelDensity
NoveltyColors
Patchwork
Compat
4 changes: 3 additions & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ environment:
matrix:
#- JULIAVERSION: "julialang/bin/winnt/x86/0.4/julia-0.4-latest-win32.exe"
- JULIAVERSION: "julialang/bin/winnt/x64/0.4/julia-0.4-latest-win64.exe"
#- JULIAVERSION: "julialang/bin/winnt/x86/0.5/julia-0.5-latest-win32.exe"
- JULIAVERSION: "julialang/bin/winnt/x64/0.5/julia-0.5-latest-win64.exe"
#- JULIAVERSION: "julianightlies/bin/winnt/x86/julia-latest-win32.exe"
- JULIAVERSION: "julianightlies/bin/winnt/x64/julia-latest-win64.exe"

Expand Down Expand Up @@ -31,4 +33,4 @@ build_script:
Pkg.clone(pwd(), \"Vega\"); Pkg.build(\"Vega\")"

test_script:
- C:\projects\julia\bin\julia --check-bounds=yes -e "Pkg.add(\"RDatasets\");Pkg.test(\"Vega\")"
- C:\projects\julia\bin\julia --check-bounds=yes -e "Pkg.test(\"Vega\")"
2 changes: 1 addition & 1 deletion src/blink_integration.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ using Blink

function blink_show(v::VegaVisualization)
w = Window()
path(url...) = Pkg.dir("Vega", "assets", "bower_components", url...)
path(url...) = joinpath(dirname(@__FILE__), "..", "assets", "bower_components", url...)
d3 = path("d3","d3.min.js")
topojson = path("topojson","topojson.js")
cloudlayout = path("d3-cloud", "build", "d3.layout.cloud.js")
Expand Down
2 changes: 1 addition & 1 deletion src/render.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ end
#Jupyter Notebook display
import Base.writemime

asset(url...) = readall(Pkg.dir("Vega", "assets", "bower_components", url...))
asset(url...) = readall(joinpath(dirname(@__FILE__), "..", "assets", "bower_components", url...))

function writemime(io::IO, ::MIME"text/html", v::VegaVisualization)
divid = "vg" * randstring(3)
Expand Down
1 change: 1 addition & 0 deletions test/REQUIRE
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ ColorBrewer
Compat
KernelDensity
RDatasets
Distributions
16 changes: 8 additions & 8 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#using PyCall
#@pyimport jsonschema
using JSON, Vega, Base.Test, KernelDensity, Distributions, RDatasets
vegaschema = JSON.parse(readall(Pkg.dir("Vega", "assets/bower_components/vega/vega-schema.json")))
vegaschema = JSON.parse(readall(joinpath(dirname(@__FILE__), "..", "assets/bower_components/vega/vega-schema.json")))

#### Tests ####
#Test that Julia returned VegaVisulization (every public function does)
Expand Down Expand Up @@ -123,7 +123,7 @@ a = bubblechart(x = x, y = y, group = cont, pointSize = z)

#13. Choropleth Counties
println("Test 13")
df = readtable(Pkg.dir("Vega", "vega-datasets/unemployment.tsv"))
df = readtable(joinpath(dirname(@__FILE__), "..", "vega-datasets/unemployment.tsv"))
a = choropleth(x = df[:id], y = df[:rate])

@test typeof(a) == VegaVisualization
Expand Down Expand Up @@ -243,7 +243,7 @@ a = piechart(x = fruit, y = bushels, holesize = 175);
#25. Population Chart
println("Test 25")
df = DataFrame()
for p in JSON.parse(readall(Pkg.dir("Vega", "vega-datasets/population.json")))
for p in JSON.parse(readall(joinpath(dirname(@__FILE__), "..", "vega-datasets/population.json")))
df = vcat(df, DataFrame(;[symbol(k)=>v for (k,v) in p]...))
end
pop1900 = df[df[:year] .== 1900, :];
Expand Down Expand Up @@ -295,7 +295,7 @@ a = stemleaf(y = data);

#29. Stream Plot
println("Test 29")
df = readtable(Pkg.dir("Vega", "vega-datasets/streamdata.csv"))
df = readtable(joinpath(dirname(@__FILE__), "..", "vega-datasets/streamdata.csv"))
a = streamplot(x = df[:date], y = df[:value], group = df[:key]);

@test typeof(a) == VegaVisualization
Expand Down Expand Up @@ -363,7 +363,7 @@ colorscheme!(a, palette = "Violet");
#36. colorscheme!
println("Test 36")
df = DataFrame()
for p in JSON.parse(readall(Pkg.dir("Vega", "vega-datasets/population.json")))
for p in JSON.parse(readall(joinpath(dirname(@__FILE__), "..", "vega-datasets/population.json")))
df = vcat(df, DataFrame(;[symbol(k)=>v for (k,v) in p]...))
end
pop1900 = df[df[:year] .== 1900, :];
Expand Down Expand Up @@ -452,7 +452,7 @@ text!(a, title = "Safe Fat Intake 65g/day", x = 150, y = 10)
#43 title!
println("Test 43")
df = DataFrame()
for p in JSON.parse(readall(Pkg.dir("Vega", "vega-datasets/population.json")))
for p in JSON.parse(readall(joinpath(dirname(@__FILE__), "..", "vega-datasets/population.json")))
df = vcat(df, DataFrame(;[symbol(k)=>v for (k,v) in p]...))
end
pop1900 = df[df[:year] .== 1900, :];
Expand Down Expand Up @@ -503,7 +503,7 @@ a.background = "green"
#47 dotplot
println("Test 47")
df = DataFrame()
for p in JSON.parse(readall(Pkg.dir("Vega", "vega-datasets/movies.json")))
for p in JSON.parse(readall(joinpath(dirname(@__FILE__), "..", "vega-datasets/movies.json")))
df = vcat(df, DataFrame(;[symbol(k)=>v for (k,v) in p]...))
end

Expand All @@ -518,7 +518,7 @@ xlab!(a, title = "Avg. U.S. Gross Movie Receipts", format = ".3s")
#48 dotplot
println("Test 48")
df = DataFrame()
for p in JSON.parse(readall(Pkg.dir("Vega", "vega-datasets/movies.json")))
for p in JSON.parse(readall(joinpath(dirname(@__FILE__), "..", "vega-datasets/movies.json")))
df = vcat(df, DataFrame(;[symbol(k)=>v for (k,v) in p]...))
end

Expand Down

0 comments on commit 6a93e48

Please sign in to comment.