dkdeploy-core 8.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +20 -0
  3. data/.rubocop.yml +18 -0
  4. data/Berksfile +3 -0
  5. data/Berksfile.lock +46 -0
  6. data/CONTRIBUTORS.md +16 -0
  7. data/Gemfile +4 -0
  8. data/LICENSE +7 -0
  9. data/README.md +88 -0
  10. data/Rakefile +5 -0
  11. data/Vagrantfile +60 -0
  12. data/config/vm/cookbooks/dkdeploy-core/metadata.rb +10 -0
  13. data/config/vm/cookbooks/dkdeploy-core/recipes/default.rb +56 -0
  14. data/dkdeploy-core.gemspec +34 -0
  15. data/features/apache.feature +35 -0
  16. data/features/assets.feature +100 -0
  17. data/features/bower.feature +52 -0
  18. data/features/current_folder.feature +17 -0
  19. data/features/db.feature +93 -0
  20. data/features/deploy.feature +48 -0
  21. data/features/enhanced_symlinks.feature +17 -0
  22. data/features/error_handlers.feature +59 -0
  23. data/features/file_access.feature +120 -0
  24. data/features/maintenance.feature +25 -0
  25. data/features/project_version.feature +42 -0
  26. data/features/support/env.rb +22 -0
  27. data/features/utils.feature +81 -0
  28. data/lib/capistrano/copy.rb +2 -0
  29. data/lib/capistrano/dkdeploy/core.rb +88 -0
  30. data/lib/dkdeploy/constants.rb +156 -0
  31. data/lib/dkdeploy/copy.rb +121 -0
  32. data/lib/dkdeploy/core/version.rb +15 -0
  33. data/lib/dkdeploy/dsl.rb +23 -0
  34. data/lib/dkdeploy/helpers/assets.rb +50 -0
  35. data/lib/dkdeploy/helpers/common.rb +31 -0
  36. data/lib/dkdeploy/helpers/db.rb +49 -0
  37. data/lib/dkdeploy/helpers/file_system.rb +76 -0
  38. data/lib/dkdeploy/i18n.rb +143 -0
  39. data/lib/dkdeploy/interaction_handler/password.rb +27 -0
  40. data/lib/dkdeploy/rollback_manager.rb +18 -0
  41. data/lib/dkdeploy/tasks/apache.rake +29 -0
  42. data/lib/dkdeploy/tasks/assets.rake +96 -0
  43. data/lib/dkdeploy/tasks/bower.rake +54 -0
  44. data/lib/dkdeploy/tasks/copy.rake +26 -0
  45. data/lib/dkdeploy/tasks/current_folder.rake +16 -0
  46. data/lib/dkdeploy/tasks/db.rake +412 -0
  47. data/lib/dkdeploy/tasks/deploy.rake +77 -0
  48. data/lib/dkdeploy/tasks/enhanced_symlinks.rake +74 -0
  49. data/lib/dkdeploy/tasks/fail.rake +8 -0
  50. data/lib/dkdeploy/tasks/file_access.rake +89 -0
  51. data/lib/dkdeploy/tasks/maintenance.rake +73 -0
  52. data/lib/dkdeploy/tasks/project_version.rake +32 -0
  53. data/lib/dkdeploy/tasks/utils.rake +141 -0
  54. data/lib/dkdeploy.rb +1 -0
  55. data/spec/fixtures/application/Capfile +11 -0
  56. data/spec/fixtures/application/Gemfile +11 -0
  57. data/spec/fixtures/application/Version +1 -0
  58. data/spec/fixtures/application/config/assets_exclude_file.txt +1 -0
  59. data/spec/fixtures/application/config/deploy/dev.rb +35 -0
  60. data/spec/fixtures/application/config/deploy.rb +18 -0
  61. data/spec/fixtures/application/config/etc/apache2/conf/.htaccess.erb +12 -0
  62. data/spec/fixtures/application/config/etc/apache2/conf/dev.htaccess.erb +3 -0
  63. data/spec/fixtures/application/config/preseed/default_content.sql.gz +0 -0
  64. data/spec/fixtures/application/config/preseed/default_structure.sql.gz +0 -0
  65. data/spec/fixtures/application/config/preseed/fileadmin.tar.gz +0 -0
  66. data/spec/fixtures/application/config/preseed/uploads.tar.gz +0 -0
  67. data/spec/fixtures/application/htdocs/.hidden/.gitkeep +0 -0
  68. data/spec/fixtures/application/htdocs/Gemfile +0 -0
  69. data/spec/fixtures/application/htdocs/bower.json +15 -0
  70. data/spec/fixtures/application/htdocs/catalog/.hidden/.gitkeep +0 -0
  71. data/spec/fixtures/application/htdocs/catalog/index.html +1 -0
  72. data/spec/fixtures/application/htdocs/index.html +1 -0
  73. data/spec/fixtures/application/htdocs/stylesheets/test1/config.rb +3 -0
  74. data/spec/fixtures/application/htdocs/stylesheets/test1/css/.gitkeep +0 -0
  75. data/spec/fixtures/application/htdocs/stylesheets/test1/src/source.scss +5 -0
  76. data/spec/fixtures/application/htdocs/stylesheets/test2/config.rb +3 -0
  77. data/spec/fixtures/application/htdocs/stylesheets/test2/css/.gitkeep +0 -0
  78. data/spec/fixtures/application/htdocs/stylesheets/test2/src/source.scss +5 -0
  79. data/spec/fixtures/application/temp/dkdeploy_core.sql.gz +0 -0
  80. data/spec/fixtures/capistrano/configuration/add_output_after_create_symlink.rb +7 -0
  81. data/spec/fixtures/capistrano/configuration/custom_compass_sources.rb +4 -0
  82. data/spec/fixtures/capistrano/configuration/custom_file_access.rb +13 -0
  83. data/spec/fixtures/capistrano/configuration/default_deployment_behaviour.rb +9 -0
  84. metadata +346 -0
