-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Copy directory instead of cloning an entire repository (#135)
* Copy directory instead of cloning an entire repository * Improve haddock of types * Rename new ADT to Source * Add tests for new configuration * Update changelog and readme * Addres PR comments * Updated changelog and hapistrano's version Co-authored-by: Juan Paucar <[email protected]>
- Loading branch information
1 parent
b321391
commit a6183c0
Showing
11 changed files
with
150 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
deploy_path: '/' | ||
host: www.example.com | ||
repo: 'my-repo' | ||
revision: 'my-revision' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
deploy_path: '/' | ||
host: www.example.com | ||
local_directory: '/' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
{-# LANGUAGE TemplateHaskell #-} | ||
module System.HapistranoConfigSpec | ||
( spec | ||
) where | ||
|
||
import System.Hapistrano.Config (Config (..), Target (..)) | ||
import System.Hapistrano.Types (Shell (..), | ||
Source (..), TargetSystem (..)) | ||
|
||
import qualified Data.Yaml.Config as Yaml | ||
import Path (mkAbsDir) | ||
import Test.Hspec | ||
|
||
|
||
spec :: Spec | ||
spec = | ||
describe "Hapistrano's configuration file" $ do | ||
context "when the key 'local-repository' is present" $ | ||
it "loads LocalRepository as the configuration's source" $ | ||
Yaml.loadYamlSettings ["fixtures/local_directory_config.yaml"] [] Yaml.useEnv | ||
>>= | ||
(`shouldBe` | ||
(defaultConfiguration | ||
{ configSource = LocalDirectory { localDirectoryPath = $(mkAbsDir "/") } } | ||
) | ||
) | ||
|
||
context "when the keys 'repo' and 'revision' are present" $ | ||
it "loads GitRepository as the configuration's source" $ | ||
Yaml.loadYamlSettings ["fixtures/git_repository_config.yaml"] [] Yaml.useEnv | ||
>>= (`shouldBe` defaultConfiguration) | ||
|
||
|
||
defaultConfiguration :: Config | ||
defaultConfiguration = | ||
Config | ||
{ configDeployPath = $(mkAbsDir "/") | ||
, configHosts = | ||
[ Target | ||
{ targetHost = "www.example.com" | ||
, targetPort = 22 | ||
, targetShell = Bash | ||
, targetSshArgs = [] | ||
} | ||
] | ||
|
||
, configSource = GitRepository "my-repo" "my-revision" | ||
, configRestartCommand = Nothing | ||
, configBuildScript = Nothing | ||
, configCopyFiles = [] | ||
, configCopyDirs = [] | ||
, configLinkedFiles = [] | ||
, configLinkedDirs = [] | ||
, configVcAction = True | ||
, configRunLocally = Nothing | ||
, configTargetSystem = GNULinux | ||
, configReleaseFormat = Nothing | ||
, configKeepReleases = Nothing | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters