Skip to content

Commit

Permalink
New search path: install into lib folder
Browse files Browse the repository at this point in the history
refs #123
  • Loading branch information
ysbaddaden committed Sep 25, 2016
1 parent b96cc09 commit eec0bab
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/.crystal
/.shards
/libs
/lib
/bin/shards
/test/.repositories
/test/.shards
/test/.libs
/test/.lib
/tmp
2 changes: 1 addition & 1 deletion SPEC.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ installed or upgraded in a project that requires it. This may be used to compile
a C library, to build tools to help working on the project, or anything else.

The script will be run from the dependency's installation directory, for example
`libs/foo` for a Shard named `foo`.
`lib/foo` for a Shard named `foo`.

```yaml
scripts:
Expand Down
2 changes: 1 addition & 1 deletion src/config.cr
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module Shards
end

def self.install_path
@@install_path ||= ENV.fetch("SHARDS_INSTALL_PATH") { File.join(Dir.current, "libs") }
@@install_path ||= ENV.fetch("SHARDS_INSTALL_PATH") { File.join(Dir.current, "lib") }
end

def self.install_path=(@@install_path : String)
Expand Down
4 changes: 2 additions & 2 deletions src/man/shards.1
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Prints the Shards version.
.PP
\fBinstall\fR
.RS 4
Resolves and installs dependencies into the \fIlibs\fR folder. If not already
Resolves and installs dependencies into the \fIlib\fR folder. If not already
present, generates a \fIshard.lock\fR file from resolved dependencies, locking
version numbers or Git commits.
.PP
Expand All @@ -60,7 +60,7 @@ doesn't generate a conflict, thus generating a new \fIshard.lock\fR file.
.PP
\fBupdate\fR
.RS 4
Resolves and updates all dependencies into the \fIlibs\fR folder again,
Resolves and updates all dependencies into the \fIlib\fR folder again,
whatever the locked versions and commits in the \fIshard.lock\fR file.
Eventually generates a new \fIshard.lock\fR file.
.RE
Expand Down
4 changes: 2 additions & 2 deletions test/integration/install_test.cr
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ class InstallCommandTest < Minitest::Test
def test_runs_postinstall_script
with_shard({ dependencies: { post: "*" } }) do
run "shards install"
assert File.exists?(File.join(application_path, "libs", "post", "made.txt"))
assert File.exists?(File.join(application_path, "lib", "post", "made.txt"))
end
end

Expand All @@ -234,7 +234,7 @@ class InstallCommandTest < Minitest::Test
ex = assert_raises(FailedCommand) { run "shards install --no-color" }
assert_match "E: Failed make:\n", ex.stdout
assert_match "test -n ''\n", ex.stdout
refute Dir.exists?(File.join(application_path, "libs", "fails"))
refute Dir.exists?(File.join(application_path, "lib", "fails"))
end
end

Expand Down
6 changes: 3 additions & 3 deletions test/integration/prune_test.cr
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,18 @@ class PruneCommandTest < Minitest::Test
end

def test_removes_directories
Dir.mkdir(File.join(application_path, "libs", "test"))
Dir.mkdir(File.join(application_path, "lib", "test"))
Dir.cd(application_path) { run "shards prune" }
assert_equal ["web"], installed_dependencies
end

def test_wont_remove_files
File.write(File.join(application_path, "libs", ".keep"), "")
File.write(File.join(application_path, "lib", ".keep"), "")
Dir.cd(application_path) { run "shards prune" }
assert_equal [".keep", "web"], installed_dependencies.sort
end

private def installed_dependencies
Dir[File.join(application_path, "libs", "*")].map { |path| File.basename(path) }
Dir[File.join(application_path, "lib", "*")].map { |path| File.basename(path) }
end
end
2 changes: 1 addition & 1 deletion test/integration_helper.cr
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class Minitest::Test
end

def install_path(project, *path_names)
File.join(application_path, "libs", project, *path_names)
File.join(application_path, "lib", project, *path_names)
end

def debug(command)
Expand Down
2 changes: 1 addition & 1 deletion test/test_helper.cr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ require "../src/logger"
require "../src/manager"

Shards.cache_path = File.join(__DIR__, ".shards")
Shards.install_path = File.join(__DIR__, ".libs")
Shards.install_path = File.join(__DIR__, ".lib")

require "./support/factories"
require "./support/mock_resolver"
Expand Down

0 comments on commit eec0bab

Please sign in to comment.