Skip to content

Commit

Permalink
Revert change of install dir (#393)
Browse files Browse the repository at this point in the history
  • Loading branch information
waj committed May 18, 2020
1 parent 89dfd3d commit 5905b10
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 39 deletions.
26 changes: 0 additions & 26 deletions spec/integration/install_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -41,32 +41,6 @@ describe "install" do
end
end

it "shows warning if legacy path is present" do
with_shard(NamedTuple.new) do
Dir.mkdir "lib"
stdout = run "shards install --no-color"
stdout.should contain(%(W: Shards now installs dependencies into the '.crystal/shards' directory. You may move or delete the legacy 'lib' directory.\n))
end
end

it "doesn't show warning if both legacy and current install path are present" do
with_shard(NamedTuple.new) do
Dir.mkdir "lib"
Dir.mkdir_p Shards::INSTALL_DIR
stdout = run "shards install --no-color"
stdout.should eq(%(I: Resolving dependencies\n))
end
end

it "doesn't show warning when explicit install path is set" do
with_shard(NamedTuple.new) do
Dir.mkdir "lib"
env = {"SHARDS_INSTALL_PATH" => "foo"}
stdout = run "shards install --no-color", env: env
stdout.should eq(%(I: Resolving dependencies\n))
end
end

it "fails when spec is missing" do
Dir.cd(application_path) do
ex = expect_raises(FailedCommand) { run "shards install --no-color" }
Expand Down
1 change: 0 additions & 1 deletion spec/support/cli.cr
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ Spec.before_each do

if File.exists?(path)
run("rm -rf #{path}/*")
run("rm -rf #{path}/.crystal")
run("rm -rf #{path}/.shards")
else
Dir.mkdir_p(path)
Expand Down
1 change: 0 additions & 1 deletion src/commands/command.cr
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ module Shards
abstract def run(*args, **kwargs)

def self.run(path, *args, **kwargs)
Shards.warn_about_legacy_libs_path
new(path).run(*args, **kwargs)
end

Expand Down
12 changes: 1 addition & 11 deletions src/config.cr
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ require "./info"
module Shards
SPEC_FILENAME = "shard.yml"
LOCK_FILENAME = "shard.lock"
INSTALL_DIR = ".crystal/shards"
INSTALL_DIR = "lib"

DEFAULT_COMMAND = "install"
DEFAULT_VERSION = "0"
Expand Down Expand Up @@ -57,16 +57,6 @@ module Shards
@@info ||= Info.new
end

def self.warn_about_legacy_libs_path
return if ENV["SHARDS_INSTALL_PATH"]?

legacy_install_path = File.join(Dir.current, "lib")

if File.exists?(legacy_install_path) && !File.exists?(install_path)
Log.warn { "Shards now installs dependencies into the '.crystal/shards' directory. You may move or delete the legacy 'lib' directory." }
end
end

def self.bin_path
@@bin_path ||= ENV.fetch("SHARDS_BIN_PATH") { File.join(Dir.current, "bin") }
end
Expand Down

0 comments on commit 5905b10

Please sign in to comment.