@@ -0,0 +1,52 @@
1
+ Feature: Test tasks for namespace 'bower'
2
+
3
+ Background:
4
+ Given a test app with the default configuration
5
+
6
+ Scenario: Given a bower.js file, running cap bower:run['install', 'htdocs'] results in Bower (v1.5.2) installing components
7
+ When I successfully run `cap dev "bower:run[install,htdocs]"`
8
+ Then the output should contain "bower jquery#2.1.4 install jquery#2.1.4"
9
+ And a file named "htdocs/bower_components/jquery/dist/jquery.js" should exist
10
+
11
+ Scenario: Running arbitrarily Bower commands
12
+ Given I run `cap dev "bower:run[install,htdocs]"`
13
+ When I run `cap dev "bower:run[list,htdocs]"`
14
+ Then the output should contain "dkdeploy-core-bower-fixture-file#0.0.1"
15
+ And the output should contain "└── jquery#2.1.4"
16
+ When I successfully run `cap dev "bower:run[lookup bootstrap,htdocs]"`
17
+ Then the output should contain "bootstrap https://github.com/twbs/bootstrap.git"
18
+
19
+ Scenario: Running arbitrarily Bower commands with multiple bower.json files
20
+ Given the default aruba exit timeout is 120 seconds
21
+ And a file named "another_directory/bower.json" with:
22
+ """
23
+ {
24
+ "name": "dkdeploy-core-another-bower-fixture-file",
25
+ "version": "0.0.1",
26
+ "authors": [
27
+ "Random Coder <mail@example.com>"
28
+ ],
29
+ "description": "This is another fixture bower.js file for dkdeploy-core",
30
+ "moduleType": [
31
+ "globals"
32
+ ],
33
+ "license": "MIT",
34
+ "dependencies": {
35
+ "bootstrap": "3.3.5"
36
+ }
37
+ }
38
+ """
39
+ When I extend the development capistrano configuration variable bower_paths with value ['htdocs', 'another_directory']
40
+ And I successfully run `cap dev "bower:run_all[install]"`
41
+ Then a file named "htdocs/bower_components/jquery/dist/jquery.js" should exist
42
+ And a file named "another_directory/bower_components/bootstrap/dist/css/bootstrap.css" should exist
43
+
44
+ Scenario: Running a Bower command with missing bower.json file
45
+ Given I successfully run `rm htdocs/bower.json`
46
+ When I successfully run `cap dev "bower:run[install,htdocs]"`
47
+ Then the output should contain "Skipping directory htdocs because it does not contain a bower.json file."
48
+
49
+ Scenario: Running a Bower command with missing directory configured
50
+ Given I successfully run `rm htdocs/bower.json`
51
+ When I successfully run `cap dev "bower:run[install,i_do_not_exist]"`
52
+ Then the output should contain "Skipping directory i_do_not_exist because it does not exist."
@@ -0,0 +1,17 @@
1
+ Feature: Test tasks for namespace 'current_folder'
2
+
3
+ Background:
4
+ Given a test app with the default configuration
5
+ And the remote server is cleared
6
+
7
+ Scenario: Do not remove current folder if it is symlinked
8
+ Given the project is deployed
9
+ And I store the symlink source of current
10
+ When I successfully run `cap dev current_folder:remove_unlesss_symlinked`
11
+ Then the symlink source of current should not have changed
12
+
13
+ Scenario: Remove current folder if it's not symlinked
14
+ Given a remote directory named "current_path"
15
+ When I successfully run `cap dev current_folder:remove_unlesss_symlinked`
16
+ Then a remote directory named "current_path" should not exist
17
+
@@ -0,0 +1,93 @@
1
+ Feature: Test tasks for namespace 'db'
2
+
3
+ Background:
4
+ Given a test app with the default configuration
5
+ And the remote server is cleared
6
+ And I want to use the database `dkdeploy_core`
7
+
8
+ Scenario: Check if settings upload is possible with settings given as arguments
9
+ When I successfully run `cap dev "db:upload_settings[127.0.0.1,3306,dkdeploy_core,root,ilikerandompasswords,utf8]"`
10
+ Then a remote file named "shared_path/config/db_settings.dev.yaml" should exist
11
+
12
+ Scenario: Check if settings upload is possible with settings given interactively
13
+ When I run `cap dev db:upload_settings` interactively
14
+ And I type "127.0.0.1"
15
+ And I type "3306"
16
+ And I type "dkdeploy_core"
17
+ And I type "root"
18
+ And I type "ilikerandompasswords"
19
+ And I type "utf8"
20
+ And I close the stdin stream
21
+ Then the exit status should be 0
22
+ And a remote file named "shared_path/config/db_settings.dev.yaml" should exist
23
+
24
+ Scenario: Check if settings upload is possible with settings given as enviroment variables
25
+ When I successfully run `cap dev db:upload_settings DB_HOST=127.0.0.1 DB_PORT=3306 DB_NAME=dkdeploy_core DB_USERNAME=root DB_PASSWORD=ilikerandompasswords DB_CHARSET=utf8`
26
+ Then a remote file named "shared_path/config/db_settings.dev.yaml" should exist
27
+
28
+ Scenario: Reading missing database config file
29
+ When I run `cap dev db:read_db_settings`
30
+ Then the output should contain "Unable to locate database config file on remote server."
31
+
32
+ Scenario: Reading existing database config file
33
+ When I successfully run `cap dev "db:upload_settings[127.0.0.1,3306,dkdeploy_core,root,ilikerandompasswords,utf8]"`
34
+ Then a file named "temp/db_settings.dev.yaml" should not exist
35
+ When I run `cap dev db:read_db_settings`
36
+ Then a file named "temp/db_settings.dev.yaml" should exist
37
+
38
+ Scenario: Check if password will not appear in log
39
+ When I successfully run `cap dev "db:upload_settings[127.0.0.1,3306,dkdeploy_core,root,ilikerandompasswords,utf8]"`
40
+ Then the output should not contain "ilikerandompasswords"
41
+
42
+ Scenario: Check content of database after uploading a script
43
+ When I successfully run `cap dev "db:upload_settings[127.0.0.1,3306,dkdeploy_core,root,ilikerandompasswords,utf8]"`
44
+ And I run `cap dev "db:update[temp,dkdeploy_core.sql.gz]"`
45
+ And I wait 5 seconds to let the database commit the transaction
46
+ Then the database should have a table `demo_table` with column `demo_column`
47
+ And the database should not have a table `wrong_table` with column `wrong_column`
48
+
49
+ Scenario: Check dumping complete database without cache table content
50
+ When I successfully run `cap dev "db:upload_settings[127.0.0.1,3306,dkdeploy_core,root,ilikerandompasswords,utf8]"`
51
+ And I successfully run `cap dev "db:update[temp,dkdeploy_core.sql.gz]"`
52
+ And I successfully run `cap dev db:download`
53
+ Then a file matching %r<database-dev-content.*sql.*gz> should exist
54
+ And a file matching %r<database-dev-structure.*sql.*gz> should exist
55
+
56
+ Scenario: Check dumping only structure of database
57
+ When I successfully run `cap dev "db:upload_settings[127.0.0.1,3306,dkdeploy_core,root,ilikerandompasswords,utf8]"`
58
+ And I successfully run `cap dev "db:update[temp,dkdeploy_core.sql.gz]"`
59
+ And I successfully run `cap dev db:download_structure`
60
+ Then a file matching %r<database-dev-structure.*sql.*gz> should exist
61
+ And a file matching %r<database-dev-content.*sql.*gz> should not exist
62
+
63
+ Scenario: Check dumping content of database
64
+ When I successfully run `cap dev "db:upload_settings[127.0.0.1,3306,dkdeploy_core,root,ilikerandompasswords,utf8]"`
65
+ And I successfully run `cap dev "db:update[temp,dkdeploy_core.sql.gz]"`
66
+ And I successfully run `cap dev db:download_content`
67
+ Then a file matching %r<database-dev-content.*sql.*gz> should exist
68
+ And a file matching %r<database-dev-structure.*.sql.*gz> should not exist
69
+
70
+ Scenario: Check dumping tables
71
+ When I successfully run `cap dev "db:upload_settings[127.0.0.1,3306,dkdeploy_core,root,ilikerandompasswords,utf8]"`
72
+ And I successfully run `cap dev "db:update[temp,dkdeploy_core.sql.gz]"`
73
+ When I successfully run `cap dev db:dump_table[demo_table]`
74
+ Then a file matching %r<database-dev-demo_table.*sql.*gz> should exist
75
+
76
+ Scenario: Check dumping tables to a specific file
77
+ When I successfully run `cap dev "db:upload_settings[127.0.0.1,3306,dkdeploy_core,root,ilikerandompasswords,utf8]"`
78
+ And I successfully run `cap dev "db:update[temp,dkdeploy_core.sql.gz]"`
79
+ When I successfully run `cap dev db:download_tables[demo_table,temp,demo_table.sql]`
80
+ Then a file matching %r<demo_table.*sql> should exist
81
+
82
+ Scenario: Check database for preseed structure
83
+ When I successfully run `cap dev "db:upload_settings[127.0.0.1,3306,dkdeploy_core,root,ilikerandompasswords,utf8]"`
84
+ And I successfully run `cap dev db:add_default_structure`
85
+ And I wait 5 second to let the database commit the transaction
86
+ Then the database should have a table `preseed_table` with column `value`
87
+
88
+ Scenario: Check database for preseed content
89
+ When I successfully run `cap dev "db:upload_settings[127.0.0.1,3306,dkdeploy_core,root,ilikerandompasswords,utf8]"`
90
+ And I successfully run `cap dev db:add_default_structure`
91
+ And I successfully run `cap dev db:add_default_content`
92
+ And I wait 5 second to let the database commit the transaction
93
+ Then the database should have a value `first preseed value` in table `preseed_table` for column `value`
@@ -0,0 +1,48 @@
1
+ Feature: Test tasks for namespace 'deploy'
2
+
3
+ Background:
4
+ Given a test app with the default configuration
5
+ And the remote server is cleared
6
+
7
+ Scenario: Check if the main capistrano directory structure has been created
8
+ When I successfully run `cap dev deploy`
9
+ Then a remote directory named "deploy_path/releases" should exist
10
+ Then a remote directory named "deploy_path/shared" should exist
11
+
12
+ Scenario: Check if the main capistrano symlink structure has been created
13
+ When I successfully run `cap dev deploy`
14
+ Then a remote symlink named "deploy_path/current" should exist
15
+
16
+ Scenario: Check if the complete directory structure has been successfully deployed
17
+ When I successfully run `cap dev deploy`
18
+ Then a remote directory named "current_path/catalog" should exist
19
+
20
+ Scenario: Check if the complete file structure has been successfully deployed
21
+ When I successfully run `cap dev deploy`
22
+ Then a remote file named "current_path/index.html" should exist
23
+
24
+ Scenario: Check if the not wanted files have been excluded
25
+ When I successfully run `cap dev deploy`
26
+ Then a remote file named "current_path/Gemfile" should not exist
27
+ Then a remote file named "current_path/Gemfile.lock" should not exist
28
+
29
+ Scenario: Check if the not wanted directories have been excluded
30
+ When I successfully run `cap dev deploy`
31
+ Then a remote directory named "current_path/.hidden" should not exist
32
+ Then a remote directory named "current_path/catalog/.hidden" should not exist
33
+ Then a remote directory named "test_app/tmp_path" should not exist
34
+
35
+ Scenario Outline: Check if I can deploy a project with different root sources
36
+ When I extend the development capistrano configuration variable copy_source with value <configuration_value>
37
+ And I successfully run `cap dev deploy`
38
+ Then a remote directory named "<remote_directory>/<target_path>" should exist
39
+
40
+ Examples:
41
+ | configuration_value | target_path | remote_directory |
42
+ | '.' | htdocs | current_path |
43
+ | 'htdocs' | catalog | current_path |
44
+
45
+ Scenario: Test default deployment behaviour
46
+ Given I extend the development capistrano configuration from the fixture file default_deployment_behaviour.rb
47
+ And I run `cap dev deploy`
48
+ Then the exit status should be 0
@@ -0,0 +1,17 @@
1
+ Feature: Test enhanced symlink tasks
2
+
3
+ Background:
4
+ Given a test app with the default configuration
5
+ And the remote server is cleared
6
+ And a remote empty file named "shared_path/sample/sample_file"
7
+ And a remote directory named "shared_path/sample_folder"
8
+ When I extend the development capistrano configuration variable enhanced_linked_files with value { 'sample/sample_file' => 'works/fine' }
9
+ And I extend the development capistrano configuration variable enhanced_linked_dirs with value { 'sample_folder' => 'fine/as_well' }
10
+
11
+ Scenario: Check enhanced symlinking of files
12
+ When I successfully run `cap dev deploy`
13
+ Then a remote file named "current_path/works/fine" should exist
14
+
15
+ Scenario: Check enhanced symlinking of directories
16
+ When I successfully run `cap dev deploy`
17
+ Then a remote directory named "current_path/fine/as_well" should exist
@@ -0,0 +1,59 @@
1
+ Feature: Test tasks for error handlers
2
+
3
+ Background:
4
+ Given a test app with the default configuration
5
+ And the remote server is cleared
6
+ And I extend the development capistrano configuration from the fixture file default_deployment_behaviour.rb
7
+ And the project is deployed
8
+
9
+ Scenario: When deployment fails before symlinking the new release
10
+ Given I store the symlink source of current
11
+ And I provoke an exception for testing purposes before symlinking the new release
12
+ And a remote file named "shared_path/config/maintenance.json" should not exist
13
+ Then I run `cap dev deploy`
14
+ And the output should contain "Failing this deployment on purpose!"
15
+ And the exit status should not be 0
16
+ And a remote file named "shared_path/config/maintenance.json" should not exist
17
+ And the symlink source of current should not have changed
18
+ And the exit status should not be 0
19
+
20
+ Scenario: When deployment fails after symlinking the new release
21
+ Given I store the symlink source of current
22
+ And I provoke an exception for testing purposes after symlinking the new release
23
+ And a remote file named "shared_path/config/maintenance.json" should not exist
24
+ Then I run `cap dev deploy`
25
+ And the output should contain "Failing this deployment on purpose!"
26
+ And the exit status should not be 0
27
+ And a remote file named "shared_path/config/maintenance.json" should not exist
28
+ And the symlink source of current should not have changed
29
+
30
+ Scenario: Deployment rollback to last stable version on failure when failing before symlinking
31
+ Given I successfully run `cap dev deploy`
32
+ And I successfully run `cap dev deploy`
33
+ And I successfully run `cap dev deploy`
34
+ And I store the symlink source of current
35
+ And I provoke an exception for testing purposes before symlinking the new release
36
+ Then I run `cap dev deploy`
37
+ And the output should contain "Failing this deployment on purpose!"
38
+ And the exit status should not be 0
39
+ And the symlink source of current should not have changed
40
+
41
+ Scenario: Deployment rollback to last stable version on failure when failing after symlinking
42
+ Given I successfully run `cap dev deploy`
43
+ And I successfully run `cap dev deploy`
44
+ And I successfully run `cap dev deploy`
45
+ And I store the symlink source of current
46
+ And I provoke an exception for testing purposes after symlinking the new release
47
+ Then I run `cap dev deploy`
48
+ And the output should contain "Failing this deployment on purpose!"
49
+ And the exit status should not be 0
50
+ And the symlink source of current should not have changed
51
+
52
+ Scenario: Deployment do not execute project task at rollback behaviour
53
+ Given I successfully run `cap dev deploy`
54
+ And I successfully run `cap dev deploy`
55
+ And I provoke an exception for testing purposes before symlinking the new release
56
+ And I extend the development capistrano configuration from the fixture file add_output_after_create_symlink.rb
57
+ Then I run `cap dev deploy`
58
+ And the output should not contain "Task 'deploy:symlink:release' executed"
59
+ And the exit status should not be 0
@@ -0,0 +1,120 @@
1
+ Feature: Test tasks for namespace 'file_permissions'
2
+
3
+ Background:
4
+ Given a test app with the default configuration
5
+ And the remote server is cleared
6
+ And the project is deployed
7
+ And I extend the development capistrano configuration from the fixture file custom_file_access.rb
8
+
9
+ # owner/group of shared path
10
+ Scenario: Check if the default owner and group of shared path are set correctly
11
+ Given I extend the development capistrano configuration variable default_file_access_owner_of_shared_path with value 'test-user'
12
+ And I extend the development capistrano configuration variable default_file_access_group_of_shared_path with value 'test-group'
13
+ And I successfully run `cap dev file_access:set_owner_group_of_shared_path`
14
+ Then remote owner of "shared_path" should be "test-user"
15
+ And remote group of "shared_path" should be "test-group"
16
+
17
+ # owner/group of release path
18
+ Scenario: Check if the default owner and group of release path are set correctly
19
+ Given I extend the development capistrano configuration variable default_file_access_owner_of_release_path with value 'test-user'
20
+ And I extend the development capistrano configuration variable default_file_access_group_of_release_path with value 'test-group'
21
+ And I successfully run `cap dev file_access:set_owner_group_of_release_path`
22
+ Then remote owner of "deploy_path/current" should be "test-user"
23
+ And remote owner of "current_path/index.html" should be "test-user"
24
+ And remote owner of "current_path/catalog" should be "test-user"
25
+ And remote group of "deploy_path/current" should be "test-group"
26
+ And remote group of "current_path/index.html" should be "test-group"
27
+ And remote group of "current_path/catalog" should be "test-group"
28
+
29
+ # file permission of shared path
30
+ Scenario: Check if the default file access properties on shared contain the following permissions
31
+ Given I extend the development capistrano configuration from the fixture file custom_file_access.rb
32
+ And I successfully run `cap dev file_access:set_permissions`
33
+ Then remote permissions of "shared_path" should contain "user" "read"
34
+ And remote permissions of "shared_path" should contain "user" "write"
35
+ And remote permissions of "shared_path" should contain "user" "execute"
36
+ And remote permissions of "shared_path" should contain "group" "read"
37
+ And remote permissions of "shared_path" should contain "group" "execute"
38
+
39
+ # file permission of release path
40
+ Scenario: Check if the default file access properties on release contain the following permissions
41
+ Given I extend the development capistrano configuration from the fixture file custom_file_access.rb
42
+ And I successfully run `cap dev file_access:set_permissions`
43
+ Then remote permissions of "current_path/index.html" should contain "user" "read"
44
+ And remote permissions of "current_path/index.html" should contain "user" "write"
45
+ And remote permissions of "current_path/catalog" should contain "user" "execute"
46
+ And remote permissions of "current_path/index.html" should contain "group" "read"
47
+ And remote permissions of "current_path/catalog" should contain "group" "execute"
48
+
49
+ Scenario: Check if the default file access properties on release does not contain the following permissions
50
+ Given I extend the development capistrano configuration from the fixture file custom_file_access.rb
51
+ And I successfully run `cap dev file_access:set_permissions`
52
+ Then remote permissions of "current_path/index.html" should not contain "user" "execute"
53
+ And remote permissions of "current_path/index.html" should not contain "group" "write"
54
+ And remote permissions of "current_path/index.html" should not contain "group" "execute"
55
+ And remote permissions of "current_path/index.html" should not contain "others" "read"
56
+ And remote permissions of "current_path/index.html" should not contain "others" "write"
57
+
58
+ Scenario: Check if the default file access properties on shared does not contain the following permissions
59
+ Given I extend the development capistrano configuration from the fixture file custom_file_access.rb
60
+ And I successfully run `cap dev file_access:set_permissions`
61
+ Then remote permissions of "shared_path" should not contain "group" "write"
62
+ And remote permissions of "shared_path" should not contain "others" "read"
63
+ And remote permissions of "shared_path" should not contain "others" "write"
64
+ And remote permissions of "shared_path" should not contain "others" "execute"
65
+
66
+ Scenario: Check if the custom file owner and group are set correctly
67
+ When I successfully run `cap dev file_access:set_custom_access`
68
+ Then remote owner of "current_path/catalog" should be "test-user"
69
+ And remote group of "current_path/catalog" should be "test-group"
70
+
71
+ Scenario: Check if the custom file access properties on release contain the following permissions
72
+ When I successfully run `cap dev file_access:set_custom_access`
73
+ Then remote permissions of "current_path/catalog" should contain "user" "read"
74
+ And remote permissions of "current_path/catalog" should contain "user" "write"
75
+ And remote permissions of "current_path/catalog" should contain "user" "execute"
76
+ And remote permissions of "current_path/catalog" should contain "group" "read"
77
+ And remote permissions of "current_path/catalog" should contain "group" "write"
78
+ And remote permissions of "current_path/catalog" should contain "group" "execute"
79
+ And remote permissions of "current_path/catalog" should contain "others" "read"
80
+
81
+ Scenario: Check if the custom file access properties on release does not contain the following permissions
82
+ When I successfully run `cap dev file_access:set_custom_access`
83
+ Then remote permissions of "current_path/catalog" should not contain "others" "write"
84
+ And remote permissions of "current_path/catalog" should not contain "others" "execute"
85
+
86
+ Scenario: Check if the set_custom_access task skips over not existing folders
87
+ Given I extend the development capistrano configuration variable custom_file_access with value {app: {release_path: {catalog: {mode: 'u+rwx,g+rwx,o-wx'}, not_existing: {mode: 'u+rwx,g+rwx,o-wx'}}}}
88
+ And a remote directory named "releases_path/not_existing" should not exist
89
+ When I successfully run `cap dev file_access:set_custom_access`
90
+ Then the output should contain "The resource /var/www/dkdeploy/current/not_existing does not exist on host dkdeploy-core.dev"
91
+ And the output should not contain "sudo chmod u+rwx,g+rwx,o-wx /var/www/dkdeploy/current/not_existing"
92
+ And the output should contain "sudo chmod u+rwx,g+rwx,o-wx /var/www/dkdeploy/current/catalog"
93
+
94
+ Scenario: Check if the selected_custom file_access_task skips with empty selected_custom_file_access
95
+ Given I extend the development capistrano configuration variable default_file_access_owner_of_shared_path with value 'test-user'
96
+ When I run `cap dev file_access:set_selected_custom_access`
97
+ Then the exit status should be 1
98
+ And the output should contain "The variable 'selected_custom_file_access' is empty. Aborting task..."
99
+
100
+ Scenario: Check if the selected_custom_file_access_task runs with configured selected_custom_file_access
101
+ Given I extend the development capistrano configuration variable default_file_access_owner_of_shared_path with value 'test-user'
102
+ And I extend the development capistrano configuration variable selected_custom_file_access with value [:catalog]
103
+ When I successfully run `cap dev file_access:set_selected_custom_access`
104
+ Then the output should contain "sudo chown -R test-user /var/www/dkdeploy/current/catalog"
105
+
106
+ Scenario: Check if the selected_custom_file_access task skips over not mentioned folders
107
+ Given I extend the development capistrano configuration variable default_file_access_owner_of_shared_path with value 'test-user'
108
+ And I extend the development capistrano configuration variable selected_custom_file_access with value ['another_directory']
109
+ When I successfully run `cap dev file_access:set_selected_custom_access`
110
+ Then the output should contain "Skipped setting custom_file_access permissions for 'catalog' because it is not mentioned in selected_custom_file_access!"
111
+ And the output should not contain "sudo chown -R test-user /var/www/dkdeploy/current/catalog"
112
+
113
+ Scenario: Check if the selected_custom_file_access task skips over not existing folders
114
+ Given I extend the development capistrano configuration variable custom_file_access with value {app: {release_path: {catalog: {mode: 'u+rwx,g+rwx,o-wx'}, not_existing: {mode: 'u+rwx,g+rwx,o-wx'}}}}
115
+ And I extend the development capistrano configuration variable selected_custom_file_access with value [:not_existing, :catalog]
116
+ And a remote directory named "releases_path/not_existing" should not exist
117
+ When I successfully run `cap dev file_access:set_selected_custom_access`
118
+ Then the output should contain "The resource /var/www/dkdeploy/current/not_existing does not exist on host dkdeploy-core.dev"
119
+ And the output should not contain "sudo chmod -R u+rwx,g+rwx,o-wx /var/www/dkdeploy/current/not_existing"
120
+ And the output should contain "sudo chmod -R u+rwx,g+rwx,o-wx /var/www/dkdeploy/current/catalog"
@@ -0,0 +1,25 @@
1
+ Feature: Test tasks for namespace 'maintenance'
2
+
3
+ Background:
4
+ Given a test app with the default configuration
5
+ And the remote server is cleared
6
+ And the project is deployed
7
+
8
+ Scenario: Check if maintenance.json is created on server if I run maintenance:enable
9
+ When I successfully run `cap dev maintenance:enable`
10
+ Then a remote file named "shared_path/config/maintenance.json" should exist
11
+
12
+ Scenario: Check if maintenance.json is removed to the config directory if I run maintenance:disable
13
+ When I successfully run `cap dev maintenance:enable`
14
+ And I successfully run `cap dev maintenance:disable`
15
+ Then a remote file named "shared_path/config/maintenance.json" should not exist
16
+
17
+ Scenario: Check if maintenance.json is not removed on server if I run maintenance:disable in a permanent mode
18
+ When I successfully run `cap dev maintenance:enable_permanent`
19
+ And I successfully run `cap dev maintenance:disable`
20
+ Then a remote file named "shared_path/config/maintenance.json" should exist
21
+
22
+ Scenario: Check if maintenance.json is removed from the server if I run maintenance_disable_permanent in a permanent mode
23
+ When I successfully run `cap dev maintenance:enable_permanent`
24
+ And I successfully run `cap dev maintenance:disable_permanent`
25
+ Then a remote file named "shared_path/config/maintenance.json" should not exist
@@ -0,0 +1,42 @@
1
+ Feature: Test tasks for namespace 'project_version'
2
+
3
+ Background:
4
+ Given a test app with the default configuration
5
+ And the remote server is cleared
6
+ And the project is deployed
7
+
8
+ Scenario: upload the project version file
9
+ Given a file named "Version" with:
10
+ """
11
+ 1.0.0
12
+ """
13
+ And I successfully run `cap dev project_version:update`
14
+ Then the remote file "current_path/Version" should contain exactly:
15
+ """
16
+ 1.0.0
17
+ """
18
+
19
+ Scenario: update the project version file
20
+ Given a remote file named "Version" with:
21
+ """
22
+ 1.0.0
23
+ """
24
+ And a file named "Version" with:
25
+ """
26
+ 2.0.0
27
+ """
28
+ And I successfully run `cap dev project_version:update`
29
+ Then the remote file "current_path/Version" should contain exactly:
30
+ """
31
+ 2.0.0
32
+ """
33
+
34
+ Scenario: change version file path and update the local version file
35
+ Given a remote directory named "current_path/version_file_directory"
36
+ And a file named "Version" with:
37
+ """
38
+ 1.0.0
39
+ """
40
+ When I extend the development capistrano configuration variable version_file_path with value 'version_file_directory'
41
+ And I successfully run `cap dev project_version:update`
42
+ Then a remote file named "current_path/version_file_directory/Version" should exist