Pkg: refactor base/pkg.jl to just cd and calls an entry point.

This avoids all the annoying nonsense of having to avoid recursive
calls to Dir.cd and reasoning about if you are or are not in the
~/.julia directory yet.
Pkg: also refactor scaffold to cd in base/pkg.jl.

This is a bit weird – it's unclear why this should cd into ~/.julia
when dir is set to something else, but this works, so moving on.
to_json() => json()
using => usingmodule, new DNS name for codespeed host!
Infer element type for general multi-dimensional getindex
Pkg: simplify check_metadata and call it after register or tag.
Pkg: move build and fixup code to the same region of pkg/entry.jl.
Pkg.status: handle lack of required or additional packages better.
Infer return type for permutedims

This is the same kind of issue as #4387, but in this case we should
be able to statically infer the return type of the array (at least as
long as we don't care to make permutedims([1, 2], [2, 1]) work, but
this currently throws anyhow).

Unfortunately this revealed a bug in type inference, which emits
statically infers typeof(dimsB) for BitArrays and SubArrays as

(Type{TypeVar(:_,Vararg{Int})},)

which leads to the wrong similar method getting selected and inlined. I
changed inference.jl to infer this as (Int...) which works, but Vararg
types give me the creeps and I'm not sure this is a complete solution.
Merge pull request #4386 from JuliaLang/sk/pkg

Pkg: refactor base/pkg.jl to just cd and calls an entry point.
fix "invalid assignment location" regression in constructor syntax
Merge branch 'master' of github.com:JuliaLang/julia
fix #4380
Pkg: major rename and refactor of package generation code.

The major user-facing change is that Pkg.scaffold has been replaced
by Pkg.generate, which has similar functionality but a slightly
different interface – license is a required second argument instead
of a "required" keyword argument.

This change also factors all the little bits of content generation
into their own separately callable functions.

Finally, if you want to generate packages to a non-standard place,
this no longer provides a keyword argument to do so. Being a non-
standard code path, that was really prone to bit-rot. Now, instead
what you can do is change JULIA_PKGDIR and then call Pkg.generate
as you normally would. It doesn't require any METADATA or other
special files to exist, so this can be an arbitary directory and
it will just work.

options that were available as keyw
Merge branch 'master' of github.com:JuliaLang/julia
doc fix
Merge pull request #4393 from wlbksy/docfix

doc fix
Merge pull request #4375 from stevengj/mimewritable

RFC: change mimewritable to take instance rather than type
Merge pull request #4387 from simonster/getindex

Infer element type for general multi-dimensional getindex
Merge pull request #4388 from simonster/permutedims

Infer return type for permutedims