Граф коммитов

69 Коммитов

Автор SHA1 Сообщение Дата
Suhas Karanth 37d6c560cd do not create cachedir recursively
source
- main.go: Try to ensure directory for given `cachedir` path.
- context.go: Create the default cache directory, `$GOPATH/pkg/dep`, if the
  user did not override it.
- source_manager.go: Use `fs.EnsureDir` instead of `os.MkdirAll` for creating
  sources folder in cache directory.
- fs.go:
  - Add func `EnsureDir` to create a directory if it does not exist.
  - Remove func `IsValidPath`.

test
- integration_test.go: Improve tests for invalid cache directory.
- fs_test.go: Add test for `EnsureDir`, remove test for `IsValidPath`.
- manager_test.go: fix TestSourceManagerInit
  - Re-create cache directory before trying to call `NewSourceManager` the 2nd
    time and defer it's removal.
  - If `NewSourceManager` fails the 2nd time, exit the error using `t.Fatal` to
    avoid panic in `sm.Release`

misc
- language - {fallback => default} for cachedir
2017-12-08 09:02:18 +05:30
Suhas Karanth 6c1220894d allow cachedir override using env var
source
- main.go: Read and use env var `DEPCACHEDIR` for instantiating dep context.
- context.go:
  - Add field `Cachedir` to struct `Ctx`. This holds the value of env var
    `DEPCACHEDIR`.
  - Use `Ctx.Cachedir` while instantiating `gps.SourceMgr` if present, fallback
    to `$GOPATH/pkg/dep` otherwise.
- source_manager.go: Add a getter func `Cachedir` to facilitate testing in
  `context_test.go`.

test
- context_test.go Add test to check `gps.SourceMgr` is instantiated with
  appropriate `cachedir`.
- integration_test.go: Add test to check environment variable `DEPCACHEDIR` is
  loaded and used if present.

misc
- update changelog
2017-12-08 09:02:18 +05:30
Jacky Chiu 64543bc060 Fixed tests from different casing 2017-11-22 10:41:20 -05:00
Jacky Chiu 27c6df2e10 Fix invalid manifest in windows test 2017-11-21 17:22:17 -05:00
Suhas Karanth d451fa03fc rename func, improve comments
- `project.go`
  - Rename method {checkCfgFilenames => checkGopkgFilenames}
  - Improve funciton comment as suggested by @sdboyer
  - Fix ambigious comment explaining rationale behind early return.
- Add comment explaining why we do not use `fs.IsCaseSensitiveFilesystem` for
  skipping following tests:
  - context_test.go#TestLoadProjectGopkgFilenames
  - project_test.go#TestCheckGopkgFilenames
  - fs_test.go#TestReadActualFilenames
2017-09-20 11:36:04 +05:30
Suhas Karanth 28f4f359fe refactor requested changes, minor improvements
- `project`
  - `checkCfgFilenames`
    - Improve function and code comments
    - Use boolean value indicating whether value was found in actual filenames.
      If manifest file was not found, return `errProjectNotFound`. Use boolean
      to determine if lock file was not found instead of length check.
  - `TestCheckCfgFilenames` - Add code comments for test cases explaining the
    expected behavior
- `fs`
  - `ReadActualFilenames`
    - Use cleaner check(`<=` ➡ `==`) to see if `names` parameter for
      `ReadActualFilenames` actually has any values.
    - Use `Readdirnames` instead of `Readdir`. This is expected to perform
      better in most cases.
  - `TestReadActualFilenames` - Add code comments for test cases explaining the
    expected behavior
- general
  - Make line length for code comments consistent(90), add periods where
    appropriate.
  - String formatting, use %q instead of '%s'
2017-09-20 11:36:04 +05:30
Suhas Karanth afaf870131 check cfg filename case on case insensitive systems
- `fs`
  - Export `IsCaseSensitiveFilesystem`. Add and run test on windows, linux and
    macOS.
  - Add function `ReadActualFilenames` to read actual file names of given
    string slice. Add tests to be run on windows and macOS.
- `project`
  - Add function `checkCfgFilenames` to check the filenames for manifest
    and lock have the expected case. Use `fs#IsCaseSensitiveFilesystem`
    for an early return as the check is costly. Add test to be run on windows
    and macOS.
- `context`
  - Call `project.go#checkCfgFilenames` after resolving project root. Add test
    for invalid manifest file name to be run on windows and macOS.
