diff --git a/.travis.yml b/.travis.yml index 685fcfe..5009c82 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,6 @@ os: - linux # - osx julia: - - 0.6 - 0.7 - '1.0' - 1.1 @@ -14,36 +13,5 @@ notifications: git: depth: 99999999 -## uncomment the following lines to allow failures on nightly julia -## (tests will run but not make your overall status red) -#matrix: -# allow_failures: -# - julia: nightly - -## uncomment and modify the following lines to manually install system packages -#addons: -# apt: # apt-get for linux -# packages: -# - gfortran -#before_script: # homebrew for mac -# - if [ $TRAVIS_OS_NAME = osx ]; then brew install gcc; fi - -install: - - ci/install.jl - -script: - # Ignore "Warning: `using A: B`" from julia 0.7: - - if [ "$TRAVIS_JULIA_VERSION" = "0.7" ]; - then - depwarn=yes; - else - depwarn=error; - fi - - echo "$depwarn" - - ci/test.jl --depwarn="$depwarn" - -after_success: - # push coverage results to Coveralls - - julia --color=yes -e 'cd(Pkg.dir("InteractiveCodeSearch")); Pkg.add("Coverage"); using Coverage; Coveralls.submit(Coveralls.process_folder())' - # push coverage results to Codecov - - julia --color=yes -e 'cd(Pkg.dir("InteractiveCodeSearch")); Pkg.add("Coverage"); using Coverage; Codecov.submit(Codecov.process_folder())' +coveralls: true +codecov: true diff --git a/ci/install.jl b/ci/install.jl deleted file mode 100755 index 7bf7946..0000000 --- a/ci/install.jl +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash -# -*- mode: julia -*- -#= -JULIA="${JULIA:-julia --color=yes --startup-file=no}" -exec ${JULIA} "$@" "${BASH_SOURCE[0]}" -=# - -JL_PKG = "InteractiveCodeSearch" -VERSION >= v"0.7.0-DEV.5183" && using Pkg - -if isfile("Project.toml") || isfile("JuliaProject.toml") - if VERSION < v"0.7.0-DEV.5183" - Pkg.clone(pwd()) - Pkg.build(JL_PKG) - elseif VERSION >= v"1.1.0-rc1" - Pkg.build(verbose=true) - else - Pkg.build() - end -else - Pkg.clone(pwd()) - if VERSION >= v"1.1.0-rc1" - Pkg.build(JL_PKG; verbose=true) - else - Pkg.build(JL_PKG) - end -end - -# https://github.com/travis-ci/travis-build/blob/master/lib/travis/build/script/julia.rb diff --git a/ci/test.jl b/ci/test.jl deleted file mode 100755 index fe8387d..0000000 --- a/ci/test.jl +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -# -*- mode: julia -*- -#= -JULIA="${JULIA:-julia --color=yes --startup-file=no}" -exec ${JULIA} "$@" "${BASH_SOURCE[0]}" -=# - -JL_PKG = "InteractiveCodeSearch" -VERSION >= v"0.7.0-DEV.5183" && using Pkg -Pkg.test(JL_PKG; coverage=true) diff --git a/src/InteractiveCodeSearch.jl b/src/InteractiveCodeSearch.jl index d01aa75..72fc063 100644 --- a/src/InteractiveCodeSearch.jl +++ b/src/InteractiveCodeSearch.jl @@ -1,5 +1,3 @@ -__precompile__() - """ # InteractiveCodeSearch.jl --- Interactively search Julia code @@ -44,44 +42,17 @@ using InteractiveCodeSearch module InteractiveCodeSearch export @search, @searchmethods +import Pkg using Base +using Base: IOError +using InteractiveUtils: edit, gen_call_with_extracted_types, methodswith -@static if VERSION < v"0.7-" - const IOError = Base.UVError - const Nothing = Void - const findall = find - const occursin = ismatch - const _readandwrite = readandwrite - const fetch = wait - names(x; all=false) = Base.names(x, all) - methodswith(args...; supertypes=false) = - Base.methodswith(args..., supertypes) - macro info(x) - :(info($(esc(x)))) - end - macro warn(x) - :(warn($(esc(x)))) - end - using Base: gen_call_with_extracted_types - @eval module Sys - function which(program::AbstractString) - try - strip(readstring(`which $program`)) - catch - nothing - end - end - end # module -else - import Pkg - using Base: IOError - using InteractiveUtils: edit, gen_call_with_extracted_types, methodswith - function _readandwrite(cmds) - processes = open(cmds, "r+") - return (processes.out, processes.in, processes) - end +function _readandwrite(cmds) + processes = open(cmds, "r+") + return (processes.out, processes.in, processes) end + abstract type SearchPolicy end struct Shallow <: SearchPolicy end struct Recursive <: SearchPolicy end @@ -100,12 +71,8 @@ is_locatable(::Function) = true is_locatable(t::Type) = !(t <: Vararg) # https://github.com/JuliaLang/julia/issues/29645 -@static if VERSION < v"0.7-" - is_defined_in(_...) = false -else - is_defined_in(child, parent) = - child !== parent && parentmodule(child) === parent -end +is_defined_in(child, parent) = + child !== parent && parentmodule(child) === parent function list_locatables(p::SearchPolicy, m::Module) locs = [] @@ -222,11 +189,6 @@ end choose_method(methods::T) where T = _choose_method(Base.IteratorSize(T), methods) -@static if VERSION < v"0.7-" - choose_method(methods::Union{Base.MethodList, AbstractVector}) = - _choose_method(Base.HasLength(), methods) -end - function _choose_method(::Base.HasLength, methods) if isempty(methods) @info "No (interesting) method found" @@ -446,11 +408,7 @@ macro search(x = :ans, flag = :(:shallow)) # Examples: # @search 1 * 2 # @search dot([], []) - if VERSION < v"0.7-" - gen_call_with_extracted_types(code_search_typed, x) - else - gen_call_with_extracted_types(__module__, code_search_typed, x) - end + gen_call_with_extracted_types(__module__, code_search_typed, x) end code_search_methods(T) = search_methods(methodswith(T; supertypes=true)) @@ -489,10 +447,7 @@ const preferred_gui = Cmd[ # what else? ] -function need_gui(stdstreams = [ - (@static VERSION < v"0.7-" ? STDOUT : stdout), - (@static VERSION < v"0.7-" ? STDIN : stdin), - ]) +function need_gui(stdstreams = [stdout, stdin]) return !all(isa.(stdstreams, Ref(Base.TTY))) end @@ -568,10 +523,8 @@ function __init__() maybe_warn_matcher() end -@static if VERSION >= v"0.7-" - include("taskmanager.jl") - include("history.jl") - include("return.jl") -end +include("taskmanager.jl") +include("history.jl") +include("return.jl") end # module diff --git a/test/preamble.jl b/test/preamble.jl index eecd2e3..d53bcab 100644 --- a/test/preamble.jl +++ b/test/preamble.jl @@ -1,9 +1,5 @@ -@static if VERSION < v"0.7.0-" - using Base.Test -else - using Test - import Pkg -end +using Test +import Pkg using InteractiveCodeSearch diff --git a/test/runtests.jl b/test/runtests.jl index 0da867b..e30d5a9 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -53,10 +53,8 @@ end @test locs >= Set(Any[ModuleA.a]) locs = Set(list_locatables(Shallow(), ModuleA.ModuleB)) @test locs >= Set(Any[ModuleA.ModuleB.b]) - if VERSION >= v"0.7-" - locs = Set(list_locatables(Recursive(), ModuleA)) - @test locs >= Set(Any[ModuleA.a, ModuleA.ModuleB.b]) - end + locs = Set(list_locatables(Recursive(), ModuleA)) + @test locs >= Set(Any[ModuleA.a, ModuleA.ModuleB.b]) end @testset "module_methods" begin