Skip to content

Commit

Permalink
require Julia 0.5-
Browse files Browse the repository at this point in the history
  • Loading branch information
wookay committed Aug 8, 2016
1 parent 63cb601 commit cc0f648
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ script:
- if [[ -a .git/shallow ]]; then git fetch --unshallow; fi
- julia --color=yes -e 'Pkg.clone(pwd()); Pkg.build("Millboard"); Pkg.test("Millboard"; coverage=true)'
after_success:
- julia --color=yes -e 'if VERSION >= v"0.4-"; cd(Pkg.dir("Millboard")); Pkg.add("Coverage"); using Coverage; Coveralls.submit(Coveralls.process_folder()); end'
- julia --color=yes -e 'if VERSION >= v"0.5-"; cd(Pkg.dir("Millboard")); Pkg.add("Coverage"); using Coverage; Coveralls.submit(Coveralls.process_folder()); end'
2 changes: 1 addition & 1 deletion REQUIRE
Original file line number Diff line number Diff line change
@@ -1 +1 @@
julia 0.4-
julia 0.5-
26 changes: 13 additions & 13 deletions src/colored.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ end
# colored
colored(color::Symbol) = check_have_color() && Colored(color)
colored(color::Symbol, indexfunc::Function) = check_have_color() && Coat(color, indexfunc)
colored(color::Symbol, indexfunc::Function, data) = check_have_color() && call(Coat(color, indexfunc), data)
colored(color::Symbol, data) = check_have_color() && call(Coat(color, identity), data)
colored(color::Symbol, indexfunc::Function, data) = check_have_color() && (Coat(color, indexfunc))(data)
colored(color::Symbol, data) = check_have_color() && (Coat(color, identity))(data)

function normal_color()
@windows ? Base.text_colors[:bold] : Base.answer_color()
is_windows() ? Base.text_colors[:bold] : Base.answer_color()
end

function check_have_color()
Expand Down Expand Up @@ -142,9 +142,9 @@ coating(c::Coating, ::Any) = ANSIEscaped(c.color, c.data)
identityfunc(::AbstractArray) = a->a[:,:]
identityfunc(::Any) = a->a

call(coat::Coat, data::Function) = coating(Coating(coat.color, data), typeof(data))
call(coat::Coat, input::Tuple) = call(coat, rotl90(collect(input)[:,:]))
function call(coat::Coat, input)
(coat::Coat)(data::Function) = coating(Coating(coat.color, data), typeof(data))
(coat::Coat)(input::Tuple) = (coat)(rotl90(collect(input)[:,:]))
function (coat::Coat)(input)
c = Coating(coat.color, input)
coated = coat.indexfunc(c)
if c==coated
Expand All @@ -156,16 +156,16 @@ end


# Colored
call(c::Colored, data::Tuple) = call(c, rotl90(collect(data)[:,:]))
call(c::Colored, data::AbstractArray) = call(Coat(c.color, identityfunc(data)), data)
call(c::Colored, data::Any) = coating(Coating(c.color, data), typeof(data))
(c::Colored)(data::Tuple) = (c)(rotl90(collect(data)[:,:]))
(c::Colored)(data::AbstractArray) = (Coat(c.color, identityfunc(data)))(data)
(c::Colored)(data::Any) = coating(Coating(c.color, data), typeof(data))

function call(c::Colored, func::Function)
isgeneric(func) ? coating(Coating(c.color, func), typeof(func)) : Coat(c.color, func)
function (c::Colored)(func::Function)
Coat(c.color, func)
end

function call(c::Colored, func::Function, data)
data |> call(c, func)
function (c::Colored)(func::Function, data)
(c)(func)(data)
end


Expand Down
2 changes: 1 addition & 1 deletion test/colored.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ cyan = colored(:cyan)


green = colored(:green)
@test_colored "\e[1m\e[32msin\e[0m\e[1m" == sin |> green |> string
@test_colored "Millboard.Coat(:green,sin)" == sin |> green |> string


magenta = colored(:magenta)
Expand Down

0 comments on commit cc0f648

Please sign in to comment.