2017-09-20 11:35:54 +05:30
Jordan Krage d61fa38258 testing: de-globalize discard loggers 2017-09-14 14:57:02 -05:00
Ibrahim AshShohail 3b01418823 [WIP]: internal/fs: add EquivalentPaths function (#940)
* internal/fs: add EquivalentPaths

* internal/fs: fix isCaseSensitiveFilesystem bug

isCaseSensitiveFilesystem returns true when os.Stat fails on the dir
passed. This caused HasFilepathPrefix to always treat *nix systems as
case-sensitive, since it passed a relative path (missing the root) to
isCaseSensitiveFilesystem.

This commit updates isCaseSensitiveFilesystem to return an error in
addtion to the boolean check. Also, HasFilepathPrefix now passes absolute
paths to isCaseSensitiveFilesystem.

Signed-off-by: Ibrahim AshShohail <ibra.sho@gmail.com>
2017-09-02 17:42:09 +03:00
sam boyer 6c5ebb93c4 Merge pull request #688 from jmank88/version_in_workspace
Break up Ctx.VersionInWorkspace
2017-07-20 11:02:01 -04:00
mstrong 7870384875
updated fs.isDir to always return an error even if the directory is not found 2017-07-10 10:05:03 -04:00
Jordan Krage c89cb10cdc remove VersionInWorkspace in favor of Exported absoluteProjectRoot and new gps.ProjectVersion 2017-06-27 07:38:02 -05:00
Jordan Krage eb972b2438 SplitAbsoluteProjectRoot refactor 2017-06-22 07:21:19 -05:00
Ibrahim AshShohail 13f512fec4
dep: cleanup TestLoadProject and TestDetectProjectGOPATH
Signed-off-by: Ibrahim AshShohail <ibra.sho@gmail.com>
2017-06-17 04:32:44 +03:00
Ibrahim AshShohail a69d6aeadd
dep: update tests for dep.*Ctx.DetectProjectGOPATH
Signed-off-by: Ibrahim AshShohail <ibra.sho@gmail.com>
2017-06-17 04:00:51 +03:00
Ibrahim AshShohail 0b8edb132a
Ensure dep reads GOPATH from Config.Env
Signed-off-by: Ibrahim AshShohail <ibra.sho@gmail.com>
2017-06-15 06:12:58 +03:00
Ibrahim AshShohail 65950010b5
Merge branch 'master' into symlink-project-roots-changes
Signed-off-by: Ibrahim AshShohail <ibra.sho@gmail.com>
2017-06-15 01:39:56 +03:00
Ibrahim AshShohail cd9bea6036
dep: add Ctx.SetPaths() ctx.DetectProjectGOPATH()
*Ctx.SetPaths() takes the working directory and any number of strings
representing GOPATHs. If no GOPATHs are passed, it will read the
environment variables to detect the GOPATH. Otherwise, it will fallback
to defaultGOPATH().

*Ctx.DetectProjectGOPATH() take a *dep.Project and attempts to detect
the containing GOPATH for the project from Ctx.GOPATHs.

Signed-off-by: Ibrahim AshShohail <ibra.sho@gmail.com>
2017-06-15 01:38:02 +03:00
Ibrahim AshShohail 71a26071db
dep: Add dep.NewProject() and add ResolveAbsRoot to dep.Project
dep.NewProject() will check if the passed root is a symlink and set
ResolveAbsRoot to the resolved path. Otherwise, ResolvedAbsRoot will
have the same value as AbsRoot.

Signed-off-by: Ibrahim AshShohail <ibra.sho@gmail.com>
2017-06-15 01:30:25 +03:00
Jordan Krage cb7df4a61c rename UnpairedVersion.Is() to Pair() 2017-06-14 09:44:59 -05:00
Ibrahim AshShohail 22cd7683f5
fix tests
Signed-off-by: Ibrahim AshShohail <ibra.sho@gmail.com>
2017-06-12 22:42:23 +03:00
Ibrahim AshShohail b7048cc449
Merge remote-tracking branch 'upstream/master' into symlink-project-roots-changes
Signed-off-by: Ibrahim AshShohail <ibra.sho@gmail.com>
2017-06-12 22:21:28 +03:00
Jordan Krage 2fd376301e improve godoc; replace Loggers with embeded fields; refactor Ctx api 2017-06-07 08:46:44 -05:00
Ibrahim AshShohail 6a464acbfd
dep: update letter casing to detectGOPATH() and ResolveProjectRootAndGOPATH()
Edit letter case of:

* detectGoPath() to detectGOPATH()
* ResolveProjectRootAndGoPath() to ResolveProjectRootAndGOPATH()

Signed-off-by: Ibrahim AshShohail <ibra.sho@gmail.com>
2017-06-06 06:25:42 +03:00
Ibrahim AshShohail 91ac4d2e0d
dep: update NewContext(), rename ResolveProjectRoot() to ResolveProjectRootAndGoPath() and add detectGoPath()
Signed-off-by: Ibrahim AshShohail <ibra.sho@gmail.com>
2017-06-03 22:15:21 +03:00
Jordan Krage f7ce515853 simplify Ctx.LoadProject 2017-05-30 09:07:23 -05:00
sam boyer f0a81f4b2f Incorporate pr/538, change manifest prop names 2017-05-22 21:59:32 -04:00
Jordan Krage cbded81ec1 move Logger into Ctx; restore logging 2017-05-11 11:16:36 -05:00
sam boyer 30cce2a3e5 Merge pull request #529 from ibrasho-forks/handle-init-in-GOPATH/src-issue
Show a clear error message when trying to 'dep init' in $GOPATH/src
2017-05-10 22:20:04 -04:00
Dave Cheney 1d53807754 test: move test to internal/test
Fixes #521
2017-05-11 08:57:58 +10:00
Ibrahim AshShohail f81437dc2f change error wording and add ensure correct error in the test case 2017-05-10 09:03:19 +03:00
Dave Cheney 9ea8489e5e gps: move gps to internal/gps
Fixes #300
Fixes #519
2017-05-10 14:15:27 +10:00
Felipe Oliveira 942792af41 fix tests 2017-05-09 20:13:26 -03:00
Ibrahim AshShohail a11483a92b add test and cleanup 2017-05-09 00:38:37 +03:00
Jordan Krage e112b2fe63 adding in-process tests 2017-05-05 18:51:26 -05:00
Kris Nova 4d5c597e0f Merge branch 'master' into add-gps 2017-05-01 20:34:30 -06:00
Chris Hines 731ae1ab28 TestResolveProjectRoot: Skip symlink tests on Windows if symlinks fail. 2017-05-01 00:32:17 -04:00
Chris Hines 0f6889dd93 TestResolveProjectRoot: Remove extraneous code. 2017-05-01 00:30:24 -04:00
Kris Nova 0561ca9bfb Fix gofmt and travis
- Changes to travis.yml
 - New hack validate-gofmt.bash script
 - Fixing staticcheck in gps
 - Fixing gosimple in gps
2017-04-25 11:14:46 -06:00
Kris Nova 122ade36c3 String replacing for import paths
sed/g the following strings (somewhat blindly)
github.com/sdboyer/gps -> github.com/golang/go/gps
github.com/sdboyer/gps/internal -> github.com/golang/dep/gps/internal
github.com/sdboyer/gps/pkgtree -> github.com/golang/dep/gps/pkgtree
2017-04-21 13:39:03 -06:00
sam boyer b839831e75 Merge pull request #342 from carolynvs/toml-allthethings
Move to TOML for manifest and lock
2017-04-13 01:24:11 -04:00
Brian Starke 753c8dd9d6 Add test case for multiple GOPATH situation 2017-04-10 17:58:07 -04:00
Brian Starke f569ebc39c Forgot to commit test updates 2017-04-06 17:10:53 -04:00
Carolyn Van Slyck 0f9b94178b Use filepath.Join and filename constants instead of hardcoding test file paths 2017-04-04 23:31:17 -05:00
Carolyn Van Slyck 12e713b546 Update test files from JSON to TOML 2017-04-04 23:31:16 -05:00
Brian Starke ab79f83fea fixes from review, added lstat passthrough 2017-03-14 14:58:47 -04:00
Brian Starke c922a91d25 check if real path is within GOPATH before resolving 2017-03-11 18:41:53 -05:00
Brian Starke bbf93640b5 Merge branch 'resolve-symlinks' of github.com:brianstarke/dep into resolve-symlinks 2017-02-21 13:46:42 -05:00
Brian Starke 5a56a59836 use filepath join to use correct os.Separator in file path 2017-02-21 13:46:27 -05:00
Brian Starke f41f58a8d7 Merge branch 'master' into resolve-symlinks 2017-02-21 13:31:42 -05:00