on master help sign in
command: Rename new thunk structure to thunk.nix/local
commit4510fd0e30058e9c5793ad45ce865f3af1a50b58 authorElliot Cameron <eacameron@gmail.com> dateWed 8 Apr 2020, 15:42 (7 years ago) parent1040ff1
3 files changed+16−16
all-tests.nix+7−7 lib/command/src/Obelisk/Command/Thunk.hs+5−5 lib/selftest/src/Obelisk/SelfTest.hs+4−4
all-tests.nix+7−7
@@ -109,7 +109,7 @@ in
109109
110110 with subtest("obelisk can pack"):
111111 client.succeed("ob -v thunk pack ~/code/myapp")
112− client.succeed("grep -qF 'git.json' ~/code/myapp/src.nix")
112+ client.succeed("grep -qF 'git.json' ~/code/myapp/thunk.nix")
113113 client.succeed("grep -qF 'myorg' ~/code/myapp/git.json")
114114 client.succeed("ob -v thunk unpack ~/code/myapp")
115115
@@ -125,17 +125,17 @@ in
125125 client.succeed("ob -v thunk unpack ~/code/myapp")
126126
127127 with subtest("building an invalid thunk fails"):
128− client.succeed("cd ~/code/myapp/unpacked && git checkout -b bad")
128+ client.succeed("cd ~/code/myapp/local && git checkout -b bad")
129129 client.succeed(
130− "cp ${invalidThunkableSample} ~/code/myapp/unpacked/default.nix"
130+ "cp ${invalidThunkableSample} ~/code/myapp/local/default.nix"
131131 )
132− client.succeed("cd ~/code/myapp/unpacked && git add .")
133− client.succeed('cd ~/code/myapp/unpacked && git commit -m "Bad commit"')
134− client.succeed("cd ~/code/myapp/unpacked && git push -u origin bad")
132+ client.succeed("cd ~/code/myapp/local && git add .")
133+ client.succeed('cd ~/code/myapp/local && git commit -m "Bad commit"')
134+ client.succeed("cd ~/code/myapp/local && git push -u origin bad")
135135 client.succeed("ob -v thunk pack ~/code/myapp --public")
136136 client.fail("nix-build ~/code/myapp")
137137 client.succeed("ob -v thunk unpack ~/code/myapp")
138− client.succeed("cd ~/code/myapp/unpacked && git checkout master")
138+ client.succeed("cd ~/code/myapp/local && git checkout master")
139139
140140 with subtest("obelisk can detect private repos"):
141141 client.succeed("ob -v thunk pack ~/code/myapp")
lib/command/src/Obelisk/Command/Thunk.hs+5−5
@@ -203,7 +203,7 @@ data ReadThunkError
203203 deriving (Show)
204204
205205unpackedDirName :: FilePath
206−unpackedDirName = "unpacked"
206+unpackedDirName = "local"
207207
208208attrCacheFileName :: FilePath
209209attrCacheFileName = ".attr-cache"
@@ -554,7 +554,7 @@ let fetch = { private ? false, fetchSubmodules ? false, owner, repo, rev, sha256
554554 inherit owner repo rev sha256 fetchSubmodules private;
555555 };
556556 json = builtins.fromJSON (builtins.readFile ./github.json);
557−in if builtins.pathExists ./unpacked then ./unpacked else fetch json
557+in if builtins.pathExists ./local then ./local else fetch json
558558|]
559559
560560parseGitHubJsonBytes :: LBS.ByteString -> Either String ThunkPtr
@@ -646,7 +646,7 @@ let fetch = {url, rev, branch ? null, sha256 ? null, fetchSubmodules ? false, pr
646646 url = realUrl; inherit rev sha256;
647647 };
648648 json = builtins.fromJSON (builtins.readFile ./git.json);
649−in if builtins.pathExists ./unpacked then ./unpacked else fetch json
649+in if builtins.pathExists ./local then ./local else fetch json
650650|]
651651
652652parseGitJsonBytes :: LBS.ByteString -> Either String ThunkPtr
@@ -655,7 +655,7 @@ parseGitJsonBytes = parseJsonObject $ parseThunkPtr $ fmap ThunkSource_Git . par
655655mkThunkSpec :: Text -> FilePath -> (LBS.ByteString -> Either String ThunkPtr) -> Text -> ThunkSpec
656656mkThunkSpec name jsonFileName parser srcNix = ThunkSpec name $ Map.fromList
657657 [ ("default.nix", ThunkFileSpec_FileMatches defaultNixViaSrc)
658− , ("src.nix", ThunkFileSpec_FileMatches srcNix)
658+ , ("thunk.nix", ThunkFileSpec_FileMatches srcNix)
659659 , (jsonFileName, ThunkFileSpec_Ptr parser)
660660 , (attrCacheFileName, ThunkFileSpec_AttrCache)
661661 , (unpackedDirName, ThunkFileSpec_CheckoutIndicator)
@@ -663,7 +663,7 @@ mkThunkSpec name jsonFileName parser srcNix = ThunkSpec name $ Map.fromList
663663 where
664664 defaultNixViaSrc = [here|
665665# DO NOT HAND-EDIT THIS FILE
666−import (import ./src.nix)
666+import (import ./thunk.nix)
667667|]
668668
669669
lib/selftest/src/Obelisk/SelfTest.hs+4−4
@@ -269,7 +269,7 @@ main' isVerbose httpManager obeliskRepoReadOnly = withInitCache $ \initCache ->
269269 runOb_ ["thunk", "pack", repo]
270270 packedFiles <- Set.fromList <$> ls (fromText repo)
271271 liftIO $ assertEqual "" packedFiles $ Set.fromList $ (repo </>) <$>
272− ["default.nix", "src.nix", "github.json" :: FilePath]
272+ ["default.nix", "thunk.nix", "github.json" :: FilePath]
273273
274274 runOb_ ["thunk", "unpack", repo]
275275 chdir (fromText repo </> unpackedDirName) $ do
@@ -493,13 +493,13 @@ testLegacyGitThunks isVerbose = withSystemTempDirectory "test-git-repo" $ \gitDi
493493
494494 for_ (legacyGitThunks (GitThunkParams gitDir rev sha256)) $ \mkFiles ->
495495 withSystemTempDirectory "test-thunks" $ \thunkDir -> do
496− let nixEval = run nixInstantiatePath ["--eval", toTextIgnore (thunkDir </> ("src.nix" :: FilePath))]
496+ let nixEval = run nixInstantiatePath ["--eval", toTextIgnore (thunkDir </> ("thunk.nix" :: FilePath))]
497497 liftIO $ mkFiles thunkDir
498498 run_ "ob" ["thunk", "unpack", toTextIgnore thunkDir]
499499 unpackedEval <- nixEval
500500 run_ "ob" ["thunk", "pack", toTextIgnore thunkDir]
501501 packedEval <- nixEval
502− liftIO $ assertBool "Unpacked and packed src.nix should not eval to the same thing" $
502+ liftIO $ assertBool "Unpacked and packed thunk.nix should not eval to the same thing" $
503503 unpackedEval /= packedEval
504504
505505data GitThunkParams = GitThunkParams
@@ -600,4 +600,4 @@ legacyGitThunks (GitThunkParams repo' rev sha256) =
600600 LBS.writeFile (dir </> ("git.json" :: FilePath)) (Aeson.encode gitJson)
601601
602602unpackedDirName :: FilePath
603−unpackedDirName = "unpacked"
603+unpackedDirName = "local"